File: dialogSupport.h

package info (click to toggle)
dfcgen-gtk 0.6-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,456 kB
  • sloc: ansic: 9,688; sh: 4,936; makefile: 207; sed: 16
file content (139 lines) | stat: -rw-r--r-- 5,333 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/**
 * \file        dialogSupport.h
 * \brief       Dialog helper functions.
 * \copyright   Copyright (C) 2006-2022 Ralf Hoppe <ralf.hoppe@dfcgen.de>
 */

#ifndef DLGSUPPORT_H
#define DLGSUPPORT_H


/* INCLUDE FILES **************************************************************/

#include "gui.h"


#ifdef  __cplusplus
extern "C" {
#endif


/* GLOBAL TYPE DECLARATIONS ***************************************************/


/* GLOBAL CONSTANT DECLARATIONS ***********************************************/


/* GLOBAL VARIABLE DECLARATIONS ***********************************************/


/* GLOBAL MACRO DEFINITIONS ***************************************************/


/* EXPORTED FUNCTIONS *********************************************************/


/* FUNCTION *******************************************************************/
/** Error message dialog.
 *
 *  \param topWidget    Toplevel widget.
 *  \param format       Printf like format string.
 *  \param ...          Arguments associated with format string.
 *
 ******************************************************************************/
    void dlgError (GtkWidget* topWidget, char* format, ...);


/* FUNCTION *******************************************************************/
/** File error message dialog.
 *
 *  \param topWidget    Toplevel widget.
 *  \param format       Printf like format string.
 *  \param filename     Filename in filesystem coding (must not be UTF-8), which
 *                      is used as first argument into the format string (needs
 *                      %s format coding).
 *  \param err          GLib error pointer.
 *
 ******************************************************************************/
    void dlgErrorFile (GtkWidget* topWidget, char* format, char *filename, GError *err);



/* FUNCTION *******************************************************************/
/** Fetches a double value from a GtkEntry dialog widget.
 *
 *  \param topWidget    Toplevel widget.
 *  \param ename        Name of text entry widget (as set by GLADE_HOOKUP_OBJECT).
 *  \param vmin         Minimum allowed value (after applying \p multiplier).
 *  \param vmax         Maximum allowed value (after applying \p multiplier).
 *  \param multiplier   Multiplier for scaling the result (wrt. units).
 *  \param pResult      Pointer to result buffer.
 *
 *  \return             TRUE on success, else FALSE. If FALSe is returned then
 *                      a message was given to the user indicating the wrong
 *                      input.
 ******************************************************************************/
    BOOL dlgGetDouble (GtkWidget* topWidget, const char *ename,
                       double vmin, double vmax, double multiplier, double *pResult);


/* FUNCTION *******************************************************************/
/** Fetches an integer value from a GtkEntry dialog widget.
 *
 *  \param topWidget    Toplevel widget.
 *  \param ename        Name of text entry widget (as set by GLADE_HOOKUP_OBJECT).
 *  \param vmin         Minimum allowed value.
 *  \param vmax         Maximum allowed value.
 *  \param pResult      Pointer to result buffer.
 *
 *  \return             TRUE on success, else FALSE. If FALSe is returned then
 *                      a message was given to the user indicating the wrong
 *                      input.
 ******************************************************************************/
    BOOL dlgGetInt (GtkWidget* topWidget, const char *ename,
                    int vmin, int vmax, int *pResult);


/* FUNCTION *******************************************************************/
/** Sets a double value into a GtkEntry dialog widget.
 *
 *  \param topWidget    Toplevel widget.
 *  \param name         Name of text entry widget (as set by GLADE_HOOKUP_OBJECT).
 *  \param multiplier   Multiplier for scaling the result (wrt. units).
 *  \param value        The double value to set.
 *
 ******************************************************************************/
    void dlgSetDouble (GtkWidget* topWidget, const char *name,
                       double multiplier, double value);



/* FUNCTION *******************************************************************/
/** A little popup dialog, where the user shall enter a double value.
 *
 *  \param topWindow    Parent window.
 *  \param title        Title of window.
 *  \param label        Label to put before the GtkEntry text field.
 *  \param comment      An introduction displayed at top of the dialog (may be
 *                      NULL, then nothing is displayed at top position).
 *  \param pResult      Pointer to result buffer, which must be initialized with
 *                      a default value.
 *
 *  \return             TRUE on success, FALSE if the user has canceled.
 ******************************************************************************/
    BOOL dlgPopupDouble (GtkWindow *topWindow, char *title, char *label,
                         char *comment, double *pResult);


#ifdef  __cplusplus
}
#endif


#endif /* DLGSUPPORT_H */


/******************************************************************************/
/* END OF FILE                                                                */
/******************************************************************************/