Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <W32STD.H>

Class RWindow

class RWindow : public RDrawableWindow;

Description

Handle to a standard window.

An RWindow is a handle to a server-side window which can be displayed and drawn to, and whose redraws are performed by the application.

Derivation

Members

Defined in RWindow:

Inherited from MWsClientClass:

Inherited from RDrawableWindow:

Inherited from RWindowBase:

Inherited from RWindowTreeNode:


Construction and destruction


RWindow()

IMPORT_C RWindow();

Description

Default constructor which creates a sessionless, uninitialised window handle.

Handles to server-side objects must be created in a session in order to be operational; this constructor is merely a convenience to allow the handle to be stored as a data member. See RWindowTreeNode::RWindowTreeNode() for details of how the complete setup of a handle field may be deferred until the window server session is known.


RWindow(RWsSession &)

IMPORT_C RWindow(RWsSession &aWs);

Description

Constructor which creates an initialised window handle within a server session.

Parameters

RWsSession &aWs

Window server session to use.

[Top]


Member functions


Construct(const RWindowTreeNode &,TUint32)

IMPORT_C TInt Construct(const RWindowTreeNode &parent, TUint32 aHandle);

Description

Completes the construction of the window handle.

This method should be called after the RWindow::RWindow() constructor, before any other functions are performed on the window. It creates a window in the window server corresponding to the RWindow object. The window is initialised to inherit the size and extent of its parent window, given by the first parameter. If its parent is a group window then it will be full screen.

This function always causes a flush of the window server buffer.

Parameters

const RWindowTreeNode &parent

The window's parent.

TUint32 aHandle

Client handle for the window. This is an integer value chosen by the client that must be unique within the current server session. The usual way of doing this is to cast the address of the object that owns the window to a TUint32; this allows event handlers which are given a window handle to obtain a reference to the window an event is intended for. For example, CCoeControl uses this technique when it constructs a window. Note that in GUI applications, every window is created and owned by a control. Therefore it is rare for 3rd party code to ever need to call a window's RWindow::Construct(const RWindowTreeNode &,TUint32) function directly.

Return value

TInt

KErrNone if successful, otherwise one of the system-wide error codes.


BeginRedraw()

IMPORT_C void BeginRedraw();

Description

Begins redrawing the window's invalid region.

This method tells the window server that the window is about to respond to the last redraw event by redrawing the entire invalid region. This causes the window server to validate the entire invalid region.

After the redraw is complete the entire region that was previously invalid is validated. The window should then call RWindow::EndRedraw().

Note: the redraw is clipped to the region that was previously invalid.

This function always causes a flush of the window server buffer.

See also:


BeginRedraw(const TRect &)

IMPORT_C void BeginRedraw(const TRect &aRect);

Description

Begins the redraw of a rectangle within the window's invalid region.

This method tells the window server that the window is about to respond to the last redraw event by redrawing the specified rectangle. This causes the window server to clear the rectangle, and remove it from the invalid region.

After the redraw is complete the window should call RWindow::EndRedraw().

Note:

When handling a redraw event, this rectangle would typically be the rectangle returned by TWsRedrawEvent::Rect()const.

The redraw is clipped to the area that is validated, i.e. the intersection of the rectangle with the previously invalid region.

If you only validate part of the rectangle given in the redraw event then, after RWindow::EndRedraw() is called, drawing will be clipped to the visible area which is not invalid. This is because drawing (that is non-redrawing) is always clipped to the visible region less the invalid region. You will get another message telling you to redraw the area that is still invalid.

Parameters

const TRect &aRect

The rectangle to be redrawn.

See also:


EndRedraw()

IMPORT_C void EndRedraw();

Description

Ends the current redraw.

This function should be called when redrawing is complete.


Invalidate()

IMPORT_C void Invalidate();

Description

Invalidates the entire window.

This function causes the window to get a redraw message specifying its entire visible area, allowing an application-initiated redraw.


Invalidate(const TRect &)

IMPORT_C void Invalidate(const TRect &aRect);

Description

Invalidates an area within the window.

This function invalidates the specified rectangle, which causes the window to get a redraw message. This allows an application-initiated redraw of a specified rectangle.

Parameters

const TRect &aRect

Area to invalidate.


GetInvalidRegion(RRegion &)

IMPORT_C void GetInvalidRegion(RRegion &aRegion);

Description

Gets the invalid region.

Note: if there is not enough memory to create the region, the region's error flag will be set.

This function always causes a flush of the window server buffer.

Parameters

RRegion &aRegion

On return, contains the invalid region.


SetBackgroundColor(TRgb)

IMPORT_C void SetBackgroundColor(TRgb aColor);

Description

Sets the background colour used for clearing in server-initiated redraws.

The window will be cleared to its background colour when a window server-initiated redraw occurs. Background colour can be changed dynamically after a window has been created and activated, however, the new background colour will not be visible until the window has been redrawn.

Parameters

TRgb aColor

Background colour to be used during redraws.


SetBackgroundColor()

IMPORT_C void SetBackgroundColor();

Description

Sets the background colour used for clearing in server-initiated redraws to none.

The window will not be cleared to its background colour when a window server-initiated redraw occurs.


SetSize(const TSize &)

IMPORT_C void SetSize(const TSize &size);

Description

Sets the size of a window.

This function may be called at any time after the window's RWindow::Construct(const RWindowTreeNode &,TUint32) function: the window's size will change dynamically.

If the window size is increased, any new area will be cleared to the background colour and a redraw event will be generated for it.

Parameters

const TSize &size

The window size.


SetExtent(const TPoint &,const TSize &)

IMPORT_C void SetExtent(const TPoint &point, const TSize &size);

Description

Sets the size and position of a window.

