cwidget 0.5.18
layout_item.h
1// layout_item.h -*-c++-*-
2//
3// Copyright (C) 2004-2005, 2007 Daniel Burrows
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License as
7// published by the Free Software Foundation; either version 2 of
8// the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13// General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; see the file COPYING. If not, write to
17// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18// Boston, MA 02111-1307, USA.
19//
20// A bridge from the layout code to the tree code.
21
22#ifndef LAYOUT_ITEM_H
23#define LAYOUT_ITEM_H
24
25#include "text_layout.h"
26#include "treeitem.h"
27
28namespace cwidget
29{
30 class fragment;
31
32 namespace widgets
33 {
34 class layout_item : public treeitem
35 {
36 protected:
37 class layout_line;
38
39 private:
40 typedef std::vector<layout_line *> child_list;
41
42 child_list children;
43 fragment *f;
45
46 int lastw;
47 int lastbasex;
48
49 protected:
50 class layout_line:public treeitem
51 {
52 int n;
53 layout_item &parent;
54 public:
55 layout_line(int _n, layout_item &_parent);
56
57 void paint(tree *win, int y, bool hierarchical,
58 const style &st);
59
60 const wchar_t *tag();
61 const wchar_t *label();
62 };
63
64 // Assumes that children.size()>0
66 {
67 size_t item_num;
68 const child_list &lines;
69
70 public:
71 levelref(const levelref &x);
72 levelref(size_t n, const child_list &_lines);
73
74 treeitem *get_item();
75 virtual void advance_next();
76 virtual void return_prev();
77 bool is_begin();
78 bool is_end();
79 levelref *clone() const;
80 };
81
82 public:
84
85 const wchar_t *tag();
86 const wchar_t *label();
87
89 void paint_line(int n,
90 tree *win, int y, bool hierarchical,
91 const style &st);
92 void paint(tree *win, int y, bool hierarchical,
93 const style &st);
94
95 int get_normal_attr();
96
97 levelref *begin();
98 levelref *end();
99 bool has_visible_children();
100
101 const fragment_line &get_line(tree *win, size_t n, int basex,
102 const style &st);
103
104 ~layout_item();
105 };
106 }
107}
108
109#endif
This class represents the formatted contents of a fragment.
Definition fragment_contents.h:31
A fragment represents a logical unit of text.
Definition fragment.h:38
A "style" is a setting to be applied to a display element (widget, text, etc).
Definition style.h:52
Definition curses++.h:199
label widgets display some (possibly formatted) text statically.
Definition label.h:25
void paint(tree *win, int y, bool hierarchical, const style &st)
Display this item and this item only (does not descend to the children of the item,...
Definition layout_item.cc:142
Definition layout_item.h:66
Definition layout_item.h:35
void paint_line(int n, tree *win, int y, bool hierarchical, const style &st)
Paints the nth line of this item at the given location in 'win'.
Definition layout_item.cc:133
void paint(tree *win, int y, bool hierarchical, const style &st)
Display this item and this item only (does not descend to the children of the item,...
Definition layout_item.cc:148
Definition treeitem.h:48
Definition tree.h:57
Definition treeitem.h:105
The namespace containing everything defined by cwidget.
Definition columnify.cc:28