csplugincommon/canvas/canvascommon.h
Go to the documentation of this file.00001 /* 00002 Copyright (C) 1998-2001 by Jorrit Tyberghein 00003 (C) 2012 by Frank Richter 00004 Originally written by Andrew Zabolotny <bit@eltech.ru> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public 00017 License along with this library; if not, write to the Free 00018 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00019 */ 00020 00021 #ifndef __CS_CSPLUGINCOMMON_CANVAS_CANVASCOMMON_H__ 00022 #define __CS_CSPLUGINCOMMON_CANVAS_CANVASCOMMON_H__ 00023 00028 #include "csextern.h" 00029 00030 #include "iutil/event.h" 00031 #include "iutil/pluginconfig.h" 00032 #include "ivideo/canvas.h" 00033 #include "ivideo/natwin.h" 00034 00039 struct iEventOutlet; 00040 struct iObjectRegistry; 00041 00042 namespace CS 00043 { 00044 namespace PluginCommon 00045 { 00046 00047 #include "csutil/deprecated_warn_off.h" 00048 00059 class CS_CRYSTALSPACE_EXPORT CanvasCommonBase : 00060 public virtual iGraphicsCanvas, 00061 public iNativeWindow, 00062 public iNativeWindowManager, 00063 public iPluginConfig, 00064 public iEventPlug 00065 { 00066 public: 00068 iObjectRegistry* objectReg; 00070 bool canvas_open; 00071 00073 csString win_title; 00074 00076 int fbWidth, fbHeight, Depth; 00077 00083 int DisplayNumber; 00085 bool FullScreen; 00087 bool AllowResizing; 00091 virtual void ChangeDepth (int d); 00095 virtual const char *GetName() const; 00096 00098 enum HWMouseMode 00099 { 00101 hwmcOff, 00103 hwmcOn, 00105 hwmcRGBAOnly 00106 }; 00107 HWMouseMode hwMouse; 00108 protected: 00110 int refreshRate; 00112 bool vsync; 00114 bool fitToWorkingArea; 00115 00116 csString name; 00117 00119 void Initialize (iObjectRegistry* object_reg); 00120 00125 void ResizeNotify (int newWidth, int newHeight); 00129 void BroadcastResize (int oldWidth, int oldHeight); 00130 00134 virtual bool GetWorkspaceDimensions (int& width, int& height); 00139 virtual bool AddWindowFrameDimensions (int& width, int& height); 00140 public: 00141 CanvasCommonBase (); 00142 virtual ~CanvasCommonBase (); 00143 00145 virtual bool CanvasOpen (); 00147 virtual void CanvasClose (); 00148 00150 virtual void Print (csRect const* /*area*/ = 0) { } 00151 00152 virtual bool SetGamma (float /*gamma*/) { return false; } 00153 virtual float GetGamma () const { return 1.0; } 00154 00155 public: 00157 csRef<iEventOutlet> EventOutlet; 00158 00159 int GetColorDepth () { return Depth; } 00160 00162 virtual bool CanvasResize (int w, int h); 00163 bool ForceCanvasResize (int w, int h); 00164 00166 virtual iNativeWindow* GetNativeWindow (); 00167 00169 virtual bool GetFullScreen () 00170 { return FullScreen; } 00171 00175 virtual void SetFullScreen (bool b); 00176 00178 virtual bool SetMousePosition (int x, int y); 00179 00189 virtual bool SetMouseCursor (csMouseCursorID iShape); 00190 00198 virtual bool SetMouseCursor (iImage *image, const csRGBcolor* keycolor = 0, 00199 int hotspot_x = 0, int hotspot_y = 0, 00200 csRGBcolor fg = csRGBcolor(255,255,255), 00201 csRGBcolor bg = csRGBcolor(0,0,0)); 00202 00203 void GetFramebufferDimensions (int& width, int& height) 00204 { width = fbWidth; height = fbHeight; } 00205 00206 bool CanResize () 00207 { return AllowResizing; } 00208 protected: 00211 // Virtual Alert function so it can be overridden by subclasses 00212 // of csGraphics2D. 00213 virtual void AlertV (int type, const char* title, const char* okMsg, 00214 const char* msg, va_list args); 00215 virtual void Alert (int type, const char* title, const char* okMsg, 00216 const char* msg, ...); 00217 virtual void AlertV (int type, const wchar_t* title, const wchar_t* okMsg, 00218 const wchar_t* msg, va_list args); 00219 virtual void Alert (int type, const wchar_t* title, const wchar_t* okMsg, 00220 const wchar_t* msg, ...); 00225 // Virtual SetTitle function so it can be overridden by subclasses 00226 // of csGraphics2D. 00227 virtual void SetTitle (const char* title); 00228 virtual void SetTitle (const wchar_t* title) 00229 { SetTitle (csString (title)); } 00230 00236 virtual void SetIcon (iImage *image); 00237 00238 virtual bool IsWindowTransparencyAvailable() { return false; } 00239 virtual bool SetWindowTransparent (bool transparent) { return false; } 00240 virtual bool GetWindowTransparent () { return false; } 00241 00242 virtual bool SetWindowDecoration (WindowDecoration decoration, bool flag) 00243 { return false; } 00244 virtual bool GetWindowDecoration (WindowDecoration decoration); 00245 00246 virtual bool FitSizeToWorkingArea (int& desiredWidth, 00247 int& desiredHeight); 00252 virtual bool GetOptionDescription (int idx, csOptionDescription*); 00253 virtual bool SetOption (int id, csVariant* value); 00254 virtual bool GetOption (int id, csVariant* value); 00259 virtual unsigned GetPotentiallyConflictingEvents () 00260 { return CSEVTYPE_Keyboard | CSEVTYPE_Mouse; } 00261 virtual unsigned QueryEventPriority (unsigned /*iType*/) 00262 { return 150; } 00265 }; 00266 00267 #include "csutil/deprecated_warn_on.h" 00268 } // namespace PluginCommon 00269 } // namespace CS 00270 00273 #endif // __CS_CSPLUGINCOMMON_CANVAS_CANVASCOMMON_H__
Generated for Crystal Space 2.1 by doxygen 1.6.1
