home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 13
/
mediashare_13.zip
/
mediashare_13
/
ZIPPED
/
PROGRAM
/
TBIWIN12.ZIP
/
WINDOW.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1992-12-15
|
3KB
|
99 lines
//----------------------------------------------------
// WINDOW.CPP (c) Casper Pedersen 1992
//----------------------------------------------------
// Test program for TBIWindow
// For use of TBIWindow, please read TBIWIN.CPP
// and TBIWIN.H and TBIWIN.DOC
//----------------------------------------------------
#include <owl.h>
#include <bwcc.h>
#include "tbiwin.h"
//----------------------------------------------------
_CLASSDEF(Win)
class _EXPORT Win : public TBIWindow
{
protected:
virtual LPSTR GetClassName() { return("WINDOW"); }
public:
Win(PTWindowsObject AParent, LPSTR ATitle);
virtual void ButtonActivated(void);
virtual void Button100(RTMessage) = [CM_FIRST + 100];
virtual void Button101(RTMessage) = [CM_FIRST + 101];
virtual void Button102(RTMessage) = [CM_FIRST + 102];
};
//----------------------------------------------------
// Construcors for both LEFT and RIGHT placement.
//Win::Win(PTWindowsObject AParent, LPSTR ATitle) : TBIWindow(AParent, ATitle, LEFT)
Win::Win(PTWindowsObject AParent, LPSTR ATitle) : TBIWindow(AParent, ATitle, RIGHT)
{
AddButton(100);
AddButton(101);
AddButton(102);
}
//----------------------------------------------------
void Win::ButtonActivated(void)
{
HDC hdc = GetDC(HWindow);
char tmp[30];
wsprintf(tmp,"Button Activate: %d", ButtonActive);
TextOut(hdc, 10, 10, tmp, lstrlen(tmp));
ReleaseDC(HWindow, hdc);
}
//----------------------------------------------------
void Win::Button100(RTMessage Msg)
{
HDC hdc = GetDC(HWindow);
char tmp[30];
wsprintf(tmp,"Button Activate: %d", Msg.WParam);
TextOut(hdc, 10, 30, tmp, lstrlen(tmp));
ReleaseDC(HWindow, hdc);
}
//----------------------------------------------------
void Win::Button101(RTMessage)
{
AboutTBIWindow();
}
//----------------------------------------------------
void Win::Button102(RTMessage)
{
SendMessage(HWindow, WM_CLOSE, 0, 0l);
}
//----------------------------------------------------
// Application Base class
//----------------------------------------------------
class T3dApp : public TApplication
{
public:
T3dApp(LPSTR Name, HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmd,int nCmdShow):TApplication(Name, hInstance, hPrevInstance, lpCmd, nCmdShow){};
virtual void InitMainWindow();
};
//----------------------------------------------------
// init FrameWin
//----------------------------------------------------
void T3dApp::InitMainWindow()
{
MainWindow = new Win(NULL, "Test Window");
}
//----------------------------------------------------
// Application entry/exit point
//----------------------------------------------------
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int CmdShow)
{
T3dApp App("WINDOW", hInstance, hPrevInstance, lpszCmdLine, CmdShow);
App.Run();
return (App.Status);
}
//----------------------------------------------------