PGItem
- 
class PGItem
- Bases: - PandaNode- This is the base class for all the various kinds of gui widget objects. - It is a Node which corresponds to a rectangular region on the screen, and it may have any number of “state” subgraphs, one of which is rendered at any given time according to its current state. - The PGItem node must be parented to the scene graph somewhere beneath a - PGTopnode in order for this behavior to work.- Inheritance diagram - 
explicit PGItem(std::string const &name)
 - 
void clear_frame(void)
- Removes the bounding rectangle from the item. It will no longer be possible to position the mouse within the item; see - set_frame().
 - 
void clear_sound(std::string const &event)
- Removes the sound associated with the indicated event. 
 - 
void clear_state_def(int state)
- Resets the - NodePathassigned to the indicated state to its initial default, with only a frame representation if appropriate.
 - 
bool get_active(void) const
- Returns whether the - PGItemis currently active for mouse events. See- set_active().
 - 
bool get_background_focus(void) const
- Returns whether background_focus is currently enabled. See - set_background_focus().
 - 
static TypeHandle get_class_type(void)
 - 
std::string get_enter_event(void) const
- Returns the event name that will be thrown when the item is active and the mouse enters its frame, but not any nested frames. 
 - 
std::string get_enter_prefix(void)
- Returns the prefix that is used to define the enter event for all - PGItems. The enter event is the concatenation of this string followed by- get_id().
 - 
std::string get_exit_event(void) const
- Returns the event name that will be thrown when the item is active and the mouse exits its frame, or enters a nested frame. 
 - 
std::string get_exit_prefix(void)
- Returns the prefix that is used to define the exit event for all - PGItems. The exit event is the concatenation of this string followed by- get_id().
 - 
bool get_focus(void) const
- Returns whether the - PGItemcurrently has focus for keyboard events. See- set_focus().
 - 
std::string get_focus_in_event(void) const
- Returns the event name that will be thrown when the item gets the keyboard focus. 
 - 
std::string get_focus_in_prefix(void)
- Returns the prefix that is used to define the focus_in event for all - PGItems. The focus_in event is the concatenation of this string followed by- get_id().- Unlike most item events, this event is thrown with no parameters. 
 - 
PGItem *get_focus_item(void)
- Returns the one - PGItemin the world that currently has keyboard focus, if any, or NULL if no item has keyboard focus. Use- PGItem::set_focus()to activate or deactivate keyboard focus on a particular item.
 - 
std::string get_focus_out_event(void) const
- Returns the event name that will be thrown when the item loses the keyboard focus. 
 - 
std::string get_focus_out_prefix(void)
- Returns the prefix that is used to define the focus_out event for all - PGItems. The focus_out event is the concatenation of this string followed by- get_id().- Unlike most item events, this event is thrown with no parameters. 
 - 
LVecBase4 const &get_frame(void) const
- Returns the bounding rectangle of the item. See - set_frame(). It is an error to call this if- has_frame()returns false.
 - 
PGFrameStyle get_frame_style(int state)
- Returns the kind of frame that will be drawn behind the item when it is in the indicated state. 
 - 
std::string const &get_id(void) const
- Returns the unique ID assigned to this - PGItem. This will be assigned to the region created with the- MouseWatcher, and will thus be used to generate event names.
 - 
std::string get_keystroke_event(void) const
- Returns the event name that will be thrown when the item is active and any key is pressed by the user. 
 - 
std::string get_keystroke_prefix(void)
- Returns the prefix that is used to define the keystroke event for all - PGItems. The keystroke event is the concatenation of this string followed by a hyphen and- get_id().
 - 
int get_num_state_defs(void) const
- Returns one more than the highest-numbered state def that was ever assigned to the - PGItem. The complete set of state defs assigned may then be retrieved by indexing from 0 to (get_num_state_defs() - 1).- This is only an upper limit on the actual number of state defs, since there may be holes in the list. 
 - 
std::string get_press_event(ButtonHandle const &button) const
- Returns the event name that will be thrown when the item is active and the indicated mouse or keyboard button is depressed while the mouse is within the frame. 
 - 
std::string get_press_prefix(void)
- Returns the prefix that is used to define the press event for all - PGItems. The press event is the concatenation of this string followed by a button name, followed by a hyphen and- get_id().
 - 
std::string get_release_event(ButtonHandle const &button) const
- Returns the event name that will be thrown when the item is active and the indicated mouse or keyboard button, formerly clicked down is within the frame, is released. 
 - 
std::string get_release_prefix(void)
- Returns the prefix that is used to define the release event for all - PGItems. The release event is the concatenation of this string followed by a button name, followed by a hyphen and- get_id().
 - 
