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.
55
/// Types of widgets that Cairo-Dock can automatically build.
57
/// boolean in a button to tick.
58
CAIRO_DOCK_WIDGET_CHECK_BUTTON='b',
59
/// boolean in a button to tick, that will control the sensitivity of the next widget.
60
CAIRO_DOCK_WIDGET_CHECK_CONTROL_BUTTON='B',
61
/// integer in a spin button.
62
CAIRO_DOCK_WIDGET_SPIN_INTEGER='i',
63
/// integer in an horizontal scale.
64
CAIRO_DOCK_WIDGET_HSCALE_INTEGER='I',
65
/// pair of integers for dimansion WidthxHeight
66
CAIRO_DOCK_WIDGET_SIZE_INTEGER='j',
67
/// double in a spin button.
68
CAIRO_DOCK_WIDGET_SPIN_DOUBLE='f',
69
/// 3 doubles with a color selector (RGB).
70
CAIRO_DOCK_WIDGET_COLOR_SELECTOR_RGB='c',
71
/// 4 doubles with a color selector (RGBA).
72
CAIRO_DOCK_WIDGET_COLOR_SELECTOR_RGBA='C',
73
/// double in an horizontal scale.
74
CAIRO_DOCK_WIDGET_HSCALE_DOUBLE='e',
77
CAIRO_DOCK_WIDGET_VIEW_LIST='n',
78
/// list of themes in a combo, with preview and readme.
79
CAIRO_DOCK_WIDGET_THEME_LIST='h',
80
/// same but with a combo-entry to let the user enter any text.
81
CAIRO_DOCK_WIDGET_THEME_LIST_ENTRY='H',
82
/// list of user dock themes, with a check button to select several themes.
83
CAIRO_DOCK_WIDGET_USER_THEME_SELECTOR='x',
84
/// list of dock themes, sortable by name, rating, and sobriety.
85
CAIRO_DOCK_WIDGET_THEME_SELECTOR='R',
86
/// list of available animations.
87
CAIRO_DOCK_WIDGET_ANIMATION_LIST='a',
88
/// list of available dialog decorators.
89
CAIRO_DOCK_WIDGET_DIALOG_DECORATOR_LIST='t',
90
/// list of available desklet decorations.
91
CAIRO_DOCK_WIDGET_DESKLET_DECORATION_LIST='O',
92
/// same but with the 'default' choice too.
93
CAIRO_DOCK_WIDGET_DESKLET_DECORATION_LIST_WITH_DEFAULT='o',
94
/// list of gauges themes.
95
CAIRO_DOCK_WIDGET_GAUGE_LIST='g',
96
/// list of existing docks.
97
CAIRO_DOCK_WIDGET_DOCK_LIST='d',
98
/// list of installed icon themes.
99
CAIRO_DOCK_WIDGET_ICON_THEME_LIST='w',
100
/// list of available modules.
101
CAIRO_DOCK_WIDGET_MODULE_LIST='N',
102
/// a button to jump to another module inside the config panel.
103
CAIRO_DOCK_WIDGET_JUMP_TO_MODULE='m',
104
/// same but only if the module exists.
105
CAIRO_DOCK_WIDGET_JUMP_TO_MODULE_IF_EXISTS='M',
108
CAIRO_DOCK_WIDGET_STRING_ENTRY='s',
109
/// a text entry with a file selector.
110
CAIRO_DOCK_WIDGET_FILE_SELECTOR='S',
111
/// a text entry with a folder selector.
112
CAIRO_DOCK_WIDGET_FOLDER_SELECTOR='D',
113
/// a text entry with a file selector and a 'play' button, for sound files.
114
CAIRO_DOCK_WIDGET_SOUND_SELECTOR='u',
115
/// a text entry with a shortkey selector.
116
CAIRO_DOCK_WIDGET_SHORTKEY_SELECTOR='k',
117
/// a text entry with a class selector.
118
CAIRO_DOCK_WIDGET_CLASS_SELECTOR='K',
119
/// a text entry, where text is hidden and the result is encrypted in the .conf file.
120
CAIRO_DOCK_WIDGET_PASSWORD_ENTRY='p',
121
/// a font selector button.
122
CAIRO_DOCK_WIDGET_FONT_SELECTOR='P',
125
CAIRO_DOCK_WIDGET_LIST='L',
126
/// a combo-entry, that is to say a list where one can add a custom choice.
127
CAIRO_DOCK_WIDGET_LIST_WITH_ENTRY='E',
128
/// a combo where the number of the line is used for the choice.
129
CAIRO_DOCK_WIDGET_NUMBERED_LIST='l',
130
/// a combo where the number of the line is used for the choice, and for controlling the sensitivity of the widgets below.
131
CAIRO_DOCK_WIDGET_NUMBERED_CONTROL_LIST='y',
132
/// 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}.
133
CAIRO_DOCK_WIDGET_NUMBERED_CONTROL_LIST_SELECTIVE='Y',
134
/// a tree view, where lines are numbered and can be moved up and down.
135
CAIRO_DOCK_WIDGET_TREE_VIEW_SORT='T',
136
/// a tree view, where lines can be added, removed, and moved up and down.
137
CAIRO_DOCK_WIDGET_TREE_VIEW_SORT_AND_MODIFY='U',
138
/// a tree view, where lines are numbered and can be selected or not.
139
CAIRO_DOCK_WIDGET_TREE_VIEW_MULTI_CHOICE='V',
141
/// an empty GtkContainer, to use by applets that want to build custom widgets.
142
CAIRO_DOCK_WIDGET_EMPTY_WIDGET='_',
143
/// a simple text label.
144
CAIRO_DOCK_WIDGET_TEXT_LABEL='>',
145
/// a simple text label.
146
CAIRO_DOCK_WIDGET_LINK='W',
147
/// a label containing the handbook of the applet.
148
CAIRO_DOCK_WIDGET_HANDBOOK='A',
149
/// an horizontal separator.
150
CAIRO_DOCK_WIDGET_SEPARATOR='v',
151
/// a frame. The previous frame will be closed.
152
CAIRO_DOCK_WIDGET_FRAME='F',
153
/// a frame inside an expander. The previous frame will be closed.
154
CAIRO_DOCK_WIDGET_EXPANDER='X',
155
CAIRO_DOCK_NB_GUI_WIDGETS
156
} CairoDockGUIWidgetType;
160
CAIRO_DOCK_MODEL_NAME = 0,
161
CAIRO_DOCK_MODEL_RESULT,
162
CAIRO_DOCK_MODEL_DESCRIPTION_FILE,
163
CAIRO_DOCK_MODEL_ACTIVE,
164
CAIRO_DOCK_MODEL_ORDER,
165
CAIRO_DOCK_MODEL_IMAGE,
166
CAIRO_DOCK_MODEL_ICON,
167
CAIRO_DOCK_MODEL_ORDER2,
168
CAIRO_DOCK_MODEL_STATE,
169
CAIRO_DOCK_MODEL_NB_COLUMNS
170
} CairoDockGUIModelColumns;
173
void cairo_dock_build_renderer_list_for_gui (GHashTable *pHashTable);
174
void cairo_dock_build_desklet_decorations_list_for_gui (GHashTable *pHashTable);
175
void cairo_dock_build_desklet_decorations_list_for_applet_gui (GHashTable *pHashTable);
176
void cairo_dock_build_animations_list_for_gui (GHashTable *pHashTable);
177
void cairo_dock_build_dialog_decorator_list_for_gui (GHashTable *pHashTable);
180
void _cairo_dock_set_value_in_pair (GtkSpinButton *pSpinButton, gpointer *data);
182
gchar *cairo_dock_parse_key_comment (gchar *cKeyComment, char *iElementType, guint *iNbElements, gchar ***pAuthorizedValuesList, gboolean *bAligned, gchar **cTipString);
184
GtkWidget *cairo_dock_build_group_widget (GKeyFile *pKeyFile, const gchar *cGroupName, const gchar *cGettextDomain, GtkWidget *pMainWindow, GSList **pWidgetList, GPtrArray *pDataGarbage, const gchar *cOriginalConfFilePath);
186
GtkWidget *cairo_dock_build_key_file_widget (GKeyFile* pKeyFile, const gchar *cGettextDomain, GtkWidget *pMainWindow, GSList **pWidgetList, GPtrArray *pDataGarbage, const gchar *cOriginalConfFilePath);
187
GtkWidget *cairo_dock_build_conf_file_widget (const gchar *cConfFilePath, const gchar *cGettextDomain, GtkWidget *pMainWindow, GSList **pWidgetList, GPtrArray *pDataGarbage, const gchar *cOriginalConfFilePath);
190
void cairo_dock_update_keyfile_from_widget_list (GKeyFile *pKeyFile, GSList *pWidgetList);
193
void cairo_dock_free_generated_widget_list (GSList *pWidgetList);
196
GSList *cairo_dock_find_widgets_from_name (GSList *pWidgetList, const gchar *cGroupName, const gchar *cKeyName);
197
GtkWidget *cairo_dock_find_widget_from_name (GSList *pWidgetList, const gchar *cGroupName, const gchar *cKeyName);
199
void cairo_dock_fill_combo_with_themes (GtkWidget *pCombo, GHashTable *pThemeTable, gchar *cActiveTheme);
200
void cairo_dock_fill_combo_with_list (GtkWidget *pCombo, GList *pElementList, const gchar *cActiveElement);