This function may be called at any time after the window's RWindow::Construct(const RWindowTreeNode &,TUint32) function: the window's extent will change dynamically.

If the window size is increased, any new area will be cleared to the background colour and a redraw event will be generated for it.

Parameters

const TPoint &point

The position of the window's origin, relative to its parent.

const TSize &size

The window size.

See also:


HandleTransparencyUpdate()

IMPORT_C void HandleTransparencyUpdate();

Description

Notifies the server that the contents of the bitmap that has been registered as the transparency bitmap has been changed


SetTransparencyFactor(const TRgb &)

IMPORT_C TInt SetTransparencyFactor(const TRgb &aTransparencyFactor);

Description

Sets the tranpsarency color for this window. This will overwrite any other settings.

Note when inherited transparency is supported all children of this window will automatically inherit the transparency set by this function. If this window's children should not inherit transparecy then call the funciton RWindow::SetNonTransparent() now so that in future releases they will still not be transparent.

Transparent windows require redraw storing to be turned on, if it is not already it will be turned on for this window by calling this function.

This function always causes a flush of the window server buffer.

Parameters

const TRgb &aTransparencyFactor

The transparency factor used across the window.

Return value

TInt

KErrNone if successful, otherwise one of the system-wide error codes.


SetTransparencyBitmap(const CFbsBitmap &)

IMPORT_C TInt SetTransparencyBitmap(const CFbsBitmap &aTransparencyBitmap);

Description

Sets the tranpsarency bitmap for this window. This will overwrite any other settings.

Note when inherited transparency is supported all children of this window will automatically inherit the transparency set by this function. If this window's children should not inherit transparecy then call the funciton RWindow::SetNonTransparent() now so that in future releases they will still not be transparent.

Transparent windows require redraw storing to be turned on, if it is not already it will be turned on for this window by calling this function.

This function always causes a flush of the window server buffer.

Parameters

const CFbsBitmap &aTransparencyBitmap

Return value

TInt

KErrNone if successful, otherwise one of the system-wide error codes.


SetTransparencyWsBitmap(const CWsBitmap &)

IMPORT_C TInt SetTransparencyWsBitmap(const CWsBitmap &aTransparencyBitmap);

Description

Sets the tranpsarency bitmap for this window using a CWsBitmap. This will overwrite any other settings.

Note when inherited transparency is supported all children of this window will automatically inherit the transparency set by this function. If this window's children should not inherit transparecy then call the funciton RWindow::SetNonTransparent() now so that in future releases they will still not be transparent.

Transparent windows require redraw storing to be turned on, if it is not already it will be turned on for this window by calling this function.

This function always causes a flush of the window server buffer.

Parameters

const CWsBitmap &aTransparencyBitmap

Return value

TInt

KErrNone if successful, otherwise one of the system-wide error codes.


SetNonTransparent()

IMPORT_C void SetNonTransparent();

Description

Sets the window to not be transparent.

This function only needs to be called if the parent window is set to be transparent. In which case it should be called to stop this window inheriting the transparency from the parent.

Note that although inherited transparency is not supported at the moment when it is implemented in future releases the children will automatically become transparent so call this funciton now to stop this window becomming transparent in the future (but you only need to if it's parent is set transparent).


EnableRedrawStore(TBool)

IMPORT_C void EnableRedrawStore(TBool aEnabled);

Description

Enables or Disables the redraw store for a window.

The window server can store the operations needed to redraw a window. This is the default behaviour, and is desired in most cases. Under certain circumstances, however, client side redrawing is essential, and then this function should be called to disable the redraw store.

Windows which do not use the redraw store will not display correctly when visible through a transparent window.

Parameters

TBool aEnabled

Indicates whether the redraw store should be enabled or disabled.


SetTransparencyAlphaChannel()

IMPORT_C TInt SetTransparencyAlphaChannel();

Description

Sets the window to be transparent using the alpha channel. Only valid when using a display mode which supports alpha blending

Transparent windows require redraw storing to be turned on, if it is not already it will be turned on for this window by calling this function.

Return value

TInt

KErrNone if successful, otherwise one of the system-wide error codes.


SetTransparentRegion(const TRegion &)

IMPORT_C TInt SetTransparentRegion(const TRegion &aRegion);

Description

Sets the user-defined transparent region of a window.

This will replace the default transparent region in a transparent window which is normally the full window base area. It is possible to make the transparent window completely opaque by passing an empty region. Passing a region equal to the window base area or larger will revert the window to its default behaviour (i.e. full window transparency). No screen content changes will occur immediately as a result of calling this function.

This function applies to transparent window only and always causes a flush of the window server buffer.

Parameters

const TRegion &aRegion

User defined windows's transparent region.

Return value

TInt

KErrNone if successful, otherwise one of the system-wide error codes.

See also:


SetTransparencyPolicy(TWsTransparencyPolicy)

IMPORT_C TInt SetTransparencyPolicy(TWsTransparencyPolicy aPolicy);

Description

Sets the transparency policy of a window.

No screen content changes will occur immediately as a result of calling this function.

This function applies to transparent window only.

Parameters

TWsTransparencyPolicy aPolicy

Transparent window policy.

Return value

TInt

KErrNone if successful, otherwise one of the system-wide error codes.

See also:


IsRedrawStoreEnabled()

IMPORT_C TBool IsRedrawStoreEnabled();

Description

Returns whether the window uses a redraw store to store drawing commands.

This function always causes a flush of the window server buffer.

Return value

TBool

ETrue if the window uses the redraw store, otherwise EFalse.

See also:


EnableOSB(TBool)

IMPORT_C void EnableOSB(TBool);

Description

Enables/Disables the WSERV to use its OSB

Parameters

TBool