~cairo-dock-team/ubuntu/oneiric/cairo-dock/2.3.0-3

« back to all changes in this revision

Viewing changes to src/gldit/cairo-dock-gui-manager.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2010-08-09 23:26:12 UTC
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: james.westby@ubuntu.com-20100809232612-pocdxliaxjdetm37
Tags: upstream-2.2.0~0beta4
ImportĀ upstreamĀ versionĀ 2.2.0~0beta4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* This file is a part of the Cairo-Dock project
 
3
*
 
4
* Copyright : (C) see the 'copyright' file.
 
5
* E-mail    : see the 'copyright' file.
 
6
*
 
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.
 
11
*
 
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/>.
 
18
*/
 
19
 
 
20
 
 
21
#ifndef __CAIRO_DOCK_GUI_MANAGER__
 
22
#define  __CAIRO_DOCK_GUI_MANAGER__
 
23
 
 
24
#include <gtk/gtk.h>
 
25
#include "cairo-dock-struct.h"
 
26
G_BEGIN_DECLS
 
27
 
 
28
/** @file cairo-dock-gui-manager.h This class manages the config panels of Cairo-Dock.
 
29
 
30
* GUIs are built from a .conf file; .conf files are normal group/key files, but with some special indications in the comments. Each key will be represented by a pre-defined widget, that is defined by the first caracter of its comment. The comment also contains a description of the key, and an optionnal tooltip. See cairo-dock-gui-factory.h for the list of pre-defined widgets and a short explanation on how to use them inside a conf file. The file 'cairo-dock.conf' can be an useful example.
 
31
 
32
* The class defines the interface that a backend to the main GUI of Cairo-Dock should implement.
 
33
* It also provides a useful function to easily build a window from a conf file : \ref cairo_dock_build_generic_gui
 
34
 
35
*/
 
36
 
 
37
/// Definition of the GUI interface.
 
38
struct _CairoDockGuiBackend {
 
39
        /// display a message on the GUI.
 
40
        void (*set_status_message_on_gui) (const gchar *cMessage);
 
41
        /// Show the main config panel, build it if necessary.
 
42
        GtkWidget * (*show_main_gui) (void);
 
43
        /// Show the config panel of a given module (internal or external), reload it if it was already opened.
 
44
        void (*show_module_gui) (const gchar *cModuleName);
 
45
        /// Show the config panel of a given module instance, reload it if it was already opened. iShowPage is the page that should be displayed in case the module has several pages, -1 means to keep the current page.
 
46
        void (*show_module_instance_gui) (CairoDockModuleInstance *pModuleInstance, int iShowPage);
 
47
        /// say whether the config of a module instance is currently opened.
 
48
        gboolean (*module_is_opened) (CairoDockModuleInstance *pModuleInstance);
 
49
        /// update the GUI to mark a module as 'inactive'.
 
50
        void (*deactivate_module_in_gui) (const gchar *cModuleName);
 
51
        /// retrieve the widgets in the current module window, corresponding to the (group,key) pair in its conf file.
 
52
        CairoDockGroupKeyWidget * (*get_widget_from_name) (const gchar *cGroupName, const gchar *cKeyName);
 
53
        /// close the config panels.
 
54
        void (*close_gui) (void);
 
55
        } ;
 
56
typedef struct _CairoDockGuiBackend CairoDockGuiBackend;
 
57
 
 
58
/// Definition of the callback called when the user apply the config panel.
 
59
typedef gboolean (* CairoDockApplyConfigFunc) (gpointer data);
 
60
typedef void (* CairoDockLoadCustomWidgetFunc) (GtkWidget *pWindow, GKeyFile *pKeyFile);
 
61
typedef void (* CairoDockSaveCustomWidgetFunc) (GtkWidget *pWindow, GKeyFile *pKeyFile);
 
62
 
 
63
 
 
64
int cairo_dock_get_nb_dialog_windows (void);
 
65
void cairo_dock_dialog_window_destroyed (void);
 
66
void cairo_dock_dialog_window_created (void);
 
