home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 7
/
FreshFishVol7.bin
/
bbs
/
gnu
/
aplusplus-1.01-src.lha
/
GNU
/
src
/
amiga
/
APlusPlus-1.01
/
include
/
APlusPlus
/
intuition
/
WindowCV.h
< prev
next >
Wrap
C/C++ Source or Header
|
1994-05-04
|
5KB
|
132 lines
#ifndef APP_WindowCV_H
#define APP_WindowCV_H
/******************************************************************************
**
** C++ Class Library for the Amiga© system software.
**
** Copyright (C) 1994 by Armin Vogt ** EMail: armin@uni-paderborn.de
** All Rights Reserved.
**
** $VER: apphome:APlusPlus/intuition/WindowCV.h 1.04 (04.05.94) $
**
******************************************************************************/
extern "C" {
#include <intuition/intuition.h>
}
#include <APlusPlus/exec/SignalResponder.h>
#include <APlusPlus/intuition/IntuiObject.h>
#include <APlusPlus/graphics/GraphicObject.h>
#include <APlusPlus/environment/Dependencies.h>
#include <APlusPlus/intuition/IntuiMessageC.h>
#include <APlusPlus/intuition/ScreenC.h>
#include <APlusPlus/intuition/IntuiRoot.h>
/***********************************************************************************************
» IntuitionResponder class «
The IntuitionResponder class is a specialized SignalResponder that awaits signals on its
dedicated userport. It receives the incoming IDCMP messages of one userport that may
be shared between several Intuition® windows and delivers them to their respective WindowCV
object.
The IntuitionResponder class is a supportive class for the WindowCV class and not designed
to work with other classes.
DO NOT USE THIS CLASS!
***********************************************************************************************/
class WindowCV;
class IntuitionResponder : public Shared, private SignalResponder
{
friend WindowCV; // needs access to msgInProcess
private:
struct MsgPort *userPort; // window userport of one or more windows
struct IntuiMessage *msgInProcess; // holds the last received yet not replied message
void actionCallback(); // inherited from SignalResponder
IntuitionResponder(struct MsgPort *IPort);
~IntuitionResponder();
struct MsgPort *getMsgPort() { return userPort; }
WORD release(Window *);
};
/***********************************************************************************************
» WindowCV class « virtual base class
» IntuitionResponder class «
A WindowCV object stands for one single Intuition window and shares its lifetime.
The WindowCV constructor opens the window (Check with obj.Ok() if the window could successfully
be opened) and the destructor closes it. The IDCMP message passing is handled by a special
MsgPort responder, the IntuitionResponder. One IntuitionResponder lives independent of a WindowCV
object, but each WindowCV object refers to an IntuitionResponder who controls the window's
user port. It is possible that several WindowCV objects, and thereby several Intuition
windows, share an IntuitionResponder == UserPort. This can be achieved by using the
WCV_SharePortWithWindow tag which needs a WindowCV object as parameter.
***********************************************************************************************/
class WindowCV : public GraphicObject
{
private:
friend IntuiMessageC;
friend class IntuitionResponder;
// class member variables
IntuitionResponder *window_rsp; // msgport responder for the windows userport
struct Window*& wPtr() { return (struct Window*&)IObject(); }
protected:
struct Window* window() { return (struct Window*)IObject(); }
// pointer to the encapsulated Intuition window
// create window
WindowCV(IntuiObject *owner,AttrList& attrs);
~WindowCV();
// message handler: must be filled with functionality by the derived classes
virtual void handleIntuiMsg(const IntuiMessageC *);
virtual void default_IMsgCallback(const IntuiMessageC *);
void newsize(const IntuiMessageC*);
IntuitionResponder *getIntuiResponder() { return window_rsp; }
public:
static void WaitSignal() { SignalResponder::WaitSignal(); } // wait for events
// window methods
ULONG setAttributes(AttrList& attrs); // inherited from IntuiObject
ULONG getAttribute(Tag,ULONG& dataStore);
const STRPTR title() { return (const STRPTR)window()->Title; }
const struct Window *windowPtr() { return (const struct Window*)IObject(); }
operator const struct Window * () { return (const struct Window*)IObject(); }
ScreenC *screenC() { return (ScreenC*)findRootOfKind(IOTYPE_SCREEN); }
// returns the ScreenC object the window is dedicated to.
void modifyIDCMP(ULONG flags);
friend ostream& operator << (ostream& OS,WindowCV *win);
// type checking for tag data values (see below)
static LONG confirm(WindowCV *obj) { return (LONG)obj; }
};
#define WCV_Dummy (TAG_USER | IOTYPE_WINDOWCV)
#define WCV_SharePortWithWindow (WCV_Dummy+3)
#define WCV_SharePortWithWindowObj(window) WCV_SharePortWithWindow,WindowCV::confirm(window)
/* let the window use the same user port as the window given in ti_Data. Prefer using
* the WCV_SharePortWithWindowObj(WindowCV* window) macro which assures type checking.
*/
#define WINDOWCV_OPENWINDOW_FAILED (IOTYPE_WINDOWCV+1)
#endif