home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
ICLUI.ZIP
/
VPORT
/
AVPORT.CPP
< prev
next >
Wrap
Text File
|
1993-02-22
|
4KB
|
72 lines
/******************************************************************************/
/* Canvas Classes Example 4 - ViewPort */
/* */
/* COPYRIGHT: Copyright (C) International Business Machines Corp., 1992,1993. */
/* */
/* DISCLAIMER OF WARRANTIES: */
/* The following [enclosed] code is sample code created by IBM */
/* Corporation. This sample code is not part of any standard IBM product */
/* and is provided to you solely for the purpose of assisting you in the */
/* development of your applications. The code is provided "AS IS", */
/* without warranty of any kind. IBM shall not be liable for any damages */
/* arising out of your use of the sample code, even if they have been */
/* advised of the possibility of such damages. */
/******************************************************************************/
/* NOTE: WE RECOMMEND USING A FIXED SPACE FONT TO LOOK AT THE SOURCE */
/******************************************************************************/
/* Canvas Classes Example 4 - ViewPort */
/* key functions: */
/* - create a main window */
/* - run the current application */
/* - create a viewport and use as client area */
/* - create a bitmap control */
/* - load the bitmap from resource bound to the exe */
/* - load strings from resource bound to the exe */
/******************************************************************************/
//Include IBM UI class headers:
#include <iapp.hpp> // IApplication class
#include <ireslib.hpp> // IResourceId class
#include "avport.h"
#include "avport.hpp"
/******************************************************************************/
/* main - Application entry point */
/******************************************************************************/
void main() //Main Procedure with no parameters
{
AViewPort mainWindow(WND_MAIN); //Create our main window on the decktop
IApplication::current().run(); //Get current & run the application
} /* end main */
/******************************************************************************/
/* AViewPort :: AViewPort - constructor for our main window */
/******************************************************************************/
AViewPort :: AViewPort(unsigned long windowId)
: IFrameWindow(windowId) //Call IFrameWindow constructor
{
// create the viewport
// and make it the client area
clientViewPort = new IViewPort( WND_VIEWPORT, this, this );
setClient( clientViewPort );
// create the bitmap and add it to
// the viewport
bitmap =new IBitmapControl( WND_BITMAP, clientViewPort, clientViewPort,
IResourceId(BMP_ID) );
update(); //Update main window
setFocus(); //Set focus to main window
show(); //Set to show main window
} /* end AViewPort :: AViewPort(...) */
/******************************************************************************/
/* AViewPort :: AViewPort - destructor for our main window */
/******************************************************************************/
AViewPort :: ~AViewPort()
{
delete bitmap;
delete clientViewPort;
} /* end AViewPort::~AViewPort() */