67
 
 
68
/**Retrieve the group-key widget in the current config panel, corresponding to the (group,key) pair in its conf file.
 
69
@param cGroupName name of the group in the conf file.
 
70
@param cKeyName name of the key in the conf file.
 
71
@return the group-key widget that match the group and key, or NULL if none was found.
 
72
*/
 
73
CairoDockGroupKeyWidget *cairo_dock_get_group_key_widget_from_name (const gchar *cGroupName, const gchar *cKeyName);
 
74
 
 
75
/** A mere wrapper around the previous function, that returns directly the GTK widget corresponding to the (group,key). Note that empty widgets will return NULL, so you can't you can't distinguish between an empty widget and an inexisant widget.
 
76
@param cGroupName name of the group in the conf file.
 
77
@param cKeyName name of the key in the conf file.
 
78
@return the widget that match the group and key, or NULL if the widget is empty or if none was found.
 
79
*/
 
80
GtkWidget *cairo_dock_get_widget_from_name (const gchar *cGroupName, const gchar *cKeyName);
 
81
 
 
82
void cairo_dock_reload_current_module_widget_full (CairoDockModuleInstance *pInstance, int iShowPage);
 
83
 
 
84
/**Reload the widget of a given module instance if it is currently opened (the current page is displayed). This is useful if the module has modified its conf file and wishes to display the changes.
 
85
@param pInstance an instance of a module.
 
86
*/
 
87
#define cairo_dock_reload_current_module_widget(pInstance) cairo_dock_reload_current_module_widget_full (pInstance, -1)
 
88
 
 
89
void cairo_dock_deactivate_module_in_gui (const gchar *cModuleName);
 
90
void cairo_dock_update_desklet_size_in_gui (CairoDockModuleInstance *pModuleInstance, int iWidth, int iHeight);
 
91
void cairo_dock_update_desklet_position_in_gui (CairoDockModuleInstance *pModuleInstance, int x, int y);
 
92
void cairo_dock_update_desklet_detached_state_in_gui (CairoDockModuleInstance *pModuleInstance, gboolean bIsDetached);
 
93
 
 
94
/** Display a message on a given window that has a status-bar. If no window is provided, the current config panel will be used.
 
95
@param pWindow window where the message should be displayed, or NULL to target the config panel.
 
96
@param cMessage the message.
 
97
*/
 
98
void cairo_dock_set_status_message (GtkWidget *pWindow, const gchar *cMessage);
 
99
/** Display a message on a given window that has a status-bar. If no window is provided, the current config panel will be used.
 
100
@param pWindow window where the message should be displayed, or NULL to target the config panel.
 
101
@param cFormat the message, in a printf-like format
 
102
@param ... arguments of the format.
 
103
*/
 
104
void cairo_dock_set_status_message_printf (GtkWidget *pWindow, const gchar *cFormat, ...) G_GNUC_PRINTF (2, 3);
 
105
 
 
106
 
 
107
/** Register a GUI backend to be the current one.
 
108
@param pBackend the new backend.
 
109
*/
 
110
void cairo_dock_register_gui_backend (CairoDockGuiBackend *pBackend);
 
111
 
 
112
/** Show the main config panel.
 
113
*/
 
114
GtkWidget *cairo_dock_show_main_gui (void);
 
115
/** Show the config panel of a given module instance. Reload the widgets if the panel was already opened.
 
116
@param pModuleInstance the module instance
 
117
@param iShowPage the specific page to display, or -1 to keep the current one if the instance is already opened.
 
118
*/
 
119
void cairo_dock_show_module_instance_gui (CairoDockModuleInstance *pModuleInstance, int iShowPage);
 
120
/** Show the config panel of a given module (internal or external). Reload the widgets if the panel was already opened.
 
121
@param cModuleName name of the module.
 
122
*/
 
123
void cairo_dock_show_module_gui (const gchar *cModuleName);
 
124
/** Close the config panel(s).
 
125
*/
 
126
void cairo_dock_close_gui (void);
 
