Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/gui/gl/glgui_pushbutton.cc @ 8305

Last change on this file since 8305 was 8145, checked in by bensch, 18 years ago

trunk: merged the gui back
merged with command:
svn merge -r8114:HEAD https://svn.orxonox.net/orxonox/branches/gui .
→ no conflicts

File size: 2.4 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
[5364]18#include "glgui_pushbutton.h"
[1853]19
[5395]20#include "text.h"
[5420]21#include "material.h"
[5395]22
[7779]23namespace 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  {
[8116]47    this->labelText().setRelCoor2D(borderLeft() + 5, borderTop() + 5);
48    this->setSize2D(this->labelText().getSizeX2D() + 10 + borderLeft()+borderRight(), this->labelText().getSizeY2D() + 10 + borderTop() + borderBottom() );
[8035]49
50    GLGuiWidget::resize();
[8117]51    this->frontRect().setTopLeft(borderLeft(), borderTop());
[8116]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  {
[8115]65    printf("%s received focus\n", this->label().c_str());
[7919]66    GLGuiWidget::receivedFocus();
67  }
68
69  void GLGuiPushButton::removedFocus()
70  {
[8115]71    printf("%s removed focus\n", this->label().c_str());
[7919]72    GLGuiWidget::removedFocus();
73
74  }
75
[8035]76  void GLGuiPushButton::clicking(const Vector2D& pos)
[7919]77  {
[8115]78    printf("%s clicked\n", this->label().c_str());
[8035]79    GLGuiButton::clicking(pos);
[7919]80  }
81
82
[8035]83  void GLGuiPushButton::releasing(const Vector2D& pos)
[7919]84  {
[8115]85    printf("%s released\n", this->label().c_str());
[8035]86    GLGuiButton::releasing(pos);
[7919]87  }
88
89
90
[7779]91  /**
[7919]92   * @brief draws the GLGuiPushButton
[7779]93   */
94  void GLGuiPushButton::draw() const
95  {
[8035]96    this->beginDraw();
[7919]97    GLGuiButton::draw();
[6287]98
[7919]99    this->frontMaterial().select();
[8035]100    this->drawRect(this->frontRect());
[7779]101    this->endDraw();
102    //   this->label->draw();
103    //  printf("test");
104  }
[5395]105
[7779]106  /**
107   * updates the GLGuiPushButton
108   */
109  void GLGuiPushButton::update()
110  {
[5395]111
[7779]112  }
[5395]113}
Note: See TracBrowser for help on using the repository browser.