Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/wcrdisplay/wcrGraphicsWindow.h

Go to the documentation of this file.
00001 // Filename: wcrGraphicsWindow.h
00002 // Created by:  skyler, based on wgl* file.
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 #ifndef WCRGRAPHICSWINDOW_H
00019 #define WCRGRAPHICSWINDOW_H
00020 //
00021 ////////////////////////////////////////////////////////////////////
00022 // Includes
00023 ////////////////////////////////////////////////////////////////////
00024 #include <pandabase.h>
00025 
00026 #include <graphicsWindow.h>
00027 #define WINDOWS_LEAN_AND_MEAN
00028 #include <windows.h>
00029 #undef WINDOWS_LEAN_AND_MEAN
00030 
00031 ////////////////////////////////////////////////////////////////////
00032 // Defines
00033 ////////////////////////////////////////////////////////////////////
00034 class wcrGraphicsPipe;
00035 
00036 ////////////////////////////////////////////////////////////////////
00037 //       Class : wcrGraphicsWindow
00038 // Description :
00039 ////////////////////////////////////////////////////////////////////
00040 class EXPCL_PANDACR wcrGraphicsWindow : public GraphicsWindow {
00041 public:
00042   wcrGraphicsWindow(GraphicsPipe* pipe);
00043   wcrGraphicsWindow(GraphicsPipe* pipe,
00044              const GraphicsWindow::Properties& props);
00045   virtual ~wcrGraphicsWindow();
00046 
00047   virtual bool supports_update() const;
00048   virtual void update();
00049   virtual void end_frame();
00050   virtual void swap();
00051   virtual int get_depth_bitwidth();
00052 
00053   virtual TypeHandle get_gsg_type() const;
00054   static GraphicsWindow* make_wcrGraphicsWindow(const FactoryParams &params);
00055 
00056 public:
00057   virtual void make_current();
00058   virtual void unmake_current();
00059 
00060   INLINE bool mouse_entry_enabled() { return _mouse_entry_enabled; }
00061   INLINE bool mouse_motion_enabled() { return _mouse_motion_enabled; }
00062   INLINE bool mouse_passive_motion_enabled() {
00063     return _mouse_passive_motion_enabled;
00064   }
00065 //  void handle_reshape(int w, int h);
00066 
00067   void handle_mouse_motion(int x, int y);
00068   void handle_mouse_entry(int state);
00069   void handle_keypress(ButtonHandle key, int x, int y);
00070   void handle_keyrelease(ButtonHandle key);
00071 
00072 protected:
00073 //  PIXELFORMATDESCRIPTOR* try_for_visual(wcrGraphicsPipe *pipe,
00074 //                              int mask, int want_depth_bits = 1, int want_color_bits = 1);
00075 //  static void get_config(PIXELFORMATDESCRIPTOR* visual, int attrib, int *value);
00076   int choose_visual();
00077   virtual void config();
00078   void setup_colormap();
00079 
00080   void enable_mouse_input(bool val);
00081   void enable_mouse_motion(bool val);
00082   void enable_mouse_passive_motion(bool val);
00083   void enable_mouse_entry(bool val);
00084 
00085   void handle_reshape();
00086   void process_events();
00087 
00088 public:
00089   HWND   _mwindow;
00090 
00091 private:
00092   // TODO:skyler HGLRC  _context;
00093   int  _context;
00094   HDC    _hdc;
00095   PIXELFORMATDESCRIPTOR  _pixelformat;
00096   HPALETTE _colormap;
00097   HCURSOR  _hMouseCursor;
00098   HWND     _hOldForegroundWindow;
00099   UINT_PTR _PandaPausedTimer;
00100 
00101   DEVMODE *_pCurrent_display_settings;
00102   bool    _bIsLowVidMemCard;
00103   bool    _bLoadedCustomCursor;
00104 
00105   bool    _window_inactive;
00106   bool    _active_minimized_fullscreen;
00107   bool    _return_control_to_app;
00108   bool    _exiting_window;
00109 
00110   bool    _mouse_input_enabled;
00111   bool    _mouse_motion_enabled;
00112   bool    _mouse_passive_motion_enabled;
00113   bool    _mouse_entry_enabled;
00114   bool    _ime_open;
00115 
00116   // vars for frames/sec meter
00117   DWORD _start_time;
00118   DWORD _start_frame_count;
00119   DWORD _cur_frame_count;
00120   float _current_fps;
00121 
00122   string _extensions_str;
00123 
00124 public:
00125   static TypeHandle get_class_type();
00126   static void init_type();
00127   virtual TypeHandle get_type() const;
00128   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00129 
00130   LONG WINAPI window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
00131   ButtonHandle lookup_key(WPARAM wparam) const;
00132   void DestroyMe(bool bAtExitFnCalled);
00133   virtual void deactivate_window();
00134   virtual void reactivate_window();
00135 
00136   virtual bool resize(unsigned int xsize,unsigned int ysize);
00137   virtual unsigned int verify_window_sizes(unsigned int numsizes,unsigned int *dimen);
00138 
00139 protected:
00140   virtual void do_close_window();
00141   void check_for_color_cursor_support();
00142 
00143 private:
00144   static TypeHandle _type_handle;
00145 };
00146 
00147 #endif

Generated on Fri May 2 00:44:42 2003 for Panda by doxygen1.3