Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8479 in orxonox.OLD


Ignore:
Timestamp:
Jun 15, 2006, 4:55:00 PM (18 years ago)
Author:
bensch
Message:

gui: enter-event handled in inputLine

Location:
branches/gui/src
Files:
5 edited

Legend:

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

    r8448 r8479  
    159159}
    160160
     161
     162/**
     163 * @brief clears the Text Line (empies it).
     164 */
     165void Text::clear()
     166{
     167  text.clear();
     168  this->setupTextWidth();
     169}
    161170
    162171/**
  • branches/gui/src/lib/graphics/text_engine/text.h

    r8448 r8479  
    4040    const std::string& operator<<(const std::string& appendText);
    4141    void removeCharacters(unsigned int chars);
     42    void clear();
    4243
    4344    /// SETUP
  • branches/gui/src/lib/gui/gl/glgui_inputline.cc

    r8448 r8479  
    4848    this->setFocusable(true);
    4949
     50    this->_clearOnEnter = false;
    5051    this->_text.setParent2D(this);
    5152    this->_text.setRelCoor2D(4,4);
     
    100101  }
    101102
     103  void GLGuiInputLine::clear()
     104  {
     105    this->_text.clear();
     106    this->changedText();
     107  }
     108
    102109  /**
    103110   * @brief If the Text has been changed this function is called.
     
    124131  }
    125132
     133  /**
     134   * @brief handles the EnterPush-Event.
     135   *
     136   * Emmits th EnterPushed Signal with the current Line,
     137   * and if _clearOnEnter is pushed clears the Line.
     138   */
     139  void GLGuiInputLine::pushEnter()
     140  {
     141    emit(this->enterPushed(this->_text.getText()));
     142    if (this->_clearOnEnter)
     143      this->clear();
     144  }
     145
    126146
    127147  /**
     
    140160        this->pressedKeyName = SDLK_BACKSPACE;
    141161        this->removeCharacters(1);
     162        return true;
     163      }
     164      else if(event.type == SDLK_RETURN || event.type == SDLK_KP_ENTER)
     165      {
     166        this->pushEnter();
    142167        return true;
    143168      }
  • branches/gui/src/lib/gui/gl/glgui_inputline.h

    r8448 r8479  
    3838    void appendCharacter(char character);
    3939    void removeCharacters(unsigned int chars);
     40    void clear();
     41
     42    void clearOnEnter(bool clear = true) { this->_clearOnEnter = clear; };
    4043
    4144    virtual void removedFocus();
     
    4750
    4851    DeclareSignal1(textChanged, const std::string&);
     52    DeclareSignal1(enterPushed, const std::string&);
    4953
    5054  protected:
     
    5761  private:
    5862    void init();
     63    void pushEnter();
    5964    void changedText();
     65
    6066
    6167  private:
    6268    Text                    _text;            //!< The Text to display inside of the InputLine.
     69    bool                    _clearOnEnter;    //!< Clear on Enter
    6370
    6471    Uint16                  pressedKey;       //!< the pressed key that will be repeated.
  • branches/gui/src/story_entities/simple_game_menu.cc

    r8475 r8479  
    100100    box->pack(rdnpb);
    101101
    102     OrxGui::GLGuiPushButton* fullscreen = new OrxGui::GLGuiPushButton("Fullscreen");
    103     fullscreen->connect(SIGNAL(fullscreen, released), GraphicsEngine::getInstance(), SLOT(GraphicsEngine, toggleFullscreen));
     102    OrxGui::GLGuiCheckButton* fullscreen = new OrxGui::GLGuiCheckButton("Fullscreen");
     103    fullscreen->connect(SIGNAL(fullscreen, toggled), GraphicsEngine::getInstance(), SLOT(GraphicsEngine, setFullscreen));
    104104
    105105    box->pack(fullscreen);
Note: See TracChangeset for help on using the changeset viewer.