OGRE  1.8
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreGTKWindow.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org
6 
7 Copyright (c) 2000-2013 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 
29 #ifndef INCL_OGRE_GTKWINDOW_H
30 #define INCL_OGRE_GTKWINDOW_H
31 
32 #include "OgreRenderWindow.h"
33 
34 #include <gtkmm/main.h>
35 #include <gtkmm/window.h>
36 #include <gtkglmm.h>
37 
38 #include <GL/gl.h>
39 
40 namespace Ogre {
41 
42 class OGREWidget : public Gtk::GL::DrawingArea
43 {
44 public:
45  OGREWidget(bool useDepthBuffer);
46 };
47 
48 class GTKWindow : public RenderWindow, public SigC::Object
49 {
50 public:
51  GTKWindow();
52  ~GTKWindow();
53 
58  bool pump_events();
59 
64 
65  void create(const String& name, unsigned int width, unsigned int height, unsigned int colourDepth,
66  bool fullScreen, int left, int top, bool depthBuffer,
67  void* miscParam, ...);
68 
69  void setFullscreen(bool fullScreen, unsigned int width, unsigned int height);
70  void destroy(void);
71  bool isActive(void) const;
72  bool isClosed(void) const;
73  void reposition(int left, int top);
74  void resize(unsigned int width, unsigned int height);
75  void swapBuffers(bool waitForVSync);
76  void copyContentsToMemory(const PixelBox &dst, FrameBuffer buffer);
77 
78  bool requiresTextureFlipping() const { return false; }
79 
86  void getCustomAttribute( const String& name, void* pData );
87 protected:
88  // Signal handlers
89  bool on_delete_event(GdkEventAny* event);
90  bool on_expose_event(GdkEventExpose* event);
91  // bool SimpleGLScene::on_configure_event(GdkEventConfigure* event)
92 private:
93  //Gtk::Main* kit;
94  Gtk::Window *mGtkWindow;
96 }; // class GTKWindow
97 
98 }; // namespace Ogre
99 
100 #endif // INCL_OGRE_GTKWINDOW_H
Manages the target rendering window.
void getCustomAttribute(const String &name, void *pData)
Get a custom, GTK specific attribute.
void swapBuffers(bool waitForVSync)
Swaps the frame buffers to display the next frame.
void reposition(int left, int top)
Reposition the window.
void destroy(void)
Destroys the window.
bool requiresTextureFlipping() const
Definition: OgreGTKWindow.h:78
void resize(unsigned int width, unsigned int height)
Alter the size of the window.
void copyContentsToMemory(const PixelBox &dst, FrameBuffer buffer)
Copies the current contents of the render target to a pixelbox.
void create(const String &name, unsigned int width, unsigned int height, unsigned int colourDepth, bool fullScreen, int left, int top, bool depthBuffer, void *miscParam,...)
OGREWidget * get_ogre_widget()
Get the actual widget that is housing OGRE's GL view.
bool isClosed(void) const
Indicates whether the window has been closed by the user.
Gtk::Window * mGtkWindow
Definition: OgreGTKWindow.h:94
bool on_delete_event(GdkEventAny *event)
OGREWidget * ogre
Definition: OgreGTKWindow.h:95
bool on_expose_event(GdkEventExpose *event)
_StringBase String
A primitive describing a volume (3D), image (2D) or line (1D) of pixels in memory.
bool pump_events()
Pump the main loop to actually generate events.
void setFullscreen(bool fullScreen, unsigned int width, unsigned int height)
Alter fullscreen mode options.
bool isActive(void) const
Overridden from RenderTarget, flags invisible windows as inactive.
OGREWidget(bool useDepthBuffer)