Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/gui/src/lib/gui/gl_gui/glgui_pushbutton.cc @ 7908

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

orxonox/trunk: the CheckButton works

File size: 2.2 KB
Line 
1/*
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.
10
11   ### File Specific:
12   main-programmer: Benjamin Grauer
13   co-programmer: ...
14*/
15
16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GUI
17
18#include "glgui_pushbutton.h"
19
20#include "text.h"
21#include "material.h"
22
23namespace OrxGui
24{
25
26  /**
27   * @brief standard constructor
28   */
29  GLGuiPushButton::GLGuiPushButton (const std::string& label)
30  : GLGuiButton(label)
31  {
32    this->init();
33
34    this->resize();
35  }
36
37
38  /**
39   * @brief standard deconstructor
40  */
41  GLGuiPushButton::~GLGuiPushButton()
42  {
43  }
44
45  void GLGuiPushButton::resize()
46  {
47    this->label.setRelCoor2D(5, 5);
48    this->setSize2D(this->label.getSizeX2D() + 10, this->label.getSizeY2D() + 10);
49  }
50
51  /**
52   * initializes the GUI-element
53   */
54  void GLGuiPushButton::init()
55  {
56    this->setClassID(CL_GLGUI_PUSHBUTTON, "GLGuiPushButton");
57  }
58
59  void GLGuiPushButton::receivedFocus()
60  {
61    printf("%s received focus\n", this->getLabel().c_str());
62    GLGuiWidget::receivedFocus();
63  }
64
65  void GLGuiPushButton::removedFocus()
66  {
67    printf("%s removed focus\n", this->getLabel().c_str());
68    GLGuiWidget::removedFocus();
69
70  }
71
72  void GLGuiPushButton::clicked()
73  {
74    printf("%s clicked\n", this->getLabel().c_str());
75    GLGuiWidget::clicked();
76  }
77
78
79  void GLGuiPushButton::released()
80  {
81    printf("%s released\n", this->getLabel().c_str());
82    GLGuiWidget::released();
83  }
84
85
86
87  /**
88   * @brief draws the GLGuiPushButton
89   */
90  void GLGuiPushButton::draw() const
91  {
92    this->startDraw();
93    GLGuiButton::draw();
94
95    this->frontMaterial().select();
96    glBegin(GL_QUADS);
97
98    glTexCoord2i(0,0); glVertex2d(1, 1);
99    glTexCoord2i(0,1); glVertex2d(1, this->getSizeY2D() - 1);
100    glTexCoord2i(1,1); glVertex2d(this->getSizeX2D() - 1, this->getSizeY2D() -1);
101    glTexCoord2i(1,0); glVertex2d(this->getSizeX2D() - 1, 1);
102
103    glEnd();
104    this->endDraw();
105    //   this->label->draw();
106    //  printf("test");
107  }
108
109  /**
110   * updates the GLGuiPushButton
111   */
112  void GLGuiPushButton::update()
113  {
114
115  }
116}
Note: See TracBrowser for help on using the repository browser.