gtk_button.c File Reference
#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_gtk/gtk_base.h"
#include "../gui_gtk/gtk_button.h"
Functions |
MemObj | GUI_button_img (MemObj *o_par, char *filnam, void *funcnam, void *data, int hsiz, int vsiz) |
int | GUI_button_mod (MemObj *mo, char *ltext) |
MemObj | GUI_Button__ (MemObj *o_par, char *ltext, void *funcnam, void *data, char *siz) |
int | GUI_button_press (void *parent, MemObj mo) |
int | GUI_ckbutt_get (MemObj *mo) |
int | GUI_ckbutt_set (MemObj *mo, int mode) |
MemObj | GUI_ckbutt__ (MemObj *o_par, char *ltxt, int state, void *funcnam, void *data, char *opts) |
Variables |
GtkWidget * | UI_act_wi |
int | UI_fontsizY |
Memspc | UI_tmpSpc |
Detailed Description
=====================================================
List_functions_start:
GUI_button__ create Button
GUI_button_mod modify buttontext (caption)
GUI_button_img create Button with image
GUI_ckbutt__ create Checkbox
GUI_ckbutt_get returns state of checkbox; 0=not sel, 1=selected.
GUI_ckbutt_set activate/disactivate Checkbox, Radiobutto
List_functions_end:
=====================================================
Function Documentation
MemObj GUI_button_img |
( |
MemObj * |
o_par, |
|
|
char * |
filnam, |
|
|
void * |
funcnam, |
|
|
void * |
data, |
|
|
int |
hsiz, |
|
|
int |
vsiz | |
|
) |
| | |
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
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)
RetCod: NULL = Error (filnam not exist)
funcnam prototyp:
see GUI_button__ ()
int GUI_button_mod |
( |
MemObj * |
mo, |
|
|
char * |
ltext | |
|
) |
| | |
GUI_Butt_Label modify buttontext (caption)
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
Output:
gBut must exist as long as button is alive.
funcnam prototyp:
int funcnam (MemObj *mo, void **data);
GUI_DATA_EVENT =*(int*)data[0]=TYP_EventPress
GUI_DATA_I1=*(int*)data[1] or GUI_DATA_S1=(char*)data[1] user-data
GUI_OBJ_TYP(mo) = TYP_GUI_Button
Example with string-data:
GUI_Butt__ (box0, "TestButton", UI_func1, "b1-clicked", 0, 0);
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_Butt__ (box0, "TestButton", UI_func1, (void*)&icb, 0, 0);
int UI_func1 (MemObj *mo, void **data) {
if(GUI_DATA_EVENT == TYP_EventPress) {
if(GUI_DATA_I1 == UI_FuncUCB1) {
..
Disactivate:
GUI_set_active (wButt, 0);
Change text/caption/label:
GUI_button_mod (wButt, " newText ");
int GUI_button_press |
( |
void * |
parent, |
|
|
MemObj |
mo | |
|
) |
| | |
int GUI_ckbutt_get |
( |
MemObj * |
mo |
) |
|
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
MemObj GUI_ckbutt__ |
( |
MemObj * |
o_par, |
|
|
char * |
ltxt, |
|
|
int |
state, |
|
|
void * |
funcnam, |
|
|
void * |
data, |
|
|
char * |
opts | |
|
) |
| | |
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 (static) data from the callbackfunktion; NULL for none
funcnam prototyp:
see GUI_button__ ()
---------------------------
Example without callback:
int istate;
MemObj cb1;
cb1 = GUI_ckbutt__ (&box0, "ckb 1", TRUE, NULL, NULL, 0);
istate = GUI_ckbutt_get (&cb1)
---------------------------
Example with callback:
GUI_ckbutt__ (&box0, "ckb 1", 0, f_ckButt_CB, NULL, 0);
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);
Variable Documentation