Debian Codegraph @

src/tools/dlgedit/gui_settings.h

raw
1 /*
2 Copyright (C) 2002 Kai Sterker <[email protected]>
3 Part of the Adonthell Project <http://adonthell.nongnu.org>
4
5 Dlgedit is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 Dlgedit is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with Dlgedit. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 /**
20 * @file gui_settings.h
21 *
22 * @author Kai Sterker
23 * @brief The Dialogue settings dialog.
24 */
25
26 #ifndef GUI_SETTINGS_H
27 #define GUI_SETTINGS_H
28
29 #include <gtk/gtk.h>
30 #include "dlg_module_entry.h"
31
32 /**
33 * Interface to various generic dialogue and project settings. Currently this
34 * includes
35 * - the project of the dialogue
36 * - the dialogue's description
37 * - the base directory of the above project
38 */
39 class GuiSettings
40 {
41 public:
42 /**
43 * Create empty Settings Dialog.
44 */
45 GuiSettings ();
46
47 /**
48 * Cleanup.
49 */
50 ~GuiSettings ();
51
52 /**
53 * Global pointer to the settings dialog
54 */
55 static GuiSettings *dialog;
56
57 /**
58 * Show the dialog and display the settings of the given module.
59 * @param entry the settings of a certain DlgModule to be edited.
60 * @param name name of the dialogue whose settings are being edited.
61 */
62 void display (DlgModuleEntry *entry, const std::string &name);
63
64 /**
65 * Store the user's entries once the OK button has been pressed.
66 */
67 void applyChanges ();
68
69 /**
70 * @name Member access
71 */
72 //@{
73 /**
74 * Set the base directory according to selected project. Call this
75 * method whenever the user assigns a different project.
76 * @param project the name of the selected project.
77 */
78 void setBasedir (const std::string & project);
79 /**
80 * Return the basedir associated with the selected project.
81 * @return The basedir of the selected project.
82 */
83 std::string getBasedir ();
84 /**
85 * Set the project list to the project the module is assigned to.
86 * If that module is not in the list yet, it will be added.
87 * @param project name of the module's project.
88 */
89 void setProject (const std::string & project);
90 /**
91 * Return the project the user has selected in the list.
92 * @return The name of the selected project.
93 */
94 std::string getProject ();
95 //@}
96
97 private:
98 /**
99 * Display the module's description. The text area is cleared
100 * if neccessary.
101 * @param desc the module's description.
102 */
103 void setDescription (const std::string & desc);
104 /**
105 * Get the Description the user has entered for the module.
106 * @return the module's description.
107 */
108 std::string getDescription ();
109
110 /**
111 * Read available projects from DlgCmdline::datadir and add
112 * them to the project list. Also add the "none" entry for
113 * modules that do not belong to a project yet.
114 */
115 void populateProjects ();
116
117 DlgModuleEntry *entry; // The module's settings
118 GtkWidget *window; // The dialog window
119 GtkWidget *project; // Dropdown list for the project
120 GtkTextBuffer *description; // Entry for the dialogue's description
121 GtkWidget *basedir; // Entry for the project's base directory
122 };
123
124 #endif // GUI_SETTINGS_H