home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
ICLUI.ZIP
/
HELLO2
/
AHELLOW2.CPP
next >
Wrap
Text File
|
1993-03-06
|
5KB
|
78 lines
/******************************************************************************/
/* HELLO WORLD SAMPLE PROGRAM - Version 2: Class Implementation (AHELLOW2.CPP)*/
/* */
/* 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
//**************************************************************************
// C++ Hello World History and Key Functions: *
// Version 1: *
// - Creates and runs a simple application *
// - Creates the main window (IFrameWindow) *
// - Creates a static text control set to "Hello, World!" as the *
// client window *
// *
// Version 2: (lines with v2 in column 79-80) * v2
// - Create Main Window (AHellowWindow) as subclass of IFrameWindow * .
// - Gets the "Hello, World!!" text string and other items from a * .
// resource file * .
// - Sets the window title from a resource file * .
// - Creates and sets the information area at the bottom of the * .
// client area * v2
//**************************************************************************
//Include the IBM UI class headers:
#include <iapp.hpp> //IApplication class
#include <istattxt.hpp> //IStaticText class
#include <iinfoa.hpp> //IInfoArea Class v2
#include "ahellow2.hpp" //Include the AHelloWindow class v2
// header v2
#include "ahellow2.h" //Include our symbolic definitions v2
//*************************************************************************
// main - Application entry point *
//*************************************************************************
void main() //Main procedure with no parameters
{
AHelloWindow mainWindow (WND_MAIN); //Create our main window on the
// desktop
IApplication::current().run(); //Get the current application and
// run it
} /* end main */
//**************************************************************************
// AHelloWindow :: AHelloWindow - Constructor for our main window *
//**************************************************************************
AHelloWindow :: AHelloWindow(unsigned long windowId)
: IFrameWindow ( //Call the IFrameWindow constructor
IFrameWindow::defaultStyle() // using the default style, plus v2
| IFrameWindow::minimizedIcon, // get minimized icon from RC file v2
windowId) // and set the main window ID
{
hello=new IStaticText(WND_HELLO, //Create a static text control
this, this); // Pass in this AHelloWindow as the
// owner and parent of the control
hello->setText(STR_HELLO); //Set text in the static text control v2
// from the RC file v2
hello->setAlignment( //Set the alignment to center in both
IStaticText::centerCenter); // directions
setClient(hello); //Set the static text control as the
// client window
infoArea=new IInfoArea(this); //Create the information area v2
infoArea->setInactiveText(STR_INFO); //Set information area text from RC v2
sizeTo(ISize(400,300)); //Set the pixel size of main window v2
setFocus(); //Set the focus to the main window
show(); //Show the main window
} /* end AHelloWindow :: AHelloWindow(...) */