FlightGear next
NewGUI Class Reference

XML-configured GUI subsystem. More...

#include <new_gui.hxx>

Inherits SGSubsystem.

Public Types

using FGDialogRef = SGSharedPtr<FGDialog>
 

Public Member Functions

 NewGUI ()
 Constructor.
 
virtual ~NewGUI ()
 Destructor.
 
void bind () override
 
void init () override
 
void reinit () override
 
void shutdown () override
 
void unbind () override
 
void update (double delta_time_sec) override
 
void postinit () override
 
virtual void redraw ()
 Redraw the GUI picking up new GUI colors.
 
virtual void newDialog (SGPropertyNode *node)
 Creates a new dialog box, using the same property format as the gui/dialogs configuration files.
 
virtual bool showDialog (const std::string &name)
 Display a dialog box.
 
virtual bool toggleDialog (const std::string &name)
 Toggle display of a dialog box.
 
virtual bool closeActiveDialog ()
 Close the currenty active dialog.
 
virtual bool closeDialog (const std::string &name)
 Close a named dialog, if it is open.
 
virtual SGPropertyNode_ptr getDialogProperties (const std::string &name)
 Get dialog property tree's root node.
 
virtual FGMenuBargetMenuBar ()
 Return a pointer to the current menubar.
 
virtual void setActiveDialog (FGDialog *dialog)
 Ignore this method.
 
virtual FGDialogRef getActiveDialog ()
 Get the dialog currently active, if any.
 
virtual FGDialogRef getDialog (const std::string &name)
 Get the named dialog if active.
 
virtual FGColorgetColor (const char *name) const
 
virtual FGColorgetColor (const std::string &name) const
 

Static Public Member Functions

static const char * staticSubsystemClassId ()
 

Protected Member Functions

virtual bool getMenuBarVisible () const
 Test if the menubar is visible.
 
virtual void setMenuBarVisible (bool visible)
 Show or hide the menubar.
 
virtual void setStyle ()
 
virtual void reset (bool reload)
 Used by reinit() and redraw() to close all dialogs and to apply current GUI colors.
 
bool getMenuBarOverlapHide () const
 
void setMenuBarOverlapHide (bool hide)
 

Detailed Description

XML-configured GUI subsystem.

This subsystem manages the graphical user interface for FlightGear. It creates a menubar from the XML configuration file in $FG_ROOT/gui/menubar.xml, then stores the configuration properties for XML-configured dialog boxes found in $FG_ROOT/gui/dialogs/. It can show or hide the menubar, and can display any dialog by name.

Definition at line 30 of file new_gui.hxx.

Member Typedef Documentation

◆ FGDialogRef

using NewGUI::FGDialogRef = SGSharedPtr<FGDialog>

Definition at line 33 of file new_gui.hxx.

Constructor & Destructor Documentation

◆ NewGUI()

NewGUI::NewGUI ( )

Constructor.

Definition at line 64 of file new_gui.cxx.

◆ ~NewGUI()

NewGUI::~NewGUI ( )
virtual

Destructor.

Definition at line 68 of file new_gui.cxx.

Member Function Documentation

◆ bind()

void NewGUI::bind ( )
override

Definition at line 246 of file new_gui.cxx.

◆ closeActiveDialog()

bool NewGUI::closeActiveDialog ( )
virtual

Close the currenty active dialog.

This function is intended to be called from code (pui callbacks, for instance) that registers its dialog object as active via setActiveDialog(). Other user-level code should use the closeDialog(name) API.

Returns
true if a dialog was active, false otherwise

Definition at line 337 of file new_gui.cxx.

◆ closeDialog()

bool NewGUI::closeDialog ( const std::string & name)
virtual

Close a named dialog, if it is open.

Parameters
nameThe name of the dialog box.
Returns
true if the dialog was active, false otherwise.

Definition at line 369 of file new_gui.cxx.

◆ getActiveDialog()

NewGUI::FGDialogRef NewGUI::getActiveDialog ( )
virtual

Get the dialog currently active, if any.

Returns
The active dialog, or 0 if none is active.

Definition at line 432 of file new_gui.cxx.

◆ getColor() [1/2]

virtual FGColor * NewGUI::getColor ( const char * name) const
inlinevirtual

Definition at line 151 of file new_gui.hxx.

◆ getColor() [2/2]

virtual FGColor * NewGUI::getColor ( const std::string & name) const
inlinevirtual

Definition at line 155 of file new_gui.hxx.

◆ getDialog()

