Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5392 in orxonox.OLD for trunk/src/lib/gui/gl_gui


Ignore:
Timestamp:
Oct 16, 2005, 2:02:51 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: definition of Connect-signals for GLWidgets

Location:
trunk/src/lib/gui/gl_gui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/gui/gl_gui/glgui_image.h

    r5366 r5392  
    1111
    1212// FORWARD DECLARATION
     13struct SDL_Surface;
    1314
    1415//! This is Image part of the openglGUI class
     
    2324
    2425  void init();
     26  void loadImageFromFile(const char* fileName);
     27  void loadImageFromSDLSurface(SDL_Surface* surface);
     28  void loadImageFromDisplayList(GLuint displayList);
    2529
    2630  virtual void draw();
  • trunk/src/lib/gui/gl_gui/glgui_widget.cc

    r5391 r5392  
    1717
    1818#include "glgui_widget.h"
     19
     20#include "debug.h"
    1921
    2022using namespace std;
     
    3941
    4042
    41 bool GLGuiWidget::focusOverWidget(float x, float y)
    42 {
    43   if (this->getAbsCoor2D().x < x && this->getAbsCoor2D().x+ this->getSizeX2D() > x &&
    44       this->getAbsCoor2D().y < y && this->getAbsCoor2D().y+ this->getSizeX2D() > y)
    45     return true;
    46   else
    47     return false;
    48 }
    49 
    50 
    5143/**
    5244 * initializes the GUI-element
     
    6355  this->frontMat = NULL;
    6456  this->frontModel = 0;
     57
     58  for (unsigned int i = 0; i < GLGuiSignalCount; i++)
     59    this->widgetSignals[i] = NULL;
    6560}
     61
     62
     63bool GLGuiWidget::focusOverWidget(float x, float y)
     64{
     65  if (this->getAbsCoor2D().x < x && this->getAbsCoor2D().x+ this->getSizeX2D() > x &&
     66      this->getAbsCoor2D().y < y && this->getAbsCoor2D().y+ this->getSizeX2D() > y)
     67    return true;
     68  else
     69    return false;
     70}
     71
     72/**
     73 * @brief connects a Signal to the Gui-Elements' Event.
     74 * @param sinalType the Type of Signal to set. @see GLGuiSignalType
     75 * @param signal the name of the Signal
     76 */
     77void GLGuiWidget::connectSignal(GLGuiSignalType signalType, Signal* signal)
     78{
     79  if (signal == NULL || signalType >= GLGuiSignalCount)
     80    return;
     81
     82  if (this->widgetSignals[signalType] != NULL)
     83    PRINTF(2)("Already connected a Signal to %s (%s) type %s... overwriting\n");
     84
     85  this->widgetSignals[signalType] = signal;
     86}
     87
     88/**
     89 * @brief removes a Signal from a Gui-ELements' Event
     90 * @param signalType the type of Signal to remove.
     91 */
     92void GLGuiWidget::disconnectSignal(GLGuiSignalType signalType)
     93{
     94  if (signalType > GLGuiSignalCount)
     95    return;
     96
     97  this->widgetSignals[signalType] = NULL;
     98}
     99
  • trunk/src/lib/gui/gl_gui/glgui_widget.h

    r5391 r5392  
    4141
    4242    void init();
     43    /** @returns a new char-array containing a string with the options. Delete with delete[]; */
     44    virtual char* save() {};
     45    /** loads options of the Widget. @param loadString a string containing the Options */
     46    virtual void load(const char* loadString) {};
    4347
    4448    void show();
     
    4650
    4751    void connectSignal(GLGuiSignalType signalType, Signal* signal);
    48     void disconnectSignal(GLGuiSignalType);
     52    void disconnectSignal(GLGuiSignalType signalType);
    4953    bool focusOverWidget(float x, float y);
    5054
Note: See TracChangeset for help on using the changeset viewer.