CrystalSpace

Public API Reference

iNativeWindow Struct Reference
[2D]

This interface represents a native window. More...

#include <ivideo/natwin.h>

Inheritance diagram for iNativeWindow:

List of all members.

Public Types

enum  WindowDecoration { decoCaption, decoClientFrame }
 

Window decorations that can be shown or hidden.

More...

Public Member Functions

virtual bool FitSizeToWorkingArea (int &desiredWidth, int &desiredHeight)=0
 Take a desired window contents size and compute a contents size so the window would (in windowed mode) fit onto the current working area.
virtual bool GetWindowDecoration (WindowDecoration decoration)=0
 Return whether a decoration is visible.
virtual void SetIcon (iImage *image)=0
 Sets the icon of this window with the provided one.
virtual void SetTitle (const wchar_t *title)=0
 Set the title for this window.
virtual void SetTitle (const char *title)=0
 Set the title for this window.
virtual bool SetWindowDecoration (WindowDecoration decoration, bool flag)=0
 Show or hide a window decoration.
Window transparency

Window transparency allows windows to be transparent, that is, the background behind it shows through (desktop, other windows.

..) where the framebuffer alpha is not opaque. (Clearing the framebuffer leaves the alpha at zero - fully transparent - so not rendering every pixel would be enough to see something.)

Note that window transparency is not available on all platforms or certain configurations:

  • Windows: available on Vista and above. Must be enabled by the user. IsWindowTransparencyAvailable() returns false when compositing is not available or enabled. Note that the user can enable or disable compositing on the fly. Currently, the only way for CrystalSpace applications to detect this is by polling GetWindowTransparent. Disabling compositing will obviously disable any window transparency (GetWindowTransparent returns false), however, CrystalSpace will re-enable transparency if the user re-enables compositing. (There is currently no way to inhibit this re-enabling. Polling GetWindowTransparent is, again, the way to detect whether this will happen.)
  • X11: compositing window manager is required. Window transparency must be enabled _before_ the window was created (i.e. system was opened) and can't be toggled later.


virtual bool GetWindowTransparent ()=0
 Query the window transparency state.
virtual bool IsWindowTransparencyAvailable ()=0
 Return whether window transparency is available.
virtual bool SetWindowTransparent (bool transparent)=0
 Set whether window transparency is desired.

Detailed Description

This interface represents a native window.

Main ways to get pointers to this interface:

Definition at line 89 of file natwin.h.


Member Enumeration Documentation

Window decorations that can be shown or hidden.

Enumerator:
decoCaption 

Window caption ("title bar").

Caveat: Hiding the caption may prevent the user from moving the window.

decoClientFrame 

On Windows, thin frame between "client" area and window borders.

This flag actually only has effect on Windows Vista+ with compositing enabled, and it's actual effect depends on whether the window caption is shown or not.

If the window has a caption, it controls the thin frame between client area and window border. Removing that frame gives the window the appearance of a continuous "sheet of glass".

If the window is transparent, has no caption and is not resizeable, setting this decoration to off actually removes the "glassy" backdrop, making transparent areas of the framebuffer truly translucent.

Definition at line 163 of file natwin.h.


Member Function Documentation

virtual bool iNativeWindow::FitSizeToWorkingArea ( int &  desiredWidth,
int &  desiredHeight 
) [pure virtual]

Take a desired window contents size and compute a contents size so the window would (in windowed mode) fit onto the current working area.

This functions computes a size so the window would fit into the current working area, taking window decorations and frame into account. The “working area” is the area on the screen where windows are typically placed, e.g. on Windows the desktop but without the task bar. On multi-monitor systems, the workspace size depends on the monitor the window is currently on (or would be created on).

Since this function works with “content sizes” the returned sizes are suitable for passing to iGraphics2D::Resize().

Parameters:
desiredWidth The desired contents width, will be corrected to fit into the workspace width.
desiredHeight The desired contents height, will be corrected to fit into the workspace height.
Returns:
Whether the corrected size could be computed: the function may not be supported on the current platform. In that case the desiredWidth and desiredHeight parameters will be left unchanged.

Implemented in csGraphics2D.

virtual bool iNativeWindow::GetWindowDecoration ( WindowDecoration  decoration  )  [pure virtual]

Return whether a decoration is visible.

Implemented in csGraphics2D.

virtual bool iNativeWindow::GetWindowTransparent (  )  [pure virtual]

Query the window transparency state.

Returns:
If the system is not open, returns the value of the "transparency desired" flag. If the system is open, returns whether the window is actually currently transparent (when transparency is desired and available),

Implemented in csGraphics2D.

virtual bool iNativeWindow::IsWindowTransparencyAvailable (  )  [pure virtual]

Return whether window transparency is available.

Returns true when the current platform and OS version generally support transparency and the user enabled it.

Implemented in csGraphics2D.

virtual void iNativeWindow::SetIcon ( iImage image  )  [pure virtual]

Sets the icon of this window with the provided one.

Parameters:
image the iImage to set as the icon of this window.

Implemented in csGraphics2D.

virtual void iNativeWindow::SetTitle ( const wchar_t *  title  )  [pure virtual]

Set the title for this window.

Implemented in csGraphics2D.

virtual void iNativeWindow::SetTitle ( const char *  title  )  [pure virtual]

Set the title for this window.

Remarks:
title is expected to be UTF-8 encoded.

Implemented in csGraphics2D.

virtual bool iNativeWindow::SetWindowDecoration ( WindowDecoration  decoration,
bool  flag 
) [pure virtual]

Show or hide a window decoration.

Parameters:
decoration Decoration to change
flag Whether to show (true) or hide (false) a decoration.
Returns:
Whether changing the visibility of the decoration was successful.
Remarks:
Always fails when in fullscreen mode.

Implemented in csGraphics2D.

virtual bool iNativeWindow::SetWindowTransparent ( bool  transparent  )  [pure virtual]

Set whether window transparency is desired.

Parameters:
transparent "Transparency desired" flag.
Returns:
Whether the flag was successfully changed. If the system is not open, and compositing is not supported at all, returns false (the flag is not changed). If the system is not open, and compositing is generally supported, the flag is stored and the actual window transparency will be set when the system opens. Returns true in that case. If the system is open, returns whether the transparency could be changed.

Implemented in csGraphics2D.


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

Generated for Crystal Space 2.0 by doxygen 1.6.1