| 1 | // menubar.hxx - XML-configured menu bar. |
| 2 | |
| 3 | #ifndef __MENUBAR_HXX |
| 4 | #define __MENUBAR_HXX 1 |
| 5 | |
| 6 | #include <string> |
| 7 | |
| 8 | class SGPropertyNode; |
| 9 | |
| 10 | /** |
| 11 | * XML-configured menu bar interface |
| 12 | * |
| 13 | * This class creates a menu bar from a tree of XML properties. These |
| 14 | * properties are not part of the main FlightGear property tree, but |
| 15 | * are read from a separate file ($FG_ROOT/gui/menubar.xml). |
| 16 | |
| 17 | */ |
| 18 | class FGMenuBar |
| 19 | { |
| 20 | public: |
| 21 | FGMenuBar(); |
| 22 | |
| 23 | /** |
| 24 | * Destructor. |
| 25 | */ |
| 26 | virtual ~FGMenuBar (); |
| 27 | |
| 28 | |
| 29 | /** |
| 30 | * Initialize the menu bar from $FG_ROOT/gui/menubar.xml |
| 31 | */ |
| 32 | virtual void init () = 0; |
| 33 | |
| 34 | virtual void postinit() |
| 35 | { |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Make the menu bar visible. |
| 40 | */ |
| 41 | virtual void show () = 0; |
| 42 | |
| 43 | |
| 44 | /** |
| 45 | * Make the menu bar invisible. |
| 46 | */ |
| 47 | virtual void hide () = 0; |
| 48 | |
| 49 | |
| 50 | /** |
| 51 | * Test whether the menu bar is visible. |
| 52 | */ |
| 53 | virtual bool isVisible () const = 0; |
| 54 | |
| 55 | /** |
| 56 | * Request the menubar to be hidden if its display overlays the main window content. |
| 57 | * (Which essentially means the PUI menubar at the moment). This is used to prevent |
| 58 | * the menubar overlapping the splash-screen during startup. |
| 59 | * |
| 60 | * The state of this flag is independant of the normal menubar visibility, i.e this |
| 61 | * flag and the normal visibility and AND-ed together inside the code. |
| 62 | */ |
| 63 | virtual void setHideIfOverlapsWindow(bool hide) = 0; |
| 64 | |
| 65 | // corresponding getter to valye able. |
| 66 | virtual bool getHideIfOverlapsWindow() const = 0; |
| 67 | |
| 68 | /** |
| 69 | * Read a menu label from the menu's property tree. |
| 70 | * Take care of mapping it to the appropriate translation, if available. |
| 71 | * Returns an UTF-8 encoded string. |
| 72 | */ |
| 73 | static std::string getLocalizedLabel(SGPropertyNode* node); |
| 74 | |
| 75 | }; |
| 76 | |
| 77 | #endif // __MENUBAR_HXX |