[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] | 23 | namespace 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 | { |
---|
| 65 | GLGuiWidget::receivedFocus(); |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | void GLGuiPushButton::removedFocus() |
---|
| 69 | { |
---|
| 70 | GLGuiWidget::removedFocus(); |
---|
| 71 | |
---|
| 72 | } |
---|
| 73 | |
---|
[8035] | 74 | void GLGuiPushButton::clicking(const Vector2D& pos) |
---|
[7919] | 75 | { |
---|
[8035] | 76 | GLGuiButton::clicking(pos); |
---|
[7919] | 77 | } |
---|
| 78 | |
---|
| 79 | |
---|
[8717] | 80 | void GLGuiPushButton::releasing(const Vector2D& pos, bool focused) |
---|
[7919] | 81 | { |
---|
[8717] | 82 | if (focused) |
---|
| 83 | GLGuiButton::releasing(pos, focused); |
---|
[7919] | 84 | } |
---|
| 85 | |
---|
| 86 | |
---|
| 87 | |
---|
[7779] | 88 | /** |
---|
[7919] | 89 | * @brief draws the GLGuiPushButton |
---|
[7779] | 90 | */ |
---|
| 91 | void GLGuiPushButton::draw() const |
---|
| 92 | { |
---|
[8035] | 93 | this->beginDraw(); |
---|
[7919] | 94 | GLGuiButton::draw(); |
---|
[6287] | 95 | |
---|
[7779] | 96 | this->endDraw(); |
---|
| 97 | } |
---|
[5395] | 98 | |
---|
[7779] | 99 | /** |
---|
| 100 | * updates the GLGuiPushButton |
---|
| 101 | */ |
---|
| 102 | void GLGuiPushButton::update() |
---|
| 103 | { |
---|
[5395] | 104 | |
---|
[7779] | 105 | } |
---|
[5395] | 106 | } |
---|