00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
#ifndef UABSTRACTCONTEXT_HPP
00029
#define UABSTRACTCONTEXT_HPP
00030
00031
#include "ucontext.hpp"
00032
00033
namespace ufo {
00034
00035
class UEvent;
00036
class UMouseEvent;
00037
class UMouseWheelEvent;
00038
class UKeyEvent;
00039
00040
class UWidget;
00041
class UAbstractGraphics;
00042
00043
00054 class UFO_EXPORT UAbstractContext :
public UContext {
00055 UFO_DECLARE_ABSTRACT_CLASS(UAbstractContext)
00056
public:
00060 UAbstractContext(UAbstractContext * parent);
00061
virtual ~UAbstractContext();
00062
00063
public:
00064
virtual UContextGroup * getContextGroup()
const;
00065
virtual UContext * getParent()
const;
00066
virtual UUIManager * getUIManager()
const;
00067
virtual UGraphics * getGraphics()
const;
00068
virtual URepaintManager * getRepaintManager()
const;
00069
00073
virtual bool getSystemInfo(USystemInfo * info)
const;
00074
00075
virtual URootPane * getRootPane()
const;
00076
virtual void setRootPane(
URootPane * paneA);
00077
00078
virtual UImage * createImage(
UImageIO * imageIO);
00079
virtual UImage * createImage(
const std::string & fileName);
00080
00081
00082
public:
00083
virtual void dispatchEvent(
UEvent * e);
00084
00085
virtual void setEventGrabber(
const USlot1<UEvent*> & slot);
00086
virtual void releaseEventGrabber();
00087
virtual USlot1<UEvent*> * getEventGrabber()
const;
00088
00089
virtual void connectListener(
const USlot1<UEvent*> & slot);
00090
virtual void disconnectListener(
const USlot1<UEvent*> & slot);
00091
virtual std::list<USlot1<UEvent*> > getListeners()
const;
00092
00093
virtual UInputMap * getInputMap();
00094
virtual void setInputMap(
UInputMap * newMap);
00095
00096
public:
00097
virtual void setDeviceBounds(
const URectangle & rect);
00098
virtual URectangle getDeviceBounds()
const;
00099
00100
virtual void setContextBounds(
const URectangle & rect);
00101
virtual URectangle getContextBounds()
const;
00102
00103
virtual void init();
00104
virtual void refresh();
00105
virtual void dispose();
00106
00107
protected:
00109
virtual UGraphics * createGraphics();
00111
virtual URepaintManager * createRepaintManager();
00112
00117
virtual void fireMouseEvent(
UMouseEvent * e);
00122
virtual void fireMouseMotionEvent(
UMouseEvent * e);
00127
virtual void fireMouseWheelEvent(
UMouseWheelEvent * e);
00132
virtual void fireKeyEvent(
UKeyEvent * e);
00133
00134
private:
00138
bool send(
UWidget * receiver,
UEvent * e);
00139
void sendToGrabber(
UEvent * e);
00140
00141
protected:
00143
UContextGroup * m_contextGroup;
00144 UUIManager * m_uiManager;
00145
URootPane * m_rootPane;
00146
00147
private:
00148 UAbstractContext * m_parent;
00149
UGraphics * m_graphics;
00150
URepaintManager * m_repaintManager;
00151
UInputMap * m_inputMap;
00152
00153
URectangle m_deviceBounds;
00154
URectangle m_bounds;
00155
00156
UWidget * m_dragWidget;
00157
00158 USlot1<UEvent*> * m_eventGrabber;
00159
UPoint m_posBeforeGrabbing;
00160
UPoint m_posAfterGrabbing;
00161
00162
typedef std::list<USlot1<UEvent*> > ListenerList;
00163
typedef std::list<USlot1<UEvent*> >::iterator ListenerIterator;
00164
00165 ListenerList m_listeners;
00166 };
00167
00168 }
00169
00170
#endif // UABSTRACTCONTEXT_HPP