1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
/*
** Copyright 2002, Double Precision Inc.
**
** See COPYING for distribution information.
*/
#ifndef cursescontainer_H
#define cursescontainer_H
#include "../curses/curses_config.h"
#include "mycurses.H"
#include <wchar.h>
#include <vector>
////////////////////////////////////////////////////////////////////////
//
// CursesContainer is a superclass for all Curses objects that contain
// other Curses object.
class CursesContainer : public Curses {
class Child {
public:
Curses *child;
Child(Curses *childArg) : child(childArg)
{
}
};
std::vector<Child> children;
std::vector<Child>::iterator drawIndex;
public:
friend class Curses;
CursesContainer(CursesContainer *parent=0);
~CursesContainer();
// getWidth()/getHeight() computes the largest rectangle that
// contains all current children.
virtual int getWidth() const;
virtual int getHeight() const;
virtual Curses *getDialogChild() const;
// draw/erase recursively invoke draw/erase methods of all children,
// unless a child CursesObject's isDialog() method returns true, in
// which case only that child's draw/erase method is called.
virtual void draw();
virtual void erase();
// The default resized() method recursively invokes the resized()
// method of all children.
virtual void resized();
// The constructor and the destructor of a Curses object automatically
// calls addChild/deleteChild to register the new child process.
virtual void addChild(Curses *child);
virtual void deleteChild(Curses *child);
// The default implementation of getNextFocus()/getPrevFocus()
// return the pointer to the first or the last child.
virtual Curses *getNextFocus();
virtual Curses *getPrevFocus();
};
#endif
|