Browse Source

one step closer

Cary Sandvig 25 years ago
parent
commit
e4ef1283aa

+ 6 - 3
panda/src/gui/Sources.pp

@@ -18,7 +18,8 @@
     guiFrame.h guiFrame.I guiFrame.cxx \
     guiFrame.h guiFrame.I guiFrame.cxx \
     guiSign.h guiSign.I guiSign.cxx \
     guiSign.h guiSign.I guiSign.cxx \
     guiListBox.h guiListBox.I guiListBox.cxx \
     guiListBox.h guiListBox.I guiListBox.cxx \
-    guiBackground.h guiBackground.I guiBackground.cxx
+    guiBackground.h guiBackground.I guiBackground.cxx \
+    guiBehavior.h guiBehavior.I guiBehavior.cxx
 
 
   #define INSTALL_HEADERS \
   #define INSTALL_HEADERS \
     guiManager.h guiManager.I \
     guiManager.h guiManager.I \
@@ -30,7 +31,8 @@
     guiFrame.h guiFrame.I \
     guiFrame.h guiFrame.I \
     guiSign.h guiSign.I \
     guiSign.h guiSign.I \
     guiListBox.h guiListBox.I \
     guiListBox.h guiListBox.I \
-    guiBackground.h guiBackground.I
+    guiBackground.h guiBackground.I \
+    guiBehavior.h guiBehavior.I
 
 
   #define IGATESCAN \
   #define IGATESCAN \
     guiManager.h guiManager.I \
     guiManager.h guiManager.I \
@@ -42,6 +44,7 @@
     guiFrame.h guiFrame.I \
     guiFrame.h guiFrame.I \
     guiSign.h guiSign.I \
     guiSign.h guiSign.I \
     guiListBox.h guiListBox.I \
     guiListBox.h guiListBox.I \
-    guiBackground.h guiBackground.I
+    guiBackground.h guiBackground.I \
+    guiBehavior.h guiBehavior.I
 
 
 #end lib_target
 #end lib_target

+ 4 - 0
panda/src/gui/config_gui.cxx

@@ -12,6 +12,8 @@
 #include "guiButton.h"
 #include "guiButton.h"
 #include "guiFrame.h"
 #include "guiFrame.h"
 #include "guiListBox.h"
 #include "guiListBox.h"
+#include "guiBehavior.h"
+#include "guiBackground.h"
 
 
 #include <dconfig.h>
 #include <dconfig.h>
 
 
@@ -22,11 +24,13 @@ ConfigureFn(config_gui) {
   GuiLabel::init_type();
   GuiLabel::init_type();
   GuiRegion::init_type();
   GuiRegion::init_type();
   GuiItem::init_type();
   GuiItem::init_type();
+  GuiBehavior::init_type();
   GuiSign::init_type();
   GuiSign::init_type();
   GuiRollover::init_type();
   GuiRollover::init_type();
   GuiButton::init_type();
   GuiButton::init_type();
   GuiFrame::init_type();
   GuiFrame::init_type();
   GuiListBox::init_type();
   GuiListBox::init_type();
+  GuiBackground::init_type();
 }
 }
 
 
 float simple_text_margin_top =
 float simple_text_margin_top =

+ 10 - 1
panda/src/gui/guiBehavior.cxx

@@ -7,6 +7,15 @@
 
 
 TypeHandle GuiBehavior::_type_handle;
 TypeHandle GuiBehavior::_type_handle;
 
 
+GuiBehavior::BehaviorFunctor::BehaviorFunctor(void) {
+}
+
+GuiBehavior::BehaviorFunctor::~BehaviorFunctor(void) {
+}
+
+void GuiBehavior::BehaviorFunctor::doit(GuiBehavior*) {
+}
+
 GuiBehavior::GuiBehavior(const string& name) : GuiItem(name),
 GuiBehavior::GuiBehavior(const string& name) : GuiItem(name),
 					       _eh((EventHandler*)0L) {
 					       _eh((EventHandler*)0L) {
 }
 }
