Changeset 7855 in orxonox.OLD for trunk/src/lib/gui/gl_gui
- Timestamp:
- May 25, 2006, 3:42:18 PM (19 years ago)
- Location:
- trunk/src/lib/gui/gl_gui
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/gui/gl_gui/Makefile.am
r6287 r7855 11 11 libORXglgui_a_SOURCES = glmenu/glmenu_imagescreen.cc \ 12 12 glgui_handler.cc \ 13 signal_connector.cc \ 13 14 glgui_mainwidget.cc \ 14 15 glgui_widget.cc \ … … 23 24 24 25 noinst_HEADERS= glmenu/glmenu_imagescreen.h \ 26 signal_connector.h \ 25 27 glgui.h \ 26 28 glgui_handler.h \ -
trunk/src/lib/gui/gl_gui/glgui.h
r7779 r7855 8 8 #include "glgui_widget.h" 9 9 10 #include "glgui_bar.h" 11 #include "glgui_box.h" 12 #include "glgui_button.h" 13 #include "glgui_checkbutton.h" 14 #include "glgui_colorselector.h" 15 10 16 namespace OrxGui 11 17 { 18 12 19 13 20 }; -
trunk/src/lib/gui/gl_gui/glgui_widget.cc
r7779 r7855 58 58 this->frontModel = 0; 59 59 60 this->widgetSignals.resize( GLGuiSignalCount, NULL);60 this->widgetSignals.resize(SignalCount, SignalConnector()); 61 61 } 62 62 … … 64 64 bool GLGuiWidget::focusOverWidget(float x, float y) 65 65 { 66 if (this->getAbsCoor2D().x < x && this->getAbsCoor2D().x + this->getSizeX2D() > x &&67 this->getAbsCoor2D().y < y && this->getAbsCoor2D().y + this->getSizeX2D() > y)66 if (this->getAbsCoor2D().x < x && this->getAbsCoor2D().x + this->getSizeX2D() > x && 67 this->getAbsCoor2D().y < y && this->getAbsCoor2D().y + this->getSizeY2D() > y) 68 68 return true; 69 69 else … … 76 76 * @param signal the name of the Signal 77 77 */ 78 void GLGuiWidget::connectSignal( GLGuiSignalType signalType, BaseObject*, const Executor* signal)78 void GLGuiWidget::connectSignal(SignalType signalType, BaseObject* object, const Executor* signal) 79 79 { 80 if (signalType >= GLGuiSignalCount)80 if (signalType >= this->widgetSignals.size()) 81 81 return; 82 82 83 if (this->widgetSignals[signalType] != NULL)84 PRINTF(2)("Already connected a Signal to '%s::%s' type %s... overwriting\n", this->getClassName(), this->getName(), "TEST");83 // if (this->widgetSignals[signalType] != NULL) 84 // PRINTF(2)("Already connected a Signal to '%s::%s' type %s... overwriting\n", this->getClassName(), this->getName(), "TEST"); 85 85 86 //this->widgetSignals[signalType] =;86 this->widgetSignals[signalType] = SignalConnector(object, signal); 87 87 } 88 88 … … 91 91 * @param signalType the type of Signal to remove. 92 92 */ 93 void GLGuiWidget::disconnectSignal( GLGuiSignalType signalType)93 void GLGuiWidget::disconnectSignal(SignalType signalType) 94 94 { 95 if (signalType > GLGuiSignalCount)95 if (signalType >= this->widgetSignals.size()) 96 96 return; 97 97 98 this->widgetSignals[signalType] = NULL;98 this->widgetSignals[signalType] = SignalConnector(); 99 99 } 100 100 -
trunk/src/lib/gui/gl_gui/glgui_widget.h
r7779 r7855 22 22 typedef enum 23 23 { 24 GLGuiSignal_click = 0,25 GLGuiSignal_release,26 GLGuiSignal_rollOn,27 GLGuiSignal_rollOff,28 GLGuiSignal_open,29 GLGuiSignal_close,30 GLGuiSignal_destroy,24 Signal_click = 0, 25 Signal_release, 26 Signal_rollOn, 27 Signal_rollOff, 28 Signal_open, 29 Signal_close, 30 Signal_destroy, 31 31 32 GLGuiSignalCount, 33 } GLGuiSignalType; 32 SignalCount, 33 } SignalType; 34 34 35 35 36 //! if the Element should be visible by default. … … 51 52 void hide(); 52 53 53 void connectSignal( GLGuiSignalType signalType, BaseObject* obj, const Executor* signal);54 void disconnectSignal( GLGuiSignalType signalType);54 void connectSignal(SignalType signalType, BaseObject* obj, const Executor* signal); 55 void disconnectSignal(SignalType signalType); 55 56 bool focusOverWidget(float x, float y); 56 57 57 58 // if something was clickt on the GUI-widget. 58 virtual void click (const Event& event) {};59 virtual void release (const Event& event) {};59 virtual void clicked(const Event& event) {}; 60 virtual void released(const Event& event) {}; 60 61 61 virtual void receiveFocus() {}; 62 virtual void removeFocus() {}; 62 virtual void receivedFocus() {}; 63 virtual void removedFocus() {}; 64 65 virtual void destroyed() {}; 63 66 64 67 virtual void update() {}; … … 75 78 void init(); 76 79 80 81 82 77 83 protected: 78 84 Material backMat; … … 83 89 84 90 private: 85 std::vector<SignalConnector *> widgetSignals;91 std::vector<SignalConnector> widgetSignals; 86 92 87 93 bool focusable; //!< If this widget can receive focus. -
trunk/src/lib/gui/gl_gui/signal_connector.cc
r7779 r7855 21 21 { 22 22 23 SignalConnector::SignalConnector( ) 24 { 25 this->object = NULL; 26 this->exec = NULL; 27 } 28 23 29 SignalConnector::SignalConnector(BaseObject* object, const Executor* executor) 24 : object(object), exec(exec) 25 {}; 30 { 31 this->object = object; 32 this->exec = executor; 33 }; 34 35 SignalConnector::SignalConnector(const SignalConnector& signalConnector) 36 { 37 this->object = signalConnector.object; 38 this->exec = (signalConnector.exec == NULL) ? NULL : signalConnector.exec->clone(); 39 } 40 41 SignalConnector::~SignalConnector() 42 { 43 delete exec; 44 } 45 46 SignalConnector& SignalConnector::operator=(const SignalConnector& signalConnector) 47 { 48 delete this->exec; 49 this->object = signalConnector.object; 50 this->exec = (signalConnector.exec == NULL) ? NULL : signalConnector.exec->clone(); 51 } 52 53 void SignalConnector::operator()(const std::string& parameters) const 54 { 55 if (exec != NULL && object != NULL) 56 (*this->exec)(this->object, parameters); 57 } 58 26 59 } -
trunk/src/lib/gui/gl_gui/signal_connector.h
r7779 r7855 1 1 /*! 2 2 * @file signal_connector.h 3 * @brief Definition of ...3 * @brief Definition of a SignalConnector class 4 4 */ 5 5 … … 11 11 namespace OrxGui 12 12 { 13 //! A class for ...13 //! A class for Conncting Signals to Objects, inside of the GUI 14 14 class SignalConnector 15 15 { 16 16 public: 17 SignalConnector(); 17 18 SignalConnector(BaseObject* object, const Executor* exec); 18 19 SignalConnector(const SignalConnector& signalConnector); 19 ~SignalConnector() { delete exec; }20 ~SignalConnector(); 20 21 21 22 SignalConnector& operator=(const SignalConnector& signalConnector); 22 23 24 void operator()(const std::string& parameters) const; 25 void execute(const std::string& parameters) const { (*this)(parameters); }; 26 27 bool isClean() const { return (this->object == NULL || this->exec == NULL); } 28 29 23 30 private: 24 const Executor* exec;25 BaseObject* object;31 BaseObject* object; //!< The object to call. 32 const Executor* exec; //!< The Executor, that will be called, on object. 26 33 }; 27 34 }
Note: See TracChangeset
for help on using the changeset viewer.