home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
VSCPPv8.zip
/
VACPP
/
IBMCPP
/
samples
/
IOC
/
LANCELOT
/
LMAINWIN.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1995-04-07
|
16KB
|
385 lines
/******************************************************************************
* FILE NAME: lmainwin.hpp *
* *
* DESCRIPTION: Frame window for the main application *
* *
* Classes: *
* LMainWindow *
* LMainWindowCommandHandler *
* LMainCnr *
* LMainCnrObject *
* LMainWindowHelpHandler *
* *
* COPYRIGHT: *
* Licensed Materials - Property of IBM *
* (C) Copyright IBM Corporation 1992, 1995 *
* All Rights Reserved *
* US Government Users Restricted Rights - Use, duplication, or disclosure *
* restricted by GSA ADP Schedule Contract with IBM Corp. *
* *
******************************************************************************/
#ifndef _LMAINWIN_
#define _LMAINWIN_
#include <iapp.hpp>
#include <irect.hpp>
#include <istring.hpp>
#include <iframe.hpp>
#include <ititle.hpp>
#include <iinfoa.hpp>
#include <imenubar.hpp>
#ifdef IC_PM
#include <itbar.hpp>
#include <itbarbut.hpp>
#include <iflytext.hpp>
#include <iflyhhdr.hpp>
#endif
#include <icmdhdr.hpp>
#include <icnrhdr.hpp>
#include <icnrmhdr.hpp>
#include <ievent.hpp>
#include <icnr.hpp>
#include <icnrobj.hpp>
#include <icnrctl.hpp>
#include <icnrcol.hpp>
#include <ipopmenu.hpp>
#include <ifont.hpp>
#include <imsgbox.hpp>
#include <ihelp.hpp>
#include <ihelphdr.hpp>
#include "linfowin.hpp"
#include "lcnrobj.hpp"
#include "ldbase.hpp"
#include "lancelot.h"
class LMainWindow;
/******************************************************************************
* Class LMainCnrObject - LMainWindow's container object *
******************************************************************************/
class LMainCnrObject : public LCnrObject
{
public:
enum ObjectType { personnel, project, query };
/*------------------------ Constructors/Destructor ----------------------------
| Construct the object in one of four ways: |
| 1) Existing object |
| 2) Icon resourceId, title, ObjectType, and description. |
| 3) Icon resourceId, title resourceId, ObjectType, & description resourceId. |
| 4) Icon resourceId, title, ObjectType, and description resourceId. |
-----------------------------------------------------------------------------*/
LMainCnrObject( const LMainCnrObject& cnrobj );
LMainCnrObject( unsigned long icon, IString title,
ObjectType type, IString description );
LMainCnrObject( unsigned long icon, IResourceId title,
ObjectType type, IResourceId description );
LMainCnrObject( unsigned long icon, IString title,
ObjectType type, IResourceId description );
virtual
~LMainCnrObject();
/*------------------------------- Accessors -----------------------------------
| These functions provide a means of getting and setting the accessible |
| attributes of instances of this class: |
| type - Returns the type of the container object |
| description - Returns the description. |
| setType - Sets the type. |
| setDescription - Sets the description. |
| typeOffset - Returns the container offset for the type. |
| descOffset - Returns the container offset for the description. |
-----------------------------------------------------------------------------*/
inline ObjectType
type() const { return theType; };
inline IString
description() const { return theDesc; };
inline LMainCnrObject
&setType( ObjectType newType ) { theType=newType; return *this; };
inline LMainCnrObject
&setDescription( IString desc ) { theDesc=desc; return *this; };
inline static unsigned long
typeOffset() { return offsetof( LMainCnrObject, theType ); };
inline static unsigned long
descOffset() { return offsetof( LMainCnrObject, theDesc ); };
private:
ObjectType
theType;
IString
theDesc;
};
/******************************************************************************
* Class LMainCnr - Main window's container *
******************************************************************************/
class LMainCnr : public IContainerControl,
protected ICnrHandler,
protected ICnrMenuHandler
{
public:
/*------------------------ Constructors/Destructor ----------------------------
| Construct the object in only one way: |
| 1) Window id, parent, owner, and location |
-----------------------------------------------------------------------------*/
LMainCnr( unsigned long id, LMainWindow* parent,
LMainWindow* owner, IRectangle location=IRectangle() );
virtual
~LMainCnr();
/*------------------------------- Accessors -----------------------------------
| These functions provide a means of getting and setting the accessible |
| attributes of instances of this class: |
| lastPopupMenuObject - Returns the last container object that had a |
| popup menu over it. But not guaranteed that the |
| last action was a popup menu. |
| setLastPopupMenuObject - Sets the last container object that had a popup |
| menu over it. |
-----------------------------------------------------------------------------*/
inline LMainCnrObject
*lastPopupMenuObject() { return ptheLastPopupMenuObject; };
inline LMainCnr
&setLastPopupMenuObject( LMainCnrObject* object )
{ ptheLastPopupMenuObject = object; return *this; };
/*------------------------------- Manipulation --------------------------------
| These functions provide a means of manipulating the instances of this class:|
| populate - Populate the container with query objects. |
| addLastQuery - Add the new saved query to the container. |
-----------------------------------------------------------------------------*/
LMainCnr
&populate();
LMainCnr
&addLastQuery( IString queryName );
protected:
/*----------------------------- Event Processing ------------------------------
| Handle and process events: |
| makePopupMenu - Process popup menu events. |
| enter - Process the enter key for container objects. |
| help - Process the help key for container objects. |
-----------------------------------------------------------------------------*/
virtual Boolean
makePopUpMenu( IMenuEvent& evt ),
enter( ICnrEnterEvent& evt ),
help( ICnrHelpEvent& evt );
private:
LMainCnrObject
*pCnrObject[ ID_MAIN_MAX_CNROBJECTS ];
IContainerColumn
colIcon,
colIconText,
colDesc;
LMainCnrObject
*ptheLastPopupMenuObject;
IHelpWindow
*helpWin;
IPopUpMenu
*popm;
unsigned long
objCount;
};
/******************************************************************************
* Class LMainWindowCommandHandler - Handle command events. *
******************************************************************************/
class LMainWindowCommandHandler : public ICommandHandler
{
public:
/*------------------------ Constructors/Destructor ----------------------------
| Construct the object in only one way: |
| 1) Owner, help window, and container. |
-----------------------------------------------------------------------------*/
LMainWindowCommandHandler( LMainWindow* owner,
IHelpWindow* helpWin,
LMainCnr* cnrCtl );
virtual
~LMainWindowCommandHandler();
/*------------------------- Container Object Actions --------------------------
| These functions provide a means of performing actions on container objects. |
| openAction - Opens/views the container object. |
| deleteAction - Deletes the container object. |
-----------------------------------------------------------------------------*/
LMainWindowCommandHandler
&openAction( LMainCnrObject* cnrObject );
Boolean
deleteAction( LMainCnrObject* cnrObject );
protected:
/*----------------------------- Event Processing ------------------------------
| Handle and process events: |
| command - Process command events. |
-----------------------------------------------------------------------------*/
virtual Boolean
command( ICommandEvent& event );
private:
LMainWindow
*pOwner;
IHelpWindow
*pHelp;
LMainCnr
*pCnr;
};
/******************************************************************************
* Class LMainWindowHelpHandler - Handle help events. *
******************************************************************************/
class LMainWindowHelpHandler : public IHelpHandler
{
public:
/*------------------------ Constructors/Destructor ----------------------------
| Construct the object in only one way: |
| 1) No parameters. |
-----------------------------------------------------------------------------*/
LMainWindowHelpHandler();
virtual
~LMainWindowHelpHandler();
protected:
/*----------------------------- Event Processing ------------------------------
| Handle and process events: |
| keysHelpId - Process help events for the container. |
-----------------------------------------------------------------------------*/
virtual Boolean
keysHelpId( IEvent& event );
};
#ifdef IC_PM
/******************************************************************************
* Class LMainToolBar - Toolbar class *
******************************************************************************/
class LMainToolBar : public IToolBar
{
public:
/*------------------------ Constructors/Destructor ----------------------------
| Construct the object in only one way: |
| 1) Resource id, owner, information area. |
-----------------------------------------------------------------------------*/
LMainToolBar( unsigned long id, IFrameWindow* owner,
ITextControl* infoArea );
/*----------------------------- Manipulators ----------------------------------
| These functions provide a means of manipulating the attributes of |
| instances of this class: |
| enableSelects - Enable or disables the select-all and deselect-all |
| toolbar buttons. |
-----------------------------------------------------------------------------*/
LMainToolBar
&enableSelects( Boolean which = true );
private:
IToolBarButton
openButton,
deleteButton,
iconButton,
treeButton,
detailsButton,
selectAllButton,
deselectAllButton,
sortAscButton,
sortDescButton,
arrangeButton,
helpButton;
IFlyText
flyText;
IFlyOverHelpHandler
flyHelpHdr;
};
#endif
/******************************************************************************
* Class LMainWindow - Main frame window. *
******************************************************************************/
class LMainWindow : public IFrameWindow
{
public:
/*------------------------ Constructors/Destructor ----------------------------
| Construct the object in only one way: |
| 1) No parameters. |
-----------------------------------------------------------------------------*/
LMainWindow();
virtual
~LMainWindow();
/*------------------------------- Accessors -----------------------------------
| These functions provide a means of getting and setting the accessible |
| attributes of instances of this class: |
| helpWindow - Returns the help window for this frame window. |
| selectsAllowed - Returns true if select all/deselect all is allowed. |
-----------------------------------------------------------------------------*/
inline IHelpWindow
*helpWindow() { return &help; };
inline Boolean
selectsAllowed() { return aSelects; };
/*----------------------------- Manipulators ----------------------------------
| These functions provide a means of manipulating the attributes of |
| instances of this class: |
| enableSelects - Enable or disables the select-all and deselect-all |
| menuitems and toolbar buttons. |
-----------------------------------------------------------------------------*/
LMainWindow
&enableSelects( Boolean which = true );
private:
ITitle
title;
IMenuBar
menubar;
IInfoArea
infoarea;
LMainCnr
cnr;
#ifdef IC_PM
LMainToolBar
toolbar;
#endif
IHelpWindow
help;
LMainWindowCommandHandler
cmdHdr;
LMainWindowHelpHandler
helpHdr;
Boolean
aSelects;
};
#endif