Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7893 in orxonox.OLD


Ignore:
Timestamp:
May 27, 2006, 4:07:35 AM (18 years ago)
Author:
bensch
Message:

gui: InputLine appends

Location:
branches/gui/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/gui/src/lib/graphics/text_engine/text.cc

    r7892 r7893  
    126126  this->setupTextWidth();
    127127}
     128
     129/**
     130 * @brief appends one Character to the String.
     131 */
     132void Text::appendCharacter(char character)
     133{
     134  this->text += character;
     135  this->setupTextWidth();
     136}
     137
    128138
    129139/**
  • branches/gui/src/lib/graphics/text_engine/text.h

    r7892 r7893  
    3737    void setText(const std::string& text);
    3838    void append(const std::string& appendText);
     39    void appendCharacter(char character);
    3940    const std::string& operator<<(const std::string& appendText);
    4041    void removeCharacters(unsigned int chars);
  • branches/gui/src/lib/gui/gl_gui/glgui_handler.cc

    r7885 r7893  
    104104    }
    105105
     106    if (GLGuiWidget::focused())
     107    {
     108      GLGuiWidget::focused()->processEvent(event);
     109    }
     110
    106111  }
    107112
  • branches/gui/src/lib/gui/gl_gui/glgui_inputline.cc

    r7892 r7893  
    4343  {
    4444    this->setClassID(CL_GLGUI_INPUTLINE, "GLGuiInputLine");
     45
     46    this->setFocusable(true);
     47    this->setClickable(true);
     48
    4549    this->text.setParent2D(this);
    4650    this->text.setFont("fonts/final_frontier.ttf", 20);
     
    4852    this->setText("SUPERTEST");
    4953    this->setSize2D( this->text.getSize2D());
    50 
    5154  }
    5255
     
    5962  {
    6063    this->text.append(appendText);
     64  }
    6165
     66  void GLGuiInputLine::appendCharacter(char character)
     67  {
     68    this->text.appendCharacter(character);
    6269  }
     70
    6371
    6472  void GLGuiInputLine::removeCharacters(unsigned int chars)
     
    6775  }
    6876
     77  bool GLGuiInputLine::processEvent(const Event& event)
     78  {
     79    if (likely(event.type < 127))
     80    {
     81      this->appendCharacter(event.x);
     82      return true;
     83    }
     84
     85    return false;
     86  }
    6987
    7088
  • branches/gui/src/lib/gui/gl_gui/glgui_inputline.h

    r7892 r7893  
    1010#include "glgui_widget.h"
    1111#include "text.h"
    12 
     12#include "event.h"
    1313
    1414// FORWARD DECLARATION
     
    3131    void setText(const std::string& text);
    3232    void append(const std::string& appendText);
     33    void appendCharacter(char character);
    3334    void removeCharacters(unsigned int chars);
    3435    const std::string& getName() const { return this->text.getText(); };
    3536
    3637    virtual void draw() const;
     38
     39    virtual bool processEvent(const Event& event);
    3740
    3841  private:
  • branches/gui/src/lib/gui/gl_gui/glgui_widget.cc

    r7887 r7893  
    4141  GLGuiWidget::~GLGuiWidget()
    4242  {
     43    if (this == GLGuiWidget::_focused)
     44      GLGuiWidget::_focused = NULL;
    4345  }
    4446
  • branches/gui/src/lib/gui/gl_gui/glgui_widget.h

    r7887 r7893  
    9393    const Material& frontMaterial() const { return this->frontMat; };
    9494
    95 
     95    /** @param the Event to process. @returns true if the Event has been consumed*/
     96    virtual bool processEvent(const Event& event) { };
    9697
    9798
  • branches/gui/src/story_entities/simple_game_menu.cc

    r7892 r7893  
    8181  OrxGui::GLGuiInputLine* input = new OrxGui::GLGuiInputLine();
    8282  input->show();
     83  input->setAbsCoor2D(200, 230);
    8384
    8485  OrxGui::GLGuiHandler::getInstance()->activateCursor();
Note: See TracChangeset for help on using the changeset viewer.