00001
00002
00003
00004
00005
00006 #ifndef WinGUI_H
00007 #define WinGUI_H
00008
00009 #if !defined (WIN32) && !defined(_WINDOWS)
00010 # error "This code only compiles for the Windows NT or Window95"
00011 #endif
00012
00013 #define STRICT
00014 #include <windows.h>
00015 #undef min
00016 #undef max
00017 #include <vector>
00018
00019 #include "gui/GUI.h"
00020 #include "gui/SceneControl.h"
00021
00022 using namespace gui;
00023
00024 #pragma warning(disable:4786)
00025
00026
00027 class WinScene;
00028 class WinGUIostream;
00029
00030 class WinGUI : public GUI {
00031
00032 public:
00033 WinGUI(const char* application="Win32", const char* title=0);
00034 ~WinGUI();
00035
00036 void addToMenu(const char* title, Command* command);
00037 Menu* beginPullDownMenu(const char*, Menu* );
00038 GUI::Toggle* addToggleToMenu(const char* title, bool state, Command* set, Command* unset);
00039 void restorePullDownMenu(Menu*);
00040 void endPullDownMenu();
00041 void menuSeparator();
00042
00043
00044 gui::SceneControl* graphicsWindow(float size, int initial_view);
00045 std::ostream* textWindow(const char* name);
00046
00047
00048 void start();
00049
00050
00051 void run(int pause_interval);
00052
00053
00054 void setTitle(const char* newtitle);
00055 void quit();
00056
00057 void processMessages();
00058
00059 char * askForFileName(const char* a, const char* b, const char* c);
00060 char* askUser(const char* promptString, const char* defaultString);
00061 void inform(const char* msg);
00062
00063 const char* nameOf()const{return "WinGUI";}
00064
00065 void execute(WPARAM);
00066
00067
00068
00069 static HINSTANCE s_instance;
00070 static WinGUI* s_gui;
00071 static HWND s_hwnd;
00072 static WinScene* s_graphics_window;
00073 static WinScene* s_2d_window;
00074 static bool s_quitting;
00075 static WinGUIostream* s_text_window;
00076
00077 private:
00078 enum{ cmdOffset=100};
00079
00080 HMENU m_currentMenu;
00081 HMENU m_menuBar;
00082
00083 UINT m_menuId;
00084
00085 typedef std::vector<Command* > CommandList;
00086 CommandList m_commands;
00087
00088 std::ostream* m_text_window;
00089 SceneControl* m_graphics_window;
00090
00091 CommandList m_owned_commands;
00092
00093 class Toggle;
00094 };
00095 #endif
00096