logo
Main Page | Namespaces | Classes | Compounds | Files | Compound Members | Related

Component.h

00001 //
00002 //  SYNTOPIA. See http://Syntopia.sourceforge.net for details and documentation.        
00003 //
00004 //      Author of this file: Mikael Hvidtfeldt Christensen (mikaelc@users.sourceforge.net)
00005 //
00006 
00007 
00008 #pragma warning(disable: 4786) // Dont limit identifier lengths to 250 chars.
00009 
00010 #ifndef __Component
00011 #define __Component
00012 
00013 #include <windows.h>
00014 #include <map>
00015 #include "Events.h"
00016 
00017 namespace GUIToolkit {
00018 
00019 class WinForm;
00020 
00022 /*
00023  *      Perhaps some nice RTTI?
00024  */ 
00025 class Component {
00026 public:
00027         
00029         Component() {myEventHandler = 0;};
00030 
00032         virtual ~Component() {};
00033 
00035         virtual void HandleEvents(event e);
00036 
00037         // for components not capable of drawing themselves. @todo check this
00038         // virtual void Paint(HDC hdc) {}; 
00039 
00041         virtual void setEventHandler(EventHandler * eh) {myEventHandler = eh;}
00042 
00044         virtual HWND getHWND() {return 0;}
00045 
00047         virtual void draw() {}
00048 
00049         // Draw @todo obsolete?
00050         //virtual bool onMouseDown(int x,int y) {return false;}
00051 
00052 protected:
00053         EventHandler * myEventHandler;
00054         HMENU ID;
00055         WinForm * topWF;
00056 };
00057 
00058 typedef std::map<Component *, int> ComponentMap ;
00059 typedef std::map<Component *, int>::const_iterator ComponentMapIter ;
00060 
00061 typedef std::map<Component *, EventHandler *> ComponentEventMap ;
00062 typedef std::map<Component *, EventHandler *>::const_iterator ComponentEventMapIter ;
00063 
00064 typedef std::map<HWND, Component *> HWNDMap ;
00065 typedef std::map<HWND, Component *>::const_iterator HWNDMapIter;
00066 
00067 };
00068 
00069 #endif

Syntopia Project. Visit the web page, or the SourceForge page.
Docs made by Doxygen. Email: Mikael Christensen