29 PGButton(
const std::string &name) :
PGItem(name)
50 _click_buttons(copy._click_buttons)
74 set_state(_button_down ? S_depressed : S_rollover);
116 _button_down =
false;
153 setup(
const std::string &label, PN_stdfloat bevel) {
162 PT(
PandaNode) geom = text_node->generate();
165 set_frame(frame[0] - 0.4, frame[1] + 0.4, frame[2] - 0.15f, frame[3] + 0.15f);
176 style.
set_type(PGFrameStyle::T_bevel_out);
182 inactive->set_attrib(ColorAttrib::make_flat(LColor(0.8f, 0.8f, 0.8f, 1.0f)));
186 style.
set_type(PGFrameStyle::T_bevel_in);
189 depressed->set_transform(TransformState::make_pos(LVector3(0.05f, 0.0f, -0.05f)));
196 ready->add_child(geom);
197 depressed->add_child(geom);
198 rollover->add_child(geom);
199 inactive->add_child(geom);
220 LPoint3 min_point, max_point;
223 min_point[2], max_point[2]);
235 set_state(active ? S_ready : S_inactive);
247 return _click_buttons.insert(button).second;
258 return (_click_buttons.erase(button) != 0);
269 return (_click_buttons.count(button) != 0);
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the base class for all the various kinds of gui widget objects.
An optional parameter associated with an event.
bool get_active() const
Returns whether the PGItem is currently active for mouse events.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool calc_tight_bounds(LPoint3 &min_point, LPoint3 &max_point, const NodePath &other=NodePath(), 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.
virtual void enter_region(const MouseWatcherParameter ¶m)
This is a callback hook function, called whenever the mouse enters the region.
bool is_outside() const
Returns true if the mouse was outside the region at the time the event was generated,...
set_text
Changes the text that is stored in the encoder.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool has_notify() const
Returns true if there is an object configured to be notified when the PGItem changes,...
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 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.
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...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_state_def
Returns the Node that is the root of the subgraph that will be drawn when the PGItem is in the indica...
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...