gCAD3D 2.35
gui_gtk2/gtk_entry.h File Reference

Go to the source code of this file.

Functions

MemObj GUI_entry__ (MemObj *o_par, char *ltxt, char *etxt, void *funcnam, void *data, char *siz)
 
int GUI_entry_set (MemObj *mo, char *text)
 
char * GUI_entry_get (MemObj *mo)
 
int GUI_entry_copy (char *cbuf, int sSiz, MemObj *mo)
 
int GUI_entry_sel_del (MemObj *mo)
 
int GUI_entry_cb (void *parent, void *event, MemObj mo)
 

Function Documentation

MemObj GUI_entry__ ( MemObj o_par,
char *  ltxt,
char *  etxt,
void *  funcnam,
void *  data,
char *  siz 
)
Create text-inputfiled. Gtk-2: siza cannot be smaller than ~10 characters ..
ltxt: Labeltext; NULL or "" for none
etxt: Text in Entryfield; NULL oder "" for none
funcnam: callback-function for Keypress & FocusIn-Events (none: NULL)
data get this (static) data from the callbackfunktion; NULL for none
opts options; must have correct sequence (Frame Side HorSiz VertSiz)
Frame: 'f' make a frameless inputfield; default = with frame.
Side: 'r' labeltext is right of inputfield; default is left.
HorSiz,VertSiz: size in characters; default is automatic size.
'e' = expand widget; default is fixed size.
Examples: "f,20" or "r" or "r,10" or "10e,e"
"r" label right of inputfield; defaults.
"r,10" label right, horiz. size 10 chars, vert. size autom.
"10e,e" horiz. size 10 chars, hor. and vert. expandable.
prototyp funcnam:
int funcnam (MemObj *mo, void **data);
// data=table of 4 pointers;
GUI_DATA_EVENT =*(int*)data[0]=TYP_EventEnter|
GUI_DATA_S1 =(char*)data[1]=userdata
GUI_DATA_I2 =*(int*)data[2]=keyvalue; eg 'a'
GUI_DATA_I3 =*(int*)data[3]=state of modifierkeys;
see ../gui/gui_types.h GUI_Modif_*
&1=shift; &4=ctrl; &8=alt.
&256=MB1; &512=MB2; &1024=MB3.
Returncodes: 0=continue with defaultOperations for this key.
1=do no defaultOperations; skip handling this key
Example without callback-function:
we1 = GUI_entry__ (&box1, "0.0", "sum", NULL, NULL, "");
printf(" |%s|\n",GUI_entry_get(&we1));
Example with callback-function:
we2 = GUI_entry__ (&box1, "0.0", "sum", went_cb, NULL, "10");
..
int we2_cb (MemObj *mo, void **data) {
printf(" event=%d typ=%d\n",GUI_DATA_EVENT,GUI_OBJ_TYP(mo));
if(GUI_DATA_I2 == GUI_KeyCurDown) return 1; // skip handling
if(GUI_DATA_EVENT != TYP_EventRelease) return 0; // continue normal
printf(" |%s|\n",GUI_entry_get(mo));
..
}
Create text-inputfiled. Gtk-2: siza cannot be smaller than ~10 characters ..
ltxt: Labeltext; NULL or "" for none
etxt: Text in Entryfield; NULL oder "" for none
data get this (static) data from the callbackfunktion; NULL for none
funcnam: callback-function for Keypress & FocusIn-Events (none: NULL)
opts options; must have correct sequence (Frame Side HorSiz VertSiz)
Frame: 'f' make a frameless inputfield; default = with frame.
Side: 'r' labeltext is right of inputfield; default is left.
HorSiz,VertSiz: size in characters; default is automatic size.
'e' = expand widget; default is fixed size.
Examples: "f,20" or "r" or "r,10" or "10e,e"
"r" label right of inputfield; defaults.
"r,10" label right, horiz. size 10 chars, vert. size autom.
"10e,e" horiz. size 10 chars, hor. and vert. expandable.
prototyp funcnam:
int funcnam (MemObj *mo, void **data);
// data=table of 4 pointers;
GUI_DATA_EVENT =*(int*)data[0]=TYP_EventEnter|
GUI_DATA_S1 =(char*)data[1]=userdata
GUI_DATA_I2 =*(int*)data[2]=keyvalue; eg 'a'
GUI_DATA_I3 =*(int*)data[3]=state of modifierkeys;
see ../gui/gui_types.h GUI_Modif_*
&1=shift; &4=ctrl; &8=alt.
&256=MB1; &512=MB2; &1024=MB3.
Returncodes: 0=continue with defaultOperations for this key.
1=do no defaultOperations; skip handling this key
Example without callback-function:
we1 = GUI_entry__ (&box1, "0.0", "sum", NULL, NULL, "");
printf(" |%s|\n",GUI_entry_get(&we1));
Example with callback-function:
we2 = GUI_entry__ (&box1, "0.0", "sum", went_cb, NULL, "10");
..
int we2_cb (MemObj *mo, void **data) {
printf(" event=%d typ=%d\n",GUI_DATA_EVENT,GUI_OBJ_TYP(mo));
if(GUI_DATA_I2 == GUI_KeyCurDown) return 1; // skip handling
if(GUI_DATA_EVENT != TYP_EventRelease) return 0; // continue normal
printf(" |%s|\n",GUI_entry_get(mo));
..
}
int GUI_entry_set ( MemObj mo,
char *  text 
)

set text in entryField

set text in entryField

char* GUI_entry_get ( MemObj mo)
GUI_entry_get get text from entryField - get pointer
GUI_entry_get get text from entryField - get pointer
int GUI_entry_copy ( char *  cbuf,
int  sSiz,
MemObj mo 
)
GUI_Entry_Get get text from entryField - copy
sSiz size of cbuf
GUI_Entry_Get get text from entryField - copy
sSiz size of cbuf
int GUI_entry_sel_del ( MemObj mo)
GUI_entry_sel_del clear selected text
if inputfiled has selected text, remove this selection.
GUI_entry_sel_del clear selected text
if inputfiled has selected text, remove this selection.
int GUI_entry_cb ( void *  parent,
void *  event,
MemObj  mo 
)
INTERNAL
1=userdata
2=key
3=modfier
INTERNAL
1=userdata
2=key
3=modfier