Explorar o código

is this fun or what?

Cary Sandvig %!s(int64=25) %!d(string=hai) anos
pai
achega
f236491613

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

@@ -17,7 +17,8 @@
     guiButton.h guiButton.I guiButton.cxx \
     guiFrame.h guiFrame.I guiFrame.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
 
   #define INSTALL_HEADERS \
     guiManager.h guiManager.I \
@@ -28,7 +29,8 @@
     guiButton.h guiButton.I \
     guiFrame.h guiFrame.I \
     guiSign.h guiSign.I \
-    guiListBox.h guiListBox.I
+    guiListBox.h guiListBox.I \
+    guiBackground.h guiBackground.I
 
   #define IGATESCAN \
     guiManager.h guiManager.I \
@@ -39,6 +41,7 @@
     guiButton.h guiButton.I \
     guiFrame.h guiFrame.I \
     guiSign.h guiSign.I \
-    guiListBox.h guiListBox.I
+    guiListBox.h guiListBox.I \
+    guiBackground.h guiBackground.I
 
 #end lib_target

+ 3 - 0
panda/src/gui/guiBackground.I

@@ -2,3 +2,6 @@
 // Created by:  cary (05Feb01)
 // 
 ////////////////////////////////////////////////////////////////////
+
+INLINE GuiBackground::GuiBackground(void) {
+}

+ 55 - 0
panda/src/gui/guiBackground.cxx

@@ -2,3 +2,58 @@
 // Created by:  cary (05Feb01)
 // 
 ////////////////////////////////////////////////////////////////////
+
+#include "guiBackground.h"
+#include "config_gui.h"
+
+TypeHandle GuiBackground::_type_handle;
+
+void GuiBackground::recompute_frame(void) {
+  GuiItem::recompute_frame();
+}
+
+GuiBackground::GuiBackground(const string& name) : GuiItem(name) {
+}
+
+GuiBackground::~GuiBackground(void) {
+  this->unmanage();
+}
+
+void GuiBackground::manage(GuiManager* mgr, EventHandler& eh) {
+  if (!_added_hooks)
+    _added_hooks = true;
+  if (_mgr == (GuiManager*)0L) {
+    GuiItem::manage(mgr, eh);
+  } else
+    gui_cat->warning() << "tried to manage background (0x" << (void*)this
+		       << ") thta is already managed" << endl;
+}
+
+void GuiBackground::unmanage(void) {
+  GuiItem::unmanage();
+}
+
+int GuiBackground::freeze(void) {
+  return 0;
+}
+
+int GuiBackground::thaw(void) {
+  return 0;
+}
+
+void GuiBackground::set_scale(float f) {
+  GuiItem::set_scale(f);
+  recompute_frame();
+}
+
+void GuiBackground::set_pos(const LVector3f& p) {
+  GuiItem::set_pos(p);
+  recompute_frame();
+}
+
+void GuiBackground::output(ostream& os) const {
+  GuiItem::output(os);
+  os << "  Background data:" << endl;
+  os << "    item - 0x" << (void*)0L << endl;
+  // then output the item
+}

+ 50 - 0
panda/src/gui/guiBackground.h

@@ -2,3 +2,53 @@
 // Created by:  cary (05Feb01)
 // 
 ////////////////////////////////////////////////////////////////////
+
+#ifndef __GUIBACKGROUND_H__
+#define __GUIBACKGROUND_H__
+
+#include "guiItem.h"
+#include "guiManager.h"
+
+class EXPCL_PANDA GuiBackground : public GuiItem {
+private:
+  INLINE GuiBackground(void);
+  virtual void recompute_frame(void);
+PUBLISHED:
+  GuiBackground(const string&);
+  ~GuiBackground(void);
+
+  virtual void manage(GuiManager*, EventHandler&);
+  virtual void unmanage(void);
+
+  virtual int freeze(void);
+  virtual int thaw(void);
+
+  virtual void set_scale(float);
+  virtual void set_pos(const LVector3f&);
+
+  virtual void output(ostream&) const;
+
+public:
+  // type interface
+  static TypeHandle get_class_type(void) {
+    return _type_handle;
+  }
+  static void init_type(void) {
+    GuiItem::init_type();
+    register_type(_type_handle, "GuiBackground",
+		  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 "guiBackground.I"
+
+#endif /* __GUIBACKGROUND_H__ */

+ 1 - 1
panda/src/gui/guiSign.cxx

@@ -30,7 +30,7 @@ void GuiSign::manage(GuiManager* mgr, EventHandler& eh) {
     mgr->add_label(_sign);
     GuiItem::manage(mgr, eh);
   } else
-    gui_cat->warning() << "tried to manager sign (0x" << (void*)this
+    gui_cat->warning() << "tried to manage sign (0x" << (void*)this
 		       << ") that is already managed" << endl;
 }