00001 #ifndef GUIENGINE_H
00002 #define GUIENGINE_H
00003
00004 #include "common.h"
00005 #ifdef SLIM_MINIGUI_ENGINE
00006 #include <minigui/common.h>
00007 #include <minigui/minigui.h>
00008 #include <minigui/gdi.h>
00009 #include <minigui/window.h>
00010 #include <minigui/control.h>
00011 #endif
00012 #include <vector>
00013 #include <map>
00014 #include <string.h>
00015 #include <stdlib.h>
00016 #include <iostream>
00017 #include <libxml/xmlreader.h>
00018 #include <assert.h>
00019 #include "gui_component.h"
00020
00021 namespace SMP{
00022
00023 #ifdef SLIM_MINIGUI_ENGINE
00024
00025
00026 using namespace std;
00027
00028
00029
00031 struct SLIMUIWidget
00032 {
00034 string name;
00036 int width;
00038 int height;
00040 int xposition;
00042 int yposition;
00043
00045 int id;
00047 string type;
00048
00050 map<string, string> attributes;
00051 };
00052
00053
00055 class SLIMUIRenderer
00056 {
00057 private:
00058
00060 DLGTEMPLATE window;
00061
00063 CTRLDATA *controls;
00064
00066 vector<SLIMUIWidget> widgets;
00067
00069 string component_xml_filename;
00070
00072 bool parse_common_attr(xmlTextReaderPtr reader, SLIMUIWidget *widget );
00074 bool parse_attr(char *attr_name, xmlTextReaderPtr reader, SLIMUIWidget *widget);
00075
00077 int _start_index;
00078
00079
00081 static int _MG_GUI_event_handler(HWND hDlg, int message, WPARAM wParam, LPARAM lParam);
00082
00084 static void _MG_GUI_widget_notif_handler(HWND hwnd, int id, int nc, DWORD add_data);
00085
00086 public:
00087
00089 SLIMUIRenderer();
00091 SLIMUIRenderer(string repos, string component_name);
00093 ~SLIMUIRenderer();
00094
00096 void set_XML_path(string repos, string component_name);
00097
00099 bool parse();
00100
00102 bool render();
00103
00105 void gui_main(void *component);
00106
00108 int get_widget_by_name(char *identifier);
00109
00110 int set_notification_callback(HWND handle, char *identifier, TFunctor *callback_functor);
00111
00112 int send_message(HWND handle, char *widget_name, int message, unsigned wParam, unsigned long lParam);
00113
00114 };
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128 #endif
00129
00130 }
00131
00132 #endif