Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/gui/src/lib/gui/gl/glgui_pushbutton.cc @ 8669

Last change on this file since 8669 was 8669, checked in by bensch, 18 years ago

orxonox/gui: slider behaves as expected

File size: 2.3 KB
RevLine 
[4744]1/*
[1853]2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
[1855]10
11   ### File Specific:
[5360]12   main-programmer: Benjamin Grauer
[1855]13   co-programmer: ...
[1853]14*/
15
[5360]16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GUI
[1853]17
[5364]18#include "glgui_pushbutton.h"
[1853]19
[5395]20#include "text.h"
[5420]21#include "material.h"
[5395]22
[7779]23namespace OrxGui
[3365]24{
[1853]25
[7779]26  /**
[7919]27   * @brief standard constructor
28   */
29  GLGuiPushButton::GLGuiPushButton (const std::string& label)
30  : GLGuiButton(label)
[7779]31  {
32    this->init();
[7919]33
34    this->resize();
[7779]35  }
[1853]36
[5360]37
[7779]38  /**
[7919]39   * @brief standard deconstructor
[7779]40  */
41  GLGuiPushButton::~GLGuiPushButton()
42  {
43  }
[5360]44
[7919]45  void GLGuiPushButton::resize()
46  {
[8448]47    this->labelText().setRelCoor2D(borderLeft(), borderTop());
48    this->setSize2D(this->labelText().getSizeX2D() + borderLeft() + borderRight(), this->labelText().getSizeY2D() + borderTop() + borderBottom() );
[8035]49
50    GLGuiWidget::resize();
[8448]51/*    this->frontRect().setTopLeft(borderLeft(), borderTop());
52    this->frontRect().setSize(this->getSizeX2D() - (borderLeft() + borderRight()), this->getSizeY2D() - (borderTop() + borderBottom()));*/
[7919]53  }
54
[7779]55  /**
56   * initializes the GUI-element
57   */
58  void GLGuiPushButton::init()
59  {
60    this->setClassID(CL_GLGUI_PUSHBUTTON, "GLGuiPushButton");
61  }
[5360]62
[7919]63  void GLGuiPushButton::receivedFocus()
64  {
[8115]65    printf("%s received focus\n", this->label().c_str());
[7919]66    GLGuiWidget::receivedFocus();
67  }
68
69  void GLGuiPushButton::removedFocus()
70  {
[8115]71    printf("%s removed focus\n", this->label().c_str());
[7919]72    GLGuiWidget::removedFocus();
73
74  }
75
[8035]76  void GLGuiPushButton::clicking(const Vector2D& pos)
[7919]77  {
[8115]78    printf("%s clicked\n", this->label().c_str());
[8035]79    GLGuiButton::clicking(pos);
[7919]80  }
81
82
[8667]83  void GLGuiPushButton::releasing(const Vector2D& pos, bool focused)
[7919]84  {
[8115]85    printf("%s released\n", this->label().c_str());
[8669]86    if (focused)
87      GLGuiButton::releasing(pos, focused);
[7919]88  }
89
90
91
[7779]92  /**
[7919]93   * @brief draws the GLGuiPushButton
[7779]94   */
95  void GLGuiPushButton::draw() const
96  {
[8035]97    this->beginDraw();
[7919]98    GLGuiButton::draw();
[6287]99
[7779]100    this->endDraw();
101  }
[5395]102
[7779]103  /**
104   * updates the GLGuiPushButton
105   */
106  void GLGuiPushButton::update()
107  {
[5395]108
[7779]109  }
[5395]110}
Note: See TracBrowser for help on using the repository browser.