~ubuntu-branches/ubuntu/oneiric/cairo-dock/oneiric

« back to all changes in this revision

Viewing changes to src/cairo-dock-dialogs.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2010-08-09 23:26:12 UTC
  • mto: (18.1.1 cairo-dock) (19.1.1 cairo-dock)
  • 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_DIALOGS__
22
 
#define  __CAIRO_DIALOGS__
23
 
 
24
 
#include "cairo-dock-container.h"
25
 
G_BEGIN_DECLS
26
 
 
27
 
/** @file cairo-dock-dialogs.h This class defines the dialog container, that are useful to bring interaction with the user.
28
 
29
 
* With dialogs, you can pop-up messages, ask for question, etc. Any GTK widget can be embedded inside a dialog, giving you any possible interaction with the user.
30
 
31
 
* Dialogs are constructed with a set of attributes grouped inside a _CairoDialogAttribute. A dialog contains the following optionnal components :
32
 
* - a message
33
 
* - an image on its left
34
 
* - a interaction widget below it
35
 
* - some buttons at the bottom.
36
 
37
 
* To add buttons, you specify a list of images in the attributes. "ok" and "cancel" are key words for the default ok/cancel buttons. You also has to provide a callback function that will be called on click. When the user clicks on a button, the function is called with the number of the clicked button, counted from 0. -1 and -2 are set if the user pushed the Return or Escape keys. The dialog is unreferenced after the user's answer, so <i>you have to reference the dialog in the callback if you want to keep the dialog alive</i>.
38
 
39
 
* The most generic way to build a Dialog is to fill a _CairoDialogAttribute and pass it to \ref cairo_dock_build_dialog.
40
 
41
 
* But in most of case, you can just use one of the following convenient functions, that will do the job for you.
42
 
* - to show a message, you can use \ref cairo_dock_show_temporary_dialog_with_icon
43
 
* - to ask the user a choice, a value or a text, you can use \ref cairo_dock_show_dialog_with_question, \ref cairo_dock_show_dialog_with_value or \ref cairo_dock_show_dialog_with_entry.
44
 
* - if you need to block while waiting for the user, use the xxx_and_wait version of these functions.
45
 
* - if you want to pop up only 1 dialog at once on a given icon, use \ref cairo_dock_remove_dialog_if_any before you pop up your dialog.
46
 
*/
47
 
 
48
 
typedef gpointer CairoDialogRendererDataParameter;
49
 
typedef CairoDialogRendererDataParameter* CairoDialogRendererDataPtr;
50
 
typedef gpointer CairoDialogRendererConfigParameter;
51
 
typedef CairoDialogRendererConfigParameter* CairoDialogRendererConfigPtr;
52
 
 
53
 
typedef void (* CairoDialogRenderFunc) (cairo_t *pCairoContext, CairoDialog *pDialog, double fAlpha);
54
 
typedef void (* CairoDialogGLRenderFunc) (CairoDialog *pDialog, double fAlpha);
55
 
typedef gpointer (* CairoDialogConfigureRendererFunc) (CairoDialog *pDialog, cairo_t *pSourceContext, CairoDialogRendererConfigPtr pConfig);
56
 
typedef void (* CairoDialogUpdateRendererDataFunc) (CairoDialog *pDialog, CairoDialogRendererDataPtr pNewData);
57
 
typedef void (* CairoDialogFreeRendererDataFunc) (CairoDialog *pDialog);
58
 
/// Definition of a Dialog renderer. It draws the inside of the Dialog.
59
 
struct _CairoDialogRenderer {
60
 
        CairoDialogRenderFunc                           render;
61
 
        CairoDialogConfigureRendererFunc        configure;
62
 
        CairoDialogFreeRendererDataFunc         free_data;
63
 
        CairoDialogUpdateRendererDataFunc       update;
64
 
        CairoDialogGLRenderFunc                         render_opengl;
65
 
};
66
 
 
67
 
typedef void (* CairoDialogSetDecorationSizeFunc) (CairoDialog *pDialog);
68
 
typedef void (* CairoDialogRenderDecorationFunc) (cairo_t *pCairoContext, CairoDialog *pDialog);
69
 
typedef void (* CairoDialogGLRenderDecorationFunc) (CairoDialog *pDialog);
70
 
/// Definition of a Dialog decorator. It draws the frame of the Dialog.
71
 
struct _CairoDialogDecorator {
72
 
