| 1 | /*! |
|---|
| 2 | * file gui_exec.h |
|---|
| 3 | * File that holds the class that creates the execute-Options. |
|---|
| 4 | */ |
|---|
| 5 | |
|---|
| 6 | #ifndef _GUI_EXEC_H |
|---|
| 7 | #define _GUI_EXEC_H |
|---|
| 8 | |
|---|
| 9 | #include "gui.h" |
|---|
| 10 | #include "gui_element.h" |
|---|
| 11 | #include "gui_gtk.h" |
|---|
| 12 | |
|---|
| 13 | #include <string> |
|---|
| 14 | |
|---|
| 15 | class Widget; |
|---|
| 16 | class CheckButton; |
|---|
| 17 | using namespace std; |
|---|
| 18 | class IniParser; |
|---|
| 19 | |
|---|
| 20 | //! Class that creates the execute-Options. |
|---|
| 21 | class GuiExec : public GuiElement |
|---|
| 22 | { |
|---|
| 23 | private: |
|---|
| 24 | CheckButton* saveSettings; //!< A CheckBox for if the Options should be saved. |
|---|
| 25 | |
|---|
| 26 | std::string confDir; //!< The directory of the orxonox-configuration-files. |
|---|
| 27 | std::string confFile; //!< The name of the .orxonox.conf(ig)-file. |
|---|
| 28 | |
|---|
| 29 | //! A struct that holds informations about variables. |
|---|
| 30 | struct VarInfo |
|---|
| 31 | { |
|---|
| 32 | const char* variableName; //!< The Name of this variable; |
|---|
| 33 | const char* variableValue; //!< The Value this variable gets. |
|---|
| 34 | }; |
|---|
| 35 | |
|---|
| 36 | public: |
|---|
| 37 | GuiExec(); |
|---|
| 38 | virtual ~GuiExec(); |
|---|
| 39 | |
|---|
| 40 | void setConfDir(const char* confDir); |
|---|
| 41 | void setConfFile(const char* confFile); |
|---|
| 42 | const char* getConfigFile() const; |
|---|
| 43 | int shouldsave(); |
|---|
| 44 | void writeToFile(Widget* widget); |
|---|
| 45 | void writeFileText(Widget* widget, IniParser* parser, int depth); |
|---|
| 46 | void readFromFile(Widget* widget); |
|---|
| 47 | static void readFileText(Widget* widget, void* varInfo); |
|---|
| 48 | Widget* locateGroup(Widget* widget, const char* groupName, int depth); |
|---|
| 49 | |
|---|
| 50 | #ifdef HAVE_GTK2 |
|---|
| 51 | static int startOrxonox(GtkWidget *widget, void* data); |
|---|
| 52 | static int quitGui(GtkWidget *widget, void* data); |
|---|
| 53 | #else /* HAVE_GTK2 */ |
|---|
| 54 | static int startOrxonox(void* widget, void* data); |
|---|
| 55 | static int quitGui(void* widget, void* data); |
|---|
| 56 | #endif /* HAVE_GTK2 */ |
|---|
| 57 | }; |
|---|
| 58 | |
|---|
| 59 | //! A simple hashtable |
|---|
| 60 | struct HashTable |
|---|
| 61 | { |
|---|
| 62 | std::string name; //!< name of the entry |
|---|
| 63 | std::string value; //!< value of the entry |
|---|
| 64 | HashTable* next; //!< pointer to the next entry |
|---|
| 65 | }; |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | #endif /* _GUI_EXEC_H */ |
|---|