00001
00002
00003
00004
00005
00006
00007
00008 #ifndef _WIN32_MAIN_WINDOW_H_
00009 #define _WIN32_MAIN_WINDOW_H_
00010
00011
00012
00013
00014
00015
00016 #include "Interfaces/MainWindowInterface.h"
00017
00018 #include <windows.h>
00019 #include <vector>
00020
00021
00022
00023
00024
00025
00026 struct Win32Widget;
00027
00028
00029
00030
00031
00032
00033
00034 class CWin32MainWindow : public CMainWindowInterface
00035 {
00036 public:
00037 CWin32MainWindow(int x, int y, int width, int height, const char *title);
00038 ~CWin32MainWindow();
00039
00040
00041 WIDGET_HANDLE AddImage(int x, int y, int width, int height, WIDGET_HANDLE parent = 0);
00042 WIDGET_HANDLE AddButton(int x, int y, int width, int height, const char *text, WIDGET_HANDLE parent = 0);
00043 WIDGET_HANDLE AddLabel(int x, int y, int width, int height, const char *text, WIDGET_HANDLE parent = 0);
00044 WIDGET_HANDLE AddCheckBox(int x, int y, int width, int height, const char *text, bool checked, WIDGET_HANDLE parent = 0);
00045 WIDGET_HANDLE AddTextEdit(int x, int y, int width, int height, const char *text, WIDGET_HANDLE parent = 0);
00046 WIDGET_HANDLE AddSlider(int x, int y, int width, int height, int min_value, int max_value, int step, int value, WIDGET_HANDLE parent = 0);
00047 WIDGET_HANDLE AddComboBox(int x, int y, int width, int height, int num_entries, const char **entries, int current_entry, WIDGET_HANDLE parent = 0);
00048 WIDGET_HANDLE AddGLWidget(int x, int y, int width, int height, WIDGET_HANDLE parent = 0);
00049
00050
00051 bool GetText(WIDGET_HANDLE widget, char *text, int len);
00052 bool SetText(WIDGET_HANDLE widget, const char *text);
00053
00054 bool SetImage(WIDGET_HANDLE widget, const CByteImage *pImage);
00055
00056 bool GetValue(WIDGET_HANDLE widget, int &value);
00057 bool SetValue(WIDGET_HANDLE widget, int value);
00058
00059 bool SwapBuffersGLWidget(WIDGET_HANDLE widget);
00060 bool MakeCurrentGLWidget(WIDGET_HANDLE widget);
00061
00062
00063 void Show(WIDGET_HANDLE widget = 0);
00064 void Hide(WIDGET_HANDLE widget = 0);
00065
00066 void SetSize(int width, int height, WIDGET_HANDLE widget = 0);
00067
00068 int GetModifierKeyState();
00069
00070 void SetEventCallback(CMainWindowEventInterface *callback) {m_event_callback = callback;}
00071
00072
00073 LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
00074 private:
00075
00076 Win32Widget *FindWidget(HWND handle);
00077
00078
00079 HINSTANCE m_hInstance;
00080 HWND m_hWnd;
00081 static int m_ref_count;
00082 static int m_quit_count;
00083 bool m_did_quit;
00084
00085 CMainWindowEventInterface *m_event_callback;
00086
00087 std::vector<Win32Widget*> m_widgets;
00088 };
00089
00090
00091
00092 #endif