#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_button.h"#include "../gui_gtk/gtk_multichoice.h"Functions | |
| void | GUI_optmen_sel (void *parent, void *data) |
| void | GUI_optmen_pos (void *menu, int *x, int *y, int *ii, void *data) |
| int | GUI_optmen_go (void *parent, void *event, MemObj mo) |
| void | GUI_optmen_chg (void *menu, char *optLst[], char *tipLst[]) |
| MemObj | GUI_optmen__ (MemObj *o_par, char *mtxt, char *optLst[], char *tipLst[], void *funcnam, int hsiz, int vsiz) |
| int | GUI_optmen_set (MemObj *mo, int mode, void *data) |
| int | GUI_popup__ (char *optLst[], char *tipLst[], int itip, void *funcnam, void *dataLst[]) |
| int | GUI_popup_cb2 (void *parent, void *event, void *data) |
| int | GUI_popup_cb1 (void *parent, void *data) |
| MemObj | GUI_radiobutt__ (MemObj *o_par, char *ltxt, int ii, void *funcnam, void *data, char *siz) |
| int | GUI_radiobutt_get (MemObj *mo) |
| void | GUI_radiobutt_set (MemObj *mo) |
| int | GUI_radiobutt_press (void *parent, MemObj mo) |
Variables | |
| void(* | UI_uf_popup )() |
| static char ** | UI_opt_lst |
| static Obj_gui2 * | UI_optmen_act |
| GtkWidget * | UI_act_wi |
===================================================== List_functions_start: GUI_radiobutt__ RadioButton GUI_radiobutt_get test a radiobutton if it is active GUI_radiobutt_set set a radiobutton to state = active GUI_popup__ popup-window with multiple-choice-comboBox. GUI_optmen__ option-menu (combo-box) GUI_optmen_set modify the basic option-menu-item GUI_optmen_chg populate option-menu GUI_optmen_go INTERNAL callback selection OptionMenu GUI_optmen_pos INTERNAL callback OptionMenu - set the position GUI_optmen_sel INTERNAL List_functions_end: =====================================================
| void GUI_optmen_sel | ( | void * | parent, | |
| void * | data | |||
| ) |
INTERNAL; see GUI_popup_cb1
| void GUI_optmen_pos | ( | void * | menu, | |
| int * | x, | |||
| int * | y, | |||
| int * | ii, | |||
| void * | data | |||
| ) |
INTERNAL callback OptionMenu - set the position of the popup
| int GUI_optmen_go | ( | void * | parent, | |
| void * | event, | |||
| MemObj | mo | |||
| ) |
INTERNAL callback selection OptionMenu
activate & place popup (OptionMenu).
| void GUI_optmen_chg | ( | void * | menu, | |
| char * | optLst[], | |||
| char * | tipLst[] | |||
| ) |
INTERNAL populate / Change the menu of existing OptionMenu.
| MemObj GUI_optmen__ | ( | MemObj * | o_par, | |
| char * | mtxt, | |||
| char * | optLst[], | |||
| char * | tipLst[], | |||
| void * | funcnam, | |||
| int | hsiz, | |||
| int | vsiz | |||
| ) |
GUI_OptMen__ option-menu (combo-box)
Input:
o_par parentBox
mtxt primary labeltext
optLst items; a null-terminated list of words
tipLst list of tooltips or NULL.
funcnam callback-function for selection (returns lNr & selected text)
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)
Output:
oom option-menu
funcnam prototype:
// data=table of 3 pointers;
GUI_DATA_EVENT =*(int*)data[0]=TYP_EventPress selection
GUI_DATA_I1 =*(int*)data[1]=line-nr; first is 0
GUI_DATA_S2 =(char*)data[2]=text of selected menu-item
Example:
static GIO_OptMen om1;
char *optLst[]={"Jaenner","Februar","Maerz",NULL};
GUI_OptMen__ (&om1, box0, optLst, NULL, OptMen_CB, 0, 0);
..
int OptMen_CB (void *parent, void **data) {
printf("OptMen_CB sel. Line = %d |%s|\n",GUI_DATA_I1,GUI_DATA_S2);
GUI_OptMenSet (parent, 1, GUI_DATA_S2); // change text of basic item
return 0;
}
| int GUI_optmen_set | ( | MemObj * | mo, | |
| int | mode, | |||
| void * | data | |||
| ) |
GUI_OptMenSet modify the basic option-menu-item
Input:
mo the option-menu
mode 1=set background-color=activated;
0=set to standard background-color, normal.
2=disactivate
3=reactivate
data text to display; NULL=do not change.
Example see GUI_OptMen__
| int GUI_popup__ | ( | char * | optLst[], | |
| char * | tipLst[], | |||
| int | itip, | |||
| void * | funcnam, | |||
| void * | dataLst[] | |||
| ) |
create popup-window with multiple-choice-comboBox.
Inputs:
optLst list of options (a menu)
tipLst list of tooltips or NULL;
itip 0=tooltips from tipLst, 1=tooltips from dataLst (using MSG_Tip)
funcnam callback-function (provides the Enter,Leave,Select-events)
dataLst (void**) get this (static) data from the callbackfunktion;
NULL for none
prototyp funcnam:
int funcnam (void *parent, void **data);
// data=table of 2 pointers;
GUI_DATA_EVENT =*(int*)data[0]=TYP_EventEnter|TYP_EventLeave|
TYP_EventPress selection
TYP_EventUnmap cancel menu, no selection
GUI_DATA_I1 =*(int*)data[1]=line-nr; first is 0 (TYP_EventPress)
GUI_DATA_S2 =(char*)data[2] user-data of selected item (TYP_EventPress)
Example:
char *popTxt[]={"txt pop1", "txt pop2", "txt pop3", NULL};
char *popTip[]={"tip pop1", "tip pop2", "tip pop3", NULL};
static char *popDat[]={"pop1", "pop2", "pop3", NULL};
GUI_popup__ (popTxt, popTip, 0, CB_popup, popDat);
int CB_popup (void *parent, void **data) {
// callback popup-window
int iEv, lNr;
// printf("cb_pop1 event=%d device=%d lNr=%d\n",
// GUI_DATA_EVENT, *(int*)data[0] TYP_EventEnter cursor over menu-item
// TYP_EventLeave leave menu-item
// TYP_EventPress selection
// TYP_EventUnmap cancel menu
// GUI_DATA_I1, *(int*)data[1] line-nr of selected menu-item
// GUI_DATA_S2); (char*)data[2] text of selected menu-item
iEv = GUI_DATA_EVENT;
lNr = GUI_DATA_I1;
if(iEv == TYP_EventEnter) printf(" enter popup-%d\n",lNr);
if(iEv == TYP_EventLeave) printf(" leave popup-%d\n",lNr);
if(iEv == TYP_EventPress) printf(" select popup-%d\n",lNr);
| int GUI_popup_cb2 | ( | void * | parent, | |
| void * | event, | |||
| void * | data | |||
| ) |
INTERNAL unmap popup-window callback
| int GUI_popup_cb1 | ( | void * | parent, | |
| void * | data | |||
| ) |
INTERNAL callback of GUI_Popup
| MemObj GUI_radiobutt__ | ( | MemObj * | o_par, | |
| char * | ltxt, | |||
| int | ii, | |||
| void * | funcnam, | |||
| void * | data, | |||
| char * | siz | |||
| ) |
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
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 (void *parent, 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
GUI_OBJ_TYP(mo) = TYP_GUI_Button
Example:
GUI_RadButt__ (&box0, "button1", 0, cb_rb1, (void*)"rb1", 0);
GUI_RadButtAdd (&box0, "button2", 1, cb_rb1, (void*)"rb2", 0);
GUI_RadButtAdd (&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;
}
activate: GUI_radiobutt_set
check state: GUI_radiobutt_get
| int GUI_radiobutt_get | ( | MemObj * | mo | ) |
test a radiobutton if it is active. 1=active, 0=not active.
| void GUI_radiobutt_set | ( | MemObj * | mo | ) |
set a radiobutton to state = active.
| int GUI_radiobutt_press | ( | void * | parent, | |
| MemObj | mo | |||
| ) |
INTERNAL
RadButt: activate UND disactivate
| void(* UI_uf_popup)() |
char** UI_opt_lst [static] |
Obj_gui2* UI_optmen_act [static] |
| GtkWidget* UI_act_wi |
1.6.3