Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

WinGUI.h

Go to the documentation of this file.
00001 // $Header: /nfs/slac/g/glast/ground/cvs/gui/src/WinGUI.h,v 1.2 2001/01/07 21:35:03 burnett Exp $
00002 //  Author: T. Burnett
00003 //
00004 // Win GUI definition.
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     // Windows 95/NT implementation of GUI functions
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     // handle menus
00043     
00044     gui::SceneControl* graphicsWindow(float size, int initial_view);
00045     std::ostream* textWindow(const char* name);
00046     // create, return handle to associated window
00047     
00048     void start();
00049     // start the window system
00050         
00051     void run(int pause_interval);
00052     // start the message loop; return only when exit message
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     // execute the given command, needed by the Windows message handling procedure
00067     
00068     // following are static and public for communication with windows routines
00069     static HINSTANCE s_instance; // handle to the application instance. Set by windows main 
00070     static WinGUI* s_gui;  //pointer to instance 
00071     static HWND s_hwnd;     // windows handle to the main window
00072     static WinScene* s_graphics_window; // primary (3d display) window
00073     static WinScene* s_2d_window; // secondary (for plots) window
00074     static bool s_quitting;
00075     static WinGUIostream* s_text_window;
00076 
00077 private:
00078     enum{ cmdOffset=100}; // constant for command indeces
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; // separate list for deleting the extra toggle commands
00092     
00093     class Toggle; // used in implementation
00094 };
00095 #endif
00096 

Generated at Wed Nov 21 12:20:55 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000