Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics
[Home] [Tutorials] [All Classes] [Grouped Classes]

X:/dropbox/visualizationlibrary/src/vlWX/WXGLCanvas.hpp

Go to the documentation of this file.
00001 /**************************************************************************************/
00002 /*                                                                                    */
00003 /*  Visualization Library                                                             */
00004 /*  http://www.visualizationlibrary.org                                               */
00005 /*                                                                                    */
00006 /*  Copyright (c) 2005-2010, Michele Bosi                                             */
00007 /*  All rights reserved.                                                              */
00008 /*                                                                                    */
00009 /*  Redistribution and use in source and binary forms, with or without modification,  */
00010 /*  are permitted provided that the following conditions are met:                     */
00011 /*                                                                                    */
00012 /*  - Redistributions of source code must retain the above copyright notice, this     */
00013 /*  list of conditions and the following disclaimer.                                  */
00014 /*                                                                                    */
00015 /*  - Redistributions in binary form must reproduce the above copyright notice, this  */
00016 /*  list of conditions and the following disclaimer in the documentation and/or       */
00017 /*  other materials provided with the distribution.                                   */
00018 /*                                                                                    */
00019 /*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND   */
00020 /*  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED     */
00021 /*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE            */
00022 /*  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR  */
00023 /*  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    */
00024 /*  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;      */
00025 /*  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON    */
00026 /*  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT           */
00027 /*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS     */
00028 /*  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                      */
00029 /*                                                                                    */
00030 /**************************************************************************************/
00031 
00032 #ifndef vlWXGLCanvas_INCLUDE_ONCE
00033 #define vlWXGLCanvas_INCLUDE_ONCE
00034 
00035 #include <vlWX/link_config.hpp>
00036 #include <vlGraphics/OpenGLContext.hpp>
00037 #include <vlCore/Time.hpp>
00038 #include <wx/frame.h>
00039 #include <wx/glcanvas.h>
00040 #include <wx/timer.h>
00041 #include <wx/dcclient.h>
00042 #include <wx/image.h>
00043 #include <wx/app.h>
00044 
00045 #if !wxUSE_GLCANVAS
00046   #error "OpenGL required: set wxUSE_GLCANVAS to 1 and rebuild the library"
00047 #endif
00048 
00049 namespace vlWX
00050 {
00052   class VLWX_EXPORT WXGLCanvas: public wxGLCanvas, public vl::OpenGLContext
00053   {
00054   public:
00055     WXGLCanvas( wxWindow *parent,
00056       const wxGLContext *shared,
00057       wxWindowID id = wxID_ANY,
00058       const wxPoint& pos = wxDefaultPosition,
00059       const wxSize& size = wxDefaultSize,
00060       long style = 0,
00061       int *attribList = 0,
00062       const wxString& name = wxT("WXGLCanvas"),
00063       const wxPalette& palette = wxNullPalette );
00064 
00065     ~WXGLCanvas();
00066 
00067     void OnPaint(wxPaintEvent& ev);
00068     void OnSize(wxSizeEvent& ev);
00069     void OnEraseBackground(wxEraseEvent& ev);
00070     void OnKeyDown(wxKeyEvent& ev);
00071     void OnKeyUp(wxKeyEvent& ev);
00072     /*void OnChar(wxKeyEvent& ev);*/
00073     void OnMouseMotion(wxMouseEvent &ev);
00074     void OnMouseDown(wxMouseEvent &ev);
00075     void OnMouseUp(wxMouseEvent &ev);
00076     void OnMouseWheel( wxMouseEvent& ev );
00077     void OnMouseEnter(wxMouseEvent& ev);
00078     void OnIdle(wxIdleEvent& ev);
00079     void OnDropFiles(wxDropFilesEvent& ev);
00080 
00081     bool setFullscreen(bool fullscreen);
00082     void quitApplication();
00083     void makeCurrent();
00084     void swapBuffers();
00085     void getFocus();
00086     void setMousePosition(int x, int y);
00087     void update();
00088     void setWindowTitle(const vl::String& text);
00089     void show();
00090     void hide();
00091     void setPosition(int x, int y);
00092     void setSize(int w, int h);
00093     vl::ivec2 position() const;
00094     void setMouseVisible(bool visible);
00095 
00096   private:
00097     wxCursor mCursor;
00098     int mMouseCount;
00099     DECLARE_EVENT_TABLE()
00100   };
00101 }
00102 
00103 #endif

Visualization Library 2011.09.1160 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu May 2 2013 13:40:44.
Permission is granted to use this page to write and publish articles regarding Visualization Library.