00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef SUBPROCESSWINDOW_H
00016 #define SUBPROCESSWINDOW_H
00017
00018 #include "pandabase.h"
00019
00020
00021
00022
00023 #ifdef IS_OSX
00024 #define SUPPORT_SUBPROCESS_WINDOW 1
00025 #else
00026 #undef SUPPORT_SUBPROCESS_WINDOW
00027 #endif
00028
00029 #ifdef SUPPORT_SUBPROCESS_WINDOW
00030
00031 #include "graphicsWindow.h"
00032 #include "graphicsBuffer.h"
00033 #include "texture.h"
00034 #include "subprocessWindowBuffer.h"
00035 #include "filename.h"
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 class SubprocessWindow : public GraphicsWindow {
00051 public:
00052 SubprocessWindow(GraphicsEngine *engine, GraphicsPipe *pipe,
00053 const string &name,
00054 const FrameBufferProperties &fb_prop,
00055 const WindowProperties &win_prop,
00056 int flags,
00057 GraphicsStateGuardian *gsg,
00058 GraphicsOutput *host);
00059 virtual ~SubprocessWindow();
00060
00061 virtual void process_events();
00062
00063 virtual bool begin_frame(FrameMode mode, Thread *current_thread);
00064 virtual void end_frame(FrameMode mode, Thread *current_thread);
00065 virtual void begin_flip();
00066
00067 virtual void set_properties_now(WindowProperties &properties);
00068
00069 protected:
00070 virtual void close_window();
00071 virtual bool open_window();
00072
00073 private:
00074 void internal_close_window();
00075 bool internal_open_window();
00076
00077 ButtonHandle translate_key(int &keycode, int os_code, unsigned int flags) const;
00078 void transition_button(unsigned int flag, ButtonHandle button);
00079
00080 private:
00081 PT(GraphicsBuffer) _buffer;
00082 PT(Texture) _texture;
00083
00084 int _fd;
00085 size_t _mmap_size;
00086 Filename _filename;
00087 SubprocessWindowBuffer *_swbuffer;
00088
00089 unsigned int _last_event_flags;
00090
00091 public:
00092 static TypeHandle get_class_type() {
00093 return _type_handle;
00094 }
00095 static void init_type() {
00096 GraphicsWindow::init_type();
00097 register_type(_type_handle, "SubprocessWindow",
00098 GraphicsWindow::get_class_type());
00099 }
00100 virtual TypeHandle get_type() const {
00101 return get_class_type();
00102 }
00103 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00104
00105 private:
00106 static TypeHandle _type_handle;
00107 };
00108
00109 #include "subprocessWindow.I"
00110
00111 #endif // SUPPORT_SUBPROCESS_WINDOW
00112
00113 #endif
00114