std::string get_repeat_event(ButtonHandle const &button) const
- Returns the event name that will be thrown when the item is active and the indicated mouse or keyboard button is continuously held down while the mouse is within the frame. 
 - 
std::string get_repeat_prefix(void)
- Returns the prefix that is used to define the repeat event for all - PGItems. The repeat event is the concatenation of this string followed by a button name, followed by a hyphen and- get_id().
 - 
AudioSound *get_sound(std::string const &event) const
- Returns the sound associated with the indicated event, or NULL if there is no associated sound. 
 - 
int get_state(void) const
- Returns the “state” of this particular - PGItem. See- set_state().
 - 
NodePath &get_state_def(int state)
- Returns the Node that is the root of the subgraph that will be drawn when the - PGItemis in the indicated state. The first time this is called for a particular state index, it may create the Node.
 - 
int get_suppress_flags(void) const
- This is just an interface to get the suppress flags on the underlying - MouseWatcherRegion. See- MouseWatcherRegion::get_suppress_flags().
 - 
static TextNode *get_text_node(void)
- Returns the - TextNodeobject that will be used by all- PGItemsto generate default labels given a string. This can be loaded with the default font, etc.
 - 
std::string get_within_event(void) const
- Returns the event name that will be thrown when the item is active and the mouse moves within the boundaries of the frame. This is different from the enter_event in that the mouse is considered within the frame even if it is also within a nested frame. 
 - 
std::string get_within_prefix(void)
- Returns the prefix that is used to define the within event for all - PGItems. The within event is the concatenation of this string followed by- get_id().
 - 
std::string get_without_event(void) const
- Returns the event name that will be thrown when the item is active and the mouse moves completely outside the boundaries of the frame. This is different from the exit_event in that the mouse is considered within the frame even if it is also within a nested frame. 
 - 
std::string get_without_prefix(void)
- Returns the prefix that is used to define the without event for all - PGItems. The without event is the concatenation of this string followed by- get_id().
 - 
bool has_frame(void) const
- Returns true if the item has a bounding rectangle; see - set_frame().
 - 
bool has_sound(std::string const &event) const
- Returns true if there is a sound associated with the indicated event, or false otherwise. 
 - 
bool has_state_def(int state) const
- Returns true if - get_state_def()has ever been called for the indicated state (thus defining a render subgraph for this state index), false otherwise.
 - 
NodePath instance_to_state_def(int state, NodePath const &path)
- Parents an instance of the bottom node of the indicated - NodePathto the indicated state index.
 - 
virtual void set_active(bool active)
- Sets whether the - PGItemis active for mouse watching. This is not necessarily related to the active/inactive appearance of the item, which is controlled by- set_state(), but it does affect whether it responds to mouse events.
 - 
void set_background_focus(bool focus)
- Sets the background_focus flag for this item. When background_focus is enabled, the item will receive keypress events even if it is not in focus; in fact, even if it is not onscreen. Unlike normal focus, many items may have background_focus simultaneously. 
 - 
virtual void set_focus(bool focus)
- Sets whether the - PGItemcurrently has keyboard focus. This simply means that the item may respond to keyboard events as well as to mouse events; precisely what this means is up to the individual item.- Only one - PGItemin the world is allowed to have focus at any given time. Setting the focus on any other item automatically disables the focus from the previous item.
 - 
void set_frame(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top)
 - 
void set_frame(LVecBase4 const &frame)
- Sets the bounding rectangle of the item, in local coordinates. This is the region on screen within which the mouse will be considered to be within the item. Normally, it should correspond to the bounding rectangle of the visible geometry of the item. 
 - 
void set_frame_style(int state, PGFrameStyle const &style)
- Changes the kind of frame that will be drawn behind the item when it is in the indicated state. 
 - 
void set_id(std::string const &id)
- Set the unique ID assigned to this - PGItem. It is the user’s responsibility to ensure that this ID is unique.- Normally, this should not need to be called, as the - PGItemwill assign itself an ID when it is created, but this function allows the user to decide to redefine the ID to be something possibly more meaningful.
 - 
void set_name(std::string const &name)
 - 
void set_sound(std::string const &event, AudioSound *sound)
- Sets the sound that will be played whenever the indicated event occurs. 
 - 
void set_state(int state)
- Sets the “state” of this particular - PGItem.- The - PGItemnode will render as if it were the subgraph assigned to the corresponding index via set_state_def().
 - 
void set_suppress_flags(int suppress_flags)
- This is just an interface to set the suppress flags on the underlying - MouseWatcherRegion. See- MouseWatcherRegion::set_suppress_flags().
 
- 
explicit PGItem(std::string const &name)
