home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
VSCPPv8.zip
/
VACPP
/
IBMCPP
/
samples
/
IOC
/
BIGCPP
/
BIGCPP.HPP
< prev
next >
Wrap
Text File
|
1995-01-20
|
7KB
|
177 lines
#ifndef BIGCPP_HPP
#define BIGCPP_HPP
/******************************************************************************/
/* Big C Plus Plus Sample Program */
/* */
/* 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. */
/******************************************************************************/
#include <iframe.hpp> //Include IFrameWindow Class Header
#include <idrawcv.hpp>
#include <igraphic.hpp>
#include <igpyline.hpp>
#include <isizehdr.hpp>
class MainWindow;
//**************************************************************************
// Class: ICPlusPlus *
// *
// Purpose: Draw a big C Plus Plus *
// *
//**************************************************************************
class ICPlusPlus : public IGraphic {
typedef IGraphic
Inherited;
public:
ICPlusPlus ( const IRectangle& rectangle );
virtual
~ICPlusPlus ( );
ICPlusPlus
&drawOn ( IGraphicContext& graphicContext );
ICPlusPlus
&setEnclosingRect ( const IRectangle& rectangle );
IRectangle
enclosingRect ( ) const;
private:
ICPlusPlus
&draw( IGraphicContext&,
IGraphicBundle::DrawOperation );
IRectangle
fRect;
};
//**************************************************************************
// The border class is derived from an IGraphic.
//
// Normally the border would be placed inside the perimeter of the
// drawing area and also around the outside of another graphic object.
//
// Borders can be raised or depressed. Raised draws the top and left
// sides lighter in shade than the bottom and right. Depressed draws the top
// and left darker than the bottom and right. The light source is from the top
// left.
//
// The border is comprised of two polygons, one for the top and left sides
// and one for the bottom and right sides.
//**************************************************************************
class IGBorder : public IGraphic {
typedef IGraphic
Inherited;
public:
/*------------------------ Constructors/Destructor -----------------------------
| You can construct objects of this class from an IRectangle object specifying |
| the location and size of the border, a value indicating the thickness of the |
| border, an optional boolean indicating whether you want the border drawn |
| inside or outside of the rectangle and an optional boolean indicating |
| to raise or depress the border. |
------------------------------------------------------------------------------*/
IGBorder ( const IRectangle& rectangle,
unsigned long thickness,
Boolean outside = true,
Boolean raised = true );
virtual
~IGBorder ( );
IGBorder
&drawOn ( IGraphicContext& graphicContext );
IGBorder
&setEnclosingRect ( const IRectangle& rectangle );
IRectangle
enclosingRect ( ) const;
IGBorder
&setThickness ( unsigned long thickness );
unsigned long
thickness ( ) const;
private:
IGPolygon
fTopBorder,
fBottomBorder;
unsigned long
fThickness;
Boolean
fOutside,
fRaised;
};
//**************************************************************************
// Class: ResizeHandler *
// *
// Purpose: Route resize events to the MainWindow *
// *
//**************************************************************************
class ResizeHandler : public IResizeHandler {
typedef IResizeHandler
Inherited;
public:
ResizeHandler ( MainWindow& mainWindow );
virtual
~ResizeHandler ( );
protected:
/*----------------------------- Event Processing -------------------------------
| This function must be supplied by a derived class to process a resizing |
| event. |
| windowResize - Implemented by a derived class to handle a resizing event. |
------------------------------------------------------------------------------*/
virtual Boolean
windowResize ( IResizeEvent& event );
private:
MainWindow
&fMainWindow;
};
//**************************************************************************
// Class: MainWindow *
// *
// Purpose: Main Window for Big C Plus Plus sample application *
// It is a subclass of IFrameWindow *
// *
//**************************************************************************
class MainWindow : public IFrameWindow
{
public: //Define the Public Information
MainWindow ( unsigned long windowIdentifier ); //Constructor for this class
virtual
~MainWindow ( );
MainWindow
&resizeGraphics ( const ISize& size );
protected:
private:
IDrawingCanvas drawingCanvas;
ICPlusPlus bigC;
IGBorder border;
ResizeHandler resizeHandler;
};
#endif