53class EXPCL_PANDA_PGUI PGItem :
public PandaNode {
55 explicit PGItem(
const std::string &name);
58 INLINE
void set_name(
const std::string &name);
61 PGItem(
const PGItem ©);
64 virtual void transform_changed();
65 virtual void draw_mask_changed();
70 virtual void compute_internal_bounds(CPT(
BoundingVolume) &internal_bounds,
71 int &internal_vertices,
73 Thread *current_thread)
const;
80 virtual void xform(
const LMatrix4 &mat);
81 bool activate_region(
const LMatrix4 &transform,
int sort,
110 INLINE
void set_frame(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top);
111 INLINE
void set_frame(
const LVecBase4 &frame);
112 INLINE
const LVecBase4 &
get_frame()
const;
141 INLINE
const std::string &
get_id()
const;
142 INLINE
void set_id(
const std::string &
id);
169 void set_sound(
const std::string &event,
AudioSound *sound);
170 void clear_sound(
const std::string &event);
171 AudioSound *get_sound(
const std::string &event)
const;
172 bool has_sound(
const std::string &event)
const;
181 void play_sound(
const std::string &event);
183 void reduce_region(LVecBase4 &clip, PGItem *obscurer)
const;
184 void reduce_region(LVecBase4 &frame, PN_stdfloat px, PN_stdfloat py)
const;
185 LVecBase4 get_relative_frame(PGItem *item)
const;
186 LPoint3 mouse_to_local(
const LPoint2 &mouse_point)
const;
188 virtual void frame_changed();
191 NodePath &do_get_state_def(
int state);
192 void slot_state_def(
int state);
193 void update_frame(
int state);
194 void mark_frames_stale();
196 INLINE
static PN_stdfloat compute_area(
const LVecBase4 &frame);
197 INLINE
static void compare_largest(
const LVecBase4 *&largest,
198 PN_stdfloat &largest_area,
199 const LVecBase4 *new_frame);
201 typedef pvector<LVecBase2> ClipPoints;
202 bool clip_frame(ClipPoints &source_points,
const LPlane &plane)
const;
216 F_background_focus = 0x04,
222 LMatrix4 _frame_inv_xform;
232 typedef pvector<StateDef> StateDefs;
233 StateDefs _state_defs;
236 typedef pmap<std::string, PT(AudioSound) > Sounds;
240 static PT(TextNode) _text_node;
241 static PGItem *_focus_item;
243 typedef pset<PGItem *> BackgroundFocus;
244 static BackgroundFocus _background_focus;
247 static TypeHandle get_class_type() {
250 static void init_type() {
251 PandaNode::init_type();
253 PandaNode::get_class_type());
255 virtual TypeHandle get_type()
const {
256 return get_class_type();
258 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
261 static TypeHandle _type_handle;
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
This functions similarly to a LightAttrib.
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
A lightweight reentrant mutex.
This is sent along as a parameter to most events generated for a region to indicate the mouse and but...
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Objects that inherit from this class can receive specialized messages when PGItems change in certain ...
void set_notify(PGItemNotify *notify)
Sets the object which will be notified when the PGItem changes.
static void background_release(const MouseWatcherParameter ¶m)
Calls release() on all the PGItems with background focus.
const LVecBase4 & get_frame() const
Returns the bounding rectangle of the item.
virtual void press(const MouseWatcherParameter ¶m, bool background)
This is a callback hook function, called whenever a mouse or keyboard button is depressed while the m...
bool get_active() const
Returns whether the PGItem is currently active for mouse events.
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.
static void background_candidate(const MouseWatcherParameter ¶m)
Calls candidate() on all the PGItems with background focus.
static std::string get_press_prefix()
Returns the prefix that is used to define the press event for all PGItems.
void clear_frame()
Removes the bounding rectangle from the item.
static std::string get_focus_out_prefix()
Returns the prefix that is used to define the focus_out event for all PGItems.
std::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...
std::string get_without_event() const
Returns the event name that will be thrown when the item is active and the mouse moves completely out...
std::string get_focus_out_event() const
Returns the event name that will be thrown when the item loses the keyboard focus.
PGItemNotify * get_notify() const
Returns the object which will be notified when the PGItem changes, if any.
static std::string get_within_prefix()
Returns the prefix that is used to define the within event for all PGItems.
int get_suppress_flags() const
This is just an interface to get the suppress flags on the underlying MouseWatcherRegion.
void clear_state_def(int state)
Resets the NodePath assigned to the indicated state to its initial default, with only a frame represe...
std::string get_exit_event() const
Returns the event name that will be thrown when the item is active and the mouse exits its frame,...
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.
static std::string get_focus_in_prefix()
Returns the prefix that is used to define the focus_in event for all PGItems.
static std::string get_keystroke_prefix()
Returns the prefix that is used to define the keystroke event for all PGItems.
static TextNode * get_text_node()
Returns the TextNode object that will be used by all PGItems to generate default labels given a strin...
LMatrix4 get_frame_inv_xform() const
Returns the inverse of the frame transform matrix.
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 ...
bool get_focus() const
Returns whether the PGItem currently has focus for keyboard events.
bool get_background_focus() const
Returns whether background_focus is currently enabled.
get_num_state_defs
Returns one more than the highest-numbered state def that was ever assigned to the PGItem.
PGMouseWatcherRegion * get_region() const
Returns the MouseWatcherRegion associated with this item.
virtual void release(const MouseWatcherParameter ¶m, bool background)
This is a callback hook function, called whenever a mouse or keyboard button previously depressed wit...
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.
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.
int get_state() const
Returns the "state" of this particular PGItem.
void set_background_focus(bool focus)
Sets the background_focus flag for this item.
virtual void without_region(const MouseWatcherParameter ¶m)
This is a callback hook function, called whenever the mouse moves completely outside the boundaries o...
static void set_text_node(TextNode *node)
Changes the TextNode object that will be used by all PGItems to generate default labels given a strin...
std::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 keyboar...
std::string get_within_event() const
Returns the event name that will be thrown when the item is active and the mouse moves within the bou...
const std::string & get_id() const
Returns the unique ID assigned to this PGItem.
void set_suppress_flags(int suppress_flags)
This is just an interface to set the suppress flags on the underlying MouseWatcherRegion.
get_state_def
Returns the Node that is the root of the subgraph that will be drawn when the PGItem is in the indica...
static std::string get_enter_prefix()
Returns the prefix that is used to define the enter event for all PGItems.
virtual void keystroke(const MouseWatcherParameter ¶m, bool background)
This is a callback hook function, called whenever the user presses a key.
virtual void exit_region(const MouseWatcherParameter ¶m)
This is a callback hook function, called whenever the mouse exits the region.
static PGItem * get_focus_item()
Returns the one PGItem in the world that currently has keyboard focus, if any, or NULL if no item has...
static void background_press(const MouseWatcherParameter ¶m)
Calls press() on all the PGItems with background focus.
virtual void set_focus(bool focus)
Sets whether the PGItem currently has keyboard focus.
std::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 keyboar...
virtual void focus_in()
This is a callback hook function, called whenever the widget gets the keyboard focus.
bool has_notify() const
Returns true if there is an object configured to be notified when the PGItem changes,...
virtual void focus_out()
This is a callback hook function, called whenever the widget loses the keyboard focus.
static std::string get_release_prefix()
Returns the prefix that is used to define the release event for all PGItems.
static std::string get_exit_prefix()
Returns the prefix that is used to define the exit event for all PGItems.
virtual void move(const MouseWatcherParameter ¶m)
This is a callback hook function, called whenever a mouse is moved while within the region.
bool has_frame() const
Returns true if the item has a bounding rectangle; see set_frame().
static std::string get_without_prefix()
Returns the prefix that is used to define the without event for all PGItems.
virtual void within_region(const MouseWatcherParameter ¶m)
This is a callback hook function, called whenever the mouse moves within the boundaries of the region...
std::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 keyboar...
virtual void candidate(const MouseWatcherParameter ¶m, bool background)
This is a callback hook function, called whenever the user highlights an option in the IME window.
static void background_keystroke(const MouseWatcherParameter ¶m)
Calls keystroke() on all the PGItems with background focus.
void set_id(const std::string &id)
Set the unique ID assigned to this PGItem.
std::string get_enter_event() const
Returns the event name that will be thrown when the item is active and the mouse enters its frame,...
static std::string get_repeat_prefix()
Returns the prefix that is used to define the repeat event for all PGItems.
std::string get_focus_in_event() const
Returns the event name that will be thrown when the item gets the keyboard focus.
virtual void enter_region(const MouseWatcherParameter ¶m)
This is a callback hook function, called whenever the mouse enters the region.
virtual void set_active(bool active)
Sets whether the PGItem is active for mouse watching.
This is a specialization on MouseWatcherRegion, to add a bit more fields that are relevant to the PG ...
The "top" node of the new Panda GUI system.
virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data)
This function will be called during the cull traversal to perform any additional operations that shou...
virtual bool is_renderable() const
Returns true if there is some value to visiting this particular node during the cull traversal for an...
virtual void r_prepare_scene(GraphicsStateGuardianBase *gsg, const RenderState *node_state, GeomTransformer &transformer, Thread *current_thread)
The recursive implementation of prepare_scene().
virtual void xform(const LMatrix4 &mat)
Transforms the contents of this PandaNode by the indicated matrix, if it means anything to do so.
set_state
Sets the complete RenderState that will be applied to all nodes at this level and below.
virtual PandaNode * make_copy() const
Returns a newly-allocated PandaNode that is a shallow copy of this one.
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
This restricts rendering to within a rectangular region of the scene, without otherwise affecting the...
The primary interface to this module.
A thread; that is, a lightweight process.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.