home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
pwrgu2.zip
/
POWERGU2.EXE
/
CANVAS
/
CVSIMPLE
/
CVSIMPLE.CPP
next >
Wrap
Text File
|
1995-07-25
|
3KB
|
74 lines
//************************************************************
// Canvas - Simple ICanvas Example
//
// Copyright (C) 1994, Law, Leong, Love, Olson, Tsuji.
// All Rights Reserved.
//************************************************************
#include <icanvas.hpp>
#include <icolor.hpp>
#include <iframe.hpp>
#include <iapp.hpp>
#include <ipushbut.hpp>
#include <isysmenu.hpp>
#include <icconst.h>
#define MARGIN 30
#define BUTTON_PAD 15
#define BUTTON_HEIGHT 35
#define COLOR_SIZE 100
#define COLOR_OVERLAP 25
#define COLOR_START_Y (MARGIN + BUTTON_HEIGHT + BUTTON_PAD)
void main ( )
{
IFrameWindow frame( "Base Canvas Example" );
ICanvas client( IC_FRAME_CLIENT_ID, &frame, &frame );
frame.setClient( &client );
// Create three color squares.
ICanvas red ( 1, &client, &client,
IRectangle( IPoint( MARGIN,
COLOR_START_Y + COLOR_SIZE
- COLOR_OVERLAP ),
ISize( COLOR_SIZE, COLOR_SIZE )));
red.setColor( ICanvas::background, IColor::red );
ICanvas green( 2, &client, &client,
IRectangle( IPoint( MARGIN + COLOR_SIZE
- COLOR_OVERLAP,
COLOR_START_Y ),
ISize( COLOR_SIZE, COLOR_SIZE )));
green.setColor( ICanvas::background, IColor::green );
ICanvas blue ( 3, &client, &client,
IRectangle( IPoint( MARGIN + 2 * COLOR_SIZE
- 2 * COLOR_OVERLAP,
COLOR_START_Y + COLOR_SIZE
- COLOR_OVERLAP ),
ISize( COLOR_SIZE, COLOR_SIZE )));
blue.setColor( ICanvas::background, IColor::blue );
// Create a push button.
IPushButton ok( ISystemMenu::idClose, &client, &client,
IRectangle( IPoint( MARGIN, MARGIN ),
ISize( 3 * COLOR_SIZE
- 2 * COLOR_OVERLAP,
BUTTON_HEIGHT )));
ok
.enableSystemCommand() // For ISystemMenu::idClose.
.enableDefault()
.setText( "OK" )
.enableTabStop()
.enableGroup();
// Size and show the window now.
ISize clientSize( client.minimumSize()
+ ISize( MARGIN, MARGIN ));
frame
.moveSizeToClient( IRectangle( IPoint( 100, 100 ),
clientSize ))
.setFocus()
.show();
IApplication::current().run();
}