home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
VSCPPv8.zip
/
VACPP
/
IBMCPP
/
samples
/
IOC
/
VPORT
/
AVPORT.CPP
next >
Wrap
Text File
|
1995-05-01
|
4KB
|
61 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:
#ifndef _IBASE_ //Make sure ibase.hpp is included
#include <ibase.hpp> // since that is where IC_<environ>
#endif // is defined.
#include <iapp.hpp> // IApplication class
#include <ireslib.hpp> // IResourceId class
#include "avport.h"
#include "avport.hpp"
/******************************************************************************/
/* main - Application entry point */
/******************************************************************************/
int 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
return 0;
} /* end main */
/******************************************************************************/
/* AViewPort :: AViewPort - constructor for our main window */
/******************************************************************************/
AViewPort :: AViewPort(unsigned long windowId)
: IFrameWindow( windowId )
, clientViewPort( WND_VIEWPORT, this, this )
, bitmap( WND_BITMAP, &clientViewPort, &clientViewPort , IResourceId(BMP_ID) )
{
sizeTo( ISize( bitmap.minimumSize().width()*0.8, // Size the frame window
bitmap.minimumSize().height()*0.9 ) ); // smaller than the bitmap
setIcon( id() ); // set icon
setClient( &clientViewPort ); // make viewport the client
setFocus().show(); // set focus and show window
} /* end AViewPort :: AViewPort(...) */