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 | |
---|
23 | namespace 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 | |
---|
35 | |
---|
36 | /** |
---|
37 | * @brief standard deconstructor |
---|
38 | */ |
---|
39 | GLGuiPushButton::~GLGuiPushButton() |
---|
40 | { |
---|
41 | } |
---|
42 | |
---|
43 | /** |
---|
44 | * initializes the GUI-element |
---|
45 | */ |
---|
46 | void GLGuiPushButton::init() |
---|
47 | { |
---|
48 | this->setClassID(CL_GLGUI_PUSHBUTTON, "GLGuiPushButton"); |
---|
49 | } |
---|
50 | |
---|
51 | void GLGuiPushButton::receivedFocus() |
---|
52 | { |
---|
53 | printf("%s received focus\n", this->getLabel().c_str()); |
---|
54 | GLGuiWidget::receivedFocus(); |
---|
55 | } |
---|
56 | |
---|
57 | void GLGuiPushButton::removedFocus() |
---|
58 | { |
---|
59 | printf("%s removed focus\n", this->getLabel().c_str()); |
---|
60 | GLGuiWidget::removedFocus(); |
---|
61 | |
---|
62 | } |
---|
63 | |
---|
64 | void GLGuiPushButton::clicked() |
---|
65 | { |
---|
66 | printf("%s clicked\n", this->getLabel().c_str()); |
---|
67 | GLGuiWidget::clicked(); |
---|
68 | } |
---|
69 | |
---|
70 | |
---|
71 | void GLGuiPushButton::released() |
---|
72 | { |
---|
73 | printf("%s released\n", this->getLabel().c_str()); |
---|
74 | GLGuiWidget::released(); |
---|
75 | } |
---|
76 | |
---|
77 | |
---|
78 | |
---|
79 | /** |
---|
80 | * draws the GLGuiPushButton |
---|
81 | */ |
---|
82 | void GLGuiPushButton::draw() const |
---|
83 | { |
---|
84 | this->startDraw(); |
---|
85 | GLGuiButton::draw(); |
---|
86 | |
---|
87 | this->frontMaterial().select(); |
---|
88 | glBegin(GL_QUADS); |
---|
89 | |
---|
90 | glTexCoord2i(0,0); glVertex2d(1, 1); |
---|
91 | glTexCoord2i(0,1); glVertex2d(1, this->getSizeY2D() - 1); |
---|
92 | glTexCoord2i(1,1); glVertex2d(this->getSizeX2D() - 1, this->getSizeY2D() -1); |
---|
93 | glTexCoord2i(1,0); glVertex2d(this->getSizeX2D() - 1, 1); |
---|
94 | |
---|
95 | glEnd(); |
---|
96 | this->endDraw(); |
---|
97 | // this->label->draw(); |
---|
98 | // printf("test"); |
---|
99 | } |
---|
100 | |
---|
101 | /** |
---|
102 | * updates the GLGuiPushButton |
---|
103 | */ |
---|
104 | void GLGuiPushButton::update() |
---|
105 | { |
---|
106 | |
---|
107 | } |
---|
108 | } |
---|