gtk_dlg_std.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include "../ut/ut_cast.h"
#include "../ut/ut_umem.h"
#include "../gui/gui_types.h"
#include "../gui/gui_base.h"
#include "../gui_gtk/gtk_base.h"
#include "../gui_gtk/gtk_entry.h"
#include "../gui_gtk/gtk_label.h"
#include "../gui_gtk/gtk_button.h"
#include "../gui_gtk/gtk_dlg_std.h"
Defines |
#define | IMIN(x, y) (((x)<(y))?(x):(y)) |
Functions |
int | GUI_DialogYN_CB (void *parent, void *data) |
int | GUI_DialogEntryCB (void *parent, void **data) |
int | GUI_Dialog_2b (char *txt, char *tb1, char *tb2) |
int | GUI_Dialog_e2b (char *txt, char *entry, int eSiz, char *tb1, char *tb2) |
int | GUI_DialogEntry (char *label, char *entry, int eSiz, char *buttons[], int border) |
void | GUI_DialogYN (char *text, void *funcnam) |
int | GUI_MsgBox (char *text) |
int | GUI_Color_select (int *ir, int *ig, int *ib) |
double | GUI_Slider_get (MemObj *mo) |
void | GUI_Slider_set (MemObj *mo, double newVal) |
MemObj | GUI_Slider__ (MemObj *o_par, int typ, void *funcnam, double valMin, double valMax, double valStart, char *opts) |
int | GUI_Slider_cb (void *parent, MemObj mo) |
Variables |
int | UI_fontsizX |
int | UI_fontsizY |
GtkWidget * | UI_MainWin |
static GtkWidget * | UI_DialogYNWin = NULL |
static void(* | UI_DialogYNFunc )() |
static MemObj | UI_DialogEntryWin |
Detailed Description
=====================================================
List_functions_start:
GUI_MsgBox display text, OK-Button, also if GTK is not yet up
GUI_DialogYN dialogWindow w. OK-Button, Cancel-Button, callback-func
GUI_DialogEntry dialogWindow 1-n buttons, entry (opt.), waiting.
GUI_Dialog_2b dialogWindow w. 2 Buttons, waiting.
GUI_Dialog_e2b dialogWindow w. entry, 2 Buttons, waiting.
GUI_Color_select select-color-Dialog. Modal (wait).
GUI_Slider__ Slider = AdjustmentControl
GUI_Slider_set change slider-value
GUI_Slider_get query slider-value
GUI_DialogYN_CB INTERNAL callback of GUI_DialogYN
GUI_DialogEntryCB INTERNAL callback of GUI_DialogEntry
GUI_Slider_cb INTERNAL slider callback
List_functions_end:
=====================================================
needs gtk_entry
Define Documentation
#define IMIN |
( |
x, |
|
|
y |
|
) |
(((x)<(y))?(x):(y)) |
Function Documentation
int GUI_DialogYN_CB |
( |
void * |
parent, |
|
|
void * |
data | |
|
) |
| | |
INTERNAL callback of GUI_DialogYN
int GUI_DialogEntryCB |
( |
void * |
parent, |
|
|
void ** |
data | |
|
) |
| | |
INTERNAL callback of GUI_DialogEntry
int GUI_Dialog_2b |
( |
char * |
txt, |
|
|
char * |
tb1, |
|
|
char * |
tb2 | |
|
) |
| | |
GUI_Dialog_2b dialogWindow w. 2 Buttons, waiting.
Input
txt text label
tb1 caption button 1
tb2 caption button 2
RetCod nr of button pressed or UI_FuncKill (delete window)
0 means first button pressed, 1=second ..
-1 = dialog cancelled
int GUI_Dialog_e2b |
( |
char * |
txt, |
|
|
char * |
entry, |
|
|
int |
eSiz, |
|
|
char * |
tb1, |
|
|
char * |
tb2 | |
|
) |
| | |
GUI_Dialog_e2b dialogWindow w. entry, 2 Buttons, waiting.
Input
txt label
entry entrytext, in & out
eSiz size of inputfield entry (max. nr of chars)
tb1 caption button 1
tb2 caption button 2
Output:
entry entrytext
RetCod nr of button pressed or UI_FuncKill (delete window)
0 means first button pressed, 1=second ..
-1 = dialog cancelled
int GUI_DialogEntry |
( |
char * |
label, |
|
|
char * |
entry, |
|
|
int |
eSiz, |
|
|
char * |
buttons[], |
|
|
int |
border | |
|
) |
| | |
GUI_DialogEntry text, 1-n buttons; entry optional; waits for return.
Input
label text
entry userinput - defaultText; NULL = no userinput (only buttons)
eSiz size of inputfield entry (max. nr of chars)
buttons pointerarray of buttontext, NULL-terminated.
border size around button
Output:
entry content of inputfield on exit
eSiz nr of chars in inputfield entry
RetCod nr of button pressed or -1 = dialog cancelled
0 means first button pressed, 1=second ..
Example without entry:
char *buttons[]={"YES","NO","Cancel",NULL}, s1[256];
irc = GUI_DialogEntry ("Save model -", NULL, 0, buttons, 2);
Example with entry:
strcpy (s1, "myName");
irc = GUI_DialogEntry ("GUI_DialogEntry", s1, 250, buttons, 2);
void GUI_DialogYN |
( |
char * |
text, |
|
|
void * |
funcnam | |
|
) |
| | |
GUI_DialogYN dialogWindow with text, OK-Button and Cancel-Button.
<funcnam> is called with int-value UI_FuncOK or UI_FuncCancel.
Input:
text multiple lines with \n
funcnam callbackfunktion for button-press
funcnam prototyp:
int funcnam (MemObj *parent, void **data);
GUI_DATA_EVENT =*(int*)data[0]=UI_FuncOK|UI_FuncCancel
Example:
GUI_DialogYN ("OK to save file xy", f_CB_save);
int f_CB_save (MemObj *mo, void **data) {
int idat;
idat = GUI_DATA_EVENT;
printf("f_CB_save %d\n",idat);
switch(idat) {
case UI_FuncOK:
break;
case UI_FuncCancel:
break;
}
return 0;
}
int GUI_MsgBox |
( |
char * |
text |
) |
|
display text, OK-Button.
Works also if GTK is not yet up.
int GUI_Color_select |
( |
int * |
ir, |
|
|
int * |
ig, |
|
|
int * |
ib | |
|
) |
| | |
GUI_Color_select select-color-Dialog. Modal (wait).
Returns 3 colors as 16-bit-integers.
Returncode 0=OK; -1=cancel.
double GUI_Slider_get |
( |
MemObj * |
mo |
) |
|
void GUI_Slider_set |
( |
MemObj * |
mo, |
|
|
double |
newVal | |
|
) |
| | |
MemObj GUI_Slider__ |
( |
MemObj * |
o_par, |
|
|
int |
typ, |
|
|
void * |
funcnam, |
|
|
double |
valMin, |
|
|
double |
valMax, |
|
|
double |
valStart, |
|
|
char * |
opts | |
|
) |
| | |
GUI_Slider__ Slider = AdjustmentControl
Input:
parent parentBox
typ 0=horizontal, 1=vertical.
funcnam callBack-function for moving the slider; NULL = no callback.
siz 0 minimum size (size of caption)
1 maximum size (expand inside container)
>1 prepare size for <siz> nr of characters
<0 absolute size (in pixels)
funcnam prototyp:
int funcnam (MemObj *mo, void **data);
GUI_DATA_EVENT = *(int*)data[0] = TYP_EventMove
GUI_DATA_D1 = *(double*)data[1] = slider-value
GUI_OBJ_TYP(mo) = TYP_GUI_Slider
Example without callback:
wsl1 = GUI_Slider__ (&box1, 0, NULL, 0., 1., 0.5, 1);
printf(" sliVal=%f\n",GUI_Slider_get(&wsl1));
GUI_Slider_set (&wsl1, 0.75);
Example with callback:
wsl1 = GUI_Slider__ (&box1, 0, sl_CB, 0., 1., 0.5, 1);
int sl_CB (MemObj *mo, void **data) {
printf("sl_CB %lf\n",GUI_DATA_D1);
}
int GUI_Slider_cb |
( |
void * |
parent, |
|
|
MemObj |
mo | |
|
) |
| | |
GUI_Slider_cb INTERNAL slider callback
Variable Documentation