        CairoDialogSetDecorationSizeFunc                set_size;
73
 
        CairoDialogRenderDecorationFunc                 render;
74
 
        CairoDialogGLRenderDecorationFunc               render_opengl;
75
 
        const gchar *cDisplayedName;
76
 
};
77
 
 
78
 
/// Definition of a generic callback of a dialog, called when the user clicks on a button. Buttons unmber starts wito 0, -1 means 'Return' and -2 means 'Escape'.
79
 
typedef void (* CairoDockActionOnAnswerFunc) (int iClickedButton, GtkWidget *pInteractiveWidget, gpointer data, CairoDialog *pDialog);
80
 
 
81
 
/// Configuration attributes of a Dialog, which derives from a Container.
82
 
struct _CairoDialogAttribute {
83
 
        /// path to an image to display in the left margin, or NULL.
84
 
        gchar *cImageFilePath;
85
 
        /// size of the icon in the left margin, or 0 to use the default one.
86
 
        gint iIconSize;
87
 
        
88
 
        /// number of frames of the image, if it's an animated image, otherwise 0.
89
 
        gint iNbFrames;  // 0 <=> 1.
90
 
        /// text of the message, or NULL.
91
 
        gchar *cText;
92
 
        /// maximum authorized width of the message; it will scroll if it is too large. Set 0 to not limit it.
93
 
        gint iMaxTextWidth;  // 0 => pas de limite.
94
 
        /// A text rendering description of the message, or NULL to use the default one.
95
 
        CairoDockLabelDescription *pTextDescription;  // NULL => &myDialogs.dialogTextDescription
96
 
        
97
 
        /// a widget to interact with the user, or NULL.
98
 
        GtkWidget *pInteractiveWidget;
99
 
        /// a NULL-terminated list of images for buttons, or NULL. "ok" and "cancel" are key word to load the default "ok" and "cancel" buttons.
100
 
        gchar **cButtonsImage;
101
 
        /// function that will be called when the user click on a button, or NULL.
102
 
        CairoDockActionOnAnswerFunc pActionFunc;
103
 
        /// data passed as a parameter of the callback, or NULL.
104
 
        gpointer pUserData;
105
 
        /// a function to free the data when the dialog is destroyed, or NULL.
106
 
        GFreeFunc pFreeDataFunc;
107
 
        
108
 
        /// life time of the dialog, or 0 for an unlimited dialog.
109
 
        gint iTimeLength;
110
 
        /// name of a decorator, or NULL to use the default one.
111
 
        gchar *cDecoratorName;
112
 
        
113
 
        /// whether the dialog should be transparent to mouse input.
114
 
        gboolean bNoInput;
115
 
};
116
 
 
117
 
struct _CairoDialogButton {
118
 
        cairo_surface_t *pSurface;
119
 
        GLuint iTexture;
120
 
        int iOffset;  // offset courant du au clic.
121
 
};
122
 
 
123
 
/// Definition of a Dialog.
124
 
struct _CairoDialog {
125
 
        /// container.
126
 
        CairoContainer container;
127
 
        //\_____________________ position
128
 
        /// icon sur laquelle pointe the dialog.
129
 
        Icon *pIcon;
130
 
        /// position en X visee par la pointe dans le rĆ©fĆ©rentiel de l'Ć©cran.
131
 
        gint iAimedX;
132
 
        /// position en Y visee par la pointe dans le rĆ©fĆ©rentiel de l'Ć©cran.
133
 
        gint iAimedY;
134
 
        /// TRUE ssi the dialog est a droite de l'Ć©cran; dialog a droite <=> pointe a gauche.
135
 
        gboolean bRight;
136
 
        //\_____________________ dimensions et structure interne.
137
 
        /// dimensions de la bulle (message + widget utilisateur + boutons).
138
 
        gint iBubbleWidth, iBubbleHeight;
139
 
        /// dimensions du message en comptant la marge du texte + vgap en bas si necessaire.
140
 
        gint iMessageWidth, iMessageHeight;
141
 
        /// dimensions des boutons + vgap en haut.
142
 
        gint iButtonsWidth, iButtonsHeight;
143
 
        /// dimensions du widget interactif.
144
 
        gint iInteractiveWidth, iInteractiveHeight;
145
 
        /// distance de la bulle au dock, donc hauteur totale de la pointe.
146
 
        gint iDistanceToDock;
147
 
