Category : Recently Uploaded Files
Archive   : DOSUIT07.ZIP
Filename : EDITCLUS.HPP

 
Output of file : EDITCLUS.HPP contained in archive : DOSUIT07.ZIP

// Automatically laid out Cluster of TextEdit's
#ifndef EDITCLUS_HPP
#define EDITCLUS_HPP
#ifndef CLUSTER_HPP
#include "cluster.hpp"
#endif
#ifndef EDITCTRL_HPP
#include "editctrl.hpp"
#endif

/*
This is an automatic layout tool for TextEdits. It arranges the
TextEdits in a vertical column, with the prompts lined up on the
left, and the fields on the right.
*/
class EditCluster : public HCluster, public EditControlList {
public:
EditCluster(const GCollection(EditControl)& textedits,
const char *name = "EditCluster",AlignFlag a = AFexpand,
BorderFlag f = BFnone);

virtual VObject *inheritingVObject();

void add(EditControl *v);
EditCluster& operator+ (const GCollection(EditControl) &c);
EditCluster& operator+ (const GCollection(EditControl) *c)
{ operator+(*c); return *this; }
EditCluster& operator+ (EditControl *c) { add(c); return *this; }

void add(VObject *v) { HCluster::add(v); }
void add(const ObjectCollection &c) { HCluster::add(c); }
EditCluster& operator+ (const ObjectCollection &c)
{ add(c); return *this; }
EditCluster& operator+ (const ObjectCollection *c)
{ add(*c); return *this; }
EditCluster& operator+ (VObject *c) { add(c); return *this; }
void add(VObject *prompt,VObject *field)
{ prompts->add(prompt); fields->add(field); }

private:
VCluster *prompts, *fields;
};

/*
A Horizontal Cluster containing EditControls. It is an EditControl
itself, and passes read, validate and write requests to all its
contents.
*/
class EditHCluster : public HCluster, public EditControlList {
public:
EditHCluster(const GCollection(EditControl)& editcontrols,
const char *name = "EditHCluster",AlignFlag a = AFexpand,
BorderFlag f = BFnone);

virtual VObject *inheritingVObject();

void add(EditControl *v)
{ EditControlList::add(v); HCluster::add(v->inheritingVObject()); }
EditHCluster& operator+ (const GCollection(EditControl) &c);
EditHCluster& operator+ (const GCollection(EditControl) *c)
{ operator+(*c); return *this; }
EditHCluster& operator+ (EditControl *c) { add(c); return *this; }

void add(VObject *v) { HCluster::add(v); }
void add(const ObjectCollection &c) { HCluster::add(c); }
EditHCluster& operator+ (const ObjectCollection &c)
{ add(c); return *this; }
EditHCluster& operator+ (const ObjectCollection *c)
{ add(*c); return *this; }
EditHCluster& operator+ (VObject *c) { add(c); return *this; }
};

/*
A Vertical Cluster containing EditControls. It is an EditControl
itself, and passes read, validate and write requests to all its
contents.
*/
class EditVCluster : public VCluster, public EditControlList {
public:
EditVCluster(const GCollection(EditControl)& c,
const char *name = "EditVCluster",AlignFlag a = AFexpand,
BorderFlag f = BFnone);

virtual VObject *inheritingVObject();

void add(EditControl *v)
{ EditControlList::add(v); VCluster::add(v->inheritingVObject()); }
EditVCluster& operator+ (const GCollection(EditControl) &c);
EditVCluster& operator+ (const GCollection(EditControl) *c)
{ operator+(*c); return *this; }
EditVCluster& operator+ (EditControl *c) { add(c); return *this; }

void add(VObject *v) { VCluster::add(v); }
void add(const ObjectCollection &c) { VCluster::add(c); }
EditVCluster& operator+ (const ObjectCollection &c)
{ add(c); return *this; }
EditVCluster& operator+ (const ObjectCollection *c)
{ add(*c); return *this; }
EditVCluster& operator+ (VObject *c) { add(c); return *this; }
};

#endif