NewGUI::FGDialogRef NewGUI::getDialog ( const std::string & name)
virtual

Get the named dialog if active.

Returns
The named dialog, or 0 if it isn't active.

Definition at line 413 of file new_gui.cxx.

◆ getDialogProperties()

SGPropertyNode_ptr NewGUI::getDialogProperties ( const std::string & name)
virtual

Get dialog property tree's root node.

Parameters
nameThe name of the dialog box.
Returns
node pointer if the dialog was found, zero otherwise.

Definition at line 384 of file new_gui.cxx.

◆ getMenuBar()

FGMenuBar * NewGUI::getMenuBar ( )
virtual

Return a pointer to the current menubar.

Definition at line 438 of file new_gui.cxx.

◆ getMenuBarOverlapHide()

bool NewGUI::getMenuBarOverlapHide ( ) const
protected

Definition at line 465 of file new_gui.cxx.

◆ getMenuBarVisible()

bool NewGUI::getMenuBarVisible ( ) const
protectedvirtual

Test if the menubar is visible.

This method exists only for binding.

Definition at line 444 of file new_gui.cxx.

◆ init()

void NewGUI::init ( )
override

Definition at line 116 of file new_gui.cxx.

◆ newDialog()

void NewGUI::newDialog ( SGPropertyNode * node)
virtual

Creates a new dialog box, using the same property format as the gui/dialogs configuration files.

Does not display the resulting dialog. If a pre-existing dialog of the same name exists, it will be deleted. The node argument will be stored in the GUI subsystem using SGPropertNode_ptr reference counting. It should not be deleted by user code.

Parameters
nodeA property node containing the dialog definition

Definition at line 479 of file new_gui.cxx.

◆ postinit()

void NewGUI::postinit ( )
override

Definition at line 255 of file new_gui.cxx.

◆ redraw()

void NewGUI::redraw ( )
virtual

Redraw the GUI picking up new GUI colors.

Definition at line 176 of file new_gui.cxx.

◆ reinit()

void NewGUI::reinit ( )
override

Definition at line 169 of file new_gui.cxx.

◆ reset()

void NewGUI::reset ( bool reload)
protectedvirtual

Used by reinit() and redraw() to close all dialogs and to apply current GUI colors.

If "reload" is false, reopens all dialogs. Otherwise reloads all XML dialog files from disk and reopens all but Nasal * generated dialogs, omitting dynamic widgets. (This is only useful for GUI development.)

Definition at line 212 of file new_gui.cxx.

◆ setActiveDialog()

void NewGUI::setActiveDialog ( FGDialog * dialog)
virtual

Ignore this method.

This method is for internal use only, but it has to be public so that a non-class callback can see it.

Definition at line 423 of file new_gui.cxx.

◆ setMenuBarOverlapHide()

void NewGUI::setMenuBarOverlapHide ( bool hide)
protected

Definition at line 471 of file new_gui.cxx.

◆ setMenuBarVisible()

void NewGUI::setMenuBarVisible ( bool visible)
protectedvirtual

Show or hide the menubar.

This method exists only for binding.

Definition at line 454 of file new_gui.cxx.

◆ setStyle()

void NewGUI::setStyle ( void )
protectedvirtual

Definition at line 579 of file new_gui.cxx.

◆ showDialog()

bool NewGUI::showDialog ( const std::string & name)
virtual

Display a dialog box.

At initialization time, the subsystem reads all of the XML configuration files from the directory $FG_ROOT/gui/dialogs/. The configuration for each dialog specifies a name, and this method invokes the dialog with the name specified (if it exists).

Parameters
nameThe name of the dialog box.
Returns
true if the dialog exists, false otherwise.

Definition at line 281 of file new_gui.cxx.

◆ shutdown()

void NewGUI::shutdown ( )
override

Definition at line 157 of file new_gui.cxx.

◆ staticSubsystemClassId()

static const char * NewGUI::staticSubsystemClassId ( )
inlinestatic

Definition at line 55 of file new_gui.hxx.

◆ toggleDialog()

bool NewGUI::toggleDialog ( const std::string & name)
virtual

Toggle display of a dialog box.

Parameters
nameThe name of the dialog box.
Returns
true if the dialog is being displayed, false otherwise.

Definition at line 324 of file new_gui.cxx.

◆ unbind()

void NewGUI::unbind ( )
override

Definition at line 251 of file new_gui.cxx.

◆ update()

void NewGUI::update ( double delta_time_sec)
override

Definition at line 272 of file new_gui.cxx.


The documentation for this class was generated from the following files: