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;
157 setup(
const std::string &label, PN_stdfloat bevel) {
166 PT(
PandaNode) geom = text_node->generate();
169 set_frame(frame[0] - 0.4, frame[1] + 0.4, frame[2] - 0.15f, frame[3] + 0.15f);
180 style.
set_type(PGFrameStyle::T_bevel_out);
186 inactive->set_attrib(ColorAttrib::make_flat(LColor(0.8f, 0.8f, 0.8f, 1.0f)));
190 style.
set_type(PGFrameStyle::T_bevel_in);
193 depressed->set_transform(TransformState::make_pos(LVector3(0.05f, 0.0f, -0.05f)));
200 ready->add_child(geom);
201 depressed->add_child(geom);
202 rollover->add_child(geom);
203 inactive->add_child(geom);
224 LPoint3 min_point, max_point;
227 min_point[2], max_point[2]);
239 set_state(active ? S_ready : S_inactive);
251 return _click_buttons.insert(button).second;
262 return (_click_buttons.erase(button) != 0);
273 return (_click_buttons.count(button) != 0);
An optional parameter associated with an event.
Similar to MutexHolder, but for a light reentrant mutex.
This is sent along as a parameter to most events generated for a region to indicate the mouse and but...
ButtonHandle get_button() const
Returns the mouse or keyboard button associated with this event.
bool is_outside() const
Returns true if the mouse was outside the region at the time the event was generated,...
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
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.
void set_type(Type type)
Sets the basic type of frame.
void set_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a)
Sets the dominant color of the frame.
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.
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.
void clear_state_def(int state)
Resets the NodePath assigned to the indicated state to its initial default, with only a frame represe...
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 TextNode * get_text_node()
Returns the TextNode object that will be used by all PGItems to generate default labels given a strin...
bool get_focus() const
Returns whether the PGItem currently has focus for keyboard events.
virtual void release(const MouseWatcherParameter ¶m, bool background)
This is a callback hook function, called whenever a mouse or keyboard button previously depressed wit...
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.
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.
bool has_notify() const
Returns true if there is an object configured to be notified when the PGItem changes,...
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 specialization on MouseWatcherParameter allows us to tag on additional elements to events for th...
A basic node of the scene graph or data graph.
set_state
Sets the complete RenderState that will be applied to all nodes at this level and below.
set_text
Changes the text that is stored in the encoder.
The primary interface to this module.
LVecBase4 get_card_actual() const
Returns the actual dimensions of the card around the text.
TypeHandle is the identifier used to differentiate C++ class types.
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.