gCAD3D 2.40
gui_gtk3/gtk_button.h File Reference

Go to the source code of this file.

Functions

MemObj GUI_button__ (MemObj *o_par, char *ltext, void *funcnam, void *data, char *siz)
 
int GUI_button_mod (MemObj *wb, char *ltext)
 
int GUI_button_styl (MemObj *mo, int iCol)
 
MemObj GUI_button_img (MemObj *o_par, char *filnam, void *funcnam, void *data, char *opts)
 
int GUI_ckbutt_get (MemObj *mo)
 
int GUI_ckbutt_set (MemObj *mo, int mode)
 
int GUI_ckbutt_set_noCB (MemObj *mo, int mode)
 
MemObj GUI_ckbutt__ (MemObj *o_par, char *ltxt, int state, void *funcnam, void *data, char *siz)
 
int GUI_button_press (void *parent, MemObj data)
 

Function Documentation

MemObj GUI_button__ ( MemObj o_par,
char *  ltext,
void *  funcnam,
void *  data,
char *  siz 
)
* Button.
* Input:
* o_par parentBox
* ltext caption (button-text)
* funcnam callbackfunktion for the press-button-event
* data get this (static) data from the callbackfunktion; NULL for none
* opts options; (HorSiz,VertSiz)
* HorSiz,VertSiz: size in characters; default is automatic size.
* 'e' = expand widget; default is fixed size.
* Examples: "" or "10" or "10e,e"
* "10e,e" horiz. size 10 chars, hor. and vert. expandable.
* Output:
* gBut must exist as long as button is alive.
*
* funcnam prototyp:
* int funcnam (MemObj *mo, void **data);
* // data=table of 2 pointers;
* GUI_DATA_EVENT =*(int*)data[0]=TYP_EventPress
* GUI_DATA_I1=*(int*)data[1] or GUI_DATA_S1=(char*)data[1] user-data
*
* Example with string-data:
* GUI_button__ (box0, "TestButton", UI_func1, "b1-clicked", "");
*
* int UI_func1 (MemObj *mo, void **data) {
* printf(" typ=%d\n",GUI_OBJ_TYP(mo));
* printf(" button |%s|\n", GUI_DATA_S1);
* ..
*
* Example with integer-data:
* static int icb = UI_FuncUCB1;
* GUI_button__ (box0, "TestButton", UI_func1, (void*)&icb, "");
*
* int UI_func1 (MemObj *mo, void **data) {
* ..
*
* Disactivate:
* GUI_set_enable (&wButt, 0); //1=activ, 0=inaktiv
*
* Change text/caption/label:
* GUI_button_mod (&wButt, " newText "); // gtk_button_set_label
*
*
* Button.
* Input:
* o_par parentBox
* ltext caption (button-text)
* funcnam callbackfunktion for the press-button-event
* data get this (static) data from the callbackfunktion; NULL for none
* opts options; (HorSiz,VertSiz)
* HorSiz,VertSiz: size in characters; default is automatic size.
* 'e' = expand widget; default is fixed size.
* Examples: "" or "10" or "10e,e"
* "10e,e" horiz. size 10 chars, hor. and vert. expandable.
* Output:
* gBut must exist as long as button is alive.
*
* funcnam prototyp:
* int funcnam (MemObj *mo, void **data);
* // data=table of 2 pointers;
* GUI_DATA_EVENT =*(int*)data[0]=TYP_EventPress
* GUI_DATA_I1=*(int*)data[1] or GUI_DATA_S1=(char*)data[1] user-data
*
* Example with string-data:
* GUI_button__ (box0, "TestButton", UI_func1, "b1-clicked", "");
*
* int UI_func1 (MemObj *mo, void **data) {
* printf(" typ=%d\n",GUI_OBJ_TYP(mo));
* printf(" button |%s|\n", GUI_DATA_S1);
* ..
*
* Example with integer-data:
* static int icb = UI_FuncUCB1;
* GUI_button__ (box0, "TestButton", UI_func1, (void*)&icb, "");
*
* int UI_func1 (MemObj *mo, void **data) {
* ..
*
* Disactivate:
* GUI_set_enable (&wButt, 0); //1=activ, 0=inaktiv
*
* Change text/caption/label:
* GUI_button_mod (&wButt, " newText "); // gtk_button_set_label
*
*
int GUI_button_mod ( MemObj wb,
char *  ltext 
)

GUI_Butt_Label modify buttontext (caption)

GUI_Butt_Label modify buttontext (caption)

int GUI_button_styl ( MemObj mo,
int  iCol 
)
* GUI_button_styl modify buttonbackgroundColor
* 0=default; 1=red; 2=blue
*
* GUI_button_styl modify buttonbackgroundColor
* 0=default; 1=red; 2=blue
*
MemObj GUI_button_img ( MemObj o_par,
char *  filnam,
void *  funcnam,
void *  data,
char *  opts 
)
* create button with pixmap
* Input:
* o_par parentBox
* filnam image
* funcnam callbackfunktion for the press-button-event
* data get this data from the callbackfunktion; NULL for none
* opts options; (HorSiz,VertSiz)
* HorSiz,VertSiz: size in characters; default is automatic size.
* 'e' = expand widget; default is fixed size.
* negative values: size in pixels.
* Examples: "" or "10" or "10e,e"
* "10e,e" horiz. size 10 chars, hor. and vert. expandable.
*
* RetCod: NULL = Error (filnam not exist)
*
* funcnam prototyp:
* see GUI_button__ ()
*
* create button with pixmap
* Input:
* o_par parentBox
* filnam image
* funcnam callbackfunktion for the press-button-event
* data get this data from the callbackfunktion; NULL for none
* opts options; (HorSiz,VertSiz)
* HorSiz,VertSiz: size in characters; default is automatic size.
* 'e' = expand widget; default is fixed size.
* negative values: size in pixels.
* Examples: "" or "10" or "10e,e"
* "10e,e" horiz. size 10 chars, hor. and vert. expandable.
*
* RetCod: NULL = Error (filnam not exist)
*
* funcnam prototyp:
* see GUI_button__ ()
*
int GUI_ckbutt_get ( MemObj mo)

returns state of checkbox; 0=not sel, 1=selected.

returns state of checkbox; 0=not sel, 1=selected.

int GUI_ckbutt_set ( MemObj mo,
int  mode 
)
* activate/disactivate Checkbox, Radiobutton.
* Input:
* mode 1 = TRUE = ON
* 0 = FALSE = OFF
*
* activate/disactivate Checkbox, Radiobutton.
* Input:
* mode 1 = TRUE = ON
* 0 = FALSE = OFF
*
int GUI_ckbutt_set_noCB ( MemObj mo,
int  mode 
)
* activate/disactivate Checkbox, Radiobutton but do not call userCB
* Input:
* mode 1 = TRUE = ON
* 0 = FALSE = OFF
*
* activate/disactivate Checkbox, Radiobutton but do not call userCB
* Input:
* mode 1 = TRUE = ON
* 0 = FALSE = OFF
*
MemObj GUI_ckbutt__ ( MemObj o_par,
char *  ltxt,
int  state,
void *  funcnam,
void *  data,
char *  siz 
)
* Checkbox.
* o_par parentBox
* ltext caption (button-text)
* state: 0=FALSE: not checked; 1=TRUE: checked.
* funcnam callbackfunktion for the select/deselect-event
* data get this (static) data from the callbackfunktion; NULL for none
* opts options; (HorSiz,VertSiz)
* HorSiz,VertSiz: size in characters; default is automatic size.
* 'e' = expand widget; default is fixed size.
* Examples: "" or "10" or "10e,e"
* "10e,e" horiz. size 10 chars, hor. and vert. expandable.
*
* funcnam prototyp:
* int funcnam (MemObj *mo, void **data);
* // data=table of 2 pointers;
* GUI_DATA_I1=*(int*)data[1] or GUI_DATA_S1=(char*)data[1] user-data
*
* ---------------------------
* Example without callback:
*
* int istate;
* MemObj cb1;
* // create checkbox
* cb1 = GUI_ckbutt__ (&box0, "ckb 1", TRUE, NULL, NULL, "");
* // query state
* istate = GUI_ckbutt_get (&cb1) // 0=not sel, 1=selected.
*
*
* ---------------------------
* Example with callback:
*
* GUI_ckbutt__ (&box0, "ckb 1", 0, f_ckButt_CB, NULL, "");
*
* int f_ckButt_CB, (MemObj *parent, void **data) {
*
* if(GUI_ckbutt_get(parent)) goto L_activate;
* printf("f_ckbutt disactivate\n");
* ..
* L_activate:
* ..
* }
*
* ---------------------------
* Optional:
*
* activate with:
* GUI_ckbutt_set (&cb1, TRUE);
*
* Checkbox.
* o_par parentBox
* ltext caption (button-text)
* state: 0=FALSE: not checked; 1=TRUE: checked.
* funcnam callbackfunktion for the select/deselect-event
* data get this (static) data from the callbackfunktion; NULL for none
* opts options; (HorSiz,VertSiz)
* HorSiz,VertSiz: size in characters; default is automatic size.
* 'e' = expand widget; default is fixed size.
* Examples: "" or "10" or "10e,e"
* "10e,e" horiz. size 10 chars, hor. and vert. expandable.
*
* funcnam prototyp:
* int funcnam (MemObj *mo, void **data);
* // data=table of 2 pointers;
* GUI_DATA_I1=*(int*)data[1] or GUI_DATA_S1=(char*)data[1] user-data
*
* ---------------------------
* Example without callback:
*
* int istate;
* MemObj cb1;
* // create checkbox
* cb1 = GUI_ckbutt__ (&box0, "ckb 1", TRUE, NULL, NULL, "");
* // query state
* istate = GUI_ckbutt_get (&cb1) // 0=not sel, 1=selected.
*
*
* ---------------------------
* Example with callback:
*
* GUI_ckbutt__ (&box0, "ckb 1", 0, f_ckButt_CB, NULL, "");
*
* int f_ckButt_CB, (MemObj *parent, void **data) {
*
* if(GUI_ckbutt_get(parent)) goto L_activate;
* printf("f_ckbutt disactivate\n");
* ..
* L_activate:
* ..
* }
*
* ---------------------------
* Optional:
*
* activate with:
* GUI_ckbutt_set (&cb1, TRUE);
*
int GUI_button_press ( void *  parent,
MemObj  data 
)