CrystalSpace

Public API Reference

CS::PluginCommon::CanvasCommonBase Class Reference

This is the base class for graphics canvases. More...

#include <csplugincommon/canvas/canvascommon.h>

Inheritance diagram for CS::PluginCommon::CanvasCommonBase:

List of all members.

Public Types

enum  HWMouseMode { hwmcOff, hwmcOn, hwmcRGBAOnly }
 

Hardware mouse cursor setting.

More...

Public Member Functions

bool CanResize ()
 Returns whether resizing is enabled for the canvas.
virtual void CanvasClose ()
 (*) Close graphics system
virtual bool CanvasOpen ()
 (*) Open graphics system (set videomode, open window etc)
virtual bool CanvasResize (int w, int h)
 Resize the canvas.
virtual void ChangeDepth (int d)
 Change the depth of the canvas.
bool ForceCanvasResize (int w, int h)
 Resize the canvas.
int GetColorDepth ()
 Return color depth of the framebuffer.
void GetFramebufferDimensions (int &width, int &height)
 Get the dimensions of the framebuffer.
virtual bool GetFullScreen ()
 Returns 'true' if the program is being run full-screen.
virtual float GetGamma () const
 Get gamma value.
virtual const char * GetName () const
 Get the name of this canvas.
virtual iNativeWindowGetNativeWindow ()
 Return the Native Window interface for this canvas (if it has one).
virtual void Print (csRect const *=0)
 (*) Flip video pages (or dump backbuffer into framebuffer).
virtual void SetFullScreen (bool b)
 Change the fullscreen state of the canvas.
virtual bool SetGamma (float)
 Set gamma value (if supported by canvas).
virtual bool SetMouseCursor (iImage *image, const csRGBcolor *keycolor=0, int hotspot_x=0, int hotspot_y=0, csRGBcolor fg=csRGBcolor(255, 255, 255), csRGBcolor bg=csRGBcolor(0, 0, 0))
 Set mouse cursor using an image.
virtual bool SetMouseCursor (csMouseCursorID iShape)
 Set mouse cursor to one of predefined shape classes (see csmcXXX enum above).
virtual bool SetMousePosition (int x, int y)
 Set mouse cursor position; return success status.

Public Attributes

bool AllowResizing
 Whether to allow resizing.
bool canvas_open
 Open/Close state.
int DisplayNumber
 Display number.
csRef< iEventOutletEventOutlet
 The event plug object.
int fbWidth
 The width, height and depth of visual.
bool FullScreen
 True if visual is full-screen.
iObjectRegistryobjectReg
 The object registry.
csString win_title
 Pointer to a title.

Protected Member Functions

virtual bool AddWindowFrameDimensions (int &width, int &height)
 Helper function for FitSizeToWorkingArea(): compute window dimensions with the window frame included.
void BroadcastResize (int oldWidth, int oldHeight)
 Send notification after a canvas resize.
virtual bool GetWorkspaceDimensions (int &width, int &height)
 Helper function for FitSizeToWorkingArea(): obtain workspace dimensions.
void Initialize (iObjectRegistry *object_reg)
 Read configuration.
void ResizeNotify (int newWidth, int newHeight)
 Handle externally triggered canvas resize.
iNativeWindowManager implementation



virtual void Alert (int type, const wchar_t *title, const wchar_t *okMsg, const wchar_t *msg,...)
 Show an alert.
virtual void Alert (int type, const char *title, const char *okMsg, const char *msg,...)
 Show an alert.
virtual void AlertV (int type, const wchar_t *title, const wchar_t *okMsg, const wchar_t *msg, va_list args)
 Show an alert.
virtual void AlertV (int type, const char *title, const char *okMsg, const char *msg, va_list args)
 Show an alert.
iNativeWindow implementation



virtual bool FitSizeToWorkingArea (int &desiredWidth, int &desiredHeight)
 Sets the icon of this window with the provided one.
virtual bool GetWindowDecoration (WindowDecoration decoration)
 Sets the icon of this window with the provided one.
virtual bool GetWindowTransparent ()
 Sets the icon of this window with the provided one.
