Cairo-Dock  3.4.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
cairo-dock-dialog-factory.h File Reference

Data Structures

struct  _CairoDialogRenderer
 Definition of a Dialog renderer. It draws the inside of the Dialog. More...
 
struct  _CairoDialogDecorator
 Definition of a Dialog/Menu decorator. It draws the frame of the Dialog/Menu. More...
 
struct  _CairoDialog
 Definition of a Dialog. More...
 

Macros

#define CAIRO_DOCK_IS_DIALOG(obj)
 
#define CAIRO_DIALOG(pContainer)
 

Functions

CairoDialoggldi_dialog_new (CairoDialogAttr *pAttribute)
 
CairoDialoggldi_dialog_show (const gchar *cText, Icon *pIcon, GldiContainer *pContainer, double fTimeLength, const gchar *cIconPath, GtkWidget *pInteractiveWidget, CairoDockActionOnAnswerFunc pActionFunc, gpointer data, GFreeFunc pFreeDataFunc)
 
CairoDialoggldi_dialog_show_temporary_with_icon_printf (const gchar *cText, Icon *pIcon, GldiContainer *pContainer, double fTimeLength, const gchar *cIconPath,...) G_GNUC_PRINTF(1
 
CairoDialog CairoDialoggldi_dialog_show_temporary_with_icon (const gchar *cText, Icon *pIcon, GldiContainer *pContainer, double fTimeLength, const gchar *cIconPath)
 
CairoDialoggldi_dialog_show_temporary (const gchar *cText, Icon *pIcon, GldiContainer *pContainer, double fTimeLength)
 
CairoDialoggldi_dialog_show_temporary_with_default_icon (const gchar *cText, Icon *pIcon, GldiContainer *pContainer, double fTimeLength)
 
CairoDialoggldi_dialog_show_with_question (const gchar *cText, Icon *pIcon, GldiContainer *pContainer, const gchar *cIconPath, CairoDockActionOnAnswerFunc pActionFunc, gpointer data, GFreeFunc pFreeDataFunc)
 
CairoDialoggldi_dialog_show_with_entry (const gchar *cText, Icon *pIcon, GldiContainer *pContainer, const gchar *cIconPath, const gchar *cTextForEntry, CairoDockActionOnAnswerFunc pActionFunc, gpointer data, GFreeFunc pFreeDataFunc)
 
CairoDialoggldi_dialog_show_with_value (const gchar *cText, Icon *pIcon, GldiContainer *pContainer, const gchar *cIconPath, double fValue, double fMaxValue, CairoDockActionOnAnswerFunc pActionFunc, gpointer data, GFreeFunc pFreeDataFunc)
 
CairoDialoggldi_dialog_show_general_message (const gchar *cMessage, double fTimeLength)
 
int gldi_dialog_show_and_wait (const gchar *cText, Icon *pIcon, GldiContainer *pContainer, const gchar *cIconPath, GtkWidget *pInteractiveWidget)
 
GtkWidget * gldi_dialog_steal_interactive_widget (CairoDialog *pDialog)
 

Detailed Description

This class defines the Dialog container, useful to bring interaction with the user. A Dialog is a container that points to an icon. It contains the following optionnal components :

  • a message
  • an image on its left
  • a interaction widget below it
  • some buttons at the bottom.

A Dialog is constructed with a set of attributes grouped inside a _CairoDialogAttribute. It has a Decorator that draws its shape, and a Renderer that draws its content.

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 you have to reference the dialog in the callback if you want to keep the dialog alive.

This class defines various helper functions to build a Dialog.

Note that Dialogs and Menus share the same rendering.

Macro Definition Documentation

#define CAIRO_DOCK_IS_DIALOG (   obj)

Say if an object is a Dialog.

Parameters
objthe object.
Returns
TRUE if the object is a dialog.
#define CAIRO_DIALOG (   pContainer)

Cast a Container into a Dialog.

Parameters
pContainerthe container.
Returns
the dialog.

Function Documentation

CairoDialog* gldi_dialog_new ( CairoDialogAttr *  pAttribute)

Create a new dialog.

Parameters
pAttributeattributes of the dialog.
Returns
the dialog.
CairoDialog* gldi_dialog_show ( const gchar *  cText,
Icon pIcon,
GldiContainer pContainer,
double  fTimeLength,
const gchar *  cIconPath,
GtkWidget *  pInteractiveWidget,
CairoDockActionOnAnswerFunc  pActionFunc,
gpointer  data,
GFreeFunc  pFreeDataFunc 
)

Pop up a dialog with a message, a widget, 2 buttons ok/cancel and an icon, all optionnal.

Parameters
cTextthe message to display.
pIconthe icon that will hold the dialog.
pContainerthe container of the icon.
fTimeLengththe duration of the dialog (in ms), or 0 for an unlimited dialog.
cIconPathpath to an icon to display in the margin.
pInteractiveWidgeta GTK widget; It is destroyed with the dialog. Use 'cairo_dock_steal_interactive_widget_from_dialog()' before if you want to keep it alive.
pActionFuncthe callback called when the user makes its choice. NULL means there will be no buttons.
datadata passed as a parameter of the callback.
pFreeDataFuncfunction used to free the data when the dialog is destroyed, or NULL if unnecessary.
Returns
the newly created dialog.
CairoDialog* gldi_dialog_show_temporary_with_icon_printf ( const gchar *  cText,
Icon pIcon,
GldiContainer pContainer,
double  fTimeLength,
const gchar *  cIconPath,
  ... 
)

Pop up a dialog with a message, and a limited duration, and an icon in the margin.

Parameters
cTextthe message to display.
pIconthe icon that will hold the dialog.
pContainerthe container of the icon.
fTimeLengththe duration of the dialog (in ms), or 0 for an unlimited dialog.
cIconPathpath to an icon.
...arguments to insert in the message, in a printf way.
Returns
the newly created dialog.
CairoDialog CairoDialog* gldi_dialog_show_temporary_with_icon ( const gchar *  cText,
Icon pIcon,
GldiContainer pContainer,
double  fTimeLength,
const gchar *  cIconPath 
)

Pop up a dialog with a message, and a limited duration, and an icon in the margin.

Parameters
cTextthe message to display.
pIconthe icon that will hold the dialog.
pContainerthe container of the icon.
fTimeLengththe duration of the dialog (in ms), or 0 for an unlimited dialog.
cIconPathpath to an icon.
Returns
the newly created dialog.
CairoDialog* gldi_dialog_show_temporary ( const gchar *  cText,
Icon pIcon,
GldiContainer pContainer,
double  fTimeLength 
)

Pop up a dialog with a message, and a limited duration, with no icon.

Parameters
cTextthe message to display.
pIconthe icon that will hold the dialog.
pContainerthe container of the icon.
fTimeLengththe duration of the dialog (in ms), or 0 for an unlimited dialog.
Returns
the newly created dialog et visible, avec une reference a 1.
CairoDialog* gldi_dialog_show_temporary_with_default_icon ( const gchar *  cText,
Icon pIcon,
GldiContainer pContainer,
double  fTimeLength 
)

Pop up a dialog with a message, and a limited duration, and a default icon.

Parameters
cTextthe format of the message to display.
pIconthe icon that will hold the dialog.
pContainerthe container of the icon.
fTimeLengththe duration of the dialog (in ms), or 0 for an unlimited dialog.
Returns
the newly created dialog et visible, avec une reference a 1.
CairoDialog* gldi_dialog_show_with_question ( const gchar *  cText,
Icon pIcon,
GldiContainer pContainer,
const gchar *  cIconPath,
CairoDockActionOnAnswerFunc  pActionFunc,
gpointer  data,
GFreeFunc  pFreeDataFunc 
)

Pop up a dialog with a question and 2 buttons ok/cancel. The dialog is unreferenced after the user has answered, so if you want to keep it alive, you have to reference it in the callback.

Parameters
cTextthe message to display.
pIconthe icon that will hold the dialog.
pContainerthe container of the icon.
cIconPathpath to an icon to display in the margin.
pActionFuncthe callback.
datadata passed as a parameter of the callback.
pFreeDataFuncfunction used to free the data.
Returns
the newly created dialog et visible, avec une reference a 1.
CairoDialog* gldi_dialog_show_with_entry ( const gchar *  cText,
Icon pIcon,
GldiContainer pContainer,
const gchar *  cIconPath,
const gchar *  cTextForEntry,
CairoDockActionOnAnswerFunc  pActionFunc,
gpointer  data,
GFreeFunc  pFreeDataFunc 
)

Pop up a dialog with a text entry and 2 buttons ok/cancel. The dialog is unreferenced after the user has answered, so if you want to keep it alive, you have to reference it in the callback.

Parameters
cTextthe message to display.
pIconthe icon that will hold the dialog.
pContainerthe container of the icon.
cIconPathpath to an icon to display in the margin.
cTextForEntrytext to display initially in the entry.
pActionFuncthe callback.
datadata passed as a parameter of the callback.
pFreeDataFuncfunction used to free the data.
Returns
the newly created dialog.
CairoDialog* gldi_dialog_show_with_value ( const gchar *  cText,
Icon pIcon,
GldiContainer pContainer,
const gchar *  cIconPath,
double  fValue,
double  fMaxValue,
CairoDockActionOnAnswerFunc  pActionFunc,
gpointer  data,
GFreeFunc  pFreeDataFunc 
)

Pop up a dialog with an horizontal scale between 0 and fMaxValue and 2 buttons ok/cancel. The dialog is unreferenced after the user has answered, so if you want to keep it alive, you have to reference it in the callback.

Parameters
cTextthe message to display.
pIconthe icon that will hold the dialog.
pContainerthe container of the icon.
cIconPathpath to an icon to display in the margin.
fValueinitial value of the scale.
fMaxValuemaximum value of the scale.
pActionFuncthe callback.
datadata passed as a parameter of the callback.
pFreeDataFuncfunction used to free the data.
Returns
the newly created dialog.
CairoDialog* gldi_dialog_show_general_message ( const gchar *  cMessage,
double  fTimeLength 
)

Pop up a dialog, pointing on "the best icon possible". This allows to display a general message.

Parameters
cMessagethe message.
fTimeLengthlife time of the dialog, in ms.
Returns
the newly created dialog, visible and with a reference of 1.
int gldi_dialog_show_and_wait ( const gchar *  cText,
Icon pIcon,
GldiContainer pContainer,
const gchar *  cIconPath,
GtkWidget *  pInteractiveWidget 
)

Pop up a dialog with GTK widget and 2 buttons ok/cancel, and block until the user makes its choice.

Parameters
cTextthe message to display.
pIconthe icon that will hold the dialog.
pContainerthe container of the icon.
cIconPathpath to an icon to display in the margin.
pInteractiveWidgetan interactive widget.
Returns
the number of the button that was clicked : 0 or -1 for OK, 1 or -2 for CANCEL, -3 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.
GtkWidget* gldi_dialog_steal_interactive_widget ( CairoDialog pDialog)

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.

Parameters
pDialogthe desklet with an interactive widget.
Returns
the widget.