16 #include "pgMouseWatcherParameter.h" 18 #include "throw_event.h" 19 #include "mouseButton.h" 20 #include "mouseWatcherParameter.h" 21 #include "colorAttrib.h" 22 #include "transformState.h" 32 PGButton(
const string &name) :
PGItem(name)
57 _click_buttons(copy._click_buttons)
86 set_state(_button_down ? S_depressed : S_rollover);
136 _button_down =
false;
178 setup(
const string &label, PN_stdfloat bevel) {
187 PT(
PandaNode) geom = text_node->generate();
190 set_frame(frame[0] - 0.4, frame[1] + 0.4, frame[2] - 0.15f, frame[3] + 0.15f);
201 style.
set_type(PGFrameStyle::T_bevel_out);
207 inactive->set_attrib(ColorAttrib::make_flat(
LColor(0.8f, 0.8f, 0.8f, 1.0f)));
211 style.
set_type(PGFrameStyle::T_bevel_in);
214 depressed->set_transform(TransformState::make_pos(
LVector3(0.05f, 0.0f, -0.05f)));
221 ready->add_child(geom);
222 depressed->add_child(geom);
223 rollover->add_child(geom);
224 inactive->add_child(geom);
251 min_point[2], max_point[2]);
266 set_state(active ? S_ready : S_inactive);
281 return _click_buttons.insert(button).second;
296 return (_click_buttons.erase(button) != 0);
309 return (_click_buttons.count(button) != 0);
bool calc_tight_bounds(LPoint3 &min_point, LPoint3 &max_point, Thread *current_thread=Thread::get_current_thread()) const
Calculates the minimum and maximum vertices of all Geoms at this NodePath's bottom node and below...
A basic node of the scene graph or data graph.
This specialization on MouseWatcherParameter allows us to tag on additional elements to events for th...
void set_width(PN_stdfloat x, PN_stdfloat y)
Sets the width parameter, which has meaning only for certain frame types.
This is the base class for all the various kinds of gui widget objects.
An optional parameter associated with an event.
NodePath & 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 indica...
bool get_active() const
Returns whether the PGItem is currently active for mouse events.
void set_text(const string &text)
Changes the text that is displayed under the TextNode.
void set_type(Type type)
Sets the basic type of 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.
virtual void enter_region(const MouseWatcherParameter ¶m)
This is a callback hook function, called whenever the mouse enters the region.
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
bool is_outside() const
Returns true if the mouse was outside the region at the time the event was generated, false otherwise.
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
bool has_notify() const
Returns true if there is an object configured to be notified when the PGItem changes, false otherwise.
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...
ButtonHandle get_button() const
Returns the mouse or keyboard button associated with this event.
NodePath attach_new_node(PandaNode *node, int sort=0, Thread *current_thread=Thread::get_current_thread()) const
Attaches a new node, with or without existing parents, to the scene graph below the referenced node o...
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 release(const MouseWatcherParameter ¶m, bool background)
This is a callback hook function, called whenever a mouse or keyboard button previously depressed wit...
void set_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a)
Sets the dominant color of the frame.
static TextNode * get_text_node()
Returns the TextNode object that will be used by all PGItems to generate default labels given a strin...
Similar to MutexHolder, but for a light reentrant mutex.
LVecBase4 get_card_actual() const
Returns the actual dimensions of the card around the text.
This is the base class for all three-component vectors and points.
void set_state(int state)
Sets the "state" of this particular PGItem.
The primary interface to this module.
void clear_state_def(int state)
Resets the NodePath assigned to the indicated state to its initial default, with only a frame represe...
TypeHandle is the identifier used to differentiate C++ class types.
This is sent along as a parameter to most events generated for a region to indicate the mouse and but...
virtual void exit_region(const MouseWatcherParameter ¶m)
This is a callback hook function, called whenever the mouse exits the region.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
virtual void set_active(bool active)
Sets whether the PGItem is active for mouse watching.
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...