FIFE  6e1afdbeda11afe9ac53e6023a4be96ef88f1dc6
textevent.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2017 by the FIFE team *
3  * http://www.fifengine.net *
4  * This file is part of FIFE. *
5  * *
6  * FIFE is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU Lesser General Public *
8  * License as published by the Free Software Foundation; either *
9  * version 2.1 of the License, or (at your option) any later version. *
10  * *
11  * This library is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14  * Lesser General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU Lesser General Public *
17  * License along with this library; if not, write to the *
18  * Free Software Foundation, Inc., *
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
20  ***************************************************************************/
21 
22 #ifndef FIFE_EVENTCHANNEL_TEXTEVENT_H
23 #define FIFE_EVENTCHANNEL_TEXTEVENT_H
24 
25 // Standard C++ library includes
26 //
27 
28 // 3rd party library includes
29 //
30 
31 // FIFE includes
32 // These includes are split up in two parts, separated by one empty line
33 // First block: files included from the FIFE root src directory
34 // Second block: files included from the same folder
35 //
38 
39 #include "text.h"
40 
41 namespace FIFE {
42 
45  class TextEvent: public InputEvent {
46  public:
48  UNKNOWN = 0,
49  INPUT = 1,
50  EDIT = 2
51  };
52 
56  InputEvent(),
58  m_text(Text()) {}
59 
62  virtual ~TextEvent() {}
63 
64  TextEventType getType() const { return m_eventType; }
65  void setType(TextEventType type) { m_eventType = type; }
66 
67  const Text& getText() const { return m_text; }
68  void setText(const Text& text) { m_text = text; }
69 
70  virtual void consume() { InputEvent::consume(); }
71  virtual bool isConsumed() const { return InputEvent::isConsumed(); }
73  virtual bool isConsumedByWidgets() const { return InputEvent::isConsumedByWidgets(); }
74  virtual IEventSource* getSource() const { return InputEvent::getSource(); }
75  virtual void setSource(IEventSource* source) { InputEvent::setSource(source); }
76  virtual int32_t getTimeStamp() const { return InputEvent::getTimeStamp(); }
77  virtual void setTimeStamp(int32_t timestamp ) { InputEvent::setTimeStamp(timestamp); }
78 
79  virtual const std::string& getName() const {
80  const static std::string eventName("TextEvent");
81  return eventName;
82  }
83  virtual std::string getDebugString() const { return InputEvent::getDebugString(); }
84 
85  private:
88  };
89 
90 } //FIFE
91 
92 #endif
virtual void consume()
Marks events as consumed.
Definition: textevent.h:70
TextEvent()
Constructor.
Definition: textevent.h:55
virtual IEventSource * getSource() const
Gets the source of the event.
Definition: inputevent.h:108
const Text & getText() const
Definition: textevent.h:67
Represents a text.
Definition: text.h:40
virtual void setSource(IEventSource *source)
Sets the source of the event.
Definition: textevent.h:75
Base class for input events (like mouse and keyboard)
Definition: inputevent.h:42
virtual bool isConsumed() const
Checks whether event is consumed.
Definition: textevent.h:71
TextEventType m_eventType
Definition: textevent.h:86
Class for text events.
Definition: textevent.h:45
virtual int32_t getTimeStamp() const
Gets the timestamp of the event.
Definition: inputevent.h:116
virtual std::string getDebugString() const
Gets the debugstring of the event.
Definition: inputevent.h:131
virtual bool isConsumedByWidgets() const
Checks whether event is consumed by widget library.
Definition: inputevent.h:96
virtual void setTimeStamp(int32_t timestamp)
Sets the timestamp of the event.
Definition: inputevent.h:120
virtual ~TextEvent()
Destructor.
Definition: textevent.h:62
TextEventType getType() const
Definition: textevent.h:64
virtual void consumedByWidgets()
Marks events as consumed by widget library.
Definition: inputevent.h:92
void setText(const Text &text)
Definition: textevent.h:68
virtual IEventSource * getSource() const
Gets the source of the event.
Definition: textevent.h:74
virtual void consumedByWidgets()
Marks events as consumed by widget library.
Definition: textevent.h:72
virtual bool isConsumed() const
Checks whether event is consumed.
Definition: inputevent.h:104
void setType(TextEventType type)
Definition: textevent.h:65
virtual std::string getDebugString() const
Gets the debugstring of the event.
Definition: textevent.h:83
virtual const std::string & getName() const
Gets the name of the event.
Definition: textevent.h:79
virtual int32_t getTimeStamp() const
Gets the timestamp of the event.
Definition: textevent.h:76
virtual void setSource(IEventSource *source)
Sets the source of the event.
Definition: inputevent.h:112
virtual bool isConsumedByWidgets() const
Checks whether event is consumed by widget library.
Definition: textevent.h:73
virtual void consume()
Marks events as consumed.
Definition: inputevent.h:100
Representation of event source (a thing sending events)
Definition: ieventsource.h:42
virtual void setTimeStamp(int32_t timestamp)
Sets the timestamp of the event.
Definition: textevent.h:77