File: cursescontainer.H

package info (click to toggle)
cone 0.75-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 31,040 kB
  • ctags: 13,930
  • sloc: ansic: 90,648; cpp: 79,781; sh: 18,355; perl: 3,218; makefile: 1,611; yacc: 289; sed: 16
file content (77 lines) | stat: -rw-r--r-- 1,788 bytes parent folder | download | duplicates (2)
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
77
/* $Id: cursescontainer.H,v 1.1 2003/05/27 14:09:07 mrsam Exp $
**
** 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