        /// le widget d'interaction utilisateur (GtkEntry, GtkHScale, zone de dessin, etc).
148
 
        GtkWidget *pInteractiveWidget;
149
 
        /// la structure interne du widget.
150
 
        GtkWidget *pLeftPaddingBox, *pRightPaddingBox, *pWidgetLayout;
151
 
        /// le widget de remplissage ou l'on dessine le message.
152
 
        GtkWidget *pMessageWidget;
153
 
        /// le widget de remplissage ou l'on dessine les boutons.
154
 
        GtkWidget *pButtonsWidget;
155
 
        /// le widget de remplissage ou l'on dessine la pointe.
156
 
        GtkWidget *pTipWidget;
157
 
        /// le widget de remplissage de la marge du haut.
158
 
        GtkWidget *pTopWidget;
159
 
        
160
 
        //\_____________________ surfaces
161
 
        /// surface representant the message to display.
162
 
        cairo_surface_t* pTextBuffer;
163
 
        /// dimension de la surface du texte.
164
 
        gint iTextWidth, iTextHeight;
165
 
        /// dimension de the icon, sans les marges (0 si aucune icon).
166
 
        gint iIconSize;
167
 
        /// surface representant the icon dans la marge a gauche du texte.
168
 
        cairo_surface_t* pIconBuffer;
169
 
        //\_____________________ renderer
170
 
        /// le moteur de rendu utilise pour dessiner the dialog.
171
 
        CairoDialogRenderer *pRenderer;
172
 
        /// donnees pouvant etre utilisees par le moteur de rendu.
173
 
        gpointer pRendererData;
174
 
        //\_____________________ decorateur
175
 
        /// le decorateur de fenetre.
176
 
        CairoDialogDecorator *pDecorator;
177
 
        /// taille que s'est reserve le decorateur.
178
 
        gint iLeftMargin, iRightMargin, iTopMargin, iBottomMargin,      iMinFrameWidth, iMinBottomGap;
179
 
        /// alignement de la pointe.
180
 
        gdouble fAlign;
181
 
        //\_____________________ actions
182
 
        /// fonction appelee au clique sur l'un des boutons.
183
 
        CairoDockActionOnAnswerFunc action_on_answer;
184
 
        /// donnees transmises a la fonction.
185
 
        gpointer pUserData;
186
 
        /// fonction appelee pour liberer les donnees.
187
 
        GFreeFunc pFreeUserDataFunc;
188
 
        /// number of buttons.
189
 
        int iNbButtons;
190
 
        
191
 
        /// le timer pour la destruction automatique du dialog.
192
 
        gint iSidTimer;
193
 
        /// conmpteur de reference.
194
 
        gint iRefCount;/// pour l'animation de the icon.
195
 
        gint iNbFrames, iCurrentFrame;
196
 
        /// pour le defilement du texte.
197
 
        gint iMaxTextWidth;
198
 
        /// offset for text scrolling.
199
 
        gint iCurrentTextOffset;
200
 
        /// timers these 2 animations.
201
 
        gint iSidAnimateIcon, iSidAnimateText;
202
 
        /// List of buttons.
203
 
        CairoDialogButton *pButtons;
204
 
        /// textures.
205
 
        GLuint iIconTexture, iTextTexture;
206
 
        /// whether the dialog is transparent to mouse input.
207
 
        gboolean bNoInput;
208
 
        /// TRUE to allow the dialog to be minimized once. The flag is reseted to FALSE after the desklet has minimized.
209
 
        gboolean bAllowMinimize;
210
 
        GdkBitmap* pShapeBitmap;
211
 
        GTimer *pUnmapTimer;
212
 
};
213
 
 
214
 
 
215
 
/** Say if a Container is a Dialog.
216
 
*@param pContainer the container.
217
 
*@return TRUE if the container is a dialog.
218
 
*/
219
 
#define CAIRO_DOCK_IS_DIALOG(pContainer) (pContainer != NULL && (pContainer)->iType == CAIRO_DOCK_TYPE_DIALOG)
220
 
 
221
 
/** Cast a Container into a Dialog.
222
 
*@param pContainer the container.
223
 
*@return the dialog.
224
 
*/
225
 
#define CAIRO_DIALOG(pContainer) ((CairoDialog *)pContainer)
226
 
 
227
 
void cairo_dock_load_dialog_buttons (CairoContainer *pContainer, gchar *cButtonOkImage, gchar *cButtonCancelImage);
228
 
