00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "jed_defs.h"
00023
00024 #include <stdio.h>
00025 #include <string.h>
00026 #include <stdlib.h>
00027 #include "jed_gl.h"
00028 #include "framework/gui/_owl.h"
00029 #include "lista.cc"
00030
00031
00032
00033
00034
00035 #ifndef OWL_ENABLED
00036
00037 JED_GUI_CLASE_NULA(JED_OWL_INTERFACE, "JED_OWL_INTERFACE",
00038 "OWL", "Borland OWL", "OWL_ENABLED");
00039
00040 #endif
00041
00042 #ifdef OWL_ENABLED
00043
00044 #include <vcl.h>
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 JED_OWL_INTERFACE *INTERFACE_Aquynza = NULL;
00057
00058
00059 int (*OWLGUI_ejecutor_callback)(int idc, int context_id);
00060 void (*OWLGUI_draw_callback)(int);
00061 int (*OWLGUI_tick_callback)(int);
00062 void (*OWLGUI_resize_callback)(int x_tam, int y_tam, int);
00063 int (*OWLGUI_keyboard_callback)(EVENTO_GUI *e, int);
00064 int (*OWLGUI_mouse_callback)(EVENTO_GUI *e, int);
00065 void (*OWLGUI_multiview_callback)(int operacion, int id_vista,
00066 char *detalles, char *menu, char *botonera);
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 #define VERIFICAR(o) \
00077 if ( !(o) ) { \
00078 fprintf(stderr, "<OWL> - ERROR FATAL: No hay memoria!\n"); \
00079 fflush(stderr); \
00080 exit(-1); \
00081 }
00082
00083
00084
00085
00086
00087 static void quit_callback(int ) { exit(1); }
00088 static void pintar_nulo(int ) { ; }
00089 static void resize_nulo(int , int , int ) { ; }
00090 static void idle_nulo(void) {
00091 }
00092 static int evento_nulo(EVENTO_GUI * , int ) { return 0; }
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102 JED_OWL_INTERFACE::JED_OWL_INTERFACE()
00103 {
00104 OWLGUI_draw_callback = pintar_nulo;
00105 OWLGUI_tick_callback = NULL;
00106 OWLGUI_mouse_callback = evento_nulo;
00107 OWLGUI_keyboard_callback = evento_nulo;
00108 OWLGUI_resize_callback = resize_nulo;
00109 OWLGUI_multiview_callback = NULL;
00110 OWLGUI_ejecutor_callback = NULL;
00111
00112
00113
00114
00115
00116
00117 }
00118
00119 JED_OWL_INTERFACE::~JED_OWL_INTERFACE()
00120 {
00121 ;
00122 }
00123
00124 void JED_OWL_INTERFACE::solicitar_repintado(void){;}
00125
00126 void JED_OWL_INTERFACE::set_draw_callback( void (*p)(int context_id) )
00127 { OWLGUI_draw_callback = p; }
00128
00129 void JED_OWL_INTERFACE::set_tick_callback( int (*p)(int context_id) )
00130 { OWLGUI_tick_callback = p; }
00131
00132 void JED_OWL_INTERFACE::set_keyboard_callback(
00133 int (*p)(EVENTO_GUI *e, int context_id) )
00134 { OWLGUI_keyboard_callback = p; }
00135
00136 void JED_OWL_INTERFACE::set_mouse_callback(
00137 int (*p)(EVENTO_GUI *e, int context_id) )
00138 { OWLGUI_mouse_callback = p; }
00139
00140 void JED_OWL_INTERFACE::set_resize_callback(
00141 void (*p)(int x_tam, int y_tam, int context_id) )
00142 { OWLGUI_resize_callback = p; }
00143
00144 void JED_OWL_INTERFACE::set_ejecutor( int (*p)(int idc, int context_id) )
00145 { OWLGUI_ejecutor_callback = p; }
00146
00147 void JED_OWL_INTERFACE::set_multiview_callback(void (*p)(int operacion,
00148 int id_vista, char *detalles, char *menu, char *botonera) )
00149 { OWLGUI_multiview_callback = p; }
00150
00151 BOOLEAN
00152 JED_OWL_INTERFACE::crear(int * , char * [],
00153 int , int , char * )
00154 {
00155
00156 leer_gui("etc/spanish.gui");
00157
00158 return TRUE;
00159 }
00160
00161 #ifdef NONONO
00162 void
00163 JED_OWL_INTERFACE::crear_ventana_glut(void)
00164 {
00165
00166 MENU *Global = resolver_menu(menu);
00167 int menu_glut;
00168
00169 if ( lista_menus.tam() > 0 && Global ) {
00170 menu_glut = Global->crear_glut(glut_menu_callback);
00171 }
00172 else {
00173 menu_glut = glutCreateMenu(quit_callback);
00174 glutSetMenu(menu_glut);
00175 glutAddMenuEntry("Salir", 666);
00176 }
00177
00178 glutSetMenu(menu_glut);
00179 glutSetWindow(Nueva_ventana->id);
00180 glutAttachMenu(GLUT_RIGHT_BUTTON);
00181
00182
00183 LAS_ventanas.anx(Nueva_ventana);
00184 glutSetWindow(Nueva_ventana->id);
00185 }
00186 #endif
00187
00188
00189 void
00190 JED_OWL_INTERFACE::ejecutar(void)
00191 {
00192
00193 Application->Run();
00194 }
00195
00196 void
00197 JED_OWL_INTERFACE::finalizar(void)
00198 {
00199
00200 }
00201
00202 BOOLEAN
00203 JED_OWL_INTERFACE::anexar_controles(LISTA <CONTROL_GUI *> * ,
00204 REPOSITORIO_DE_ENTIDADES * )
00205 {
00206 fprintf(stderr, "<JED_INTERFACE> ERROR: Los controles GUI no estan\n"
00207 " implemetados en la interface actual. Intente Motif.\n");
00208 fflush(stderr);
00209 return FALSE;
00210 }
00211
00212 #endif // OWL_ENABLED
00213
00214
00215
00216
00217