PGItem
from panda3d.core import 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 PGTop node in order for this behavior to work.
Inheritance diagram
- __init__(*args, **kwargs)
- active
- background_focus
- clearFrame()
C++ Interface: clear_frame(const PGItem self)
- /**
Removes the bounding rectangle from the item. It will no longer be
possible to position the mouse within the item; see set_frame().
*/
- clearSound()
C++ Interface: clear_sound(const PGItem self, str event)
- /**
Removes the sound associated with the indicated event.
*/
- clearStateDef()
C++ Interface: clear_state_def(const PGItem self, int state)
- /**
Resets the NodePath assigned to the indicated state to its initial default,
with only a frame representation if appropriate.
*/
- clear_frame()
C++ Interface: clear_frame(const PGItem self)
- /**
Removes the bounding rectangle from the item. It will no longer be
possible to position the mouse within the item; see set_frame().
*/
- clear_sound()
C++ Interface: clear_sound(const PGItem self, str event)
- /**
Removes the sound associated with the indicated event.
*/
- clear_state_def()
C++ Interface: clear_state_def(const PGItem self, int state)
- /**
Resets the NodePath assigned to the indicated state to its initial default,
with only a frame representation if appropriate.
*/
- enter_prefix = 'enter-'
- exit_prefix = 'exit-'
- focus
- focus_in_prefix = 'fin-'
- focus_out_prefix = 'fout-'
- frame
- getActive()
C++ Interface: get_active(PGItem self)
- /**
Returns whether the PGItem is currently active for mouse events. See
set_active().
*/
- getBackgroundFocus()
C++ Interface: get_background_focus(PGItem self)
- /**
Returns whether background_focus is currently enabled. See
set_background_focus().
*/
- getClassType()
C++ Interface: get_class_type()
- getEnterEvent()
C++ Interface: get_enter_event(PGItem self)
- /**
Returns the event name that will be thrown when the item is active and the
mouse enters its frame, but not any nested frames.
*/
- getEnterPrefix()
C++ Interface: get_enter_prefix()
- /**
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().
*/
- getExitEvent()
C++ Interface: get_exit_event(PGItem self)
- /**
Returns the event name that will be thrown when the item is active and the
mouse exits its frame, or enters a nested frame.
*/
- getExitPrefix()
C++ Interface: get_exit_prefix()
- /**
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().
*/
- getFocus()
C++ Interface: get_focus(PGItem self)
- /**
Returns whether the PGItem currently has focus for keyboard events. See
set_focus().
*/
- getFocusInEvent()
C++ Interface: get_focus_in_event(PGItem self)
- /**
Returns the event name that will be thrown when the item gets the keyboard
focus.
*/
- getFocusInPrefix()
C++ Interface: get_focus_in_prefix()
- /**
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.
*/
- getFocusItem()
C++ Interface: get_focus_item()
- /**
Returns the one PGItem in 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.
*/
- getFocusOutEvent()
C++ Interface: get_focus_out_event(PGItem self)
- /**
Returns the event name that will be thrown when the item loses the keyboard
focus.
*/
- getFocusOutPrefix()
C++ Interface: get_focus_out_prefix()
- /**
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.
*/
- getFrame()
C++ Interface: get_frame(PGItem self)
- /**
Returns the bounding rectangle of the item. See set_frame(). It is an
error to call this if has_frame() returns false.
*/
- getFrameInvXform()
C++ Interface: get_frame_inv_xform(PGItem self)
- /**
Returns the inverse of the frame transform matrix
*/
- getFrameStyle()
C++ Interface: get_frame_style(const PGItem self, int state)
- /**
Returns the kind of frame that will be drawn behind the item when it is in
the indicated state.
*/
- getId()
C++ Interface: get_id(PGItem self)
- /**
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.
*/
- getKeystrokeEvent()
C++ Interface: get_keystroke_event(PGItem self)
- /**
Returns the event name that will be thrown when the item is active and any
key is pressed by the user.
*/
- getKeystrokePrefix()
C++ Interface: get_keystroke_prefix()
- /**
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().
*/
- getNumStateDefs()
C++ Interface: get_num_state_defs(PGItem self)
- /**
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.
*/
- getPressEvent()
C++ Interface: get_press_event(PGItem self, const ButtonHandle button)
- /**
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.
*/
- getPressPrefix()
C++ Interface: get_press_prefix()
- /**
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().
*/
- getReleaseEvent()
C++ Interface: get_release_event(PGItem self, const ButtonHandle button)
- /**
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.
*/
- getReleasePrefix()
C++ Interface: get_release_prefix()
- /**
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().
*/
- getRepeatEvent()
C++ Interface: get_repeat_event(PGItem self, const ButtonHandle button)
- /**
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.
*/
- getRepeatPrefix()
C++ Interface: get_repeat_prefix()
- /**
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().
*/
- getSound()
C++ Interface: get_sound(PGItem self, str event)
- /**
Returns the sound associated with the indicated event, or NULL if there is
no associated sound.
*/
- getState()
C++ Interface: get_state(PGItem self)
- /**
Returns the “state” of this particular PGItem. See set_state().
*/
- getStateDef()
C++ Interface: get_state_def(const PGItem self, int state)
- /**
Returns the Node that is the root of the subgraph that will be drawn when
the PGItem is in the indicated state. The first time this is called for a
particular state index, it may create the Node.
*/
- getStateDefs()
- getSuppressFlags()
C++ Interface: get_suppress_flags(PGItem self)
- /**
This is just an interface to get the suppress flags on the underlying
MouseWatcherRegion. See MouseWatcherRegion::get_suppress_flags().
*/
- getTextNode()
C++ Interface: get_text_node()
- /**
Returns the TextNode object that will be used by all PGItems to generate
default labels given a string. This can be loaded with the default font,
etc.
*/
- getWithinEvent()
C++ Interface: get_within_event(PGItem self)
- /**
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.
*/
- getWithinPrefix()
C++ Interface: get_within_prefix()
- /**
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().
*/
- getWithoutEvent()
C++ Interface: get_without_event(PGItem self)
- /**
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.
*/
- getWithoutPrefix()
C++ Interface: get_without_prefix()
- /**
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().
*/
- get_active()
C++ Interface: get_active(PGItem self)
- /**
Returns whether the PGItem is currently active for mouse events. See
set_active().
*/
- get_background_focus()
C++ Interface: get_background_focus(PGItem self)
- /**
Returns whether background_focus is currently enabled. See
set_background_focus().
*/
- get_class_type()
C++ Interface: get_class_type()
- get_enter_event()
C++ Interface: get_enter_event(PGItem self)
- /**
Returns the event name that will be thrown when the item is active and the
mouse enters its frame, but not any nested frames.
*/
- get_enter_prefix()
C++ Interface: get_enter_prefix()
- /**
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().
*/
- get_exit_event()
C++ Interface: get_exit_event(PGItem self)
- /**
Returns the event name that will be thrown when the item is active and the
mouse exits its frame, or enters a nested frame.
*/
- get_exit_prefix()
C++ Interface: get_exit_prefix()
- /**
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().
*/
- get_focus()
C++ Interface: get_focus(PGItem self)
- /**
Returns whether the PGItem currently has focus for keyboard events. See
set_focus().
*/
- get_focus_in_event()
C++ Interface: get_focus_in_event(PGItem self)
- /**
Returns the event name that will be thrown when the item gets the keyboard
focus.
*/
- get_focus_in_prefix()
C++ Interface: get_focus_in_prefix()
- /**
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.
*/
- get_focus_item()
C++ Interface: get_focus_item()
- /**
Returns the one PGItem in 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.
*/
- get_focus_out_event()
C++ Interface: get_focus_out_event(PGItem self)
- /**
Returns the event name that will be thrown when the item loses the keyboard
focus.
*/
- get_focus_out_prefix()
C++ Interface: get_focus_out_prefix()
- /**
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.
*/
- get_frame()
C++ Interface: get_frame(PGItem self)
- /**
Returns the bounding rectangle of the item. See set_frame(). It is an
error to call this if has_frame() returns false.
*/
- get_frame_inv_xform()
C++ Interface: get_frame_inv_xform(PGItem self)
- /**
Returns the inverse of the frame transform matrix
*/
- get_frame_style()
C++ Interface: get_frame_style(const PGItem self, int state)
- /**
Returns the kind of frame that will be drawn behind the item when it is in
the indicated state.
*/
- get_id()
C++ Interface: get_id(PGItem self)
- /**
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.
*/
- get_keystroke_event()
C++ Interface: get_keystroke_event(PGItem self)
- /**
Returns the event name that will be thrown when the item is active and any
key is pressed by the user.
*/
- get_keystroke_prefix()
C++ Interface: get_keystroke_prefix()
- /**
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().
*/
- get_num_state_defs()
C++ Interface: get_num_state_defs(PGItem self)
- /**
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.
*/
- get_press_event()
C++ Interface: get_press_event(PGItem self, const ButtonHandle button)
- /**
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.
*/
- get_press_prefix()
C++ Interface: get_press_prefix()
- /**
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().
*/
- get_release_event()
C++ Interface: get_release_event(PGItem self, const ButtonHandle button)
- /**
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.
*/
- get_release_prefix()
C++ Interface: get_release_prefix()
- /**
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().
*/
- get_repeat_event()
C++ Interface: get_repeat_event(PGItem self, const ButtonHandle button)
- /**
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.
*/
- get_repeat_prefix()
C++ Interface: get_repeat_prefix()
- /**
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().
*/
- get_sound()
C++ Interface: get_sound(PGItem self, str event)
- /**
Returns the sound associated with the indicated event, or NULL if there is
no associated sound.
*/
- get_state()
C++ Interface: get_state(PGItem self)
- /**
Returns the “state” of this particular PGItem. See set_state().
*/
- get_state_def()
C++ Interface: get_state_def(const PGItem self, int state)
- /**
Returns the Node that is the root of the subgraph that will be drawn when
the PGItem is in the indicated state. The first time this is called for a
particular state index, it may create the Node.
*/
- get_state_defs()
- get_suppress_flags()
C++ Interface: get_suppress_flags(PGItem self)
- /**
This is just an interface to get the suppress flags on the underlying
MouseWatcherRegion. See MouseWatcherRegion::get_suppress_flags().
*/
- get_text_node()
C++ Interface: get_text_node()
- /**
Returns the TextNode object that will be used by all PGItems to generate
default labels given a string. This can be loaded with the default font,
etc.
*/
- get_within_event()
C++ Interface: get_within_event(PGItem self)
- /**
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.
*/
- get_within_prefix()
C++ Interface: get_within_prefix()
- /**
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().
*/
- get_without_event()
C++ Interface: get_without_event(PGItem self)
- /**
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.
*/
- get_without_prefix()
C++ Interface: get_without_prefix()
- /**
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().
*/
- hasFrame()
C++ Interface: has_frame(PGItem self)
- /**
Returns true if the item has a bounding rectangle; see set_frame().
*/
- hasSound()
C++ Interface: has_sound(PGItem self, str event)
- /**
Returns true if there is a sound associated with the indicated event, or
false otherwise.
*/
- hasStateDef()
C++ Interface: has_state_def(PGItem self, int state)
- /**
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.
*/
- has_frame()
C++ Interface: has_frame(PGItem self)
- /**
Returns true if the item has a bounding rectangle; see set_frame().
*/
- has_sound()
C++ Interface: has_sound(PGItem self, str event)
- /**
Returns true if there is a sound associated with the indicated event, or
false otherwise.
*/
- has_state_def()
C++ Interface: has_state_def(PGItem self, int state)
- /**
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.
*/
- id
- instanceToStateDef()
C++ Interface: instance_to_state_def(const PGItem self, int state, const NodePath path)
- /**
Parents an instance of the bottom node of the indicated NodePath to the
indicated state index.
*/
- instance_to_state_def()
C++ Interface: instance_to_state_def(const PGItem self, int state, const NodePath path)
- /**
Parents an instance of the bottom node of the indicated NodePath to the
indicated state index.
*/
- keystroke_prefix = 'keystroke-'
- name
- press_prefix = 'press-'
- release_prefix = 'release-'
- repeat_prefix = 'repeat-'
- setActive()
C++ Interface: set_active(const PGItem self, bool active)
- /**
Sets whether the PGItem is 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.
*/
- setBackgroundFocus()
C++ Interface: set_background_focus(const PGItem self, 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.
*/
- setFocus()
C++ Interface: set_focus(const PGItem self, bool focus)
- /**
Sets whether the PGItem currently 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 PGItem in 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.
*/
- setFrame()
C++ Interface: set_frame(const PGItem self, const LVecBase4f frame) set_frame(const PGItem self, float left, float right, float bottom, float top)
- /**
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.
*/
- /**
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.
*/
- setFrameStyle()
C++ Interface: set_frame_style(const PGItem self, int state, const PGFrameStyle style)
- /**
Changes the kind of frame that will be drawn behind the item when it is in
the indicated state.
*/
- setId()
C++ Interface: set_id(const PGItem self, str 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 PGItem will 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.
*/
- setSound()
C++ Interface: set_sound(const PGItem self, str event, AudioSound sound)
- /**
Sets the sound that will be played whenever the indicated event occurs.
*/
- setState()
C++ Interface: set_state(const PGItem self, int state)
- /**
Sets the “state” of this particular PGItem.
The PGItem node will render as if it were the subgraph assigned to the
corresponding index via set_state_def().
*/
- setSuppressFlags()
C++ Interface: set_suppress_flags(const PGItem self, int suppress_flags)
- /**
This is just an interface to set the suppress flags on the underlying
MouseWatcherRegion. See MouseWatcherRegion::set_suppress_flags().
*/
- setTextNode()
C++ Interface: set_text_node(TextNode node)
- /**
Changes the TextNode object that will be used by all PGItems to generate
default labels given a string. This can be loaded with the default font,
etc.
*/
- set_active()
C++ Interface: set_active(const PGItem self, bool active)
- /**
Sets whether the PGItem is 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.
*/
- set_background_focus()
C++ Interface: set_background_focus(const PGItem self, 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.
*/
- set_focus()
C++ Interface: set_focus(const PGItem self, bool focus)
- /**
Sets whether the PGItem currently 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 PGItem in 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.
*/
- set_frame()
C++ Interface: set_frame(const PGItem self, const LVecBase4f frame) set_frame(const PGItem self, float left, float right, float bottom, float top)
- /**
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.
*/
- /**
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.
*/
- set_frame_style()
C++ Interface: set_frame_style(const PGItem self, int state, const PGFrameStyle style)
- /**
Changes the kind of frame that will be drawn behind the item when it is in
the indicated state.
*/
- set_id()
C++ Interface: set_id(const PGItem self, str 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 PGItem will 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.
*/
- set_sound()
C++ Interface: set_sound(const PGItem self, str event, AudioSound sound)
- /**
Sets the sound that will be played whenever the indicated event occurs.
*/
- set_state()
C++ Interface: set_state(const PGItem self, int state)
- /**
Sets the “state” of this particular PGItem.
The PGItem node will render as if it were the subgraph assigned to the
corresponding index via set_state_def().
*/
- set_suppress_flags()
C++ Interface: set_suppress_flags(const PGItem self, int suppress_flags)
- /**
This is just an interface to set the suppress flags on the underlying
MouseWatcherRegion. See MouseWatcherRegion::set_suppress_flags().
*/
- set_text_node()
C++ Interface: set_text_node(TextNode node)
- /**
Changes the TextNode object that will be used by all PGItems to generate
default labels given a string. This can be loaded with the default font,
etc.
*/
- state
- state_defs
- suppress_flags
- within_prefix = 'within-'
- without_prefix = 'without-'