void cairo_dock_unload_dialog_buttons (void);
229
 
 
230
 
/** Increase by 1 the reference of a dialog. Use #cairo_dock_dialog_unreference when you're done, so that the dialog can be destroyed.
231
 
*@param pDialog the dialog.
232
 
*@return TRUE if the reference was not nul, otherwise you must not use it.
233
 
*/
234
 
gboolean cairo_dock_dialog_reference (CairoDialog *pDialog);
235
 
 
236
 
/** Decrease by 1 the reference of a dialog. If the reference becomes nul, the disalog is destroyed.
237
 
*@param pDialog the dialog.
238
 
*@return TRUE if the reference became nul, in which case the dialog must not be used anymore.
239
 
*/
240
 
gboolean cairo_dock_dialog_unreference (CairoDialog *pDialog);
241
 
 
242
 
/** Free a dialog and all its allocated ressources, and remove it from the list of dialogs. Should never be used, use #cairo_dock_dialog_unreference instead.
243
 
*@param pDialog the dialog.
244
 
*/
245
 
void cairo_dock_free_dialog (CairoDialog *pDialog);
246
 
 
247
 
/** Unreference the dialogs pointed by an icon.
248
 
*@param icon the icon you want to delete all dialogs from.
249
 
*@param bAll whether all dialogs should be removed or only the one that don't have interaction with the user.
250
 
*@returns TRUE if at least one dialog has been unreferenced.
251
 
*/
252
 
gboolean cairo_dock_remove_dialog_if_any_full (Icon *icon, gboolean bAll);
253
 
 
254
 
/** Unreference all the dialogs pointed by an icon.
255
 
*@param icon the icon you want to delete all dialogs from.
256
 
*@returns TRUE if at least one dialog has been unreferenced.
257
 
*/
258
 
#define cairo_dock_remove_dialog_if_any(icon) cairo_dock_remove_dialog_if_any_full (icon, TRUE)
259
 
 
260
 
 
261
 
GtkWidget *cairo_dock_add_dialog_internal_box (CairoDialog *pDialog, int iWidth, int iHeight, gboolean bCanResize);
262
 
 
263
 
 
264
 
/** Generic function to pop up a dialog.
265
 
*@param pAttribute attributes of the dialog.
266
 
*@param pIcon the icon that will hold the dialog.
267
 
*@param pContainer the container of the icon.
268
 
*@return a newly created dialog, visible, with a reference of 1.
269
 
*/
270
 
CairoDialog *cairo_dock_build_dialog (CairoDialogAttribute *pAttribute, Icon *pIcon, CairoContainer *pContainer);
271
 
 
272
 
 
273
 
void cairo_dock_dialog_calculate_aimed_point (Icon *pIcon, CairoContainer *pContainer, int *iX, int *iY, gboolean *bRight, CairoDockTypeHorizontality *bIsHorizontal, gboolean *bDirectionUp, double fAlign);
274
 
 
275
 
void cairo_dock_place_dialog (CairoDialog *pDialog, CairoContainer *pContainer);
276
 
 
277
 
void cairo_dock_replace_all_dialogs (void);
278
 
 
279
 
void cairo_dock_compute_dialog_sizes (CairoDialog *pDialog);
280
 
 
281
 
/** Pop up a dialog with a message, a widget, 2 buttons ok/cancel and an icon, all optionnal.
282
 
*@param cText the message to display.
283
 
*@param pIcon the icon that will hold the dialog.
284
 
*@param pContainer the container of the icon.
285
 
*@param fTimeLength the duration of the dialog (in ms), or 0 for an unlimited dialog.
286
 
*@param cIconPath path to an icon to display in the margin.
287
 
*@param pInteractiveWidget a GTK widget; It is destroyed with the dialog. Use 'gtk_widget_reparent()' before if you want to keep it alive, or use #cairo_dock_show_dialog_and_wait.
288
 
*@param pActionFunc the callback called when the user makes its choice. NULL means there will be no buttons.
289
 
*@param data data passed as a parameter of the callback.
290
 
*@param pFreeDataFunc function used to free the data when the dialog is destroyed, or NULL if unnecessary.
291
 
*@return the newly created dialog, visible, with a reference of 1.
292
 
*/
293
 