virtual bool IsWindowTransparencyAvailable ()
 Sets the icon of this window with the provided one.
virtual void SetIcon (iImage *image)
 Sets the icon of this window with the provided one.
virtual void SetTitle (const wchar_t *title)
 Sets the icon of this window with the provided one.
virtual void SetTitle (const char *title)
 Sets the icon of this window with the provided one.
virtual bool SetWindowDecoration (WindowDecoration decoration, bool flag)
 Sets the icon of this window with the provided one.
virtual bool SetWindowTransparent (bool transparent)
 Sets the icon of this window with the provided one.
iPluginConfig implementation



virtual bool GetOption (int id, csVariant *value)
 Get the value of the option of index idx.
virtual bool GetOptionDescription (int idx, csOptionDescription *)
 Get the description of the option of index idx.
virtual bool SetOption (int id, csVariant *value)
 Set the value of the option of index idx.
iEventPlug implementation



virtual unsigned GetPotentiallyConflictingEvents ()
 Get the mask of events that can be generated by this source and are generated directly from user actions (e.g.
virtual unsigned QueryEventPriority (unsigned)
 Query how strong the plug's wish to generate certain class of events is.

Protected Attributes

bool fitToWorkingArea
 Reduce window size to fit into workspace, if necessary.
int refreshRate
 Screen refresh rate.
bool vsync
 Activate Vsync.

Detailed Description

This is the base class for graphics canvases.

Plugins should derive their own class from this one and implement required (marked with an asterisk (*)) functions. Functions not marked with an asterisk are optional, but possibly slow since they are too general.

Remarks:
Note that this class only provides implementations for certain interfaces, but not SCF facilities (QueryInterface etc.) - these have to be added by derived classes.

Definition at line 98 of file canvascommon.h.


Member Enumeration Documentation

Hardware mouse cursor setting.

Enumerator:
hwmcOff 

Never use hardware cursor.

hwmcOn 

Always use hardware cursor, if possible.

hwmcRGBAOnly 

Only use hardware cursor if true RGBA cursor is available.

Definition at line 137 of file canvascommon.h.


Member Function Documentation

virtual bool CS::PluginCommon::CanvasCommonBase::AddWindowFrameDimensions ( int &  width,
int &  height 
) [protected, virtual]

Helper function for FitSizeToWorkingArea(): compute window dimensions with the window frame included.

virtual void CS::PluginCommon::CanvasCommonBase::Alert ( int  type,
const wchar_t *  title,
const wchar_t *  okMsg,
const wchar_t *  msg,
  ... 
) [protected, virtual]

Show an alert.

Type is one of CS_ALERT_???.

See also:
CS_ALERT_ERROR
Notes about string formatting in Crystal Space

Reimplemented from iNativeWindowManager.

virtual void CS::PluginCommon::CanvasCommonBase::Alert ( int  type,
const char *  title,
const char *  okMsg,
const char *  msg,
  ... 
) [protected, virtual]

Show an alert.

Type is one of CS_ALERT_???.

Remarks:
All strings are expected to be UTF-8 encoded.
See also:
CS_ALERT_ERROR
Notes about string formatting in Crystal Space

Reimplemented from iNativeWindowManager.

virtual void CS::PluginCommon::CanvasCommonBase::AlertV ( int  type,
const wchar_t *  title,
const wchar_t *  okMsg,
const wchar_t *  msg,
va_list  arg 
) [protected, virtual]

Show an alert.

Type is one of CS_ALERT_???.

See also:
CS_ALERT_ERROR
Notes about string formatting in Crystal Space

Reimplemented from iNativeWindowManager.

virtual void CS::PluginCommon::CanvasCommonBase::AlertV ( int  type,
const char *  title,
const char *  okMsg,
const char *  msg,
va_list  arg 
) [protected, virtual]

Show an alert.

Type is one of CS_ALERT_???.

See also:
CS_ALERT_ERROR
Notes about string formatting in Crystal Space

Implements iNativeWindowManager.

void CS::PluginCommon::CanvasCommonBase::BroadcastResize ( int  oldWidth,
int  oldHeight 
) [protected]

Send notification after a canvas resize.

bool CS::PluginCommon::CanvasCommonBase::CanResize (  )  [inline, virtual]

Returns whether resizing is enabled for the canvas.

Implements iGraphicsCanvas.

Definition at line 245 of file canvascommon.h.

virtual void CS::PluginCommon::CanvasCommonBase::CanvasClose (  )  [virtual]

(*) Close graphics system

Implements iGraphicsCanvas.

Reimplemented in CS::PluginCommon::GL::CanvasCommonBase.

virtual bool CS::PluginCommon::CanvasCommonBase::CanvasOpen (  )  [virtual]

(*) Open graphics system (set videomode, open window etc)

Implements iGraphicsCanvas.

Reimplemented in CS::PluginCommon::GL::CanvasCommonBase.

virtual bool CS::PluginCommon::CanvasCommonBase::CanvasResize ( int  w,
int  h 
) [virtual]

Resize the canvas.

Implements iGraphicsCanvas.

Reimplemented in CS::PluginCommon::GL::CanvasCommonBase.

virtual void CS::PluginCommon::CanvasCommonBase::ChangeDepth ( int  d  )  [virtual]

Change the depth of the canvas.

virtual bool CS::PluginCommon::CanvasCommonBase::FitSizeToWorkingArea ( int &  desiredWidth,
int &  desiredHeight 
) [protected, virtual]

Sets the icon of this window with the provided one.

Note:
Virtual SetIcon function so it can be overridden by subclasses of csGraphics2D.
Parameters:
image the iImage to set as the icon of this window.

Implements iNativeWindow.

bool CS::PluginCommon::CanvasCommonBase::ForceCanvasResize ( int  w,
int  h 
) [virtual]

Resize the canvas.

Ignores the "allow resizing" flag, so is useful when to programmatically resize the canvas while still preventing the user to resize it.

Remarks:
May nevertheless return false if the resizing fails for other reasons.

Implements iGraphicsCanvas.

int CS::PluginCommon::CanvasCommonBase::GetColorDepth (  )  [inline, virtual]

Return color depth of the framebuffer.

Implements iGraphicsCanvas.

Definition at line 198 of file canvascommon.h.

void CS::PluginCommon::CanvasCommonBase::GetFramebufferDimensions ( int &  width,
int &  height 
) [inline, virtual]

Get the dimensions of the framebuffer.

Implements iGraphicsCanvas.

Definition at line 242 of file canvascommon.h.

virtual bool CS::PluginCommon::CanvasCommonBase::GetFullScreen (  )  [inline, virtual]

Returns 'true' if the program is being run full-screen.

Implements iGraphicsCanvas.

Definition at line 208 of file canvascommon.h.

virtual float CS::PluginCommon::CanvasCommonBase::GetGamma (  )  const [inline, virtual]

Get gamma value.

Implements iGraphicsCanvas.

Definition at line 192 of file canvascommon.h.

virtual const char* CS::PluginCommon::CanvasCommonBase::GetName (  )  const [virtual]

Get the name of this canvas.

Implements iGraphicsCanvas.

virtual iNativeWindow* CS::PluginCommon::CanvasCommonBase::GetNativeWindow (  )  [virtual]

Return the Native Window interface for this canvas (if it has one).

Implements iGraphicsCanvas.

virtual bool CS::PluginCommon::CanvasCommonBase::GetOption ( int  index,
csVariant value 
) [protected, virtual]

Get the value of the option of index idx.

Return false if this option does not exist, true otherwise.

Parameters:
index The index of the option
value A variant where to store the value of the option

Implements iPluginConfig.

virtual bool CS::PluginCommon::CanvasCommonBase::GetOptionDescription ( int  index,
csOptionDescription option 
) [protected, virtual]

Get the description of the option of index idx.

Return false if this option does not exist, true otherwise.

Parameters:
index The index of the option
option The returned description of the option

Implements iPluginConfig.

virtual unsigned CS::PluginCommon::CanvasCommonBase::GetPotentiallyConflictingEvents (  )  [inline, protected, virtual]

Get the mask of events that can be generated by this source and are generated directly from user actions (e.g.

key presses, mouse clicks and so on). This is used to locate potentialy conflicting combinations of event source plugins (for example two event sources may generate a csevKeyDown event each from every key press).

The mask is a combination of CSEVTYPE_XXX values ORed together.

Implements iEventPlug.

Definition at line 298 of file canvascommon.h.

virtual bool CS::PluginCommon::CanvasCommonBase::GetWindowDecoration ( WindowDecoration  decoration  )  [protected, virtual]

Sets the icon of this window with the provided one.

Note:
Virtual SetIcon function so it can be overridden by subclasses of csGraphics2D.
Parameters:
image the iImage to set as the icon of this window.

Implements iNativeWindow.

virtual bool CS::PluginCommon::CanvasCommonBase::GetWindowTransparent (  )  [inline, protected, virtual]

Sets the icon of this window with the provided one.

Note:
Virtual SetIcon function so it can be overridden by subclasses of csGraphics2D.
Parameters:
image the iImage to set as the icon of this window.

Implements iNativeWindow.

Definition at line 279 of file canvascommon.h.

virtual bool CS::PluginCommon::CanvasCommonBase::GetWorkspaceDimensions ( int &  width,
int &  height 
) [protected, virtual]

Helper function for FitSizeToWorkingArea(): obtain workspace dimensions.

void CS::PluginCommon::CanvasCommonBase::Initialize ( iObjectRegistry object_reg  )  [protected]

Read configuration.

Reimplemented in csGraphics2D, and csGraphics2DGLCommon.

virtual bool CS::PluginCommon::CanvasCommonBase::IsWindowTransparencyAvailable (  )  [inline, protected, virtual]

Sets the icon of this window with the provided one.

Note:
Virtual SetIcon function so it can be overridden by subclasses of csGraphics2D.
Parameters:
image the iImage to set as the icon of this window.

Implements iNativeWindow.

Definition at line 277 of file canvascommon.h.

virtual void CS::PluginCommon::CanvasCommonBase::Print ( csRect const *  = 0  )  [inline, virtual]

(*) Flip video pages (or dump backbuffer into framebuffer).

Implements iGraphicsCanvas.

Definition at line 189 of file canvascommon.h.

virtual unsigned CS::PluginCommon::CanvasCommonBase::QueryEventPriority ( unsigned  iType  )  [inline, protected, virtual]

Query how strong the plug's wish to generate certain class of events is.

The plug with the strongest wish wins. The argument is one of CSEVTYPE_XXX values (but never a combination of several OR'ed together).

The typical value is somewhere around 100; the event plugs which are sometimes implemented inside the system drivers (such as for Windows and DJGPP) usually have the priority 100.

Implements iEventPlug.

Definition at line 300 of file canvascommon.h.

void CS::PluginCommon::CanvasCommonBase::ResizeNotify ( int  newWidth,
int  newHeight 
) [protected]

Handle externally triggered canvas resize.

Should be called when e.g. the window belonging to a canvas was resized.

virtual void CS::PluginCommon::CanvasCommonBase::SetFullScreen ( bool  b  )  [virtual]

Change the fullscreen state of the canvas.

Implements iGraphicsCanvas.

virtual bool CS::PluginCommon::CanvasCommonBase::SetGamma ( float  gamma  )  [inline, virtual]

Set gamma value (if supported by canvas).

By default this is 1. Smaller values are darker. If the canvas doesn't support gamma then this function will return false.

Implements iGraphicsCanvas.

Definition at line 191 of file canvascommon.h.

virtual void CS::PluginCommon::CanvasCommonBase::SetIcon ( iImage image  )  [protected, virtual]

Sets the icon of this window with the provided one.

Note:
Virtual SetIcon function so it can be overridden by subclasses of csGraphics2D.
Parameters:
image the iImage to set as the icon of this window.

Implements iNativeWindow.

virtual bool CS::PluginCommon::CanvasCommonBase::SetMouseCursor ( iImage image,
const csRGBcolor keycolor = 0,
int  hotspot_x = 0,
int  hotspot_y = 0,
csRGBcolor  fg = csRGBcolor(255, 255, 255),
csRGBcolor  bg = csRGBcolor(0, 0, 0) 
) [virtual]

Set mouse cursor using an image.

If the operation is unsupported, return 'false' otherwise return 'true'. On some platforms there is only monochrome pointers available. In this all black colors in the image will become the value of 'bg' and all non-black colors will become 'fg'

Implements iGraphicsCanvas.

virtual bool CS::PluginCommon::CanvasCommonBase::SetMouseCursor ( csMouseCursorID  iShape  )  [virtual]

Set mouse cursor to one of predefined shape classes (see csmcXXX enum above).

If a specific mouse cursor shape is not supported, return 'false'; otherwise return 'true'. If system supports it and iBitmap != 0, shape should be set to the bitmap passed as second argument; otherwise cursor should be set to its nearest system equivalent depending on iShape argument.

Implements iGraphicsCanvas.

virtual bool CS::PluginCommon::CanvasCommonBase::SetMousePosition ( int  x,
int  y 
) [virtual]

Set mouse cursor position; return success status.

Implements iGraphicsCanvas.

virtual bool CS::PluginCommon::CanvasCommonBase::SetOption ( int  index,
csVariant value 
) [protected, virtual]

Set the value of the option of index idx.

Return false if this option does not exist, true otherwise.

Parameters:
index The index of the option
value The new value to be set for the option

Implements iPluginConfig.

virtual void CS::PluginCommon::CanvasCommonBase::SetTitle ( const wchar_t *  title  )  [inline, protected, virtual]

Sets the icon of this window with the provided one.

Note:
Virtual SetIcon function so it can be overridden by subclasses of csGraphics2D.
Parameters:
image the iImage to set as the icon of this window.

Implements iNativeWindow.

Definition at line 267 of file canvascommon.h.

virtual void CS::PluginCommon::CanvasCommonBase::SetTitle ( const char *  title  )  [protected, virtual]

Sets the icon of this window with the provided one.

Note:
Virtual SetIcon function so it can be overridden by subclasses of csGraphics2D.
Parameters:
image the iImage to set as the icon of this window.

Implements iNativeWindow.

virtual bool CS::PluginCommon::CanvasCommonBase::SetWindowDecoration ( WindowDecoration  decoration,
bool  flag 
) [inline, protected, virtual]

Sets the icon of this window with the provided one.

Note:
Virtual SetIcon function so it can be overridden by subclasses of csGraphics2D.
Parameters:
image the iImage to set as the icon of this window.

Implements iNativeWindow.

Definition at line 281 of file canvascommon.h.

virtual bool CS::PluginCommon::CanvasCommonBase::SetWindowTransparent ( bool  transparent  )  [inline, protected, virtual]

Sets the icon of this window with the provided one.

Note:
Virtual SetIcon function so it can be overridden by subclasses of csGraphics2D.
Parameters:
image the iImage to set as the icon of this window.

Implements iNativeWindow.

Definition at line 278 of file canvascommon.h.


Member Data Documentation

Whether to allow resizing.

Definition at line 126 of file canvascommon.h.

Open/Close state.

Definition at line 109 of file canvascommon.h.

Display number.

If 0, use primary display; else if greater than 0, use that display number. If that display number is not present, use primary display.

Definition at line 122 of file canvascommon.h.

The event plug object.

Definition at line 196 of file canvascommon.h.

The width, height and depth of visual.

Definition at line 115 of file canvascommon.h.

Reduce window size to fit into workspace, if necessary.

Definition at line 153 of file canvascommon.h.

True if visual is full-screen.

Definition at line 124 of file canvascommon.h.

The object registry.

Definition at line 107 of file canvascommon.h.

Screen refresh rate.

Definition at line 149 of file canvascommon.h.

Activate Vsync.

Definition at line 151 of file canvascommon.h.

Pointer to a title.

Definition at line 112 of file canvascommon.h.


The documentation for this class was generated from the following file:

Generated for Crystal Space 2.1 by doxygen 1.6.1