Mercurial > fife-parpg
comparison engine/core/gui/guimanager.h @ 157:bb9902910067
input_rework merged!
Bad features:
* Broken DND for zero-projekt.
* Design short-comings.
author | phoku@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Tue, 14 Oct 2008 07:41:48 +0000 |
parents | 90005975cdbb |
children | 51cc05d862f2 |
comparison
equal
deleted
inserted
replaced
156:376b8afc9a18 | 157:bb9902910067 |
---|---|
32 // These includes are split up in two parts, separated by one empty line | 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 | 33 // First block: files included from the FIFE root src directory |
34 // Second block: files included from the same folder | 34 // Second block: files included from the same folder |
35 #include "util/base/singleton.h" | 35 #include "util/base/singleton.h" |
36 #include "eventchannel/sdl/ec_isdleventlistener.h" | 36 #include "eventchannel/sdl/ec_isdleventlistener.h" |
37 #include "eventchannel/mouse/ec_imouselistener.h" | 37 // #include "eventchannel/mouse/ec_imouselistener.h" |
38 #include "eventchannel/key/ec_ikeylistener.h" | 38 // #include "eventchannel/key/ec_ikeylistener.h" |
39 #include "eventchannel/widget/ec_iwidgetlistener.h" | |
40 | 39 |
41 namespace gcn { | 40 namespace gcn { |
42 | 41 |
43 class Gui; | 42 class Gui; |
44 class Container; | 43 class Container; |
63 * | 62 * |
64 * This class controls the GUI system in FIFE. | 63 * This class controls the GUI system in FIFE. |
65 */ | 64 */ |
66 class GUIManager : | 65 class GUIManager : |
67 public DynamicSingleton<GUIManager>, | 66 public DynamicSingleton<GUIManager>, |
68 public ISdlEventListener, | 67 public ISdlEventListener |
69 public IKeyListener, | |
70 public IMouseListener, | |
71 public gcn::ActionListener | |
72 { | 68 { |
73 public: | 69 public: |
74 /** Constructor. | 70 /** Constructor. |
75 */ | 71 */ |
76 GUIManager(IWidgetListener* widgetListener, ImagePool& pool); | 72 GUIManager(ImagePool& pool); |
77 /** Destructor. | 73 /** Destructor. |
78 */ | 74 */ |
79 virtual ~GUIManager(); | 75 virtual ~GUIManager(); |
80 | 76 |
81 /** Gets the member pointer to the Guichan GUI. | 77 /** Gets the member pointer to the Guichan GUI. |
138 | 134 |
139 /** Releases given font. | 135 /** Releases given font. |
140 */ | 136 */ |
141 void releaseFont(GuiFont* font); | 137 void releaseFont(GuiFont* font); |
142 | 138 |
143 /** Callback from guichan | 139 bool onSdlEvent(SDL_Event& evt); |
144 */ | |
145 void action(const gcn::ActionEvent & event); | |
146 | 140 |
147 void onSdlEvent(SDL_Event& evt); | 141 KeyEvent translateKeyEvent(const gcn::KeyEvent& evt); |
148 void keyPressed(KeyEvent& evt) { evaluateKeyEventConsumption(evt); } | 142 MouseEvent translateMouseEvent(const gcn::MouseEvent& evt); |
149 void keyReleased(KeyEvent& evt) { evaluateKeyEventConsumption(evt); } | |
150 void mouseEntered(MouseEvent& evt) { evaluateMouseEventConsumption(evt); } | |
151 void mouseExited(MouseEvent& evt) { evaluateMouseEventConsumption(evt); } | |
152 void mousePressed(MouseEvent& evt); | |
153 void mouseReleased(MouseEvent& evt) { evaluateMouseEventConsumption(evt); } | |
154 void mouseClicked(MouseEvent& evt) { evaluateMouseEventConsumption(evt); } | |
155 void mouseWheelMovedUp(MouseEvent& evt) { evaluateMouseEventConsumption(evt); } | |
156 void mouseWheelMovedDown(MouseEvent& evt) { evaluateMouseEventConsumption(evt); } | |
157 void mouseMoved(MouseEvent& evt) { evaluateMouseEventConsumption(evt); } | |
158 void mouseDragged(MouseEvent& evt); | |
159 | 143 |
160 private: | 144 private: |
161 void evaluateKeyEventConsumption(KeyEvent& evt); | |
162 void evaluateMouseEventConsumption(MouseEvent& evt); | |
163 | |
164 // The Guichan GUI. | 145 // The Guichan GUI. |
165 gcn::Gui* m_gcn_gui; | 146 gcn::Gui* m_gcn_gui; |
166 // Focus handler for input management | 147 // Focus handler for input management |
167 gcn::FocusHandler* m_focushandler; | 148 gcn::FocusHandler* m_focushandler; |
168 // The top container of the GUI. | 149 // The top container of the GUI. |
176 // The fonts used | 157 // The fonts used |
177 std::vector<GuiFont*> m_fonts; | 158 std::vector<GuiFont*> m_fonts; |
178 // Added widgets | 159 // Added widgets |
179 std::set<gcn::Widget*> m_widgets; | 160 std::set<gcn::Widget*> m_widgets; |
180 | 161 |
181 // instance whom to deliver widget events coming from guichan | 162 // Used to accept mouse motion events that leave widget space |
182 IWidgetListener* m_widgetlistener; | 163 bool m_had_mouse; |
164 | |
183 // pool used for images | 165 // pool used for images |
184 ImagePool& m_pool; | 166 ImagePool& m_pool; |
185 | 167 |
186 // default font settings | 168 // default font settings |
187 std::string m_fontpath; | 169 std::string m_fontpath; |