CairoDialog *cairo_dock_show_dialog_full (const gchar *cText, Icon *pIcon, CairoContainer *pContainer, double fTimeLength, const gchar *cIconPath, GtkWidget *pInteractiveWidget, CairoDockActionOnAnswerFunc pActionFunc, gpointer data, GFreeFunc pFreeDataFunc);
294
 
 
295
 
/** Pop up a dialog with a message, and a limited duration, and an icon in the margin.
296
 
*@param cText the message to display.
297
 
*@param pIcon the icon that will hold the dialog.
298
 
*@param pContainer the container of the icon.
299
 
*@param fTimeLength the duration of the dialog (in ms), or 0 for an unlimited dialog.
300
 
*@param cIconPath path to an icon.
301
 
*@param ... arguments to insert in the message, in a printf way.
302
 
*@return the newly created dialog, visible, with a reference of 1.
303
 
*/
304
 
CairoDialog *cairo_dock_show_temporary_dialog_with_icon_printf (const gchar *cText, Icon *pIcon, CairoContainer *pContainer, double fTimeLength, const gchar *cIconPath, ...);
305
 
 
306
 
/** Pop up a dialog with a message, and a limited duration, and an icon in the margin.
307
 
*@param cText the message to display.
308
 
*@param pIcon the icon that will hold the dialog.
309
 
*@param pContainer the container of the icon.
310
 
*@param fTimeLength the duration of the dialog (in ms), or 0 for an unlimited dialog.
311
 
*@param cIconPath path to an icon.
312
 
*@return the newly created dialog, visible, with a reference of 1.
313
 
*/
314
 
CairoDialog *cairo_dock_show_temporary_dialog_with_icon (const gchar *cText, Icon *pIcon, CairoContainer *pContainer, double fTimeLength, const gchar *cIconPath);
315
 
 
316
 
/** Pop up a dialog with a message, and a limited duration, with no icon.
317
 
*@param cText the message to display.
318
 
*@param pIcon the icon that will hold the dialog.
319
 
*@param pContainer the container of the icon.
320
 
*@param fTimeLength the duration of the dialog (in ms), or 0 for an unlimited dialog.
321
 
*@return the newly created dialog, visible, with a reference of 1 et visible, avec une reference a 1.
322
 
*/
323
 
CairoDialog *cairo_dock_show_temporary_dialog (const gchar *cText, Icon *pIcon, CairoContainer *pContainer, double fTimeLength);
324
 
 
325
 
/** Pop up a dialog with a message, and a limited duration, and a default icon.
326
 
*@param cText the format of the message to display.
327
 
*@param pIcon the icon that will hold the dialog.
328
 
*@param pContainer the container of the icon.
329
 
*@param fTimeLength the duration of the dialog (in ms), or 0 for an unlimited dialog.
330
 
*@return the newly created dialog, visible, with a reference of 1 et visible, avec une reference a 1.
331
 
*/
332
 
CairoDialog *cairo_dock_show_temporary_dialog_with_default_icon (const gchar *cText, Icon *pIcon, CairoContainer *pContainer, double fTimeLength);
333
 
 
334
 
/** Pop up a dialog with a question and 2 buttons ok/cancel.
335
 
* When the user make its choice, the callback is called with the value "yes" if he clicked on "ok", and with "no" if he clicked on "cancel".
336
 
* The dialog is unreferenced after that, so if you want to keep it alive, you have to reference it in the callback.
337
 
*@param cText the message to display.
338
 
*@param pIcon the icon that will hold the dialog.
339
 
*@param pContainer the container of the icon.
340
 
*@param cIconPath path to an icon to display in the margin.
341
 
*@param pActionFunc the callback.
342
 
*@param data data passed as a parameter of the callback.
343
 
*@param pFreeDataFunc function used to free the data.
344
 
*@return the newly created dialog, visible, with a reference of 1 et visible, avec une reference a 1.
345
 
*/
346
 
CairoDialog *cairo_dock_show_dialog_with_question (const gchar *cText, Icon *pIcon, CairoContainer *pContainer, const gchar *cIconPath, CairoDockActionOnAnswerFunc pActionFunc, gpointer data, GFreeFunc pFreeDataFunc);
347
 
 
348
 
