00001 /* 00002 * mmscanvasfactory.h 00003 * 00004 * Created on: Nov 3, 2011 00005 * Author: sxs 00006 */ 00007 00008 #ifndef MMSCANVASFACTORY_H_ 00009 #define MMSCANVASFACTORY_H_ 00010 00011 #include "mmsgui/mmscanvaswidget.h" 00012 #include <map> 00013 00014 typedef MMSCanvasWidget *(*MMS_CANVAS_CONSTRUCTOR)(MMSWindow *, string, MMSTheme *); 00015 00016 typedef std::map<std::string, MMS_CANVAS_CONSTRUCTOR> MMS_CANVAS_MAP; 00017 00018 00019 class MMSCanvasFactory { 00020 public: 00021 MMSCanvasFactory(); 00022 ~MMSCanvasFactory(); 00023 void registerCanvas(string name, MMS_CANVAS_CONSTRUCTOR constructor); 00024 MMSCanvasWidget *constructCanvas(const char *name, MMSWindow *root, string classname, MMSTheme *theme); 00025 00026 private: 00027 static MMS_CANVAS_MAP canvasFactoryList; 00028 00029 }; 00030 00031 MMS_CREATEERROR(MMSCanvasFactoryError); 00032 00033 #endif /* MMSCANVASFACTORY_H_ */