C-KIT-GUI-GTK 0.60
gtk_opengl.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_gtk2/gtk_base.h"
#include "../gui_gtk2/gtk_opengl.h"
#include "../gui_gtk2/gtk_gl_x11.h"

Functions

int GUI_gl_set_active (int mode, MemObj *mo)
 
MemObj GUI_gl__ (MemObj *o_par, void *fDraw, char *opts)
 
int GUI_gl_ev_move (MemObj *mo, void *fMove)
 
int GUI_gl_ev_butt_upd ()
 
int GUI_gl_ev_butt__ (int *iTyp, int *ikey)
 
int GUI_gl_ev_button (MemObj *mo, void *fButton)
 
int GUI_gl_ev_key (MemObj *mo, void *fKey)
 
int GUI_gl_block (MemObj *mo, int mode)
 
int GUI_gl_draw (void *parent, void *event, MemObj mo)
 
int GUI_gl_move (void *parent, void *event, MemObj mo)
 
int GUI_gl_button (void *parent, void *ev, MemObj mo)
 
int GUI_gl_key (void *parent, void *event, MemObj mo)
 
int GUI_gl_idle1 (void *data)
 

Variables

GtkWidget * UI_MainWin
 
GtkWidget * UI_act_wi
 
static Obj_GLwin * UI_win_gl
 
static MemObj UI_mo_gl
 
static int statM1 =0
 
static int statM2 =0
 
static int statM3 =0
 
static int statMK =0
 

Detailed Description

=====================================================
List_functions_start:
GUI_gl__ get opengl-window; connect redraw- and resize-event
GUI_gl_ev_move connect mouse-move
GUI_gl_ev_button connect mouse-button
GUI_gl_ev_key connect keyboard
GUI_gl_block block (1) / unblock (0) input
GUI_gl_set_active activate/disactivate output to gl-window
GUI_gl_config INTERNAL callback
GUI_gl_draw INTERNAL callback
GUI_gl_move INTERNAL callback
GUI_gl_button INTERNAL callback
GUI_gl_key INTERNAL callback
GUI_gl_idle1 INTERNAL callback
INTERNAL:
GUI_gl_ev_butt_upd update (release) mousebuttons
GUI_gl_ev_butt__ usercall mousebutton
List_functions_end:
=====================================================

Function Documentation

int GUI_gl_set_active ( int  mode,
MemObj *  mo 
)
GUI_gl_set_active activate/disactivate output to gl-window
mode 1=activate (call before using gl-functions)
0=disactivate; (call after gl-functions = execute)
must be used for all gl*-functions
MemObj GUI_gl__ ( MemObj *  o_par,
void *  fDraw,
char *  opts 
)
GUI_gl__ get opengl-window; connect redraw- and resize-event
Input:
o_par parentBox
fDraw callback-function redraw-, resize-event
opts options; (HorSiz,VertSiz)
HorSiz,VertSiz: size in characters; default is automatic size.
negative values: size in pixels.
'e' = expand widget; default is fixed size.
Examples: "" or "-500,-500" or "10e,e"
"10e,e" horiz. size 10 chars, hor. and vert. expandable
Prototypes:
int fDraw (void *parent, void **data);
// data=table of 3 pointers;
GUI_DATA_EVENT=*(int*)data[0]=TYP_EventConfig|TYP_EventDraw|TYP_EventEnter
parameters for TYP_EventConfig and TYP_EventDraw:
GUI_DATA_I1 =*(int*)data[1]=window-width
GUI_DATA_I2 =*(int*)data[2]=window-height
parameters for TYP_EventEnter:
GUI_DATA_I1 =*(int*)data[1]=keystate GUI_Modif_*
GUI_OBJ_TYP(parent) = TYP_GUI_BoxGL
int GUI_gl_ev_move ( MemObj *  mo,
void *  fMove 
)
add callback for mouse-move-events in OpenGL-window
Input:
mo OpenGL-window-obj
fMove callback-function move-event
prototype:
int fMove (MemObj *mo, void **data);
// data=table of 3 pointers;
GUI_DATA_EVENT=*(int*)data[0]=TYP_EventMove
GUI_DATA_I1 =*(int*)data[2]=x-val mousepos in screencoords
GUI_DATA_I2 =*(int*)data[3]=y-val mousepos in screencoords
GUI_OBJ_TYP(mo) = TYP_GUI_BoxGL
printf(" x=%d y=%d\n",GUI_DATA_I1,GUI_DATA_I2);
int GUI_gl_ev_butt_upd ( )
int GUI_gl_ev_butt__ ( int *  iTyp,
int *  ikey 
)
int GUI_gl_ev_button ( MemObj *  mo,
void *  fButton 
)
add callback for the mouse-button event
Input:
mo OpenGL-window-obj
fButton callback-function mouse-button event
prototype:
int fButton (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]=TYP_DeviceMouse
GUI_DATA_I2 =*(int*)data[2]=GUI_MouseL| left mousebutton
GUI_MouseM| mid mousebutton
GUI_MouseR| right mousebutton
GUI_MouseScUp| mouse scroll up
GUI_MouseScDown mouse scroll down
GUI_OBJ_TYP(mo) = TYP_GUI_BoxGL
printf(" button=%d\n",GUI_DATA_I1);
int GUI_gl_ev_key ( MemObj *  mo,
void *  fKey 
)
add callback for the key-events
Input:
mo OpenGL-window-obj
fKey callback-function key-events
prototyp fKey:
int fKey (MemObj *mo, void **data);
// data=table of 3 pointers
GUI_DATA_EVENT =*(int*)data[0]=TYP_EventPress|TYP_EventRelease
GUI_DATA_I1 =*(int*)data[1]=TYP_DeviceKeyb
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.
GUI_OBJ_TYP(mo) = TYP_GUI_BoxGL
Returncodes: 0=continue with defaultOperations for this key.
1=do no defaultOperations; skip handling this key
printf(" key=%d\n",GUI_DATA_I1);
Example see GUI_entry__
int GUI_gl_block ( MemObj *  mo,
int  mode 
)
block (1) or unblock (0) input
Blocks scroll-events, key-events, button-events and move-events.
mo OpenGL-window-obj
int GUI_gl_draw ( void *  parent,
void *  event,
MemObj  mo 
)

INTERNAL draw / expose & config-callback

int GUI_gl_move ( void *  parent,
void *  event,
MemObj  mo 
)

INTERNAL

int GUI_gl_button ( void *  parent,
void *  ev,
MemObj  mo 
)

INTERNAL

int GUI_gl_key ( void *  parent,
void *  event,
MemObj  mo 
)

INTERNAL

int GUI_gl_idle1 ( void *  data)
INTERNAL draw must be last call
return 0; // removes idle-Call!
return 1; // keep idle-Call; call AP_Idle_CB again.

Variable Documentation

GtkWidget* UI_MainWin
GtkWidget* UI_act_wi
Obj_GLwin* UI_win_gl
static
MemObj UI_mo_gl
static
int statM1 =0
static
int statM2 =0
static
int statM3 =0
static
int statMK =0
static