/** Pop up a dialog with a text entry and 2 buttons ok/cancel.
349
 
* When the user make its choice, the callback is called with the value of the entry if he clicked on "ok", and with "" if he clicked on "cancel".
350
 
* The dialog is unreferenced after that, so if you want to keep it alive, you have to reference it in the callback.
351
 
*@param cText the message to display.
352
 
*@param pIcon the icon that will hold the dialog.
353
 
*@param pContainer the container of the icon.
354
 
*@param cIconPath path to an icon to display in the margin.
355
 
*@param cTextForEntry text to display initially in the entry.
356
 
*@param pActionFunc the callback.
357
 
*@param data data passed as a parameter of the callback.
358
 
*@param pFreeDataFunc function used to free the data.
359
 
*@return the newly created dialog, visible, with a reference of 1.
360
 
*/
361
 
CairoDialog *cairo_dock_show_dialog_with_entry (const gchar *cText, Icon *pIcon, CairoContainer *pContainer, const gchar *cIconPath, const gchar *cTextForEntry, CairoDockActionOnAnswerFunc pActionFunc, gpointer data, GFreeFunc pFreeDataFunc);
362
 
 
363
 
/** Pop up a dialog with an horizontal scale between 0 and fMaxValue and 2 buttons ok/cancel.
364
 
* When the user make its choice, the callback is called with the value of the scale in a text form if he clicked on "ok", and with "-1" if he clicked on "cancel".
365
 
* The dialog is unreferenced after that, so if you want to keep it alive, you have to reference it in the callback.
366
 
*@param cText the message to display.
367
 
*@param pIcon the icon that will hold the dialog.
368
 
*@param pContainer the container of the icon.
369
 
*@param cIconPath path to an icon to display in the margin.
370
 
*@param fValue initial value of the scale.
371
 
*@param fMaxValue maximum value of the scale.
372
 
*@param pActionFunc the callback.
373
 
*@param data data passed as a parameter of the callback.
374
 
*@param pFreeDataFunc function used to free the data.
375
 
*@return the newly created dialog, visible, with a reference of 1.
376
 
*/
377
 
CairoDialog *cairo_dock_show_dialog_with_value (const gchar *cText, Icon *pIcon, CairoContainer *pContainer, const gchar *cIconPath, double fValue, double fMaxValue, CairoDockActionOnAnswerFunc pActionFunc, gpointer data, GFreeFunc pFreeDataFunc);
378
 
 
379
 
 
380
 
 
381
 
/** Pop up a dialog with GTK widget and 2 buttons ok/cancel, and block until the user makes its choice.
382
 
*@param cText the message to display.
383
 
*@param pIcon the icon that will hold the dialog.
384
 
*@param pContainer the container of the icon.
385
 
*@param fTimeLength time length of the dialog, or 0 for an unlimited dialog.
386
 
*@param cIconPath path to an icon to display in the margin.
387
 
*@param pInteractiveWidget an interactive widget.
388
 
*@return GTK_RESPONSE_OK if the user has valideated, GTK_RESPONSE_CANCEL if he cancelled, GTK_RESPONSE_NONE if the dialog has been destroyed before. The dialog is destroyed after the user choosed, but the interactive widget is not destroyed, which allows to retrieve the changes made by the user. Destroy it with 'gtk_widget_destroy' when you're done with it.
389
 
*/
390
 
int cairo_dock_show_dialog_and_wait (const gchar *cText, Icon *pIcon, CairoContainer *pContainer, double fTimeLength, const gchar *cIconPath, GtkWidget *pInteractiveWidget);
391
 
 
392
 
/** Pop up a dialog with a text entry, and 2 buttons ok/cancel, and block until the user makes its choice.
393
 
*@param cMessage the message to display.
394
 
*@param pIcon the icon that will hold the dialog.
395
 
*@param pContainer the container of the icon.
396
 
*@param cInitialAnswer the initial value of the entry (can be NULL).
397
 
*@return the text entered by the user, or NULL if he cancelled or if the dialog has been destroyed before.
398
 
*/
399
 
gchar *cairo_dock_show_demand_and_wait (const gchar *cMessage, Icon *pIcon, CairoContainer *pContainer, const gchar *cInitialAnswer);
400
 
 
401
 
/** Pop up a dialog with an horizontal scale between 0 and fMaxValue, and 2 buttons ok/cancel, and block until the user makes its choice.
402
 
*@param cMessage the message to display.
403
 
*@param pIcon the icon that will hold the dialog.
404
 
*@param pContainer the container of the icon.
405
 
*@param fInitialValue the initial value of the scale.
406
 
*@param fMaxValue the maximum value of the scale.
407
 
*@return the value choosed by the user, or -1 if he cancelled or if the dialog has been destroyed before.
408
 
*/
409
 
