Browse Source

*** empty log message ***

David Rose 25 years ago
parent
commit
ffd517c79b
3 changed files with 30 additions and 9 deletions
  1. 24 9
      panda/src/gui/guiButton.cxx
  2. 5 0
      panda/src/gui/guiRegion.I
  3. 1 0
      panda/src/gui/guiRegion.h

+ 24 - 9
panda/src/gui/guiButton.cxx

@@ -613,15 +613,30 @@ void GuiButton::set_priority(GuiItem* i, const GuiItem::Priority p) {
 }
 }
 
 
 int GuiButton::set_draw_order(int v) {
 int GuiButton::set_draw_order(int v) {
-  int o = _up->set_draw_order(v);
-  o = _down->set_draw_order(o);
-  if (_up_rollover != (GuiLabel*)0L)
-    o = _up_rollover->set_draw_order(o);
-  if (_down_rollover != (GuiLabel*)0L)
-    o = _down_rollover->set_draw_order(o);
-  if (_inactive != (GuiLabel*)0L)
-    o = _inactive->set_draw_order(o);
-  return GuiBehavior::set_draw_order(o);
+  // No two of these labels will ever be drawn simultaneously, so
+  // there's no need to cascade the draw orders.  They can each be
+  // assigned the same value, and the value we return is the maximum
+  // of any of the values returned by the labels.
+  int o = _rgn->set_draw_order(v);
+  int o1 = _up->set_draw_order(v);
+  o = max(o, o1);
+  o1 = _down->set_draw_order(v);
+  o = max(o, o1);
+  if (_up_rollover != (GuiLabel*)0L) {
+    o1 = _up_rollover->set_draw_order(v);
+    o = max(o, o1);
+  }
+  if (_down_rollover != (GuiLabel*)0L) {
+    o1 = _down_rollover->set_draw_order(v);
+    o = max(o, o1);
+  }
+  if (_inactive != (GuiLabel*)0L) {
+    o1 = _inactive->set_draw_order(v);
+    o = max(o, o1);
+  }
+  o1 = GuiBehavior::set_draw_order(v);
+  o = max(o, o1);
+  return o;
 }
 }
 
 
 void GuiButton::output(ostream& os) const {
 void GuiButton::output(ostream& os) const {

+ 5 - 0
panda/src/gui/guiRegion.I

@@ -47,3 +47,8 @@ INLINE LVector4f GuiRegion::get_frame(void) const {
   _region->test_ref_count_integrity();
   _region->test_ref_count_integrity();
   return LVector4f(_left, _right, _bottom, _top);
   return LVector4f(_left, _right, _bottom, _top);
 }
 }
+
+INLINE int GuiRegion::set_draw_order(int draw_order) {
+  _region->set_sort(draw_order);
+  return draw_order + 1;
+}

+ 1 - 0
panda/src/gui/guiRegion.h

@@ -36,6 +36,7 @@ PUBLISHED:
 
 
   INLINE void set_region(float, float, float, float);
   INLINE void set_region(float, float, float, float);
   INLINE LVector4f get_frame(void) const;
   INLINE LVector4f get_frame(void) const;
+  INLINE int set_draw_order(int);
 
 
 public:
 public:
   // type interface
   // type interface