core/vgui/internals/vgui_overlay_helper.h
Go to the documentation of this file.
00001 // This is core/vgui/internals/vgui_overlay_helper.h
00002 #ifndef vgui_overlay_helper_h_
00003 #define vgui_overlay_helper_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \author fsm
00010 // \brief  Helper class to emulate overlays using an auxiliary buffer.
00011 
00012 class vgui_event;
00013 class vgui_adaptor;
00014 
00015 //: A helper class which emulates overlays using an auxiliary buffer.
00016 //  The auxiliary buffer may be an OpenGL "aux buffer", the OpenGL
00017 //  back buffer, a Mesa pixmap or some other resource.
00018 //
00019 //  To use it, the adaptor must relinquish control of event dispatch
00020 //  to the vgui_overlay_helper using the dispatch method and also
00021 //  call post_overlay_redraw() when an overlay redraw is posted on
00022 //  the adaptor.
00023 struct vgui_overlay_helper
00024 {
00025   vgui_overlay_helper(vgui_adaptor *);
00026   ~vgui_overlay_helper();
00027 
00028   // client methods
00029   void post_overlay_redraw() { overlay_redraw_posted = true; }
00030   bool dispatch(vgui_event const &e);
00031 
00032  private:
00033   vgui_adaptor *adaptor;
00034   bool aux_buffer_is_back_buffer;
00035   bool last_draw_was_overlay;
00036   bool overlay_redraw_posted;
00037 
00038   // these helpers implement dispatch()
00039   bool dispatch_draw(vgui_event const &);
00040   bool dispatch_other(vgui_event const &);
00041   bool dispatch_overlay_draw(vgui_event const &);
00042 };
00043 
00044 #endif // vgui_overlay_helper_h_