Listing 7: The Activate, Deactivate, Constructor, and New functions (wndmenu.c)
#include "resource.h"
extern void mWndMenuActivate( CWndMenu *this, UINT message, LPARAM lparam, WPARAM wparam )
{
/* Paint the window if dirty */
if (this->m_bDirty) {
this->objPnlControls.Paint( &this->objPnlControls, RESOURCE, COLOR_NONE );
this->objButTitle.Paint( &this->objButTitle, RESOURCE, COLOR_NONE, COLOR_NONE );
this->objButHome.Paint( &this->objButHome, RESOURCE, COLOR_NONE, COLOR_NONE );
this->objButSettings.Paint( &this->objButSettings, RESOURCE, COLOR_NONE, COLOR_NONE );
this->m_bDirty = FALSE;
return;
}
/* Event Handling */
switch (tNavControlObjects[ tFocus.posWnd ][ tFocus.posRow ][ tFocus.posCol ]) {
case IDC_TITLE:
this->objButTitle.GotFocus( &this->objButTitle );
break;
case IDC_HOME:
switch(wparm)
{
case WM_KEY_ACTION:
/* Perform some action */
break;
default:
this->objButHome.GotFocus( &this->objButHome );
break;
}
break;
case IDC_SETTINGS:
this->objButSettings.GotFocus( &this->objButSettings );
break;
default:
break;
}
/* Message Passing */
/* Entering the Inherited Window Activate Member Functions */
switch (tFocus.posWnd) {
case IDW_HOME:
this->objWndHome.Activate( &this->objWndHome, message, lparam, wparam );
break;
case IDW_SETTINGS:
this->objWndSettings.Activate( &this->objWndSettings, message, lparam, wparam );
break;
default:
break;
}
return;
}
extern void mWndMenuDeactivate( CWndMenu *this, UINT message, LPARAM lparam, WPARAM wparam )
{
switch (tNavControlObjects[ tFocus.posWnd ][ tFocus.posRow ][ tFocus.posCol ]) {
case IDC_TITLE:
this->objButTitle.LostFocus( &this->objButTitle );
break;
case IDC_HOME:
this->objButHome.LostFocus( &this->objButHome );
break;
case IDC_SETTINGS:
this->objButSettings.LostFocus( &this->objButSettings );
break;
default:
break;
}
/* Entering the Inherited Window Activate Member Functions */
switch (tFocus.posWnd) {
case IDW_HOME:
this->objWndHome.Deactivate( &this->objWndHome, message, lparam, wparam );
break;
case IDW_SETTINGS:
this->objWndSettings.Deactivate( &this->objWndSettings, message, lparam, wparam );
break;
default:
break;
}
return;
}
extern void mWndMenuConstructor( CWndMenu *this )
{
this->m_bDirty = FALSE;
/* Inherited Controls */
this->objButTitle.Construct( &this->objButTitle, &objButHomeStatusResource );
this->objButHome.Construct( &this->objButHome, &objButHomeResource );
this->objButSettings.Construct( &this->objButSettings, &objButSettingsResource );
this->objPnlControls.Construct( &this->objPnlControls, &objPnlControlsResource );
/* Inherited Windows */
this->objWndHome.Construct( &this->objWndHome );
this->objWndSettings.Construct( &this->objWndSettings );
}
extern void NewWndMenu( CWndMenu *this )
{
this->Activate = mWinMenuActivate;
this->Deactivate = mWinMenuDeactivate;
this->Construct = mWinMenuConstructor;
/* Inherited Controls */
CButtonNew( &this->objButTitle );
CButtonNew( &this->objButHome );
CButtonNew( &this->objButSettings );
CPanelNew( &this->objPnlControls );
/* Inherited Windows */
NewWndHome( &this->objWndHome );
NewWndHome( &this->objWndSettings );
}
|