63 dispatchDestroyEvent();
68 const wxGLContext *shared,
75 const wxPalette& palette):
76 wxGLCanvas(parent, shared, id, pos, size, style, name, attribList)
81 DragAcceptFiles(
true);
86 std::vector<String> files;
87 for(
int i=0; i<ev.GetNumberOfFiles(); ++i)
89 wxCharBuffer chars = ev.GetFiles()[i].ToUTF8();
90 String str = String::fromUTF8(chars.data());
116 int d = ev.GetWheelRotation() / ev.GetWheelDelta();
122 if (ev.GetButton() == wxMOUSE_BTN_NONE)
124 switch(ev.GetButton())
141 if (ev.GetButton() == wxMOUSE_BTN_NONE)
143 switch(ev.GetButton())
161 wxGLCanvas::OnSize(ev);
162 wxSize s = GetClientSize();
174 #if wxUSE_UNICODE == 1 175 unicode = ev.GetUnicodeKey();
177 unicode = ev.GetKeyCode() < 128 ? ev.GetKeyCode() : 0;
180 switch(ev.GetKeyCode())
182 case '0': key =
Key_0;
break;
183 case '1': key =
Key_1;
break;
184 case '2': key =
Key_2;
break;
185 case '3': key =
Key_3;
break;
186 case '4': key =
Key_4;
break;
187 case '5': key =
Key_5;
break;
188 case '6': key =
Key_6;
break;
189 case '7': key =
Key_7;
break;
190 case '8': key =
Key_8;
break;
191 case '9': key =
Key_9;
break;
193 case 'Q': key =
Key_Q;
break;
194 case 'W': key =
Key_W;
break;
195 case 'E': key =
Key_E;
break;
196 case 'R': key =
Key_R;
break;
197 case 'T': key =
Key_T;
break;
198 case 'Y': key =
Key_Y;
break;
199 case 'U': key =
Key_U;
break;
200 case 'I': key =
Key_I;
break;
201 case 'O': key =
Key_O;
break;
202 case 'P': key =
Key_P;
break;
203 case 'A': key =
Key_A;
break;
204 case 'S': key =
Key_S;
break;
205 case 'D': key =
Key_D;
break;
206 case 'F': key =
Key_F;
break;
207 case 'G': key =
Key_G;
break;
208 case 'H': key =
Key_H;
break;
209 case 'J': key =
Key_J;
break;
210 case 'K': key =
Key_K;
break;
211 case 'L': key =
Key_L;
break;
212 case 'Z': key =
Key_Z;
break;
213 case 'X': key =
Key_X;
break;
214 case 'C': key =
Key_C;
break;
215 case 'V': key =
Key_V;
break;
216 case 'B': key =
Key_B;
break;
217 case 'N': key =
Key_N;
break;
218 case 'M': key =
Key_M;
break;
222 case WXK_TAB: key =
Key_Tab;
break;
247 case '@': key =
Key_At;
break;
257 case WXK_CONTROL: key =
Key_Ctrl; unicode = 0;
break;
260 case WXK_ALT: key =
Key_Alt; unicode = 0;
break;
263 case WXK_SHIFT: key =
Key_Shift; unicode = 0;
break;
266 case WXK_INSERT: key =
Key_Insert; unicode = 0;
break;
267 case WXK_DELETE: key =
Key_Delete; unicode = 0;
break;
268 case WXK_HOME: key =
Key_Home; unicode = 0;
break;
269 case WXK_END: key =
Key_End; unicode = 0;
break;
270 case WXK_PRINT: key =
Key_Print; unicode = 0;
break;
271 case WXK_PAUSE: key =
Key_Pause; unicode = 0;
break;
272 case WXK_PAGEUP: key =
Key_PageUp; unicode = 0;
break;
273 case WXK_PAGEDOWN: key =
Key_PageDown; unicode = 0;
break;
274 case WXK_LEFT: key =
Key_Left; unicode = 0;
break;
275 case WXK_RIGHT: key =
Key_Right; unicode = 0;
break;
276 case WXK_UP: key =
Key_Up; unicode = 0;
break;
277 case WXK_DOWN: key =
Key_Down; unicode = 0;
break;
278 case WXK_F1: key =
Key_F1; unicode = 0;
break;
279 case WXK_F2: key =
Key_F2; unicode = 0;
break;
280 case WXK_F3: key =
Key_F3; unicode = 0;
break;
281 case WXK_F4: key =
Key_F4; unicode = 0;
break;
282 case WXK_F5: key =
Key_F5; unicode = 0;
break;
283 case WXK_F6: key =
Key_F6; unicode = 0;
break;
284 case WXK_F7: key =
Key_F7; unicode = 0;
break;
285 case WXK_F8: key =
Key_F8; unicode = 0;
break;
286 case WXK_F9: key =
Key_F9; unicode = 0;
break;
287 case WXK_F10: key =
Key_F10; unicode = 0;
break;
288 case WXK_F11: key =
Key_F11; unicode = 0;
break;
289 case WXK_F12: key =
Key_F12; unicode = 0;
break;
327 float r = rand()%100 / 100.0f;
328 float g = rand()%100 / 100.0f;
329 float b = rand()%100 / 100.0f;
330 float a = rand()%100 / 100.0f;
331 glClearColor(r,g,b,a);
332 glClear(GL_COLOR_BUFFER_BIT);
344 wxWindow* win =
this;
345 while(win->GetParent())
347 win = win->GetParent();
348 wxTopLevelWindowBase* win_base =
dynamic_cast<wxTopLevelWindowBase*
>(win);
351 win_base->ShowFullScreen(fullscreen, wxFULLSCREEN_ALL);
361 wxApp* app =
dynamic_cast<wxApp*
>(wxApp::GetInstance());
370 if (!GetContext())
return;
379 if (!GetContext())
return;
402 wxWindow* win =
this;
403 while(win->GetParent())
404 win = win->GetParent();
424 SetPosition(wxPoint(x,y));
434 wxPoint pt = GetPosition();
435 return ivec2(pt.x, pt.y);
442 mCursor = GetCursor();
453 image.SetRGB( wxRect(0,0,8,8), 255,255,255 );
454 image.SetMaskColour(255, 255, 255);
456 wxCursor cursor(image);
462 SetCursor( mCursor );
void swapBuffers()
Swaps the back and front buffers to present the last rendering.
void dispatchKeyReleaseEvent(unsigned short unicode_ch, EKey key)
Dispatches the UIEventListener::keyReleaseEvent() notification to the subscribed UIEventListener obje...
Vector2< int > ivec2
A 2 components vector with int precision.
void OnIdle(wxIdleEvent &ev)
void setMousePosition(int x, int y)
If the OpenGL context is a widget this function sets the mouse position.
void setAutomaticDelete(bool autodel_on)
If set to true the Object is deleted when its reference count reaches 0.
std::wstring toStdWString() const
Returns the std::wstring representation of a String.
void dispatchMouseDownEvent(EMouseButton button, int x, int y)
Dispatches the UIEventListener::mouseDownEvent() notification to the subscribed UIEventListener objec...
void OnKeyDown(wxKeyEvent &ev)
The String class implements an advanced UTF16 (Unicode BMP) string manipulation engine.
void eraseAllEventListeners()
Removes all UIEventListener previously registered.
virtual bool fullscreen() const
If the OpenGL context is a widget this function returns whether it has been maximized to fullscreen...
void dispatchKeyPressEvent(unsigned short unicode_ch, EKey key)
Dispatches the UIEventListener::keyPressEvent() notification to the subscribed UIEventListener object...
void dispatchResizeEvent(int w, int h)
Dispatches the UIEventListener::resizeEvent() notification to the subscribed UIEventListener objects...
void OnEraseBackground(wxEraseEvent &ev)
void quitApplication()
Asks to the windowing system that is managing the OpenGLContext to quit the application.
Visualization Library main namespace.
void translateKey(int &unicode, EKey &key, const wxKeyEvent &ev)
bool continuousUpdate() const
If the OpenGL context is a widget this function returns whether its area is continuously updated at e...
void dispatchUpdateEvent()
Dispatches the UIEventListener::updateEvent() notification to the subscribed UIEventListener objects...
void setSize(int w, int h)
If the OpenGL context is a widget this function sets its size.
void update()
If the OpenGLContext is a widget this function requests a redraw and generates an updateEvent()...
void OnMouseUp(wxMouseEvent &ev)
void setWindowTitle(const vl::String &text)
If the OpenGL context is a top window this function sets its title.
void dispatchMouseWheelEvent(int n)
Dispatches the UIEventListener::mouseWheelEvent() notification to the subscribed UIEventListener obje...
void OnKeyUp(wxKeyEvent &ev)
void setMouseVisible(bool visible)
If the OpenGL context is a widget this function sets whether the mouse is visible over it or not...
The wxWidgets bindings namespace.
virtual bool mouseVisible() const
If the OpenGL context is a widget this function returns whether the mouse is visible over it or not...
void OnMouseWheel(wxMouseEvent &ev)
void OnMouseEnter(wxMouseEvent &ev)
void OnMouseMotion(wxMouseEvent &ev)
void dispatchFileDroppedEvent(const std::vector< String > &files)
Dispatches the UIEventListener::fileDroppedEvent() notification to the subscribed UIEventListener obj...
vl::ivec2 position() const
If the OpenGL context is a widget this function returns its position.
void show()
If the OpenGL context is a widget this function makes it visible to the user.
void dispatchMouseMoveEvent(int x, int y)
Dispatches the UIEventListener::mouseMoveEvent() notification to the subscribed UIEventListener objec...
The WXGLCanvas class implements a vl::OpenGLContext using the wxWidgets library.
void OnMouseDown(wxMouseEvent &ev)
void makeCurrent()
Sets the OpenGL context as current for the calling thread.
WXGLCanvas(wxWindow *parent, const wxGLContext *shared, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, int *attribList=0, const wxString &name=wxT("WXGLCanvas"), const wxPalette &palette=wxNullPalette)
std::string toStdString() const
Returns a UTF8 encoded std::string.
void setPosition(int x, int y)
If the OpenGL context is a widget this function sets its position.
void hide()
If the OpenGL context is a widget this function makes it invisible to the user.
void OnPaint(wxPaintEvent &ev)
void getFocus()
If the OpenGL context is a widget this function requests the mouse focus on it.
void OnDropFiles(wxDropFilesEvent &ev)
bool setFullscreen(bool fullscreen)
If the OpenGL context is a widget this function requests a maximization to fullscreen.
void OnSize(wxSizeEvent &ev)
void dispatchMouseUpEvent(EMouseButton button, int x, int y)
Dispatches the UIEventListener::mouseUpEvent() notification to the subscribed UIEventListener objects...