Humble Framework for SkyOS


Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

HWindow< T > Class Template Reference
[Graphical User Interface]

#include <HWindow.h>

Inheritance diagram for HWindow< T >:

HWidget HColorable HObjNoCopy HObj HObj

Detailed Description

template<class T>
class HWindow< T >

This class is the root class of all window classes, and manages the creation/destruction of a Graphic Context (GC). Windows can also be thought of as "owner drawn widgets", i.e., unlike SkyGI-provided widgets windows have to implement the Draw() method. Windows are also "colorable" by default, i.e., the HColorable class is mixed in so that windows have a background color (m_clrBG) and a foreground color (m_clrFG), as well as the appropriate getters/setters.

Definition at line 42 of file HWindow.h.

Public Member Functions

virtual ErrCode Create (HANDLE hParent, StringPtr pstrTitle=NULL, HRect const *prFrame=NULL, uint32 uStyle=0)
 Create the window based on caller-provided parameters.
virtual ErrCode UpdateLayout (void)
 Repositions all child widgets when the window's dimensions change.

Protected Member Functions

virtual END_MSG_MAP bool onRedraw (const s_gi_msg &msg, HRESULT &hr)
 Handler for the MSG_GUI_REDRAW message.
bool onWindowDestroy (const s_gi_msg &msg, HRESULT &hr)
 Handler for the MSG_WINDOW_DESTROY message.
bool onWindowSized (const s_gi_msg &msg, HRESULT &hr)
 Handler for the MSG_WINDOW_SIZED message.
ErrCode manageWindow (void)
 Takes control of a pre-created window.

Protected Attributes

HGC m_gc
 Graphic Context (GC).


Member Function Documentation

template<class T>
virtual END_MSG_MAP bool HWindow< T >::onRedraw const s_gi_msg &  msg,
HRESULT &  hr
[protected, virtual]
 

Standard handler for the MSG_GUI_REDRAW message, which calls GI_beginpaint() before invoking the subclass-specific Draw() method, passing the "dirty" rectangle. Once drawing is complete, GI_endpaint() is called.

Returns:
Always true
Parameters:
msg MSG_GUI_REDRAW message received by window procedure
[out] hr S_OK on success, error code otherwise; preset to S_OK

Reimplemented from HWidget.

Definition at line 85 of file HWindow.h.

template<class T>
bool HWindow< T >::onWindowDestroy const s_gi_msg &  msg,
HRESULT &  hr
[protected, virtual]
 

Overrides the onWindowDestroy() method so that the cached Graphic Context is destroyed.

Returns:
True if message handled, false otherwise
Parameters:
msg MSG_WINDOW_DESTROY message received by window procedure
[out] hr S_OK on success, error code otherwise; preset to S_OK

Reimplemented from HWidget.

Definition at line 115 of file HWindow.h.

template<class T>
bool HWindow< T >::onWindowSized const s_gi_msg &  msg,
HRESULT &  hr
[protected, virtual]
 

Handler for the MSG_WINDOW_SIZED message, which repositions all the widgets.

Returns:
True if handled, false otherwise
Parameters:
msg MSG_WINDOW_SIZED message received by window procedure
[out] hr S_OK on success, error code otherwise; preset to S_OK

Reimplemented from HWidget.

Definition at line 134 of file HWindow.h.

template<class T>
virtual ErrCode HWindow< T >::Create HANDLE  hParent,
StringPtr  pstrTitle = NULL,
HRect const *  prFrame = NULL,
uint32  uStyle = 0
[virtual]
 

Subclasses MUST call this function to determine the window class, title, and screen location.

Returns:
NO_ERROR on success, error code otherwise
Parameters:
hParent Handle to parent window of the window being created
pstrTitle [optional] Window title
prFrame [optional] Ptr to frame rectangle in screen coordinates
uStyle [optional] Window style flags (WF_* constants)

Reimplemented in HLabel.

Definition at line 160 of file HWindow.h.

template<class T>
virtual ErrCode HWindow< T >::UpdateLayout void   )  [virtual]
 

Returns:
Always NO_ERROR

Reimplemented in HApp, and HLayout.

Definition at line 196 of file HWindow.h.

template<class T>
ErrCode HWindow< T >::manageWindow void   )  [protected]
 

Subclasses of HWindow<T> that create their own windows must call this method to finish the window creation.

Returns:
NO_ERROR on success, error code otherwise

Definition at line 208 of file HWindow.h.


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

2006.01.09-16:37