00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __WXWINDOWSGUI__
00023 #define __WXWINDOWSGUI__
00024
00025 #include "jed_defs.h"
00026 #include "framework/gui/jed_gui.h"
00027 #include "lista.h"
00028
00029 #ifdef WXWINDOWS_ENABLED
00030
00031 #ifdef _STRING_H
00032 #undef _STRING_H
00033 #include <wx/wx.h>
00034 #define _STRING_H
00035 #endif
00036 #ifndef _STRING_H
00037 #include <wx/wx.h>
00038 #endif
00039 #include <wx/timer.h>
00040 #include <wx/log.h>
00041
00042 #if !wxUSE_GLCANVAS
00043 #error WXWINDOWS INSTALLATION ERROR - Please activate wxUSE_GLCANVAS
00044 #endif
00045 #include <wx/glcanvas.h>
00046 #include <wx/notebook.h>
00047
00048
00049
00050 class JED_WXWINDOWS_GUI;
00051 class _WXWINDOWS_GLWIDGET;
00052 class _WXWINDOWS_APLICACION;
00053
00054 class _WXWINDOWS_NOTEBOOK : public wxNotebook
00055 {
00056 public:
00057 _WXWINDOWS_NOTEBOOK(wxWindow *parent, wxWindowID id = -1,
00058 const wxPoint& pos = wxDefaultPosition,
00059 const wxSize& size = wxDefaultSize, long style = 0);
00060 wxPanel *crear_pagina(void);
00061 };
00062
00063 class _WXWINDOWS_WINDOW: public wxFrame
00064 {
00065 DECLARE_EVENT_TABLE();
00066
00067 private:
00068 wxTimer tick_timer;
00069 int _id;
00070 _WXWINDOWS_GLWIDGET *drawing_area;
00071 wxPanel *panel;
00072 wxSizer *panel_sizer;
00073 _WXWINDOWS_NOTEBOOK *area2;
00074
00075 public:
00076 _WXWINDOWS_WINDOW(wxFrame *frame, const wxString& title, const wxPoint& pos,
00077 const wxSize& size, long style = wxDEFAULT_FRAME_STYLE);
00078
00079 void OnExit(wxCommandEvent& event);
00080 void OnNewWindow(wxCommandEvent& event);
00081 void OnTimer(wxTimerEvent& event);
00082 void OnMenu(wxCommandEvent& event);
00083 wxPanel *crear_area_adicional(void);
00084
00085 friend class _WXWINDOWS_APLICACION;
00086 };
00087
00088 class _WXWINDOWS_GLWIDGET: public wxGLCanvas
00089 {
00090 DECLARE_EVENT_TABLE();
00091
00092 private:
00093 int id_vista;
00094
00095 public:
00096 _WXWINDOWS_GLWIDGET(wxWindow *parent, const wxWindowID id = -1,
00097 const wxPoint& pos = wxDefaultPosition,
00098 const wxSize& size = wxDefaultSize,
00099 long style = 0, const wxString& name = "AQUYNZA_APPLICATION");
00100 _WXWINDOWS_GLWIDGET(wxWindow *parent, const _WXWINDOWS_GLWIDGET &other,
00101 const wxWindowID id = -1,
00102 const wxPoint& pos = wxDefaultPosition,
00103 const wxSize& size = wxDefaultSize, long style = 0,
00104 const wxString& name = "AQUYNZA_APPLICATION" );
00105
00106 ~_WXWINDOWS_GLWIDGET(void);
00107
00108 void OnPaint(wxPaintEvent& event);
00109 void OnSize(wxSizeEvent& event);
00110 void OnChar(wxKeyEvent& event);
00111 void OnKeyDown(wxKeyEvent& event);
00112 void OnKeyUp(wxKeyEvent& event);
00113 void OnEnterWindow(wxMouseEvent& event);
00114 void OnMotion(wxMouseEvent& event);
00115 void OnButton(wxMouseEvent& event);
00116 void OnEraseBackground(wxEraseEvent& event);
00117
00118 friend class _WXWINDOWS_WINDOW;
00119 };
00120
00121
00122 #endif // WXWINDOWS_ENABLED
00123
00124 class JED_WXWINDOWS_INTERFACE : public JED_INTERFACE {
00125 private:
00126 int _xtam;
00127 int _ytam;
00128 char *_nombre;
00129 int *_Argc;
00130 char **_ARgv;
00131
00132 LISTA <CONTROL_GUI *> *Controles_pendientes;
00133 REPOSITORIO_DE_ENTIDADES *Repositorio_pendiente;
00134
00135
00136
00137 public:
00138 JED_WXWINDOWS_INTERFACE();
00139 virtual ~JED_WXWINDOWS_INTERFACE();
00140
00141 BOOLEAN crear(int *Argc, char *argv[],
00142 int x_tam = 320, int y_tam = 200, char *nombre = "AQUYNZA");
00143 void finalizar(void);
00144 void ejecutar(void);
00145 #ifdef WXWINDOWS_ENABLED
00146 void solicitar_nueva_ventana(void);
00147 #endif
00148 void solicitar_repintado(void);
00149 void set_draw_callback( void (*p)(int context_id) );
00150 void set_tick_callback( int (*p)(int context_id) );
00151 void set_ejecutor( int (*p)(int idc, int context_id) );
00152 void set_mouse_callback( int (*p)(EVENTO_GUI *e, int context_id) );
00153 void set_keyboard_callback( int (*p)(EVENTO_GUI *e, int context_id) );
00154 void set_resize_callback(void (*p)(int x_tam, int y_tam, int context_id));
00155 void set_multiview_callback
00156 ( void (*p)(int operacion, int id_vista, char *detalles,
00157 char *menu, char *botonera) );
00158 BOOLEAN
00159 anexar_controles(LISTA <CONTROL_GUI *> *Controles,
00160 REPOSITORIO_DE_ENTIDADES *Repositorio);
00161 #ifdef WXWINDOWS_ENABLED
00162 friend class _WXWINDOWS_APLICACION;
00163 #endif
00164 };
00165
00166 #ifdef WXWINDOWS_ENABLED
00167 class _WXWINDOWS_APLICACION : public wxApp
00168 {
00169 private:
00170 JED_WXWINDOWS_INTERFACE *_Gui;
00171 public:
00172 bool OnInit(void);
00173 void set_gui(JED_WXWINDOWS_INTERFACE *Gui);
00174 };
00175 #endif
00176
00177 #endif // __WXWINDOWSGUI__
00178
00179
00180
00181
00182