Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/gui/gl/glgui_button.cc @ 8458

Last change on this file since 8458 was 8448, checked in by bensch, 18 years ago

merged gui back to the trunk
merged with command
merge -r8377:HEAD https://svn.orxonox.net/orxonox/branches/gui .

File size: 2.0 KB
RevLine 
[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
[1853]22
[7779]23namespace OrxGui
[3365]24{
[7779]25  /**
26   * standard constructor
27  */
[7919]28  GLGuiButton::GLGuiButton (const std::string& label)
[7779]29  {
30    this->init();
[4320]31
[8115]32    this->_label.setText( label );
[7779]33  }
[1853]34
35
[7779]36  /**
37   * standard deconstructor
[5395]38  */
[7779]39  GLGuiButton::~GLGuiButton()
40  {
41    /* this does not have to be done, since the Label is a child,
42     * and will be deleted by Element2D's deletion Process
43     * delete this->label;
44    */
45  }
[5360]46
[7779]47  /**
[7919]48   * @brief initializes the GUI-element
[7779]49   */
50  void GLGuiButton::init()
51  {
52    this->setClassID(CL_GLGUI_BUTTON, "GLGuiButton");
[7919]53    this->setFocusable(true);
54    this->setClickable(true);
[5360]55
[8115]56    this->_label.setFont("fonts/final_frontier.ttf", 20);
[8448]57    this->_label.setColor(this->frontColor());
[7919]58
[8115]59    this->_label.setParent2D(this);
60    this->_label.setVisibility(false);
[7779]61  }
[5360]62
[7919]63
[7779]64  void GLGuiButton::setLabel(const std::string& label)
65  {
[8115]66    this->_label.setText(label);
[7919]67    this->resize();
[7779]68  }
[5395]69
[8035]70
[8448]71  void GLGuiButton::updateFrontColor()
72  {
73    this->_label.setColor(this->frontColor());
74  }
[8035]75
76  void GLGuiButton::clicking(const Vector2D& pos)
77  {
[8448]78    GLGuiWidget::clicking(pos);
[8035]79    emit(clicked());
80  }
81  void GLGuiButton::releasing(const Vector2D& pos)
82  {
[8448]83    GLGuiWidget::releasing(pos);
[8035]84    emit(released());
85  }
86
[8115]87  void GLGuiButton::hiding()
88  {
89    this->_label.setVisibility(false);
90  }
91
92  void GLGuiButton::showing()
93  {
94    this->_label.setVisibility(true);
95  }
96
97
[7779]98  /**
[7919]99   * @brief draws the GLGuiButton
[7779]100   */
101  void GLGuiButton::draw() const
102  {
103    GLGuiWidget::draw();
104  }
[5360]105}
Note: See TracBrowser for help on using the repository browser.