- Your Widget Set For OpenGL
Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | Related Pages

uabstractcontext.hpp

00001 /*************************************************************************** 00002 LibUFO - UI For OpenGL 00003 copyright : (C) 2001-2005 by Johannes Schmidt 00004 email : schmidtjf at users.sourceforge.net 00005 ------------------- 00006 00007 file : include/ufo/uabstractcontext.hpp 00008 begin : Fri Aug 16 2002 00009 $Id: uabstractcontext.hpp,v 1.21 2005/05/21 15:17:23 schmidtjf Exp $ 00010 ***************************************************************************/ 00011 00012 /*************************************************************************** 00013 * This library is free software; you can redistribute it and/or * 00014 * modify it under the terms of the GNU Lesser General Public * 00015 * License as published by the Free Software Foundation; either * 00016 * version 2.1 of the License, or (at your option) any later version. * 00017 * * 00018 * This library is distributed in the hope that it will be useful, * 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00021 * Lesser General Public License for more details. * 00022 * * 00023 * You should have received a copy of the GNU Lesser General Public * 00024 * License along with this library; if not, write to the Free Software * 00025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 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: // c'tors / d'tors 00060 UAbstractContext(UAbstractContext * parent); 00061 virtual ~UAbstractContext(); 00062 00063 public: // Implements UContext 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: // Implements UContext 00083 virtual void dispatchEvent(UEvent * e); 00084 00085 virtual void setEventGrabber(const USlot1<UEvent*> & slot);//, UEvent::Type type); 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: // Implements UContext 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: // Private methods 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: // Private functions 00138 bool send(UWidget * receiver, UEvent * e); 00139 void sendToGrabber(UEvent * e); 00140 00141 protected: // Protected attributes 00143 UContextGroup * m_contextGroup; 00144 UUIManager * m_uiManager; 00145 URootPane * m_rootPane; 00146 00147 private: // Private attributes 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 } // namespace ufo 00169 00170 #endif // UABSTRACTCONTEXT_HPP

The libUFO Project - written by Johannes Schmidt