Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 8349 was 8145, checked in by bensch, 19 years ago

trunk: merged the gui back
merged with command:
svn merge -r8114:HEAD https://svn.orxonox.net/orxonox/branches/gui .
→ no conflicts

File size: 2.4 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->labelText().setRelCoor2D(borderLeft() + 5, borderTop() + 5);
48    this->setSize2D(this->labelText().getSizeX2D() + 10 + borderLeft()+borderRight(), this->labelText().getSizeY2D() + 10 + borderTop() + borderBottom() );
49
50    GLGuiWidget::resize();
51    this->frontRect().setTopLeft(borderLeft(), borderTop());
52    this->frontRect().setSize(this->getSizeX2D() - (borderLeft() + borderRight()), this->getSizeY2D() - (borderTop() + borderBottom()));
53  }
54
55  /**
56   * initializes the GUI-element
57   */
58  void GLGuiPushButton::init()
59  {
60    this->setClassID(CL_GLGUI_PUSHBUTTON, "GLGuiPushButton");
61  }
62
63  void GLGuiPushButton::receivedFocus()
64  {
65    printf("%s received focus\n", this->label().c_str());
66    GLGuiWidget::receivedFocus();
67  }
68
69  void GLGuiPushButton::removedFocus()
70  {
71    printf("%s removed focus\n", this->label().c_str());
72    GLGuiWidget::removedFocus();
73
74  }
75
76  void GLGuiPushButton::clicking(const Vector2D& pos)
77  {
78    printf("%s clicked\n", this->label().c_str());
79    GLGuiButton::clicking(pos);
80  }
81
82
83  void GLGuiPushButton::releasing(const Vector2D& pos)
84  {
85    printf("%s released\n", this->label().c_str());
86    GLGuiButton::releasing(pos);
87  }
88
89
90
91  /**
92   * @brief draws the GLGuiPushButton
93   */
94  void GLGuiPushButton::draw() const
95  {
96    this->beginDraw();
97    GLGuiButton::draw();
98
99    this->frontMaterial().select();
100    this->drawRect(this->frontRect());
101    this->endDraw();
102    //   this->label->draw();
103    //  printf("test");
104  }
105
106  /**
107   * updates the GLGuiPushButton
108   */
109  void GLGuiPushButton::update()
110  {
111
112  }
113}
Note: See TracBrowser for help on using the repository browser.