gCAD3D 2.40
gui_gtk2/gtk_menu.h File Reference

Go to the source code of this file.

Functions

MemObj GUI_menu__ (MemObj *o_par, char *ltxt, int mode)
 
MemObj GUI_menu_entry (MemObj *o_par, char *ltxt, void *funcnam, void *data)
 
MemObj GUI_menu_checkbox__ (MemObj *o_par, char *ltxt, int state, void *funcnam, void *data)
 
int GUI_menu_checkbox_set (MemObj *mo, int mode)
 
int GUI_menu_checkbox_get (MemObj *mo)
 
MemObj GUI_menu_radiobutt__ (MemObj *o_par, char *ltxt, int ii, void *funcnam, void *data)
 
int GUI_menu_radiobutt_get (MemObj *mo)
 
void GUI_menu_radiobutt_set (MemObj *mo)
 

Function Documentation

MemObj GUI_menu__ ( MemObj o_par,
char *  ltxt,
int  mode 
)
* GUI_Menu__ create menu or submenu
*
* Input:
* o_par parentbox or parent-menushell
* ltxt menu-title, NULL for creating the menu-bar
* mode 0=normal; 'r'=right-justified; 's'=Submenu.
* 1 (ltxt=NULL only) expand inside parent-container
*
* Example:
* MemObj menu_bar, men_fil, mns, men_hlp, wm2, wml;
* menu_bar = GUI_menu__ (&box1, NULL, 0); // create Menubar
* men_fil = GUI_menu__ (&menu_bar, "File ", 0); // first Menu on Menubar
* men_hlp = GUI_Menu__ (&menu_bar, "Help ", 'r'); // Menu rechts
* GUI_menu_entry (men_fil, "New", UI_CB, (void*)"new"); // add entry to Menu
*
* mns = GUI_menu__ (&men_fil, "Save as ", 0); // add submenu
* GUI_menu_entry (&mns, "dxf", UI_CB, (void*)"saveDxf");
*
* GUI_menu_entry (&men_fil, "---", NULL, NULL); // menu-separatorline
*
* GUI_menu_checkbox__ (&men_fil, "wmcb1", 0, UI_CB, (void*)"wmcb1");
*
* wm2 = GUI_menu__ (&menu_bar, "Lang ", 'r');
* GUI_menu_radiobutt__ (&wm2, "de", 0, mywin3, "l-de", 0);
* wml = GUI_menu_radiobutt__ (&wm2, "en", 1, mywin3, "l-en", 0);
* GUI_menu_radiobutt_set (&wml); // preset en
*
* int UI_CB (MemObj *mo, void **data) {
* printf("UI_CB %d\n",GUI_DATA_EVENT);
* if(GUI_DATA_EVENT == TYP_EventPress) {
* if(!strcmp(GUI_DATA_S1, "new")) {
* ..
*
*
* GUI_Menu__ create menu or submenu
*
* Input:
* o_par parentbox or parent-menushell
* ltxt menu-title, NULL for creating the menu-bar
* mode 0=normal; 'r'=right-justified; 's'=Submenu.
* 1 (ltxt=NULL only) expand inside parent-container
*
* Example:
* MemObj menu_bar, men_fil, mns, men_hlp, wm2, wml;
* menu_bar = GUI_menu__ (&box1, NULL, 0); // create Menubar
* men_fil = GUI_menu__ (&menu_bar, "File ", 0); // first Menu on Menubar
* men_hlp = GUI_menu__ (&menu_bar, "Help ", 'r'); // Menu rechts
* GUI_menu_entry (men_fil, "New", UI_CB, (void*)"new"); // add entry to Menu
*
* mns = GUI_menu__ (&men_fil, "Save as ", 's'); // add submenu
* GUI_menu_entry (&mns, "dxf", UI_CB, (void*)"saveDxf");
*
* GUI_menu_entry (&men_fil, "---", NULL, NULL); // menu-separatorline
*
* GUI_menu_checkbox__ (&men_fil, "wmcb1", 0, UI_CB, (void*)"wmcb1");
*
* wm2 = GUI_menu__ (&menu_bar, "Lang ", 'r');
* GUI_menu_radiobutt__ (&wm2, "de", 0, mywin3, "l-de", 0);
* wml = GUI_menu_radiobutt__ (&wm2, "en", 1, mywin3, "l-en", 0);
* GUI_menu_radiobutt_set (&wml); // preset en
*
* int UI_CB (MemObj *mo, void **data) {
* printf("UI_CB %d\n",GUI_DATA_EVENT);
* if(GUI_DATA_EVENT == TYP_EventPress) {
* if(!strcmp(GUI_DATA_S1, "new")) {
* ..
*
*
MemObj GUI_menu_entry ( MemObj o_par,
char *  ltxt,
void *  funcnam,
void *  data 
)
* create menuItem or MenuSeparator (if ltxt == "---")
*
* Input:
* o_par parentBox
* ltxt item-text
* funcnam callback from selection
* data get this data from the callbackfunktion; NULL for none
*
* funcnam prototype:
* int funcnam (void *parent, void **data);
* // data=table of 2 pointers;
* GUI_DATA_EVENT =*(int*)data[0]=TYP_EventPress
* GUI_DATA_I1=*(int*)data[2] or GUI_DATA_S1=(char*)data[2] user-data
*
* RetCod: gio_typ = TYP_GUI_OptMen
*
* Example: see GUI_menu__
*
*
* create menuItem or MenuSeparator (if ltxt == "---")
*
* Input:
* o_par parentBox
* ltxt item-text
* funcnam callback from selection
* data get this data from the callbackfunktion; NULL for none
*
* funcnam prototype:
* int funcnam (void *parent, void **data);
* // data=table of 2 pointers;
* GUI_DATA_EVENT =*(int*)data[0]=TYP_EventPress
* GUI_DATA_I1=*(int*)data[2] or GUI_DATA_S1=(char*)data[2] user-data
*
* RetCod: gio_typ = TYP_GUI_OptMen
*
* Example: see GUI_menu__
*
*
MemObj GUI_menu_checkbox__ ( MemObj o_par,
char *  ltxt,
int  state,
void *  funcnam,
void *  data 
)
* Checkbox.
* o_par parentBox
* ltext caption (button-text)
* state: 0=FALSE: not checked; 1=TRUE: checked.
* funcnam callbackfunktion for the press-button-event
* data get this data from the callbackfunktion; NULL for none
*
* funcnam prototyp:
* int funcnam (MemObj *mo, void **data);
* // data=table of 2 pointers;
* GUI_DATA_EVENT =*(int*)data[0]=TYP_EventPress|TYP_EventRelease
* GUI_DATA_I1=*(int*)data[1] or GUI_DATA_S1=(char*)data[1] user-data
*
* ---------------------------
* Example without callback:
*
* int istate;
* MemObj cb1;
* cb1 = GUI_menu_checkbox__ (&men1, "ckb 1", 0, NULL, NULL);
* // query state
* istate = GUI_menu_checkbox_get (&cb1) // 0=not sel, 1=selected.
*
*
* ---------------------------
* Example with callback:
*
* GUI_menu_checkbox__ (&men1, "ckb 1", 0, mywin3, (void*)"cb1");
*
* int mywin3, (MemObj *parent, void **data) {
*
* if(GUI_DATA_EVENT == TYP_EventPress) {
* if(!strcmp(GUI_DATA_S1, "cb1")) {
* ..
*
* ---------------------------
* Optional:
*
* activate with:
*
* Checkbox.
* o_par parentBox
* ltext caption (button-text)
* state: 0=FALSE: not checked; 1=TRUE: checked.
* funcnam callbackfunktion for the press-button-event
* data get this data from the callbackfunktion; NULL for none
*
* funcnam prototyp:
* int funcnam (MemObj *mo, void **data);
* // data=table of 2 pointers;
* GUI_DATA_EVENT =*(int*)data[0]=TYP_EventPress|TYP_EventRelease
* GUI_DATA_I1=*(int*)data[1] or GUI_DATA_S1=(char*)data[1] user-data
*
* ---------------------------
* Example without callback:
*
* int istate;
* MemObj cb1;
* cb1 = GUI_menu_checkbox__ (&men1, "ckb 1", 0, NULL, NULL);
* // query state
* istate = GUI_menu_checkbox_get (&cb1) // 0=not sel, 1=selected.
*
*
* ---------------------------
* Example with callback:
*
* GUI_menu_checkbox__ (&men1, "ckb 1", 0, mywin3, (void*)"cb1");
*
* int mywin3, (MemObj *parent, void **data) {
*
* if(GUI_DATA_EVENT == TYP_EventPress) {
* if(!strcmp(GUI_DATA_S1, "cb1")) {
* ..
*
* ---------------------------
* Optional:
*
* activate with:
*
int GUI_menu_checkbox_set ( MemObj mo,
int  mode 
)
* activate/disactivate menu-Checkbox, Radiobutton.
* Input:
* mode 1 = TRUE = ON
* 0 = FALSE = OFF
*
* activate/disactivate menu-Checkbox, Radiobutton.
* Input:
* mode 1 = TRUE = ON
* 0 = FALSE = OFF
*
int GUI_menu_checkbox_get ( MemObj mo)

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

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

MemObj GUI_menu_radiobutt__ ( MemObj o_par,
char *  ltxt,
int  ii,
void *  funcnam,
void *  data 
)
* Radiobuttons.
* The callbackfunctions provides signal "activated" and "disactivated"
*
* Input:
* o_par parentBox
* ii 0=start new radioButtonChain; 1=add button to existing chain
* ltxt caption
* funcnam callback-function or NULL; returns data of selected RB
* data this data will be provided by the callback-function
*
* funcnam prototyp:
* int funcnam (void *parent, void **data);
* // data=table of 2 pointers;
* GUI_DATA_EVENT =*(int*)data[0]=TYP_EventPress|TYP_EventRelease
* GUI_DATA_I1=*(int*)data[2] or GUI_DATA_S1=(char*)data[2] user-data
*
* Example:
* GUI_menu_radiobutt__ (&box0, "button1", 0, cb_rb1, (void*)"rb1", 0);
* GUI_menu_radiobutt__ (&box0, "button2", 1, cb_rb1, (void*)"rb2", 0);
* GUI_menu_radiobutt__ (&box0, "button3", 1, cb_rb1, (void*)"rb3", 0);
*
* int cb_rb1 (void *parent, void **data) {
* // skip disactivation
* if(GUI_DATA_EVENT == TYP_EventRelease) return 0;
* printf(" being activated: |%s|\n",GUI_DATA_S1;
* }
*
* check state: GUI_menu_radiobutt_get
*
* Radiobuttons.
* The callbackfunctions provides signal "activated" and "disactivated"
*
* Input:
* o_par parentBox
* ii 0=start new radioButtonChain; 1=add button to existing chain
* ltxt caption
* funcnam callback-function or NULL; returns data of selected RB
* data this data will be provided by the callback-function
*
* funcnam prototyp:
* int funcnam (void *parent, void **data);
* // data=table of 2 pointers;
* GUI_DATA_EVENT =*(int*)data[0]=TYP_EventPress|TYP_EventRelease
* GUI_DATA_I1=*(int*)data[2] or GUI_DATA_S1=(char*)data[2] user-data
*
* Example:
* GUI_menu_radiobutt__ (&box0, "button1", 0, cb_rb1, (void*)"rb1", 0);
* GUI_menu_radiobutt__ (&box0, "button2", 1, cb_rb1, (void*)"rb2", 0);
* GUI_menu_radiobutt__ (&box0, "button3", 1, cb_rb1, (void*)"rb3", 0);
*
* int cb_rb1 (void *parent, void **data) {
* // skip disactivation
* if(GUI_DATA_EVENT == TYP_EventRelease) return 0;
* printf(" being activated: |%s|\n",GUI_DATA_S1;
* }
*
* check state: GUI_menu_radiobutt_get
*
int GUI_menu_radiobutt_get ( MemObj mo)

test a menu-radiobutton if it is active. 1=active, 0=not active.

test a menu-radiobutton if it is active. 1=active, 0=not active.

void GUI_menu_radiobutt_set ( MemObj mo)

set a menu-radiobutton to state = active.

set a menu-radiobutton to state = active.