double cairo_dock_show_value_and_wait (const gchar *cMessage, Icon *pIcon, CairoContainer *pContainer, double fInitialValue, double fMaxValue);
410
 
 
411
 
/** Pop up a dialog with a question and 2 buttons yes/no, and block until the user makes its choice.
412
 
*@param cQuestion the question to ask.
413
 
*@param pIcon the icon that will hold the dialog.
414
 
*@param pContainer the container of the icon.
415
 
*@return GTK_RESPONSE_YES ou GTK_RESPONSE_NO according to the user's choice, or GTK_RESPONSE_NONE if the dialog has been destroyed before.
416
 
*/
417
 
int cairo_dock_ask_question_and_wait (const gchar *cQuestion, Icon *pIcon, CairoContainer *pContainer);
418
 
 
419
 
 
420
 
/** Test if an icon has at least one dialog.
421
 
*@param pIcon the icon.
422
 
*@return TRUE if the icon has one or more dialog(s).
423
 
*/
424
 
gboolean cairo_dock_icon_has_dialog (Icon *pIcon);
425
 
 
426
 
/** Search the "the best icon possible" to hold a general dialog.
427
 
*@return an icon, never NULL except if the dock is.
428
 
*/
429
 
Icon *cairo_dock_get_dialogless_icon (void);
430
 
 
431
 
 
432
 
/** Pop up a dialog, pointing on "the best icon possible". This allows to display a general message.
433
 
*@param cMessage the message.
434
 
*@param fTimeLength life time of the dialog, in ms.
435
 
*@return the newly created dialog, visible and with a reference of 1.
436
 
*/
437
 
CairoDialog * cairo_dock_show_general_message (const gchar *cMessage, double fTimeLength);
438
 
 
439
 
/* Pop up a blocking dialog with a question, pointing on "the best icon possible". This allows to ask a general question and freeze the application until the user answers.
440
 
*@param cQuestion the question to ask.
441
 
*@return same #cairo_dock_ask_question_and_wait.
442
 
*/
443
 
int cairo_dock_ask_general_question_and_wait (const gchar *cQuestion);
444
 
 
445
 
 
446
 
/** Hide a dialog.
447
 
*@param pDialog the dialog.
448
 
*/
449
 
void cairo_dock_hide_dialog (CairoDialog *pDialog);
450
 
/** Show a dialog and give it focus.
451
 
*@param pDialog the dialog.
452
 
*/
453
 
void cairo_dock_unhide_dialog (CairoDialog *pDialog);
454
 
/** Toggle the visibility of a dialog.
455
 
*@param pDialog the dialog.
456
 
*/
457
 
void cairo_dock_toggle_dialog_visibility (CairoDialog *pDialog);
458
 
 
459
 
GtkWidget *cairo_dock_steal_widget_from_its_container (GtkWidget *pWidget);
460
 
/** Detach the interactive widget from a dialog. The widget can then be placed anywhere after that. You have to unref it after you placed it into a container, or to destroy it.
461
 
*@param pDialog the desklet with an interactive widget.
462
 
*@return the widget.
463
 
*/
464
 
GtkWidget *cairo_dock_steal_interactive_widget_from_dialog (CairoDialog *pDialog);
465
 
 
466
 
void cairo_dock_set_new_dialog_text_surface (CairoDialog *pDialog, cairo_surface_t *pNewTextSurface, int iNewTextWidth, int iNewTextHeight);
467
 
void cairo_dock_set_new_dialog_icon_surface (CairoDialog *pDialog, cairo_surface_t *pNewIconSurface, int iNewIconSize);
468
 
 
469
 
void cairo_dock_set_dialog_message (CairoDialog *pDialog, const gchar *cMessage);
470
 
void cairo_dock_set_dialog_message_printf (CairoDialog *pDialog, const gchar *cMessageFormat, ...);
471
 
void cairo_dock_set_dialog_icon (CairoDialog *pDialog, const gchar *cImageFilePath);
472
 
 
473
 
void cairo_dock_damage_icon_dialog (CairoDialog *pDialog);
474
 
void cairo_dock_damage_text_dialog (CairoDialog *pDialog);
475
 
void cairo_dock_damage_interactive_widget_dialog (CairoDialog *pDialog);
476
 
 
477
 
 
478
 
G_END_DECLS
479
 
#endif