@@ -22,7 +31,7 @@ void GuiBehavior::manage(GuiManager* mgr, EventHandler& eh) {
 void GuiBehavior::unmanage(void) {
 void GuiBehavior::unmanage(void) {
   if (_behavior_running)
   if (_behavior_running)
     this->stop_behavior();
     this->stop_behavior();
-  _eh = (EventHandler)0L;
+  _eh = (EventHandler*)0L;
   GuiItem::unmanage();
   GuiItem::unmanage();
 }
 }
 
 

+ 35 - 1
panda/src/gui/guiBehavior.h

@@ -8,9 +8,19 @@
 
 
 #include "guiItem.h"
 #include "guiItem.h"
 
 
-claas EXPCL_PANDA GuiBehavior : public GuiItem {
+class EXPCL_PANDA GuiBehavior : public GuiItem {
 protected:
 protected:
   EventHandler* _eh;
   EventHandler* _eh;
+  bool _behavior_running;
+
+  INLINE GuiBehavior(void);
+PUBLISHED:
+  class EXPCL_PANDA BehaviorFunctor {
+  public:
+    BehaviorFunctor(void);
+    ~BehaviorFunctor(void);
+    virtual void doit(GuiBehavior*) = 0;
+  };
 PUBLISHED:
 PUBLISHED:
   GuiBehavior(const string&);
   GuiBehavior(const string&);
   virtual ~GuiBehavior(void);
   virtual ~GuiBehavior(void);
@@ -20,6 +30,30 @@ PUBLISHED:
 
 
   virtual void start_behavior(void) = 0;
   virtual void start_behavior(void) = 0;
   virtual void stop_behavior(void) = 0;
   virtual void stop_behavior(void) = 0;
+  virtual void reset_behavior(void) = 0;
+
+  virtual void output(ostream&) const = 0;
+public:
+  // type interface
+  static TypeHandle get_class_type(void) {
+    return _type_handle;
+  }
+  static void init_type(void) {
+    GuiItem::init_type();
+    register_type(_type_handle, "GuiItem",
+		  GuiItem::get_class_type());
+  }
+  virtual TypeHandle get_type(void) const {
+    return get_class_type();
+  }
+  virtual TypeHandle force_init_type(void) {
+    init_type();
+    return get_class_type();
+  }
+private:
+  static TypeHandle _type_handle;
 };
 };
 
 
+#include "guiBehavior.I"
+
 #endif /* __GUIBEHAVIOR_H__ */
 #endif /* __GUIBEHAVIOR_H__ */

+ 62 - 12
panda/src/gui/guiButton.cxx

@@ -194,7 +194,7 @@ void GuiButton::switch_state(GuiButton::States nstate) {
 }
 }
 
 
 void GuiButton::recompute_frame(void) {
 void GuiButton::recompute_frame(void) {
-  GuiItem::recompute_frame();
+  GuiBehavior::recompute_frame();
   _up->recompute();
   _up->recompute();
   _down->recompute();
   _down->recompute();
   if (_up_rollover != (GuiLabel*)0L)
   if (_up_rollover != (GuiLabel*)0L)
@@ -208,14 +208,43 @@ void GuiButton::recompute_frame(void) {
   _rgn->set_region(_left, _right, _bottom, _top);
   _rgn->set_region(_left, _right, _bottom, _top);
 }
 }
 
 
+void GuiButton::behavior_up(CPT_Event, void* data) {
+  GuiButton* button = (GuiButton*)data;
+  button->run_button_up();
+}
+
+void GuiButton::behavior_down(CPT_Event, void* data) {
+  GuiButton* button = (GuiButton*)data;
+  button->run_button_down();
+}
+
+void GuiButton::run_button_up(void) {
+  if (_eh == (EventHandler*)0L)
+    return;
+  _eh->remove_hook(_up_event, GuiButton::behavior_up, (void*)this);
+  _eh->remove_hook(_up_rollover_event, GuiButton::behavior_up, (void*)this);
+  if (!_behavior_event.empty())
+    throw_event(_behavior_event);
+  if (_behavior_functor != (GuiBehavior::BehaviorFunctor*)0L)
+    _behavior_functor->doit(this);
+}
+
+void GuiButton::run_button_down(void) {
+  if (_eh == (EventHandler*)0L)
+    return;
+  _eh->add_hook(_up_event, GuiButton::behavior_up, (void*)this);
+  _eh->add_hook(_up_rollover_event, GuiButton::behavior_up, (void*)this);
+}
+
 GuiButton::GuiButton(const string& name, GuiLabel* up, GuiLabel* down)
 GuiButton::GuiButton(const string& name, GuiLabel* up, GuiLabel* down)
-  : GuiItem(name), _up(up), _up_rollover((GuiLabel*)0L), _down(down),
+  : GuiBehavior(name), _up(up), _up_rollover((GuiLabel*)0L), _down(down),
     _down_rollover((GuiLabel*)0L), _inactive((GuiLabel*)0L),
     _down_rollover((GuiLabel*)0L), _inactive((GuiLabel*)0L),
     _up_event(name + "-up"), _up_rollover_event(""),
     _up_event(name + "-up"), _up_rollover_event(""),
     _down_event(name +"-down"), _down_rollover_event(""),
     _down_event(name +"-down"), _down_rollover_event(""),
     _inactive_event(""), _up_scale(up->get_scale()), _upr_scale(1.),
     _inactive_event(""), _up_scale(up->get_scale()), _upr_scale(1.),
     _down_scale(down->get_scale()), _downr_scale(1.), _inactive_scale(1.),
     _down_scale(down->get_scale()), _downr_scale(1.), _inactive_scale(1.),
-    _state(GuiButton::NONE) {
+    _state(GuiButton::NONE),
+    _behavior_functor((GuiBehavior::BehaviorFunctor*)0L) {
   GetExtents(up, down, _up_rollover, _down_rollover, _inactive, _left, _right,
   GetExtents(up, down, _up_rollover, _down_rollover, _inactive, _left, _right,
 	     _bottom, _top);
 	     _bottom, _top);
   _rgn = new GuiRegion("button-" + name, _left, _right, _bottom, _top, true);
   _rgn = new GuiRegion("button-" + name, _left, _right, _bottom, _top, true);
@@ -228,13 +257,14 @@ GuiButton::GuiButton(const string& name, GuiLabel* up, GuiLabel* down)
 
 
 GuiButton::GuiButton(const string& name, GuiLabel* up, GuiLabel* down,
 GuiButton::GuiButton(const string& name, GuiLabel* up, GuiLabel* down,
 		     GuiLabel* inactive)
 		     GuiLabel* inactive)
-  : GuiItem(name), _up(up), _up_rollover((GuiLabel*)0L), _down(down),
+  : GuiBehavior(name), _up(up), _up_rollover((GuiLabel*)0L), _down(down),
     _down_rollover((GuiLabel*)0L), _inactive(inactive),
     _down_rollover((GuiLabel*)0L), _inactive(inactive),
     _up_event(name + "-up"), _up_rollover_event(""),
     _up_event(name + "-up"), _up_rollover_event(""),
     _down_event(name +"-down"), _down_rollover_event(""),
     _down_event(name +"-down"), _down_rollover_event(""),
     _inactive_event(name + "-inactive"), _up_scale(up->get_scale()),
     _inactive_event(name + "-inactive"), _up_scale(up->get_scale()),
     _upr_scale(1.), _down_scale(down->get_scale()), _downr_scale(1.),
     _upr_scale(1.), _down_scale(down->get_scale()), _downr_scale(1.),
-    _inactive_scale(inactive->get_scale()), _state(GuiButton::NONE) {
+    _inactive_scale(inactive->get_scale()), _state(GuiButton::NONE),
+    _behavior_functor((GuiBehavior::BehaviorFunctor*)0L) {
   GetExtents(up, down, _up_rollover, _down_rollover, inactive, _left, _right,
   GetExtents(up, down, _up_rollover, _down_rollover, inactive, _left, _right,
 	     _bottom, _top);
 	     _bottom, _top);
   _rgn = new GuiRegion("button-" + name, _left, _right, _bottom, _top, true);
   _rgn = new GuiRegion("button-" + name, _left, _right, _bottom, _top, true);
@@ -247,14 +277,15 @@ GuiButton::GuiButton(const string& name, GuiLabel* up, GuiLabel* down,
 
 
 GuiButton::GuiButton(const string& name, GuiLabel* up, GuiLabel* up_roll,
 GuiButton::GuiButton(const string& name, GuiLabel* up, GuiLabel* up_roll,
 		     GuiLabel* down, GuiLabel* down_roll, GuiLabel* inactive)
 		     GuiLabel* down, GuiLabel* down_roll, GuiLabel* inactive)
-  : GuiItem(name), _up(up), _up_rollover(up_roll), _down(down),
+  : GuiBehavior(name), _up(up), _up_rollover(up_roll), _down(down),
     _down_rollover(down_roll), _inactive(inactive), _up_event(name + "-up"),
     _down_rollover(down_roll), _inactive(inactive), _up_event(name + "-up"),
     _up_rollover_event(name + "-up-rollover"), _down_event(name +"-down"),
     _up_rollover_event(name + "-up-rollover"), _down_event(name +"-down"),
     _down_rollover_event(name + "-down-rollover"),
     _down_rollover_event(name + "-down-rollover"),
     _inactive_event(name + "-inactive"), _up_scale(up->get_scale()),
     _inactive_event(name + "-inactive"), _up_scale(up->get_scale()),
     _upr_scale(up_roll->get_scale()), _down_scale(down->get_scale()),
     _upr_scale(up_roll->get_scale()), _down_scale(down->get_scale()),
     _downr_scale(down_roll->get_scale()),
     _downr_scale(down_roll->get_scale()),
-    _inactive_scale(inactive->get_scale()), _state(GuiButton::NONE) {
+    _inactive_scale(inactive->get_scale()), _state(GuiButton::NONE),
+    _behavior_functor((GuiBehavior::BehaviorFunctor*)0L) {
   GetExtents(up, down, up_roll, down_roll, inactive, _left, _right, _bottom,
   GetExtents(up, down, up_roll, down_roll, inactive, _left, _right, _bottom,
 	     _top);
 	     _top);
   _rgn = new GuiRegion("button-" + name, _left, _right, _bottom, _top, true);
   _rgn = new GuiRegion("button-" + name, _left, _right, _bottom, _top, true);
@@ -276,6 +307,9 @@ GuiButton::~GuiButton(void) {
   buttons.erase("gui-button-" + name + "-mouse1");
   buttons.erase("gui-button-" + name + "-mouse1");
   buttons.erase("gui-button-" + name + "-mouse2");
   buttons.erase("gui-button-" + name + "-mouse2");
   buttons.erase("gui-button-" + name + "-mouse3");
   buttons.erase("gui-button-" + name + "-mouse3");
+
+  if (_behavior_functor != (GuiBehavior::BehaviorFunctor*)0L)
+    delete _behavior_functor;
 }
 }
 
 
 void GuiButton::manage(GuiManager* mgr, EventHandler& eh) {
 void GuiButton::manage(GuiManager* mgr, EventHandler& eh) {
@@ -289,7 +323,9 @@ void GuiButton::manage(GuiManager* mgr, EventHandler& eh) {
   }
   }
   if (_mgr == (GuiManager*)0L) {
   if (_mgr == (GuiManager*)0L) {
     mgr->add_region(_rgn);
     mgr->add_region(_rgn);
-    GuiItem::manage(mgr, eh);
+    GuiBehavior::manage(mgr, eh);
+    if (_behavior_running)
+      this->start_behavior();
     switch_state(UP);
     switch_state(UP);
   } else
   } else
     gui_cat->warning() << "tried to manage button (0x" << (void*)this
     gui_cat->warning() << "tried to manage button (0x" << (void*)this
@@ -299,8 +335,10 @@ void GuiButton::manage(GuiManager* mgr, EventHandler& eh) {
 void GuiButton::unmanage(void) {
 void GuiButton::unmanage(void) {
   if (_mgr != (GuiManager*)0L)
   if (_mgr != (GuiManager*)0L)
     _mgr->remove_region(_rgn);
     _mgr->remove_region(_rgn);
+  if (_behavior_running)
+    this->stop_behavior();
   switch_state(NONE);
   switch_state(NONE);
-  GuiItem::unmanage();
+  GuiBehavior::unmanage();
 }
 }
 
 
 int GuiButton::freeze() {
 int GuiButton::freeze() {
@@ -338,7 +376,7 @@ void GuiButton::set_scale(float f) {
     _down_rollover->set_scale(f * _downr_scale);
     _down_rollover->set_scale(f * _downr_scale);
   if (_inactive != (GuiLabel*)0L)
   if (_inactive != (GuiLabel*)0L)
     _inactive->set_scale(f * _inactive_scale);
     _inactive->set_scale(f * _inactive_scale);
-  GuiItem::set_scale(f);
+  GuiBehavior::set_scale(f);
   this->recompute_frame();
   this->recompute_frame();
 }
 }
 
 
@@ -351,12 +389,24 @@ void GuiButton::set_pos(const LVector3f& p) {
     _down_rollover->set_pos(p);
     _down_rollover->set_pos(p);
   if (_inactive != (GuiLabel*)0L)
   if (_inactive != (GuiLabel*)0L)
     _inactive->set_pos(p);
     _inactive->set_pos(p);
-  GuiItem::set_pos(p);
+  GuiBehavior::set_pos(p);
   this->recompute_frame();
   this->recompute_frame();
 }
 }
 
 
+void GuiButton::start_behavior(void) {
+  GuiBehavior::start_behavior();
+}
+
+void GuiButton::stop_behavior(void) {
+  GuiBehavior::stop_behavior();
+}
+
+void GuiButton::reset_behavior(void) {
+  GuiBehavior::reset_behavior();
+}
+
 void GuiButton::output(ostream& os) const {
 void GuiButton::output(ostream& os) const {
-  GuiItem::output(os);
+  GuiBehavior::output(os);
   os << "  Button data:" << endl;
   os << "  Button data:" << endl;
   os << "    up - 0x" << (void*)_up << endl;
   os << "    up - 0x" << (void*)_up << endl;
   os << "    up_rollover - 0x" << (void*)_up_rollover << endl;
   os << "    up_rollover - 0x" << (void*)_up_rollover << endl;

+ 15 - 4
panda/src/gui/guiButton.h

@@ -6,12 +6,12 @@
 #ifndef __GUIBUTTON_H__
 #ifndef __GUIBUTTON_H__
 #define __GUIBUTTON_H__
 #define __GUIBUTTON_H__
 
 
-#include "guiItem.h"
+#include "guiBehavior.h"
 #include "guiRegion.h"
 #include "guiRegion.h"
 #include "guiLabel.h"
 #include "guiLabel.h"
 #include "guiManager.h"
 #include "guiManager.h"
 
 
-class EXPCL_PANDA GuiButton : public GuiItem {
+class EXPCL_PANDA GuiButton : public GuiBehavior {
 private:
 private:
   PT(GuiLabel) _up;
   PT(GuiLabel) _up;
   PT(GuiLabel) _up_rollover;
   PT(GuiLabel) _up_rollover;
@@ -32,10 +32,17 @@ private:
 		INACTIVE_ROLLOVER };
 		INACTIVE_ROLLOVER };
   States _state;
   States _state;
 
 
+  string _behavior_event;
+  GuiBehavior::BehaviorFunctor* _behavior_functor;
+
   INLINE GuiButton(void);
   INLINE GuiButton(void);
   void switch_state(States);
   void switch_state(States);
   virtual void recompute_frame(void);
   virtual void recompute_frame(void);
 
 
+  static void behavior_up(CPT_Event, void*);
+  static void behavior_down(CPT_Event, void*);
+  void run_button_up(void);
+  void run_button_down(void);
 PUBLISHED:
 PUBLISHED:
   GuiButton(const string&, GuiLabel*, GuiLabel*);
   GuiButton(const string&, GuiLabel*, GuiLabel*);
   GuiButton(const string&, GuiLabel*, GuiLabel*, GuiLabel*);
   GuiButton(const string&, GuiLabel*, GuiLabel*, GuiLabel*);
@@ -80,6 +87,10 @@ PUBLISHED:
   virtual void set_scale(float);
   virtual void set_scale(float);
   virtual void set_pos(const LVector3f&);
   virtual void set_pos(const LVector3f&);
 
 
+  virtual void start_behavior(void);
+  virtual void stop_behavior(void);
+  virtual void reset_behavior(void);
+
   virtual void output(ostream&) const;
   virtual void output(ostream&) const;
 
 
 public:
 public:
@@ -88,9 +99,9 @@ public:
     return _type_handle;
     return _type_handle;
   }
   }
   static void init_type(void) {
   static void init_type(void) {
-    GuiItem::init_type();
+    GuiBehavior::init_type();
     register_type(_type_handle, "GuiButton",
     register_type(_type_handle, "GuiButton",
-		  GuiItem::get_class_type());
+		  GuiBehavior::get_class_type());
   }
   }
   virtual TypeHandle get_type(void) const {
   virtual TypeHandle get_type(void) const {
     return get_class_type();
     return get_class_type();

+ 19 - 7
panda/src/gui/guiListBox.cxx

@@ -8,7 +8,7 @@
 TypeHandle GuiListBox::_type_handle;
 TypeHandle GuiListBox::_type_handle;
 
 
 void GuiListBox::recompute_frame(void) {
 void GuiListBox::recompute_frame(void) {
-  GuiItem::recompute_frame();
+  GuiBehavior::recompute_frame();
   LVector3f p = _pos;
   LVector3f p = _pos;
   float lft = 100000.;
   float lft = 100000.;
   float rgt = -100000.;
   float rgt = -100000.;
@@ -91,7 +91,7 @@ void GuiListBox::visible_patching(void) {
 }
 }
 
 
 GuiListBox::GuiListBox(const string& name, int N, GuiItem* up, GuiItem* down)
 GuiListBox::GuiListBox(const string& name, int N, GuiItem* up, GuiItem* down)
-  : GuiItem(name), _arrow_top(false), _arrow_bottom(false), _up_arrow(up),
+  : GuiBehavior(name), _arrow_top(false), _arrow_bottom(false), _up_arrow(up),
     _down_arrow(down), _n_visible(N) {
     _down_arrow(down), _n_visible(N) {
   if (N < 4) {
   if (N < 4) {
     gui_cat->warning() << "ListBoxes should have at least 4 visible slots"
     gui_cat->warning() << "ListBoxes should have at least 4 visible slots"
@@ -199,7 +199,7 @@ void GuiListBox::manage(GuiManager* mgr, EventHandler& eh) {
     for (ItemVector::iterator i=_visible.begin(); i!=_visible.end(); ++i)
     for (ItemVector::iterator i=_visible.begin(); i!=_visible.end(); ++i)
       (*i)->manage(mgr, eh);
       (*i)->manage(mgr, eh);
     _eh = &eh;
     _eh = &eh;
-    GuiItem::manage(mgr, eh);
+    GuiBehavior::manage(mgr, eh);
   } else
   } else
     gui_cat->warning() << "tried to manage listbox (0x" << (void*)this
     gui_cat->warning() << "tried to manage listbox (0x" << (void*)this
 		       << ") that is already managed" << endl;
 		       << ") that is already managed" << endl;
@@ -208,7 +208,7 @@ void GuiListBox::manage(GuiManager* mgr, EventHandler& eh) {
 void GuiListBox::unmanage(void) {
 void GuiListBox::unmanage(void) {
   for (ItemVector::iterator i=_visible.begin(); i!=_visible.end(); ++i)
   for (ItemVector::iterator i=_visible.begin(); i!=_visible.end(); ++i)
     (*i)->unmanage();
     (*i)->unmanage();
-  GuiItem::unmanage();
+  GuiBehavior::unmanage();
 }
 }
 
 
 void GuiListBox::set_scale(float f) {
 void GuiListBox::set_scale(float f) {
@@ -220,7 +220,7 @@ void GuiListBox::set_scale(float f) {
   for (ItemDeque::iterator j=_bottom_stack.begin(); j!=_bottom_stack.end();
   for (ItemDeque::iterator j=_bottom_stack.begin(); j!=_bottom_stack.end();
        ++j)
        ++j)
     (*j)->set_scale(f);
     (*j)->set_scale(f);
-  GuiItem::set_scale(f);
+  GuiBehavior::set_scale(f);
 }
 }
 
 
 void GuiListBox::set_pos(const LVector3f& p) {
 void GuiListBox::set_pos(const LVector3f& p) {
@@ -232,11 +232,23 @@ void GuiListBox::set_pos(const LVector3f& p) {
   for (ItemDeque::iterator j=_bottom_stack.begin(); j!=_bottom_stack.end();
   for (ItemDeque::iterator j=_bottom_stack.begin(); j!=_bottom_stack.end();
        ++j)
        ++j)
     (*j)->set_pos(p);
     (*j)->set_pos(p);
-  GuiItem::set_pos(p);
+  GuiBehavior::set_pos(p);
+}
+
+void GuiListBox::start_behavior(void) {
+  GuiBehavior::start_behavior();
+}
+
+void GuiListBox::stop_behavior(void) {
+  GuiBehavior::stop_behavior();
+}
+
+void GuiListBox::reset_behavior(void) {
+  GuiBehavior::reset_behavior();
 }
 }
 
 
 void GuiListBox::output(ostream& os) const {
 void GuiListBox::output(ostream& os) const {
-  GuiItem::output(os);
+  GuiBehavior::output(os);
   os << "  Listbox data:" << endl;
   os << "  Listbox data:" << endl;
   os << "    There is ";
   os << "    There is ";
   if (!_arrow_top)
   if (!_arrow_top)

+ 8 - 4
panda/src/gui/guiListBox.h

@@ -6,12 +6,12 @@
 #ifndef __GUILISTBOX_H__
 #ifndef __GUILISTBOX_H__
 #define __GUILISTBOX_H__
 #define __GUILISTBOX_H__
 
 
-#include "guiItem.h"
+#include "guiBehavior.h"
 
 
 #include <vector>
 #include <vector>
 #include <deque>
 #include <deque>
 
 
-class EXPCL_PANDA GuiListBox : public GuiItem {
+class EXPCL_PANDA GuiListBox : public GuiBehavior {
 private:
 private:
   typedef vector< PT(GuiItem) > ItemVector;
   typedef vector< PT(GuiItem) > ItemVector;
   typedef deque< PT(GuiItem) > ItemDeque;
   typedef deque< PT(GuiItem) > ItemDeque;
@@ -46,6 +46,10 @@ PUBLISHED:
   virtual void set_scale(float);
   virtual void set_scale(float);
   virtual void set_pos(const LVector3f&);
   virtual void set_pos(const LVector3f&);
 
 
+  virtual void start_behavior(void);
+  virtual void stop_behavior(void);
+  virtual void reset_behavior(void);
+
   virtual void output(ostream&) const;
   virtual void output(ostream&) const;
 public:
 public:
   // type interface
   // type interface
@@ -53,9 +57,9 @@ public:
     return _type_handle;
     return _type_handle;
   }
   }
   static void init_type(void) {
   static void init_type(void) {
-    GuiItem::init_type();
+    GuiBehavior::init_type();
     register_type(_type_handle, "GuiListBox",
     register_type(_type_handle, "GuiListBox",
-		  GuiItem::get_class_type());
+		  GuiBehavior::get_class_type());
   }
   }
   virtual TypeHandle get_type(void) const {
   virtual TypeHandle get_type(void) const {
     return get_class_type();
     return get_class_type();