Category : C++ Source Code
Archive   : O2MBAR.ZIP
Filename : CHILDB.CPP

 
Output of file : CHILDB.CPP contained in archive : O2MBAR.ZIP
// *************************************************************** //
// Filename: ChildB.cpp //
// //
// Date: November 26, 1993 //
// //
// Description: //
// *************************************************************** //
#include "MDIMenu.h"

// --------------------------------------------------------------- //
// MDIMenuChild constructor //
// --------------------------------------------------------------- //
TMDIChildB::TMDIChildB(TMDIClient &parent,
const char far *title, TWindow *clientWnd,
BOOL shrinkToClient, TModule *module) :
TMDIChild(parent, title, clientWnd, shrinkToClient, module)
{
TMenuDescr menuDescr("BMenu", 0, 0, 0, 1, 0, 0);
SetMenuDescr(menuDescr);
Gadget = new TButtonGadget("B", CMB_ACTION);
Inserted = FALSE;
}

// --------------------------------------------------------------- //
// MDIMenuChild destructor //
// --------------------------------------------------------------- //
TMDIChildB::~TMDIChildB()
{
if (!Inserted)
{
delete Gadget;
}
}

// --------------------------------------------------------------- //
// GetClassName //
// --------------------------------------------------------------- //
char *TMDIChildB::GetClassName()
{
return "MDIChildB";
}

// --------------------------------------------------------------- //
// GetWindowClass //
// --------------------------------------------------------------- //
void TMDIChildB::GetWindowClass(WNDCLASS &wc)
{
TMDIChild::GetWindowClass(wc);
wc.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
}

// --------------------------------------------------------------- //
// SetupWindow //
// --------------------------------------------------------------- //
void TMDIChildB::SetupWindow()
{
TMDIChild::SetupWindow();
// put new stuff here
}

// --------------------------------------------------------------- //
// CleanupWindow //
// --------------------------------------------------------------- //
void TMDIChildB::CleanupWindow()
{
// put new stuff here
TMDIChild::CleanupWindow();
}

// --------------------------------------------------------------- //
// Response table for MDIMenuChild //
// --------------------------------------------------------------- //
DEFINE_RESPONSE_TABLE1(TMDIChildB, TMDIChild)
EV_COMMAND(CMB_ACTION, CmAction),
EV_WM_MDIACTIVATE,
END_RESPONSE_TABLE;


// --------------------------------------------------------------- //
// TryMe //
// --------------------------------------------------------------- //
void TMDIChildB::CmAction()
{
MessageBox("Thank you for selecting me", "B", MB_OK);
}


void TMDIChildB::EvMDIActivate(HWND hWndActivated, HWND hWndDeactivated)
{
TMDIMenuApp *app = TYPESAFE_DOWNCAST(GetApplication(), TMDIMenuApp);
if (*this == hWndActivated)
{
// add button gadgets
if (app)
{
app->ControlBar->Insert(*Gadget);
app->ControlBar->LayoutSession();
app->ControlBar->Invalidate();
Inserted = TRUE;
}
}
else if (*this == hWndDeactivated)
{
// remove button gadgets
if (app && app->ControlBar->Remove(*Gadget))
{
app->ControlBar->LayoutSession();
app->ControlBar->Invalidate();
Inserted = FALSE;
}
}
// continue with default processing, merge menus
TMDIChild::EvMDIActivate(hWndActivated, hWndDeactivated);
}





  3 Responses to “Category : C++ Source Code
Archive   : O2MBAR.ZIP
Filename : CHILDB.CPP

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/