2
* This file is a part of the Cairo-Dock project
4
* Copyright : (C) see the 'copyright' file.
5
* E-mail : see the 'copyright' file.
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 3
10
* of the License, or (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
21
#ifndef __CAIRO_DOCK_GUI_FACTORY__
22
#define __CAIRO_DOCK_GUI_FACTORY__
29
*@file cairo-dock-gui-factory.h This class handles the construction of the common widgets used in the conf files.
31
* A conf file is a common group/key file, with the following syntax :
40
* Each key in the conf file has a comment.
42
* The first character of the comment defines the type of widget. Known types are listed in the CairoDockGUIWidgetType enum.
44
* A key can be a behaviour key or an appearance key. Appearance keys are keys that defines the look of the appli, they belong to the theme. Behaviour keys are keys that define some configuration parameters, that depends on the user. To mark a key as an apppearance one, suffix the widget character with a '+'. Thus, keys not marked with a '+' won't be loaded when the user loads a theme, except if he forces it.
46
* After the widget character and its suffix, some widget accept a list of values. For instance, a spinbutton can have a min and a max limits, a list can have pre-defined elements, etc. Such values are set between '[' and ']' brackets, and separated by ';' inside.
48
* After that, let a blank to start the widget description. It will appear on the left of the widget; description must be short enough to fit the config panel width.
50
* You can complete this description with a tooltip. To do that, on a new comment line, add some text between '{' and '}' brackets. Tooltips appear above the widget when you let the mouse over it for ~1 second. They can be as long as you want. Use '\n' to insert new lines inside the tooltip.
54
#define CAIRO_DOCK_GUI_MARGIN 4
56
/// Types of widgets that Cairo-Dock can automatically build.
58
/// boolean in a button to tick.
59
CAIRO_DOCK_WIDGET_CHECK_BUTTON='b',
60
/// boolean in a button to tick, that will control the sensitivity of the next widget.
61
CAIRO_DOCK_WIDGET_CHECK_CONTROL_BUTTON='B',
62
/// integer in a spin button.
63
CAIRO_DOCK_WIDGET_SPIN_INTEGER='i',
64
/// integer in an horizontal scale.
65
CAIRO_DOCK_WIDGET_HSCALE_INTEGER='I',
66
/// pair of integers for dimansion WidthxHeight
67
CAIRO_DOCK_WIDGET_SIZE_INTEGER='j',
68
/// double in a spin button.
69
CAIRO_DOCK_WIDGET_SPIN_DOUBLE='f',
70
/// 3 doubles with a color selector (RGB).
71
CAIRO_DOCK_WIDGET_COLOR_SELECTOR_RGB='c',
72
/// 4 doubles with a color selector (RGBA).
73
CAIRO_DOCK_WIDGET_COLOR_SELECTOR_RGBA='C',
74
/// double in an horizontal scale.
75
CAIRO_DOCK_WIDGET_HSCALE_DOUBLE='e',
78
CAIRO_DOCK_WIDGET_VIEW_LIST='n',
79
/// list of themes in a combo, with preview and readme.
80
CAIRO_DOCK_WIDGET_THEME_LIST='h',
81
/// same but with a combo-entry to let the user enter any text.
82
CAIRO_DOCK_WIDGET_THEME_LIST_ENTRY='H',
84
CAIRO_DOCK_WIDGET_USER_THEME_SELECTOR='x',
85
/// list of dock themes, sortable by name, rating, and sobriety.
86
CAIRO_DOCK_WIDGET_THEME_SELECTOR='R',
87
/// list of available animations.
88
CAIRO_DOCK_WIDGET_ANIMATION_LIST='a',
90
CAIRO_DOCK_WIDGET_ANIMATION_DOUBLE_LIST='z',
91
/// list of available dialog decorators.
92
CAIRO_DOCK_WIDGET_DIALOG_DECORATOR_LIST='t',
93
/// list of available desklet decorations.
94
CAIRO_DOCK_WIDGET_DESKLET_DECORATION_LIST='O',
95
/// same but with the 'default' choice too.
96
CAIRO_DOCK_WIDGET_DESKLET_DECORATION_LIST_WITH_DEFAULT='o',
97
// list of gauges themes.
98
//CAIRO_DOCK_WIDGET_GAUGE_LIST='g',
99
/// list of existing docks.
100
CAIRO_DOCK_WIDGET_DOCK_LIST='d',
101
/// list of installed icon themes.
102
CAIRO_DOCK_WIDGET_ICON_THEME_LIST='w',
103
/// list of available modules.
104
CAIRO_DOCK_WIDGET_MODULE_LIST='N',
105
/// a button to jump to another module inside the config panel.
106
CAIRO_DOCK_WIDGET_JUMP_TO_MODULE='m',
107
/// same but only if the module exists.
108
CAIRO_DOCK_WIDGET_JUMP_TO_MODULE_IF_EXISTS='M',
110
/// a button to launch a specific command.
111
CAIRO_DOCK_WIDGET_LAUNCH_COMMAND='Z',
112
/// a button to launch a specific command with a condition.
113
CAIRO_DOCK_WIDGET_LAUNCH_COMMAND_IF_CONDITION='G',
116
CAIRO_DOCK_WIDGET_STRING_ENTRY='s',
117
/// a text entry with a file selector.
118
CAIRO_DOCK_WIDGET_FILE_SELECTOR='S',
119
/// a text entry with a folder selector.
120
CAIRO_DOCK_WIDGET_FOLDER_SELECTOR='D',
121
/// a text entry with a file selector and a 'play' button, for sound files.
122
CAIRO_DOCK_WIDGET_SOUND_SELECTOR='u',
123
/// a text entry with a shortkey selector.
124
CAIRO_DOCK_WIDGET_SHORTKEY_SELECTOR='k',
125
/// a text entry with a class selector.
126
CAIRO_DOCK_WIDGET_CLASS_SELECTOR='K',
127
/// a text entry, where text is hidden and the result is encrypted in the .conf file.
128
CAIRO_DOCK_WIDGET_PASSWORD_ENTRY='p',
129
/// a font selector button.
130
CAIRO_DOCK_WIDGET_FONT_SELECTOR='P',
133
CAIRO_DOCK_WIDGET_LIST='L',
134
/// a combo-entry, that is to say a list where one can add a custom choice.
135
CAIRO_DOCK_WIDGET_LIST_WITH_ENTRY='E',
136
/// a combo where the number of the line is used for the choice.
137
CAIRO_DOCK_WIDGET_NUMBERED_LIST='l',
138
/// a combo where the number of the line is used for the choice, and for controlling the sensitivity of the widgets below.
139
CAIRO_DOCK_WIDGET_NUMBERED_CONTROL_LIST='y',
140
/// a combo where the number of the line is used for the choice, and for controlling the sensitivity of the widgets below; controlled widgets are indicated in the list : {entry;index first widget;nb widgets}.
141
CAIRO_DOCK_WIDGET_NUMBERED_CONTROL_LIST_SELECTIVE='Y',
142
/// a tree view, where lines are numbered and can be moved up and down.
143
CAIRO_DOCK_WIDGET_TREE_VIEW_SORT='T',
144
/// a tree view, where lines can be added, removed, and moved up and down.
145
CAIRO_DOCK_WIDGET_TREE_VIEW_SORT_AND_MODIFY='U',
146
/// a tree view, where lines are numbered and can be selected or not.
147
CAIRO_DOCK_WIDGET_TREE_VIEW_MULTI_CHOICE='V',
149
/// an empty GtkContainer, in case you need to build custom widgets.
150
CAIRO_DOCK_WIDGET_EMPTY_WIDGET='_',
151
/// a simple text label.
152
CAIRO_DOCK_WIDGET_TEXT_LABEL='>',
153
/// a simple text label.
154
CAIRO_DOCK_WIDGET_LINK='W',
155
/// a label containing the handbook of the applet.
156
CAIRO_DOCK_WIDGET_HANDBOOK='A',
157
/// an horizontal separator.
158
CAIRO_DOCK_WIDGET_SEPARATOR='v',
159
/// a frame. The previous frame will be closed.
160
CAIRO_DOCK_WIDGET_FRAME='F',
161
/// a frame inside an expander. The previous frame will be closed.
162
CAIRO_DOCK_WIDGET_EXPANDER='X',
163
CAIRO_DOCK_NB_GUI_WIDGETS
164
} CairoDockGUIWidgetType;
166
/// Model used for combo-box and tree-view. CAIRO_DOCK_MODEL_NAME is the name as displayed in the widget, and CAIRO_DOCK_MODEL_RESULT is the resulting string effectively written in the config file.
168
CAIRO_DOCK_MODEL_NAME = 0,
169
CAIRO_DOCK_MODEL_RESULT,
170
CAIRO_DOCK_MODEL_DESCRIPTION_FILE,
171
CAIRO_DOCK_MODEL_ACTIVE,
172
CAIRO_DOCK_MODEL_ORDER,
173
CAIRO_DOCK_MODEL_IMAGE,
174
CAIRO_DOCK_MODEL_ICON,
175
CAIRO_DOCK_MODEL_ORDER2,
176
CAIRO_DOCK_MODEL_STATE,
177
CAIRO_DOCK_MODEL_NB_COLUMNS
178
} CairoDockGUIModelColumns;
180
/// Definition of a widget corresponding to a given (group;key) pair.
181
struct _CairoDockGroupKeyWidget {
184
GSList *pSubWidgetList;
185
gchar *cOriginalConfFilePath;
190
void cairo_dock_build_renderer_list_for_gui (GHashTable *pHashTable);
191
void cairo_dock_build_desklet_decorations_list_for_gui (GHashTable *pHashTable);
192
void cairo_dock_build_desklet_decorations_list_for_applet_gui (GHashTable *pHashTable);
193
void cairo_dock_build_animations_list_for_gui (GHashTable *pHashTable);
194
void cairo_dock_build_dialog_decorator_list_for_gui (GHashTable *pHashTable);
197
void _cairo_dock_set_value_in_pair (GtkSpinButton *pSpinButton, gpointer *data); // exportee pour pouvoir desactiver la callback.
199
gchar *cairo_dock_parse_key_comment (gchar *cKeyComment, char *iElementType, guint *iNbElements, gchar ***pAuthorizedValuesList, gboolean *bAligned, gchar **cTipString);
201
GtkWidget *cairo_dock_build_group_widget (GKeyFile *pKeyFile, const gchar *cGroupName, const gchar *cGettextDomain, GtkWidget *pMainWindow, GSList **pWidgetList, GPtrArray *pDataGarbage, const gchar *cOriginalConfFilePath);
203
GtkWidget *cairo_dock_build_key_file_widget (GKeyFile* pKeyFile, const gchar *cGettextDomain, GtkWidget *pMainWindow, GSList **pWidgetList, GPtrArray *pDataGarbage, const gchar *cOriginalConfFilePath);
204
GtkWidget *cairo_dock_build_conf_file_widget (const gchar *cConfFilePath, const gchar *cGettextDomain, GtkWidget *pMainWindow, GSList **pWidgetList, GPtrArray *pDataGarbage, const gchar *cOriginalConfFilePath);
207
void cairo_dock_update_keyfile_from_widget_list (GKeyFile *pKeyFile, GSList *pWidgetList);
210
void cairo_dock_free_generated_widget_list (GSList *pWidgetList);
217
void cairo_dock_fill_combo_with_list (GtkWidget *pCombo, GList *pElementList, const gchar *cActiveElement); // utile pour les applets.
219
GtkWidget *cairo_dock_gui_make_tree_view (void);
221
GtkWidget *cairo_dock_gui_make_combo (gboolean bWithEntry);
223
void cairo_dock_gui_select_in_combo (GtkWidget *pOneWidget, const gchar *cValue);
225
gchar **cairo_dock_gui_get_active_rows_in_tree_view (GtkWidget *pOneWidget, gboolean bSelectedRows, gsize *iNbElements);
227
gchar *cairo_dock_gui_get_active_row_in_combo (GtkWidget *pOneWidget);
230
CairoDockGroupKeyWidget *cairo_dock_gui_find_group_key_widget_in_list (GSList *pWidgetList, const gchar *cGroupName, const gchar *cKeyName);
232
CairoDockGroupKeyWidget *cairo_dock_gui_find_group_key_widget (GtkWidget *pWindow, const gchar *cGroupName, const gchar *cKeyName);
234
#define cairo_dock_gui_get_widgets(pGroupKeyWidget) (pGroupKeyWidget)->pSubWidgetList
235
#define cairo_dock_gui_get_first_widget(pGroupKeyWidget) (pGroupKeyWidget)->pSubWidgetList->data
236
#define cairo_dock_gui_add_widget(pGroupKeyWidget, pOneWidget) (pGroupKeyWidget)->pSubWidgetList = g_slist_append ((pGroupKeyWidget)->pSubWidgetList, pOneWidget)