This is the base class for all the various kinds of gui widget objects. More...

#include "pgItem.h"

Inheritance diagram for PGItem:
PandaNode TypedWritable Namable LinkedListNode ReferenceCount TypedObject MemoryBase MemoryBase MemoryBase PGButton PGEntry PGSliderBar PGVirtualFrame PGWaitBar PGScrollFrame

List of all members.

Classes

class  StateDef

Public Member Functions

 PGItem (const string &name)
bool activate_region (const LMatrix4 &transform, int sort, const ClipPlaneAttrib *cpa, const ScissorAttrib *sa)
 Applies the indicated scene graph transform and order as determined by the traversal from PGTop.
virtual void candidate (const MouseWatcherParameter &param, bool background)
 This is a callback hook function, called whenever the user highlights an option in the IME window.
void clear_frame ()
 Removes the bounding rectangle from the item.
void clear_state_def (int state)
 Resets the NodePath assigned to the indicated state to its initial default, with only a frame representation if appropriate.
virtual void enter_region (const MouseWatcherParameter &param)
 This is a callback hook function, called whenever the mouse enters the region.
virtual void exit_region (const MouseWatcherParameter &param)
 This is a callback hook function, called whenever the mouse exits the region.
virtual void focus_in ()
 This is a callback hook function, called whenever the widget gets the keyboard focus.
virtual void focus_out ()
 This is a callback hook function, called whenever the widget loses the keyboard focus.
virtual TypeHandle force_init_type ()
bool get_active () const
 Returns whether the PGItem is currently active for mouse events.
bool get_background_focus () const
 Returns whether background_focus is currently enabled.
string get_enter_event () 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.
string get_exit_event () 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.
bool get_focus () const
 Returns whether the PGItem currently has focus for keyboard events.
string get_focus_in_event () const
 Returns the event name that will be thrown when the item gets the keyboard focus.
string get_focus_out_event () const
 Returns the event name that will be thrown when the item loses the keyboard focus.
const LVecBase4get_frame () const
 Returns the bounding rectangle of the item.
LMatrix4 get_frame_inv_xform () const
 Returns the inverse of the frame transform matrix.
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.
const string & get_id () const
 Returns the unique ID assigned to this PGItem.
string get_keystroke_event () const
 Returns the event name that will be thrown when the item is active and any key is pressed by the user.
PGItemNotifyget_notify () const
 Returns the object which will be notified when the PGItem changes, if any.
int get_num_state_defs () const
 Returns one more than the highest-numbered state def that was ever assigned to the PGItem.
