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 | 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(), borderTop()); |
---|
48 | this->setSize2D(this->labelText().getSizeX2D() + borderLeft() + borderRight(), this->labelText().getSizeY2D() + 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 | GLGuiWidget::receivedFocus(); |
---|
66 | } |
---|
67 | |
---|
68 | void GLGuiPushButton::removedFocus() |
---|
69 | { |
---|
70 | GLGuiWidget::removedFocus(); |
---|
71 | |
---|
72 | } |
---|
73 | |
---|
74 | void GLGuiPushButton::clicking(const Vector2D& pos) |
---|
75 | { |
---|
76 | GLGuiButton::clicking(pos); |
---|
77 | } |
---|
78 | |
---|
79 | |
---|
80 | void GLGuiPushButton::releasing(const Vector2D& pos, bool focused) |
---|
81 | { |
---|
82 | if (focused) |
---|
83 | GLGuiButton::releasing(pos, focused); |
---|
84 | } |
---|
85 | |
---|
86 | |
---|
87 | |
---|
88 | /** |
---|
89 | * @brief draws the GLGuiPushButton |
---|
90 | */ |
---|
91 | void GLGuiPushButton::draw() const |
---|
92 | { |
---|
93 | this->beginDraw(); |
---|
94 | GLGuiButton::draw(); |
---|
95 | |
---|
96 | this->endDraw(); |
---|
97 | } |
---|
98 | |
---|
99 | /** |
---|
100 | * updates the GLGuiPushButton |
---|
101 | */ |
---|
102 | void GLGuiPushButton::update() |
---|
103 | { |
---|
104 | |
---|
105 | } |
---|
106 | } |
---|