1 // new_gui.hxx - XML-configured GUI subsystem.
4 #define __NEW_GUI_HXX 1
7 # error This library requires C++
12 #include <simgear/compiler.h> // for SG_USING_STD
13 #include <simgear/misc/props.hxx>
21 #include <Main/fgfs.hxx>
22 #include <Main/fg_props.hxx>
30 * XML-configured GUI subsystem.
32 * This subsystem manages the graphical user interface for FlightGear.
33 * It creates a menubar from the XML configuration file in
34 * $FG_ROOT/gui/menubar.xml, then stores the configuration properties
35 * for XML-configured dialog boxes in $FG_ROOT/gui/dialogs/*. It
36 * can show or hide the menubar, and can display any dialog by name.
38 class NewGUI : public FGSubsystem
53 * Initialize the GUI subsystem.
58 * Reinitialize the GUI subsystem.
60 virtual void reinit ();
63 * Bind properties for the GUI subsystem.
65 * Currently, this method binds the properties for showing and
71 * Unbind properties for the GUI subsystem.
73 virtual void unbind ();
76 * Update the GUI subsystem.
78 * Currently, this method is a no-op, because nothing the GUI
79 * subsystem does is time-dependent.
81 virtual void update (double delta_time_sec);
84 * Display a dialog box.
86 * At initialization time, the subsystem reads all of the XML
87 * configuration files from $FG_ROOT/gui/dialogs/*. The
88 * configuration for each dialog specifies a name, and this method
89 * invokes the dialog with the name specified (if it exists).
91 * @param name The name of the dialog box.
92 * @return true if the dialog exists, false otherwise.
94 virtual bool showDialog (const string &name);
98 * Close the currently-active dialog, if any.
100 * @return true if a dialog was active, false otherwise.
102 virtual bool closeActiveDialog ();
106 * Return a pointer to the current menubar.
108 virtual FGMenuBar * getMenuBar ();
112 * Ignore this method.
114 * This method is for internal use only, but it has to be public
115 * so that a non-class callback can see it.
117 virtual void setActiveDialog (FGDialog * dialog);
120 * Get the dialog currently active, if any.
122 * @return The active dialog, or 0 if none is active.
124 virtual FGDialog * getActiveDialog ();
129 * Test if the menubar is visible.
131 * This method exists only for binding.
133 virtual bool getMenuBarVisible () const;
136 * Show or hide the menubar.
138 * This method exists only for binding.
140 virtual void setMenuBarVisible (bool visible);
145 // Free all allocated memory.
148 // Read all the configuration files in a directory.
149 void readDir (const char * path);
151 FGMenuBar * _menubar;
152 FGDialog * _active_dialog;
153 map<string,SGPropertyNode *> _dialog_props;
158 #endif // __NEW_GUI_HXX