Mercurial > fife-parpg
diff 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 |
line wrap: on
line diff
--- a/engine/core/gui/guimanager.h Sun Oct 12 20:30:09 2008 +0000 +++ b/engine/core/gui/guimanager.h Tue Oct 14 07:41:48 2008 +0000 @@ -34,9 +34,8 @@ // Second block: files included from the same folder #include "util/base/singleton.h" #include "eventchannel/sdl/ec_isdleventlistener.h" -#include "eventchannel/mouse/ec_imouselistener.h" -#include "eventchannel/key/ec_ikeylistener.h" -#include "eventchannel/widget/ec_iwidgetlistener.h" +// #include "eventchannel/mouse/ec_imouselistener.h" +// #include "eventchannel/key/ec_ikeylistener.h" namespace gcn { @@ -65,15 +64,12 @@ */ class GUIManager : public DynamicSingleton<GUIManager>, - public ISdlEventListener, - public IKeyListener, - public IMouseListener, - public gcn::ActionListener + public ISdlEventListener { public: /** Constructor. */ - GUIManager(IWidgetListener* widgetListener, ImagePool& pool); + GUIManager(ImagePool& pool); /** Destructor. */ virtual ~GUIManager(); @@ -140,27 +136,12 @@ */ void releaseFont(GuiFont* font); - /** Callback from guichan - */ - void action(const gcn::ActionEvent & event); + bool onSdlEvent(SDL_Event& evt); - void onSdlEvent(SDL_Event& evt); - void keyPressed(KeyEvent& evt) { evaluateKeyEventConsumption(evt); } - void keyReleased(KeyEvent& evt) { evaluateKeyEventConsumption(evt); } - void mouseEntered(MouseEvent& evt) { evaluateMouseEventConsumption(evt); } - void mouseExited(MouseEvent& evt) { evaluateMouseEventConsumption(evt); } - void mousePressed(MouseEvent& evt); - void mouseReleased(MouseEvent& evt) { evaluateMouseEventConsumption(evt); } - void mouseClicked(MouseEvent& evt) { evaluateMouseEventConsumption(evt); } - void mouseWheelMovedUp(MouseEvent& evt) { evaluateMouseEventConsumption(evt); } - void mouseWheelMovedDown(MouseEvent& evt) { evaluateMouseEventConsumption(evt); } - void mouseMoved(MouseEvent& evt) { evaluateMouseEventConsumption(evt); } - void mouseDragged(MouseEvent& evt); + KeyEvent translateKeyEvent(const gcn::KeyEvent& evt); + MouseEvent translateMouseEvent(const gcn::MouseEvent& evt); private: - void evaluateKeyEventConsumption(KeyEvent& evt); - void evaluateMouseEventConsumption(MouseEvent& evt); - // The Guichan GUI. gcn::Gui* m_gcn_gui; // Focus handler for input management @@ -178,8 +159,9 @@ // Added widgets std::set<gcn::Widget*> m_widgets; - // instance whom to deliver widget events coming from guichan - IWidgetListener* m_widgetlistener; + // Used to accept mouse motion events that leave widget space + bool m_had_mouse; + // pool used for images ImagePool& m_pool;