source:
orxonox.OLD/trunk/src/lib/gui/gl_gui/glgui_button.cc
@
6774
Last change on this file since 6774 was 6287, checked in by bensch, 19 years ago | |
---|---|
File size: 1.3 KB |
Rev | Line | |
---|---|---|
[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 | |
[5363] | 18 | #include "glgui_button.h" |
[1853] | 19 | |
[5395] | 20 | #include "text.h" |
21 | ||
[1856] | 22 | using namespace std; |
[1853] | 23 | |
[3245] | 24 | /** |
[4838] | 25 | * standard constructor |
[3245] | 26 | */ |
[5363] | 27 | GLGuiButton::GLGuiButton () |
[3365] | 28 | { |
[5360] | 29 | this->init(); |
[4320] | 30 | |
[3365] | 31 | } |
[1853] | 32 | |
33 | ||
[3245] | 34 | /** |
[4838] | 35 | * standard deconstructor |
[3245] | 36 | */ |
[5363] | 37 | GLGuiButton::~GLGuiButton() |
[3543] | 38 | { |
[5395] | 39 | /* this does not have to be done, since the Label is a child, |
40 | * and will be deleted by Element2D's deletion Process | |
41 | * delete this->label; | |
42 | */ | |
[3543] | 43 | } |
[5360] | 44 | |
45 | /** | |
46 | * initializes the GUI-element | |
47 | */ | |
[5363] | 48 | void GLGuiButton::init() |
[5360] | 49 | { |
[5363] | 50 | this->setClassID(CL_GLGUI_BUTTON, "GLGuiButton"); |
[5360] | 51 | |
[5395] | 52 | this->label = new Text(); |
53 | this->label->setParent2D(this); | |
[5360] | 54 | } |
55 | ||
[5395] | 56 | void GLGuiButton::setLabel(const char* label) |
57 | { | |
58 | this->label->setText(label); | |
[5421] | 59 | this->label->setRelCoor2D(5, 5); |
60 | this->setSize2D(this->label->getSizeX2D()+10, this->label->getSizeY2D()+10); | |
[5395] | 61 | } |
62 | ||
63 | ||
[5360] | 64 | /** |
[5363] | 65 | * draws the GLGuiButton |
[5360] | 66 | */ |
[5427] | 67 | void GLGuiButton::draw() const |
[5360] | 68 | { |
[6287] | 69 | GLGuiWidget::draw(); |
[5360] | 70 | } |
Note: See TracBrowser
for help on using the repository browser.