string get_press_event (const ButtonHandle &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.
PGMouseWatcherRegionget_region () const
 Returns the MouseWatcherRegion associated with this item.
string get_release_event (const ButtonHandle &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.
string get_repeat_event (const ButtonHandle &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.
int get_state () const
 Returns the "state" of this particular PGItem.
NodePathget_state_def (int state)
 Returns the Node that is the root of the subgraph that will be drawn when the PGItem is in the indicated state.
int get_suppress_flags () const
 This is just an interface to get the suppress flags on the underlying MouseWatcherRegion.
virtual TypeHandle get_type () const
string get_within_event () const
 Returns the event name that will be thrown when the item is active and the mouse moves within the boundaries of the frame.
string get_without_event () 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.
bool has_frame () const
 Returns true if the item has a bounding rectangle; see set_frame().
bool has_notify () const
 Returns true if there is an object configured to be notified when the PGItem changes, 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, const NodePath &path)
 Parents an instance of the bottom node of the indicated NodePath to the indicated state index.
virtual void keystroke (const MouseWatcherParameter &param, bool background)
 This is a callback hook function, called whenever the user presses a key.
 MAKE_SEQ (get_state_defs, get_num_state_defs, get_state_def)
virtual void move (const MouseWatcherParameter &param)
 This is a callback hook function, called whenever a mouse is moved while within the region.
virtual void press (const MouseWatcherParameter &param, bool background)
 This is a callback hook function, called whenever a mouse or keyboard button is depressed while the mouse is within the region.
virtual void release (const MouseWatcherParameter &param, bool background)
 This is a callback hook function, called whenever a mouse or keyboard button previously depressed with press() is released.
virtual void set_active (bool active)
 Sets whether the PGItem is active for mouse watching.
void set_background_focus (bool focus)
 Sets the background_focus flag for this item.
virtual void set_focus (bool focus)
 Sets whether the PGItem currently has keyboard focus.
void set_frame (PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top)
 Sets the bounding rectangle of the item, in local coordinates.
void set_frame (const LVecBase4 &frame)
 Sets the bounding rectangle of the item, in local coordinates.
void set_frame_style (int state, const PGFrameStyle &style)
 Changes the kind of frame that will be drawn behind the item when it is in the indicated state.
void set_id (const string &id)
 Set the unique ID assigned to this PGItem.
void set_name (const string &name)
void set_notify (PGItemNotify *notify)
 Sets the object which will be notified when the PGItem changes.
void set_state (int state)
 Sets the "state" of this particular PGItem.
void set_suppress_flags (int suppress_flags)
 This is just an interface to set the suppress flags on the underlying MouseWatcherRegion.
virtual void within_region (const MouseWatcherParameter &param)
 This is a callback hook function, called whenever the mouse moves within the boundaries of the region, even if it is also within the boundaries of a nested region.
virtual void without_region (const MouseWatcherParameter &param)
 This is a callback hook function, called whenever the mouse moves completely outside the boundaries of the region.
virtual void xform (const LMatrix4 &mat)
 Transforms the contents of this node by the indicated matrix, if it means anything to do so.

Static Public Member Functions

static void background_candidate (const MouseWatcherParameter &param)
 Calls candidate() on all the PGItems with background focus.
static void background_keystroke (const MouseWatcherParameter &param)
 Calls keystroke() on all the PGItems with background focus.
static void background_press (const MouseWatcherParameter &param)
 Calls press() on all the PGItems with background focus.
static void background_release (const MouseWatcherParameter &param)
 Calls release() on all the PGItems with background focus.
static TypeHandle get_class_type ()
static string get_enter_prefix ()
 Returns the prefix that is used to define the enter event for all PGItems.
static string get_exit_prefix ()
 Returns the prefix that is used to define the exit event for all PGItems.
static string get_focus_in_prefix ()
 Returns the prefix that is used to define the focus_in event for all PGItems.
static PGItemget_focus_item ()
 Returns the one PGItem in the world that currently has keyboard focus, if any, or NULL if no item has keyboard focus.
static string get_focus_out_prefix ()
 Returns the prefix that is used to define the focus_out event for all PGItems.
static string get_keystroke_prefix ()
 Returns the prefix that is used to define the keystroke event for all PGItems.
static string get_press_prefix ()
 Returns the prefix that is used to define the press event for all PGItems.
static string get_release_prefix ()
 Returns the prefix that is used to define the release event for all PGItems.
static string get_repeat_prefix ()
 Returns the prefix that is used to define the repeat event for all PGItems.
static TextNodeget_text_node ()
 Returns the TextNode object that will be used by all PGItems to generate default labels given a string.
static string get_within_prefix ()
 Returns the prefix that is used to define the within event for all PGItems.
static string get_without_prefix ()
 Returns the prefix that is used to define the without event for all PGItems.
static void init_type ()
static void set_text_node (TextNode *node)
 Changes the TextNode object that will be used by all PGItems to generate default labels given a string.

Detailed Description

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.

Definition at line 58 of file pgItem.h.


Member Function Documentation

bool PGItem::activate_region ( const LMatrix4 transform,
int  sort,
const ClipPlaneAttrib cpa,
const ScissorAttrib sa 
)

Applies the indicated scene graph transform and order as determined by the traversal from PGTop.

The return value is true if the region is valid, or false if it is empty or completely clipped.

Definition at line 424 of file pgItem.cxx.

References ScissorAttrib::get_frame(), NodePath::get_mat(), ClipPlaneAttrib::get_num_on_planes(), ClipPlaneAttrib::get_on_plane(), LMatrix4f::invert_from(), NodePath::node(), LPoint3f::rfu(), LVector3f::right(), and LVector3f::up().

void PGItem::background_candidate ( const MouseWatcherParameter param) [static]

Calls candidate() on all the PGItems with background focus.

Definition at line 870 of file pgItem.cxx.

References candidate(), and get_focus().

Referenced by PGMouseWatcherBackground::candidate().

void PGItem::background_keystroke ( const MouseWatcherParameter param) [static]

Calls keystroke() on all the PGItems with background focus.

Definition at line 853 of file pgItem.cxx.

References get_focus(), and keystroke().

Referenced by PGMouseWatcherBackground::keystroke().

void PGItem::background_press ( const MouseWatcherParameter param) [static]

Calls press() on all the PGItems with background focus.

Definition at line 819 of file pgItem.cxx.

References get_focus(), and press().

Referenced by PGMouseWatcherBackground::press().

void PGItem::background_release ( const MouseWatcherParameter param) [static]

Calls release() on all the PGItems with background focus.

Definition at line 836 of file pgItem.cxx.

References get_focus(), and release().

Referenced by PGMouseWatcherBackground::release().

void PGItem::candidate ( const MouseWatcherParameter param,
bool  background 
) [virtual]

This is a callback hook function, called whenever the user highlights an option in the IME window.

Reimplemented in PGEntry.

Definition at line 778 of file pgItem.cxx.

References get_notify(), and has_notify().

Referenced by background_candidate(), and PGMouseWatcherRegion::candidate().

void PGItem::clear_frame ( ) [inline]

Removes the bounding rectangle from the item.

It will no longer be possible to position the mouse within the item; see set_frame().

Definition at line 157 of file pgItem.I.

void PGItem::clear_state_def ( int  state)

Resets the NodePath assigned to the indicated state to its initial default, with only a frame representation if appropriate.

Definition at line 1021 of file pgItem.cxx.

References PandaNode::mark_internal_bounds_stale().

Referenced by PGWaitBar::setup(), PGScrollFrame::setup(), PGButton::setup(), PGVirtualFrame::setup(), PGSliderBar::setup_scroll_bar(), and PGSliderBar::setup_slider().

void PGItem::enter_region ( const MouseWatcherParameter param) [virtual]

This is a callback hook function, called whenever the mouse enters the region.

The mouse is only considered to be "entered" in one region at a time; in the case of nested regions, it exits the outer region before entering the inner one.

Reimplemented in PGButton.

Definition at line 541 of file pgItem.cxx.

References get_enter_event(), get_notify(), and has_notify().

Referenced by PGMouseWatcherRegion::enter_region().

void PGItem::exit_region ( const MouseWatcherParameter param) [virtual]

This is a callback hook function, called whenever the mouse exits the region.

The mouse is only considered to be "entered" in one region at a time; in the case of nested regions, it exits the outer region before entering the inner one.

Reimplemented in PGButton.

Definition at line 568 of file pgItem.cxx.

References get_exit_event(), get_notify(), and has_notify().

Referenced by PGMouseWatcherRegion::exit_region().

void PGItem::focus_in ( ) [virtual]

This is a callback hook function, called whenever the widget gets the keyboard focus.

Definition at line 647 of file pgItem.cxx.

References get_focus_in_event(), get_notify(), and has_notify().

Referenced by set_focus().

void PGItem::focus_out ( ) [virtual]

This is a callback hook function, called whenever the widget loses the keyboard focus.

Definition at line 670 of file pgItem.cxx.

References get_focus_out_event(), get_notify(), and has_notify().

Referenced by set_focus().

bool PGItem::get_background_focus ( ) const [inline]

Returns whether background_focus is currently enabled.

See set_background_focus().

Definition at line 223 of file pgItem.I.

Referenced by PGEntry::press(), and set_background_focus().

string PGItem::get_enter_event ( ) const [inline]

Returns the event name that will be thrown when the item is active and the mouse enters its frame, but not any nested frames.

Definition at line 425 of file pgItem.I.

References get_enter_prefix(), and get_id().

Referenced by enter_region().

string PGItem::get_enter_prefix ( ) [inline, static]

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().

Definition at line 295 of file pgItem.I.

Referenced by get_enter_event().

string PGItem::get_exit_event ( ) const [inline]

Returns the event name that will be thrown when the item is active and the mouse exits its frame, or enters a nested frame.

Definition at line 438 of file pgItem.I.

References get_exit_prefix(), and get_id().

Referenced by exit_region().

string PGItem::get_exit_prefix ( ) [inline, static]

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().

Definition at line 307 of file pgItem.I.

Referenced by get_exit_event().

bool PGItem::get_focus ( ) const [inline]

Returns whether the PGItem currently has focus for keyboard events.

See set_focus().

Definition at line 211 of file pgItem.I.

Referenced by background_candidate(), background_keystroke(), background_press(), background_release(), PGEntry::press(), set_active(), and set_focus().

string PGItem::get_focus_in_event ( ) const [inline]

Returns the event name that will be thrown when the item gets the keyboard focus.

Definition at line 481 of file pgItem.I.

References get_focus_in_prefix(), and get_id().

Referenced by focus_in().

string PGItem::get_focus_in_prefix ( ) [inline, static]

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.

Definition at line 346 of file pgItem.I.

Referenced by get_focus_in_event().

PGItem * PGItem::get_focus_item ( ) [inline, static]

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.

Definition at line 573 of file pgItem.I.

string PGItem::get_focus_out_event ( ) const [inline]

Returns the event name that will be thrown when the item loses the keyboard focus.

Definition at line 493 of file pgItem.I.

References get_focus_out_prefix(), and get_id().

Referenced by focus_out().

string PGItem::get_focus_out_prefix ( ) [inline, static]

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.

Definition at line 361 of file pgItem.I.

Referenced by get_focus_out_event().

const LVecBase4 & PGItem::get_frame ( ) const [inline]

Returns the bounding rectangle of the item.

See set_frame(). It is an error to call this if has_frame() returns false.

Definition at line 131 of file pgItem.I.

References has_frame().

Referenced by PGVirtualFrame::get_clip_frame(), PGSliderBar::recompute(), PGScrollFrame::remanage(), and PGSliderBar::remanage().

Returns the inverse of the frame transform matrix.

Definition at line 583 of file pgItem.I.

Returns the kind of frame that will be drawn behind the item when it is in the indicated state.

Definition at line 1087 of file pgItem.cxx.

Referenced by PGScrollFrame::remanage().

string PGItem::get_keystroke_event ( ) const [inline]

Returns the event name that will be thrown when the item is active and any key is pressed by the user.

Definition at line 547 of file pgItem.I.

References get_id(), and get_keystroke_prefix().

Referenced by keystroke().

string PGItem::get_keystroke_prefix ( ) [inline, static]

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().

Definition at line 413 of file pgItem.I.

Referenced by get_keystroke_event().

PGItemNotify * PGItem::get_notify ( ) const [inline]

Returns the object which will be notified when the PGItem changes, if any.

Returns NULL if there is no such object configured.

Reimplemented in PGSliderBar, and PGButton.

Definition at line 85 of file pgItem.I.

Referenced by candidate(), enter_region(), exit_region(), focus_in(), focus_out(), keystroke(), move(), press(), release(), within_region(), and without_region().

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.

Definition at line 992 of file pgItem.cxx.

string PGItem::get_press_event ( const ButtonHandle button) const [inline]

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.

Definition at line 507 of file pgItem.I.

References get_id(), ButtonHandle::get_name(), and get_press_prefix().

Referenced by press().

string PGItem::get_press_prefix ( ) [inline, static]

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().

Definition at line 374 of file pgItem.I.

Referenced by get_press_event().

Returns the MouseWatcherRegion associated with this item.

Every PGItem has a MouseWatcherRegion associated with it, that is created when the PGItem is created; it does not change during the lifetime of the PGItem. Even items that do not have a frame have an associated MouseWatcherRegion, although it will not be used in this case.

Definition at line 39 of file pgItem.I.

string PGItem::get_release_event ( const ButtonHandle button) const [inline]

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.

Definition at line 535 of file pgItem.I.

References get_id(), ButtonHandle::get_name(), and get_release_prefix().

Referenced by release().

string PGItem::get_release_prefix ( ) [inline, static]

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().

Definition at line 400 of file pgItem.I.

Referenced by get_release_event().

string PGItem::get_repeat_event ( const ButtonHandle button) const [inline]

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.

Definition at line 521 of file pgItem.I.

References get_id(), ButtonHandle::get_name(), and get_repeat_prefix().

Referenced by press().

string PGItem::get_repeat_prefix ( ) [inline, static]

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().

Definition at line 387 of file pgItem.I.

Referenced by get_repeat_event().

int PGItem::get_state ( ) const [inline]

Returns the "state" of this particular PGItem.

See set_state().

Definition at line 187 of file pgItem.I.

Referenced by PGScrollFrame::remanage().

NodePath & PGItem::get_state_def ( 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.

Definition at line 1043 of file pgItem.cxx.

Referenced by instance_to_state_def(), set_frame_style(), and PGButton::setup().

int PGItem::get_suppress_flags ( ) const [inline]

This is just an interface to get the suppress flags on the underlying MouseWatcherRegion.

See MouseWatcherRegion::get_suppress_flags().

Definition at line 249 of file pgItem.I.

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.

Definition at line 1177 of file pgItem.cxx.

Referenced by PGEntry::get_text_def(), and PGButton::setup().

string PGItem::get_within_event ( ) const [inline]

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.

Definition at line 453 of file pgItem.I.

References get_id(), and get_within_prefix().

Referenced by within_region().

string PGItem::get_within_prefix ( ) [inline, static]

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().

Definition at line 319 of file pgItem.I.

Referenced by get_within_event().

string PGItem::get_without_event ( ) const [inline]

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.

Definition at line 469 of file pgItem.I.

References get_id(), and get_without_prefix().

Referenced by without_region().

string PGItem::get_without_prefix ( ) [inline, static]

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().

Definition at line 331 of file pgItem.I.

Referenced by get_without_event().

bool PGItem::has_frame ( ) const [inline]

Returns true if the item has a bounding rectangle; see set_frame().

Definition at line 144 of file pgItem.I.

Referenced by get_frame(), and PGSliderBar::recompute().

bool PGItem::has_notify ( ) const [inline]

Returns true if there is an object configured to be notified when the PGItem changes, false otherwise.

Definition at line 72 of file pgItem.I.

Referenced by PGSliderBar::adjust(), candidate(), PGButton::click(), enter_region(), exit_region(), focus_in(), focus_out(), keystroke(), move(), press(), release(), PGSliderBar::set_range(), within_region(), and without_region().

bool PGItem::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.

Definition at line 1005 of file pgItem.cxx.

NodePath PGItem::instance_to_state_def ( int  state,
const NodePath path 
)

Parents an instance of the bottom node of the indicated NodePath to the indicated state index.

Definition at line 1068 of file pgItem.cxx.

References get_state_def(), NodePath::instance_to(), NodePath::is_empty(), and PandaNode::mark_internal_bounds_stale().

Referenced by PGButton::setup().

void PGItem::keystroke ( const MouseWatcherParameter param,
bool  background 
) [virtual]

This is a callback hook function, called whenever the user presses a key.

Reimplemented in PGEntry.

Definition at line 752 of file pgItem.cxx.

References get_keystroke_event(), get_notify(), and has_notify().

Referenced by background_keystroke(), and PGMouseWatcherRegion::keystroke().

void PGItem::move ( const MouseWatcherParameter param) [virtual]

This is a callback hook function, called whenever a mouse is moved while within the region.

Reimplemented in PGSliderBar.

Definition at line 800 of file pgItem.cxx.

References get_notify(), and has_notify().

Referenced by PGMouseWatcherRegion::move().

void PGItem::press ( const MouseWatcherParameter param,
bool  background 
) [virtual]

This is a callback hook function, called whenever a mouse or keyboard button is depressed while the mouse is within the region.

Reimplemented in PGEntry, PGSliderBar, and PGButton.

Definition at line 694 of file pgItem.cxx.

References MouseWatcherParameter::get_button(), get_notify(), get_press_event(), get_repeat_event(), has_notify(), and MouseWatcherParameter::is_keyrepeat().

Referenced by background_press(), and PGMouseWatcherRegion::press().

void PGItem::release ( const MouseWatcherParameter param,
bool  background 
) [virtual]

This is a callback hook function, called whenever a mouse or keyboard button previously depressed with press() is released.

Reimplemented in PGSliderBar, and PGButton.

Definition at line 726 of file pgItem.cxx.

References MouseWatcherParameter::get_button(), get_notify(), get_release_event(), and has_notify().

Referenced by background_release(), and PGMouseWatcherRegion::release().

void PGItem::set_active ( bool  active) [virtual]

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.

Reimplemented in PGEntry, PGSliderBar, and PGButton.

Definition at line 890 of file pgItem.cxx.

References get_focus(), and set_focus().

void PGItem::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.

Definition at line 962 of file pgItem.cxx.

References get_background_focus().

void PGItem::set_focus ( bool  focus) [virtual]

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.

Reimplemented in PGEntry.

Definition at line 917 of file pgItem.cxx.

References focus_in(), focus_out(), get_active(), get_focus(), and set_focus().

Referenced by set_active(), and set_focus().

void PGItem::set_frame ( PN_stdfloat  left,
PN_stdfloat  right,
PN_stdfloat  bottom,
PN_stdfloat  top 
) [inline]

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.

Definition at line 100 of file pgItem.I.

Referenced by PGWaitBar::setup(), PGScrollFrame::setup(), PGButton::setup(), PGVirtualFrame::setup(), PGEntry::setup(), PGSliderBar::setup_scroll_bar(), and PGSliderBar::setup_slider().

void PGItem::set_frame ( const LVecBase4 frame) [inline]

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.

Definition at line 114 of file pgItem.I.

void PGItem::set_frame_style ( int  state,
const PGFrameStyle style 
)

Changes the kind of frame that will be drawn behind the item when it is in the indicated state.

Definition at line 1102 of file pgItem.cxx.

References get_state_def(), NodePath::is_empty(), and PandaNode::mark_internal_bounds_stale().

Referenced by PGWaitBar::setup(), PGScrollFrame::setup(), PGButton::setup(), PGVirtualFrame::setup(), PGEntry::setup(), PGSliderBar::setup_scroll_bar(), and PGSliderBar::setup_slider().

void PGItem::set_id ( const string &  id) [inline]

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.

Definition at line 282 of file pgItem.I.

void PGItem::set_notify ( PGItemNotify notify) [inline]

Sets the object which will be notified when the PGItem changes.

Set this to NULL to disable this effect. The PGItem does not retain ownership of the pointer; it is your responsibility to ensure that the notify object does not destruct.

Definition at line 54 of file pgItem.I.

void PGItem::set_state ( int  state) [inline]

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().

Definition at line 175 of file pgItem.I.

Referenced by PGButton::enter_region(), PGButton::exit_region(), PGButton::press(), PGButton::release(), PGButton::set_active(), PGWaitBar::setup(), PGScrollFrame::setup(), PGVirtualFrame::setup(), PGSliderBar::setup_scroll_bar(), and PGSliderBar::setup_slider().

void PGItem::set_suppress_flags ( int  suppress_flags) [inline]

This is just an interface to set the suppress flags on the underlying MouseWatcherRegion.

See MouseWatcherRegion::set_suppress_flags().

Definition at line 236 of file pgItem.I.

void PGItem::set_text_node ( TextNode node) [inline, static]

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.

Definition at line 560 of file pgItem.I.

void PGItem::within_region ( const MouseWatcherParameter param) [virtual]

This is a callback hook function, called whenever the mouse moves within the boundaries of the region, even if it is also within the boundaries of a nested region.

This is different from "enter", which is only called whenever the mouse is within only that region.

Definition at line 598 of file pgItem.cxx.

References get_notify(), get_within_event(), and has_notify().

Referenced by PGMouseWatcherRegion::within_region().

void PGItem::without_region ( const MouseWatcherParameter param) [virtual]

This is a callback hook function, called whenever the mouse moves completely outside the boundaries of the region.

See within().

Definition at line 623 of file pgItem.cxx.

References get_notify(), get_without_event(), and has_notify().

Referenced by PGMouseWatcherRegion::without_region().

void PGItem::xform ( const LMatrix4 mat) [virtual]

Transforms the contents of this node by the indicated matrix, if it means anything to do so.

For most kinds of nodes, this does nothing.

Reimplemented from PandaNode.

Reimplemented in PGEntry, PGScrollFrame, and PGSliderBar.

Definition at line 386 of file pgItem.cxx.

References SceneGraphReducer::apply_attribs(), NodePath::get_transform(), PandaNode::mark_internal_bounds_stale(), NodePath::node(), and NodePath::set_transform().


The documentation for this class was generated from the following files: