Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

CascadeWindow Class Reference

base class of windows in the CascadeApp windowing system More...

#include <cascade/app/CascadeWindow.h>

Inheritance diagram for CascadeWindow:

CascadeObject CascadeDirBrowser CascadeMessageBox CascadeWidget CascadeButtonWidget CascadeLabelWidget CascadePictureWidget CascadeSpinnerWidget CascadeVesselPanel CascadeDirBrowser::BrowserButton List of all members.

Public Types

typedef bool() EnumProc (CascadeWindow *pWindow, void *pClientData)
enum  Plane { kBottomMost = 0, kTopMost = 2, kAppNormal = 1 }

Public Member Functions

 CascadeWindow ()
virtual ~CascadeWindow ()
void Materialize (Plane plane=kAppNormal)
void Vanish ()
void Redraw ()
void Redraw (const CascadeRect &rect)
CascadeRect GetRectRelative () const
CascadeRect GetRectAbsolute () const
void SetRectRelative (const CascadeRect &rect)
void SetRectAbsolute (const CascadeRect &rect)
CascadeWindowGetParent ()
CascadeWindowGetFirstChild ()
CascadeWindowGetFirstSibling ()
void AddChild (CascadeWindow *pWndChild)
void RemoveChild (CascadeWindow *pWndChild)
bool IsParentOf (CascadeWindow *pWindow)
bool IsChildOf (CascadeWindow *pWindow)
bool IsSiblingOf (CascadeWindow *pWindow)
CascadeWindowGetTopLevelWindow ()
bool EnumerateTree (EnumProc *pEnumProc, void *pClientData)
virtual void OnPaint (CascadeBitmap &bitmap)
void PaintTree (CascadeBitmap &bitmap)
bool IsVisible ()
virtual void OnMaterialize ()
virtual void OnMaterialized ()
virtual void OnVanish ()
virtual void OnClearFocus ()
virtual void OnSetFocus ()
virtual bool OnKeyDown (u32 nKey)
virtual bool OnKeyUp (u32 nKey)
virtual bool OnNavKey (u32 nKey, CascadeWindow *&pProposedNewFocusWnd)
virtual bool WillAcceptFocus ()
bool IsActiveFocus ()
bool IsInactiveFocus ()
bool IsFocus ()
void SetFocus (bool bRedraw=true)
void ClearFocus (bool bRedraw=true)

Static Public Member Functions

static void RedrawScreen ()
static CascadeWindowGetFocus ()

Friends

class CascadeApp

Detailed Description

base class of windows in the CascadeApp windowing system

Skip the description

CascadeWindow is the heart of the windowing system for CascadeApps. CascadeWindow is both the data structure for a window and the implementation of the windowing system. As a data structure, CascadeWindows are simple and small. They simply contain a rectangle that defines their coordinates and 3 pointers which enable them to be Nodes in a tree of CascadeWindows, of which there may be many.

The CascadeWindow Tree Structure

Each CascadeWindow is simply a tree-node, a rectangle, and a bunch of functions, some virtual. The rectangle describes the physical location of the window, relative to its parent window.


class CascadeWindow


Member Typedef Documentation

typedef bool() CascadeWindow::EnumProc(CascadeWindow *pWindow, void *pClientData)
 

callback function for enumerating child windows

Clients provide their own EnumProc to the EnumerateTree() function. Your custom EnumProc will get called back by the EnumerateTree() function, one for each child window of this window.

Parameters:
pWindow the child window being enumerated on in this callback invocation
pClientData the void * pClientData passed thru from EnumerateTree()
Returns:
You should return true to continue enumeration, false to abort it
See also:
EnumerateTree()


Member Enumeration Documentation

enum CascadeWindow::Plane
 

a type representing z-plane in the windowing system

Plane is used as an argument to the Materialize function.

Top-level windows (those without parents) are displayed in 1 of 3 planes: bottom-most, top-most, and app-normal. The bottom-most plane is for windows that are always kept below the windows of the app-normal plane. The top-most plane is for windows that are always kept on top of the app-normal plane. The app-normal plane is for normal windows that the applications display. The app-normal plane is special in that the z-order of windows within it is managed carefully. Within the app-normal plane, windows displayed by apps have their z-order automatically changed cohesively as a group as the app becomes activated and deactivated. When an application becomes active, all of its top level displayed (materialized) windows move as a group to the front of the app-normal plane. When an app becomes deactivated, the newly activated app's windows replace the deactivated app's windows as the window-group at the front of the app-normal plane - as a result the deactivated app's windows fall behind the activated app's windows.

See also:
Materialize()
Enumeration values:
kBottomMost  the bottom-most plane
kTopMost  the top-most plane
kAppNormal  the middle or app-normal plane


Constructor & Destructor Documentation

CascadeWindow::CascadeWindow  ) 
 

The CascadeWindow constructor - lightweight.

This base class constructor is lightweight. It simply nullifies its pointer member variables.

virtual CascadeWindow::~CascadeWindow  )  [virtual]
 

Destructor.

This destructor is lightweight.

Note:
In order to remain lightweight, this destructor requires that this CascadeWindow not be materialized on screen or the app's focus window when called.

Fix that.

Warning:
If you do not make your destructors of CascadeWindow derived classes virtual, then your destructor will not get called if a delete is done on a base class pointer to one of your class instances.


Member Function Documentation

void CascadeWindow::AddChild CascadeWindow pWndChild  ) 
 

adds a child window to the window

Parameters:
pWndChild the child window to add
See also:
The CascadeWindow Tree Structure

RemoveChild()

GetParent(), GetFirstChild(), GetFirstSibling()

IsParentOf(), IsChildOf(), IsSiblingOf()

void CascadeWindow::ClearFocus bool  bRedraw = true  ) 
 

clears the focus window

ClearFocus() clears the focus window for this process' application.

Parameters:
bRedraw whether to redraw the focus state change - defaults to true

bool CascadeWindow::EnumerateTree EnumProc pEnumProc,
void *  pClientData
 

Enumerates child windows.

EnumerateTree() will call *pEnumProc for each child window of this window.

Parameters:
pEnumProc your EnumProc to be called back for each child window
pClientData a void * that will be passed straight thru to your EnumProc
Returns:
true if enumeration carried through to completion, false if enumeration was aborted
See also:
EnumProc

CascadeWindow * CascadeWindow::GetFirstChild  )  [inline]
 

gets the window's first child window

Returns:
the window's first child window
See also:
The CascadeWindow Tree Structure

AddChild(), RemoveChild()

CascadeWindow * CascadeWindow::GetFirstSibling  )  [inline]
 

gets the window's first sibling window

Returns:
the window's first sibling window
See also:
The CascadeWindow Tree Structure

AddChild(), RemoveChild()

static CascadeWindow* CascadeWindow::GetFocus  )  [static]
 

returns the focus window

GetFocus() returns the window (within this process' application) that has focus or NULL if no window (within this process' application) has focus.

Returns:
the focus window or NULL if no focus window exists
See also:
SetFocus(), ClearFocus()

CascadeWindow * CascadeWindow::GetParent  )  [inline]
 

gets the window's parent window

Returns:
the window's parent window
See also:
The CascadeWindow Tree Structure

AddChild(), RemoveChild()

CascadeRect CascadeWindow::GetRectAbsolute  )  const
 

gets the window's rectangle relative to the screen

GetRectAbsolute() returns the rectangle coordinates in absolute screen coordinates.

Returns:
the window's absolute rect
Note:
Internally a window's rectangle is stored in relative coordinates. As a result, the rectangle returned by GetRectAbsolute() will vary depending on whether or not the window has a parent window.
See also:
GetRectRelative(), SetRectAbsolute(), SetRectRelative()

CascadeRect CascadeWindow::GetRectRelative  )  const
 

gets the window's rectangle relative to its parent

GetRectRelative() returns the rectangle coordinates of the window relative to its parent.

Returns:
the window's relative rect
See also:
GetRectAbsolute(), SetRectRelative(), SetRectAbsolute()

CascadeWindow* CascadeWindow::GetTopLevelWindow  ) 
 

gets this window's top-level window

Returns:
the top-most parent window or NULL if this has no parent
See also:
The CascadeWindow Tree Structure

bool CascadeWindow::IsActiveFocus  ) 
 

determines if this window is the active focus window

IsActiveFocus() returns true if the current window has focus *and* the application that owns (created) the window is the active application.

Returns:
whether or not this window is the active focus window
See also:
SetFocus()

CascadeApp::Activate()

bool CascadeWindow::IsChildOf CascadeWindow pWindow  ) 
 

determines if this is a child window of another window

Parameters:
pWindow the window to test to see if I am a child of
Returns:
whether or not I am a child of pWindow
See also:
The CascadeWindow Tree Structure

GetParent(), GetFirstChild(), GetFirstSibling()

IsParentOf(), IsSiblingOf()

bool CascadeWindow::IsFocus  ) 
 

determines if the window is the focus window for this application

IsFocus() returns true if the current window has focus within the process' application regardless of whether or not the application is the active application.

See also:
SetFocus()
Returns:
whether or not this window is the focus window

bool CascadeWindow::IsInactiveFocus  ) 
 

determines if the window is an inactive focus window

IsInactiveFocus() returns true if the current window has focus within the process' application but the application is not the active application.

Returns:
whether or not this window is an inactive focus window
See also:
SetFocus()

bool CascadeWindow::IsParentOf CascadeWindow pWindow  ) 
 

determines if this is a parent window of another window

Parameters:
pWindow the window to test to see if I am a parent of
Returns:
whether or not I am a parent of pWindow
See also:
The CascadeWindow Tree Structure

GetParent(), GetFirstChild(), GetFirstSibling()

IsChildOf(), IsSiblingOf()

bool CascadeWindow::IsSiblingOf CascadeWindow pWindow  ) 
 

determines if this is a sibling of another window

Parameters:
pWindow the window to test to see if I am a sibling of
Returns:
whether or not I am a sibling of pWindow
See also:
The CascadeWindow Tree Structure

GetParent(), GetFirstChild(), GetFirstSibling()

IsParentOf(), IsChildOf()

bool CascadeWindow::IsVisible  ) 
 

Determines whether or not a window is visible

IsVisible() returns true if the window is materialized or if the window is a child of a materialized window.

Returns:
whether or not the window is visible

void CascadeWindow::Materialize Plane  plane = kAppNormal  ) 
 

causes the window to materialize onto the screen

Materialize() causes a window to materialize (be displayed) on screen. Materialize() only works on top-level windows (those without parents or siblings). The Materialize() function is asynchronous - a call to Materialize() merely instructs the windowing system to materialize the window. When materialization is complete the window's OnMaterialize() virtual member function is invoked.

Parameters:
plane The z-plane the window should be materialized into
See also:
OnMaterialize()

OnMaterialized()

Vanish()

virtual void CascadeWindow::OnClearFocus  )  [virtual]
 

notifies the window that has lost focus

OnClearFocus() gets called when the window has lost its focus. The window will be redrawn automatically (after OnClearFocus()). Clients should not redraw in OnClearFocus() but they may update member variables if desired before painting occurs.

See also:
SetFocus(), ClearFocus()

OnSetFocus()

virtual bool CascadeWindow::OnKeyDown u32  nKey  )  [virtual]
 

called to handle a key down CK_KEY message

OnKeyDown() gets called to handle a key down message. return true to indicate you have processed the message; false to allow the message to continue to be dispatched. NOTE that navigation keys (CK_NORTH, etc.) do not get dispatched to OnKeyDown(), they get dispatched to OnNavKey().

Parameters:
nKey the CK_KEY being notified
Returns:
true to prevent further message processing, false to allow it
See also:
OnKeyUp()

CascadeApp

Reimplemented in CascadeMessageBox, CascadeDirBrowser, CascadeDirBrowser::BrowserButton, CascadeButtonWidget, CascadeSpinnerWidget, and CascadeVesselPanel.

virtual bool CascadeWindow::OnKeyUp u32  nKey  )  [virtual]
 

called to handle a key down CK_KEY message

OnKeyDown() gets called to handle a key up message. return true to indicate you have processed the message; false to allow the message to continue to be dispatched. NOTE that navigation key up messages don't get dispatched to CascadeWindows. CascadeWindows only receive Nav key down messages to their OnNavKey() procedures.

Parameters:
nKey the CK_KEY being notified
Returns:
true to prevent further message processing, false to allow it
See also:
OnKeyDown()

CascadeApp

Reimplemented in CascadeMessageBox.

virtual void CascadeWindow::OnMaterialize  )  [virtual]
 

notifies the window when it has been materialized on screen

OnMaterialize() gets called when the window has been materialized, before it has been painted.

See also:
Materialize(), Vanish()

OnVanish()

Reimplemented in CascadeDirBrowser.

virtual void CascadeWindow::OnMaterialized  )  [virtual]
 

notifies the window materialization is complete and the window is painted

OnMaterialize() gets called when the window has been materialized, after it has been painted.

See also:
Materialize(), Vanish()

OnVanish()

virtual bool CascadeWindow::OnNavKey u32  nKey,
CascadeWindow *&  pProposedNewFocusWnd
[virtual]
 

called to handle a navigation key message

OnNavKey() gets called to handle a navigation key message. pProposedNewFocusWnd is the proposed new focus window. Clients who override this function may examine pProposedNewFocusWnd and change it if they want. OnNavKey() will be successively be called on a window and its parents until someone returns true, indicating they wish message dispatch to stop. At that point the pProposedNewFocusWnd (if non-NULL) will be set as the new focus window. The base class implementation returns false to allow its parent a chance to change the pProposedNewFocusWnd. If at the end of this business, pProposedNewFocusWnd doesn't point to a new focus window, then the focus will not change and the nav key will get dispatched to your CascadeApp's OnKeyDown() handler.

Parameters:
nKey the navigation key being processed
pProposedNewFocusWnd a settable pointer to the proposed new focus window
Returns:
true to prevent further message processing, false to allow it
See also:
CascadeApp

Reimplemented in CascadeDirBrowser, CascadeSpinnerWidget, and CascadeVesselPanel.

virtual void CascadeWindow::OnPaint CascadeBitmap bitmap  )  [virtual]
 

Called to instruct this window to paint

OnPaint() is called by the Cascade Windowing system to instruct your window to paint (on the bitmap passed in). Higher system performance will result if you manually clip your painting to the bitmap's clipRect (bitmap.GetClipRect()), though this is not required. It IS required to manually clip your painting to the window's absolute rect (since the graphics library doesn't yet support clipping). OnPaint() will only be called by the Cascade windowing system if some portion of the window's absolute rect intersects with the bitmap's clipRect. clients can manually call OnPaint to instruct the window to paint to an arbitrary bitmap outside of the context of the Cascade windowing system. Note that OnPaint() is a paint handling function for a single window. To cause a window and all of its child windows to paint, call PaintTree() instead.

Note:
Windows are themselves responsible for determining if they are the active window with input focus and rendering appropriately.
Parameters:
bitmap The bitmap to paint onto
See also:
OnPaint()

CascadeBitmap

Reimplemented in CascadeMessageBox, CascadeDirBrowser, CascadeDirBrowser::BrowserButton, CascadeButtonWidget, CascadeLabelWidget, CascadePictureWidget, CascadeSpinnerWidget, and CascadeVesselPanel.

virtual void CascadeWindow::OnSetFocus  )  [virtual]
 

notifies the window when it has gained focus

OnSetFocus() gets called when the window has gained focus. The window will be redrawn automatically (after OnSetFocus()). Clients should not redraw in OnSetFocus() but they may update member variables if desired before painting occurs.

See also:
SetFocus(), ClearFocus()

OnClearFocus()

Reimplemented in CascadeDirBrowser.

virtual void CascadeWindow::OnVanish  )  [virtual]
 

notifies the window that it has vanished from the screen

OnVanish() gets called when the window has vanished, before the screen has been updated.

Reimplemented in CascadeDirBrowser.

void CascadeWindow::PaintTree CascadeBitmap bitmap  ) 
 

Instructs a window to paint itself and its child windows

PaintTree() causes this window's OnPaint() function to be called to paint this window first, then calls OnPaint() on all child windows (and their children, etc.) in proper order. Note that in all cases OnPaint() will only be called on windows whose absolute rectangle intersects with bitmap.GetClipRect();

See also:
OnPaint()

CascadeBitmap

void CascadeWindow::Redraw const CascadeRect rect  ) 
 

causes a portion of a visible window to be redrawn

This version of Redraw() works the same way as the simple Redraw(), but sets the screen's clipping rect to rect before painting is dispatched.

Parameters:
rect The rectangle within the window to redraw

void CascadeWindow::Redraw  ) 
 

causes a visible window to be redrawn

Redraw() causes this window and all windows on top of it that intersect with it to be intellegently redrawn. Clients should never directly call PaintTree() or OnPaint() with the screen directly, they should always call Redraw() if they want to force manual redrawing of their window. Redraw() will cause all involved windows' OnPaint handlers to be called with a proper clipping rect set.

See also:
OnPaint(), PaintTree()

static void CascadeWindow::RedrawScreen  )  [static]
 

causes the entire screen to be redrawn

RedrawScreen causes the entire screen to be redrawn.

void CascadeWindow::RemoveChild CascadeWindow pWndChild  ) 
 

removes a child window from the window

Parameters:
pWndChild the child window to remove
See also:
The CascadeWindow Tree Structure

AddChild()

GetParent(), GetFirstChild(), GetFirstSibling()

IsParentOf(), IsChildOf(), IsSiblingOf()

void CascadeWindow::SetFocus bool  bRedraw = true  ) 
 

sets this window to be the focus window

SetFocus() sets this to be the window (within process' application) that has focus. Each application has at all times zero or one window that is in focus.

Parameters:
bRedraw whether to redraw the focus state change - defaults to true

void CascadeWindow::SetRectAbsolute const CascadeRect rect  ) 
 

sets the window's rectangle relative to to the screen

SetRectAbsolute() sets the rectangle coordinates of the window relative to the screen.

Parameters:
rect the new window rectangle relative to the screen
Note:
Internally a window's rectangle is stored in relative coordinates. As a result, the rectangle set by SetRectAbsolute() will vary depending on whether or not the window has a parent window.
See also:
SetRectRelative(), GetRectAbsolute(), GetRectRelative()

void CascadeWindow::SetRectRelative const CascadeRect rect  ) 
 

sets the window's rectangle relative to its parent

SetRectRelative() sets the rectangle coordinates of the window relative to its parent.

Parameters:
rect the new window rectangle relative to the window's parent
See also:
SetRectAbsolute(), GetRectRelative(), GetRectAbsolute()

void CascadeWindow::Vanish  ) 
 

causes the window to vanish from the screen

Vanish() causes a materialized window to vanish from the screen. Vanish() only works on top-level windows that are materialized. Like Materialize(), Vanish() is asynchronous. When vanishing is complete, the window's OnVanish() virtual member function is invoked.

See also:
OnVanish()

Materialize()

virtual bool CascadeWindow::WillAcceptFocus  )  [virtual]
 

called to ask the window if it will accept focus

WillAcceptFocus() is called during navigation allow the window to indicate whether or not it will accept the focus at the current point in time.

Returns:
whether or not the window will accept focus at this time

Reimplemented in CascadeDirBrowser, CascadeLabelWidget, CascadePictureWidget, CascadeVesselPanel, and CascadeWidget.


Friends And Related Function Documentation

friend class CascadeApp [friend]
 

Reimplemented in CascadeWidget.


The documentation for this class was generated from the following file:
Generated on Sun Jul 24 14:27:22 2005 for Cascade Library by  doxygen 1.4.1