home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
VSCPPv8.zip
/
VACPP
/
IBMCPP
/
samples
/
IOC
/
HELLO6
/
AHELLOW6.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1995-04-07
|
23KB
|
297 lines
#ifndef _AHELLOW6_
#define _AHELLOW6_
/*****************************************************************************
* HELLO WORLD SAMPLE PROGRAM - Version 6: Class Header (ahellow6.hpp) *
* *
* COPYRIGHT: Copyright (C) International Business Machines Corp., 1992,1995. *
* *
* 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.
#ifndef _IFRAME_ //V2
#include <iframe.hpp> //Include IFrameWindow class header V2
#endif //V2
#ifndef _ISTATTXT_ //V2
#include <istattxt.hpp> //Include IStaticText class header V2
#endif //V2
#ifndef _IINFOA_ //V2
#include <iinfoa.hpp> //Include IInfoArea class header V2
#endif //V2
#ifndef _IMENUBAR_ //V3
#include <imenubar.hpp> //Include IMenuBar class header V3
#endif //V3
#ifndef _ICMDHDR_ //V3
#include <icmdhdr.hpp> //Include ICommandHandler class header V3
#endif //V3
#ifndef _ISETCV_ //V4
#include <isetcv.hpp> //Include ISetCanvas class header V4
#endif //V4
#ifndef _IPUSHBUT_ //V4
#include <ipushbut.hpp> //Include IPushButton class header V4
#endif //V4
#ifndef _ISPLITCV_ //V5
#include <isplitcv.hpp> //Include ISplitCanvas class header V5
#endif //V5
#ifndef _ILISTBOX_ //V5
#include <ilistbox.hpp> //Include IListBox class header V5
#endif //V5
#ifndef _ISELHDR_ //V5
#include <iselhdr.hpp> //Include ISelectHandler class header V5
#endif //V5
#ifndef _IHELPHDR_ //V5
#include <ihelphdr.hpp> //Include IHelpHandler class header V5
#endif //V5
#ifndef _IHELP_ //V5
#include <ihelp.hpp> //Include IHelp class header V5
#endif //V5
#ifndef _IPOPMENU_ //V6
#include <ipopmenu.hpp> //Include IPopUpMenu class header V6
#endif //V6
#ifndef _IMENUHDR_ //V6
#include <imenuhdr.hpp> //Include IMenuHandler class header V6
#endif //V6
#ifndef _AEARTHW6_ //v6
#include "aearthw6.hpp" //Include AEarthWindow class header v6
#endif //V5
#ifndef _ATIMEHDR_ //V6
#include "atimehdr.hpp" //Include ATimeHandler class header V6
#endif //V6
#ifndef _ANOTEBW6_ //V6
#include "anotebw6.hpp" //Include ANotebookWindow class header V6
#endif //V6
//Forward declarations for other classes:
class AHelloWindow; //V3
class ANotebookWindow; //V6
/************************************************************************** V3
* Class: ACommandHandler * V3
* * V3
* Purpose: New Command Handler class that handles commands * V3
* specifically for AHelloWindow class windows. * V3
* * V3
**************************************************************************/ //V3
class ACommandHandler : public ICommandHandler { //V3
public: //V3
ACommandHandler(AHelloWindow *helloFrame); //V3
virtual ~ACommandHandler() { } //V3
protected: //V3
/*------------------------ Override Command Function ---------------------| V3
| The command function is called to handle application command events. | V3
|------------------------------------------------------------------------*/ //V3
virtual Boolean //V3
command(ICommandEvent& cmdEvent); //V3
private: //V3
AHelloWindow *frame; //V3
}; //V3
/************************************************************************** V5
* Class: ASelectHandler * V5
* * V5
* Purpose: New Select Handler class that handles list box selections * V5
* specifically for AHelloWindow class windows. * V5
* * V5
**************************************************************************/ //V5
class ASelectHandler : public ISelectHandler { //V5
public: //V5
ASelectHandler(AHelloWindow *helloFrame); //V5
virtual ~ASelectHandler() { } //V5
protected: //V5
/*------------------------ Override Selected Function --------------------| V5
| The selected() function is called to handle list box selection events. | V5
|------------------------------------------------------------------------*/ //V5
virtual Boolean //V5
selected(IControlEvent& ctlEvent); //V5
private: //V5
AHelloWindow *frame; //V5
};
/************************************************************************** V5
* Class: AHelpHandler * V5
* * V5
* Purpose: New Help Handler class that only overrides one * V5
* IHelpHandler function, keysHelpId(). If keysHelpId() * V5
* is not overridden, then the default action sets the event * V5
* result to zero, which indicates that no action is required, * V5
* that is, no help information for keys is displayed. * V5
**************************************************************************/ //V5
class AHelpHandler : public IHelpHandler { //V5
public: //V5
virtual ~AHelpHandler() { } //V5
protected: //V5
/*----------------------- Override keysHelpId Function -------------------| V5
| The keysHelpId() function is called to set the event result to the | V5
| ID within the Hello World help libraries for Keys Help. | V5
|------------------------------------------------------------------------*/ //V5
virtual Boolean //V5
keysHelpId(IEvent& evt); //V5
};
/************************************************************************** V6
* Class: APopUpHandler * V6
* * V6
* Purpose: New Menu Handler class that handles makePopUpMenu requests * V6
* specifically for AHelloWindow class windows. * V6
* * V6
**************************************************************************/ //V6
class APopUpHandler : public IMenuHandler { //V6
protected: //V6
/*------------------- Override MakePopUpMenu Function --------------------| V6
| The makePopUpMenu function is called to process requests for showing | V6
| pop-up menus for windows attached to this handler. | V6
|------------------------------------------------------------------------*/ //V6
virtual Boolean //V6
makePopUpMenu(IMenuEvent& menuEvent); //V6
}; //V6
/************************************************************************** V6
* Class: AHelloTimeHandler * V6
* * V6
* Purpose: New Time Handler class that processes timer ticks specifically * V6
* for AHelloWindow class windows. It is derived from the * V6
* ATimeHandler class, which is derived from IHandler class. * V6
* * V6
**************************************************************************/ //V6
class AHelloTimeHandler : public ATimeHandler { //V6
protected: //V6
/*------------------------ Override Tick Function ------------------------| V6
| The tick function is called each time a timer event occurs. | V6
|------------------------------------------------------------------------*/ //V6
virtual IBase::Boolean //V6
tick(IEvent& evt); //V6
}; //V6
/************************************************************************** V2
* Class: AHelloWindow * V2
* * V2
* Purpose: Main Window class for C++ Hello World sample application. * V2
* It is derived from IFrameWindow class. * V2
* * V2
**************************************************************************/ //V2
class AHelloWindow : public IFrameWindow //V2
{ //V2
public: //V2
AHelloWindow(unsigned long windowId); //V2
virtual ~AHelloWindow(); //Destructor for this class v3
/*------------------------ Hello Text Alignment --------------------------| V3
| The following enumeration type is used to specify the alignment of | V3
| text in the hello static text window. | V3
|------------------------------------------------------------------------*/ //V3
enum Alignment //V3
{ //V3
left, center, right //V3
}; //V3
/*---------------------- Hello Static Text Functions ---------------------| V3
| These functions are used to change the hello static text window. | V3
| setAlignment - Align the static text horizontally. The text is | V3
| always centered vertically by design. | V3
| editText - Use a modal dialog window to edit the text in the static | V4
| text window. | V4
| setTextFromListBox - Set the text to the first selected item in the | V5
| list box. | V5
│ setHelloFont - Use a modal font dialog window to change the font of | V6
| static text. | V6
|------------------------------------------------------------------------*/ //V3
virtual AHelloWindow //V3
&setAlignment(Alignment alignment), //V3
&editText(), //V4
&setTextFromListBox(), //V5
&setHelloFont(); //V6
/*----------------------- Hello Settings Functions -----------------------| V6
| These functions are used to manage attributes of the hello and | V6
| earthWindow static text windows. | V6
| readHelloSettings - Read saved settings from an IProfile file. A | V6
| message box displays the success or failure of the read | V6
| operation. | V6
| openHelloSettings - Open a non-modal frame window containing a | V6
| notebook window with multiple controls for changing | V6
| settings in AHelloWindow. | V6
| saveHelloSettings - Save current AHelloWindow settings in an IProfile | V6
| file. A message box displays the success or failure of the | V6
| save operation. | V6
| earth - Provide non-AHelloWindow functions with access to the | V6
| AEarthWindow settings functions by returning a pointer to | V6
| the earthWindow object contained in AHelloWindow. | V6
|------------------------------------------------------------------------*/ //V6
virtual AHelloWindow //V6
&readHelloSettings(), //V6
&openHelloSettings(), //V6
&saveHelloSettings(); //V6
AEarthWindow //V6
*earth(); //V6
/*-------------------- Hello Date and Time Functions ---------------------| V6
| These functions are used to manage the date and time static text | V6
| windows in AHelloWindow. | V6
| tickTime - Update date and time windows if the current values are | V6
| different than what is displayed. This is the function that | V6
| the AHelloTimeHandler::tick calls each time a timer event isu | V6
| processed. | V6
| enableDateLong - Change the format of the date to long, | V6
| for example, August 10, 1994. | V6
| disableDateLong - Change the format of the date to short, | V6
| for example, 08/10/94 (depending on locale). | V6
| enableTimeLong - Change the format of the time to long, | V6
| for example, 01:57:59. | V6
| disableTimeLong - Change the format of the time to short, | V6
| for example, 13:57. | V6
| isDateLong - Return true is date format is long. | V6
| isTimeLong - Return true is time format is long. | V6
|------------------------------------------------------------------------*/ //V6
virtual AHelloWindow //V6
&tickTime(), //V6
&enableDateLong(IBase::Boolean makingLong=true), //V6
&disableDateLong(), //V6
&enableTimeLong(IBase::Boolean makingLong=true), //V6
&disableTimeLong(); //V6
const Boolean //V6
isDateLong(), //V6
isTimeLong(); //V6
private: //V2
IMenuBar menuBar; //V3
ISplitCanvas statusCanvas; //V3
IStaticText statusLine; //V3
IStaticText statusDate; //V3
IStaticText statusTime; //V3
ISplitCanvas clientWindow; //V5
ISplitCanvas helloCanvas; //V5
IStaticText hello; //V2
AEarthWindow earthWindow; //V5
IListBox listBox; //V5
ISetCanvas buttons; //V4
IPushButton leftButton; //V4
IPushButton centerButton; //V4
IPushButton rightButton; //V4
IPushButton helpButton; //V5
IInfoArea infoArea; //V2
ACommandHandler commandHandler; //V3
ASelectHandler selectHandler; //V5
AHelpHandler helpHandler; //V5
IHelpWindow helpWindow; //V5
AHelloTimeHandler timeHandler; //V6
APopUpHandler popUpHandler; //V6
ANotebookWindow *settingsNotebook; //V6
Boolean dateLong; //V6
Boolean timeLong; //V6
IPopUpMenu helloPopUpMenu; //V6
AHelloWindow(const AHelloWindow&); //Default copy constructor V2
AHelloWindow //V2
&operator=(const AHelloWindow&); //Default assignment operator V2
}; //V2
#endif //V2