gCAD3D 2.35
gui_gtk3/gtk_entry.c File Reference

Entry (input) More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include "../ut/ut_umem.h"
#include "../gui/gui_types.h"
#include "../gui/gui_base.h"
#include "../gui_gtk3/gtk_base.h"
#include "../gui_gtk3/gtk_entry.h"


int GUI_entry_styl (MemObj *o_par, int imod)
int GUI_entry_pos_get (MemObj *o_par)
int GUI_entry_pos_set (int cPos, MemObj *o_par)
int GUI_entry_copy (char *cbuf, int sSiz, MemObj *mo)
char * GUI_entry_get (MemObj *mo)
int GUI_entry_set (MemObj *mo, char *text)
MemObj GUI_entry__ (MemObj *o_par, char *ltxt, char *etxt, void *funcnam, void *data, char *opts)
int GUI_entry_cb (void *parent, void *event, MemObj mo)
int GUI_entry_sel_del (MemObj *mo)


GtkWidget * UI_act_wi
int UI_fontsizX
int UI_fontsizY

Detailed Description

Entry (input)

GUI_entry__ inputfield for text
GUI_entry_styl modify frame of entry
GUI_entry_get get text from entryField - gives back a Pointer
GUI_entry_copy get a copy of the text from entryField
GUI_entry_set set text in entryField
GUI_entry_pos_get get cursorPosition
GUI_entry_pos_set set cursorPosition
GUI_entry_sel_del clear selected text

Function Documentation

int GUI_entry_styl ( MemObj o_par,
int  imod 
GUI_entry_styl modify frame of entry;
imod 0=GUI_STYL_normal=def_frame; 1=GUI_STYL_activ=red_frame.
int GUI_entry_pos_get ( MemObj o_par)
GUI_entry_pos_get get cursorPosition
retCod = position; 0=leftmost.
int GUI_entry_pos_set ( int  cPos,
MemObj o_par 

GUI_entry_pos_set set cursorPosition cPos -1 = last pos.

int GUI_entry_copy ( char *  cbuf,
int  sSiz,
MemObj mo 
GUI_Entry_Get get text from entryField - copy
sSiz size of cbuf
char* GUI_entry_get ( MemObj mo)
GUI_entry_get get text from entryField - get pointer
int GUI_entry_set ( MemObj mo,
char *  text 

set text in entryField

MemObj GUI_entry__ ( MemObj o_par,
char *  ltxt,
char *  etxt,
void *  funcnam,
void *  data,
char *  opts 
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_cb ( void *  parent,
void *  event,
MemObj  mo 
int GUI_entry_sel_del ( MemObj mo)
GUI_entry_sel_del clear selected text
if inputfiled has selected text, remove this selection.

Variable Documentation

GtkWidget* UI_act_wi
int UI_fontsizX
int UI_fontsizY