127
 
 
128
 
 
129
/** Build a generic GUI window, that contains 2 buttons apply and quit, and a statusbar.
 
130
@param cTitle title to set to the window.
 
131
@param iWidth width of the window.
 
132
@param iHeight height of the window.
 
133
@param pAction callback to be called when the apply button is pressed, or NULL.
 
134
@param pUserData data passed to the previous callback, or NULL.
 
135
@param pFreeUserData callback called when the window is destroyed, to free the previous data, or NULL.
 
136
@return the new window.
 
137
*/
 
138
GtkWidget *cairo_dock_build_generic_gui_window (const gchar *cTitle, int iWidth, int iHeight, CairoDockApplyConfigFunc pAction, gpointer pUserData, GFreeFunc pFreeUserData);
 
139
 
 
140
GtkWidget *cairo_dock_build_generic_gui_full (const gchar *cConfFilePath, const gchar *cGettextDomain, const gchar *cTitle, int iWidth, int iHeight, CairoDockApplyConfigFunc pAction, gpointer pUserData, GFreeFunc pFreeUserData, CairoDockLoadCustomWidgetFunc load_custom_widgets, CairoDockSaveCustomWidgetFunc save_custom_widgets);
 
141
 
 
142
/** Load a conf file into a generic window, that contains 2 buttons apply and quit, and a statusbar. If no callback is provided, the window is blocking, until the user press one of the button; in this case, TRUE is returned if ok was pressed.
 
143
@param cConfFilePath conf file to load into the window.
 
144
@param cGettextDomain translation domain.
 
145
@param cTitle title to set to the window.
 
146
@param iWidth width of the window.
 
147
@param iHeight height of the window.
 
148
@param pAction callback to be called when the apply button is pressed, or NULL.
 
149
@param pUserData data passed to the previous callback, or NULL.
 
150
@param pFreeUserData callback called when the window is destroyed, to free the previous data, or NULL.
 
151
@param pWindow pointer to the newly created window.
 
152
@return the new window.
 
153
*/
 
154
#define cairo_dock_build_generic_gui(cConfFilePath, cGettextDomain, cTitle, iWidth, iHeight, pAction, pUserData, pFreeUserData) cairo_dock_build_generic_gui_full (cConfFilePath, cGettextDomain, cTitle, iWidth, iHeight, pAction, pUserData, pFreeUserData, NULL, NULL)
 
155
 
 
156
/** Reload a generic window built upon a conf file, by parsing again the conf file.
 
157
@param pWindow the window.
 
158
*/
 
159
void cairo_dock_reload_generic_gui (GtkWidget *pWindow);
 
160
 
 
161
 
 
162
 
 
163
/// Definition of the launcher GUI interface.
 
164
struct _CairoDockLauncherGuiBackend {
 
165
        /// Show the config panel on a given launcher, build or reload it if necessary.
 
166
        GtkWidget * (*show_gui) (Icon *pIcon);
 
167
        /// reload the gui and its content, for the case a launcher has changed (image, order, new container, etc).
 
168
        void (*refresh_gui) (void);
 
169
        } ;
 
170
typedef struct _CairoDockLauncherGuiBackend CairoDockLauncherGuiBackend;
 
171
 
 
172
/** Register a launcher GUI backend to be the current one.
 
173
@param pBackend the new backend.
 
174
*/
 
175
void cairo_dock_register_launcher_gui_backend (CairoDockLauncherGuiBackend *pBackend);
 
176
 
 
177
/** Build and show the launcher GUI for a given launcher.
 
178
@param pIcon the launcher.
 
179
@return the GUI window.
 
180
*/
 
181
GtkWidget *cairo_dock_build_launcher_gui (Icon *pIcon);
 
182
 
 
183
/** Trigger the refresh of the launcher GUI. The refresh well happen when the main loop gets available.
 
184
*/
 
185
void cairo_dock_trigger_refresh_launcher_gui (void);
 
186
 
 
187
 
 
188
G_END_DECLS
 
189
#endif