| 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-2006 Torus Knot Software Ltd |
|---|
| 8 | Also see acknowledgements in Readme.html |
|---|
| 9 | |
|---|
| 10 | This program is free software; you can redistribute it and/or modify it under |
|---|
| 11 | the terms of the GNU Lesser General Public License as published by the Free Software |
|---|
| 12 | Foundation; either version 2 of the License, or (at your option) any later |
|---|
| 13 | version. |
|---|
| 14 | |
|---|
| 15 | This program is distributed in the hope that it will be useful, but WITHOUT |
|---|
| 16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|---|
| 17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
|---|
| 18 | |
|---|
| 19 | You should have received a copy of the GNU Lesser General Public License along with |
|---|
| 20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
|---|
| 21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to |
|---|
| 22 | http://www.gnu.org/copyleft/lesser.txt. |
|---|
| 23 | |
|---|
| 24 | You may alternatively use this source under the terms of a specific version of |
|---|
| 25 | the OGRE Unrestricted License provided you have obtained such a license from |
|---|
| 26 | Torus Knot Software Ltd. |
|---|
| 27 | ----------------------------------------------------------------------------- |
|---|
| 28 | */ |
|---|
| 29 | |
|---|
| 30 | #ifndef INCL_OGRE_GTKWINDOW_H |
|---|
| 31 | #define INCL_OGRE_GTKWINDOW_H |
|---|
| 32 | |
|---|
| 33 | #include "OgreRenderWindow.h" |
|---|
| 34 | |
|---|
| 35 | #include <gtkmm/main.h> |
|---|
| 36 | #include <gtkmm/window.h> |
|---|
| 37 | #include <gtkglmm.h> |
|---|
| 38 | |
|---|
| 39 | #include <GL/gl.h> |
|---|
| 40 | |
|---|
| 41 | namespace Ogre { |
|---|
| 42 | |
|---|
| 43 | class OGREWidget : public Gtk::GL::DrawingArea |
|---|
| 44 | { |
|---|
| 45 | public: |
|---|
| 46 | OGREWidget(bool useDepthBuffer); |
|---|
| 47 | }; |
|---|
| 48 | |
|---|
| 49 | class GTKWindow : public RenderWindow, public SigC::Object |
|---|
| 50 | { |
|---|
| 51 | public: |
|---|
| 52 | GTKWindow(); |
|---|
| 53 | ~GTKWindow(); |
|---|
| 54 | |
|---|
| 55 | /** |
|---|
| 56 | * Pump the main loop to actually generate events |
|---|
| 57 | * @returns false when there are no events left to pump |
|---|
| 58 | */ |
|---|
| 59 | bool pump_events(); |
|---|
| 60 | |
|---|
| 61 | /** |
|---|
| 62 | * Get the actual widget that is housing OGRE's GL view. |
|---|
| 63 | */ |
|---|
| 64 | OGREWidget* get_ogre_widget(); |
|---|
| 65 | |
|---|
| 66 | void create(const String& name, unsigned int width, unsigned int height, unsigned int colourDepth, |
|---|
| 67 | bool fullScreen, int left, int top, bool depthBuffer, |
|---|
| 68 | void* miscParam, ...); |
|---|
| 69 | |
|---|
| 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 writeContentsToFile(const String& filename); |
|---|
| 77 | |
|---|
| 78 | bool requiresTextureFlipping() const { return false; } |
|---|
| 79 | |
|---|
| 80 | /** |
|---|
| 81 | * Get a custom, GTK specific attribute. The specific attributes |
|---|
| 82 | * are: |
|---|
| 83 | * GTKMMWINDOW The Gtk::Window instance (Rendering window) |
|---|
| 84 | * GTKGLMMWIDGET The Gtk::GL::DrawingArea instance (Ogre widget) |
|---|
| 85 | */ |
|---|
| 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; |
|---|
| 95 | OGREWidget* ogre; |
|---|
| 96 | }; // class GTKWindow |
|---|
| 97 | |
|---|
| 98 | }; // namespace Ogre |
|---|
| 99 | |
|---|
| 100 | #endif // INCL_OGRE_GTKWINDOW_H |
|---|