2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 // $XConsortium: TableDefn.hh /main/13 1996/11/06 16:52:17 cde-hal $
25 #define CRSEP_NOT_SPECIFIED -1
37 char char_align () { return f_char_align ; }
38 char char_align (const char *s)
39 { f_char_align = s[0] ; return f_char_align ; }
41 const char *name () { return f_name ; }
42 const char *name (const char *);
44 _DtCvFrmtOption justify ()
45 { return f_justify ; }
46 _DtCvFrmtOption justify (_DtCvFrmtOption c)
47 { f_justify = c ; return c ; }
49 unsigned width () { return f_width ; }
50 unsigned width (int w) { f_width = w ; return w ; }
52 int colsep() { return f_colsep; }
53 void colsep(int v) { f_colsep = v; }
54 int rowsep() { return f_rowsep; }
55 void rowsep(int v) { f_rowsep = v; }
57 bool operator==(const ColFormat &c) const
58 { return &c == this ; }
61 char f_char_align ; // alignment character
63 _DtCvFrmtOption f_justify ; //
64 unsigned f_width ; // percentage of total width
72 ColDefn(_DtCvSegment *par, _DtCvSegment *gpar,
73 unsigned rows, char *colref, char* colstart, char* colend,
74 _DtCvFrmtOption justify, _DtCvFrmtOption vjustify,
75 int colsep, int rowsep, char char_align)
80 f_colstart (colstart),
83 f_vjustify (vjustify),
86 f_char_align(char_align)
90 if (f_colref) delete f_colref;
91 if (f_colstart) delete f_colstart;
92 if (f_colend) delete f_colend;
95 _DtCvSegment *parseg() const { return f_parseg; }
96 _DtCvSegment *gparseg() const { return f_gparseg; }
98 unsigned spanrows () const { return f_spanrows ; }
100 const char *colref(char *r) { f_colref = r ; return r ; }
101 const char *colref() { return f_colref ; }
103 void colstart(char *s) { f_colstart = s; }
104 const char* colstart() const { return f_colstart; }
106 void colend(char *e) { f_colend = e; }
107 const char* colend() { return f_colend; }
109 bool operator==(const ColDefn &c) const
110 { return &c == this ; }
112 _DtCvFrmtOption justify() { return f_justify; }
113 _DtCvFrmtOption justify(_DtCvFrmtOption c) { f_justify = c ; return c ; }
115 _DtCvFrmtOption vjustify() { return f_vjustify; }
116 _DtCvFrmtOption vjustify(_DtCvFrmtOption c) { f_vjustify = c ; return c ; }
118 int colsep() { return f_colsep; }
119 void colsep(int v) { f_colsep = v; }
120 int rowsep() { return f_rowsep; }
121 void rowsep(int v) { f_rowsep = v; }
123 void char_align(char c) { f_char_align = c; }
124 char char_align() { return f_char_align; }
127 _DtCvSegment *f_parseg ;
128 _DtCvSegment *f_gparseg ;
129 unsigned f_spanrows ;
130 char *f_colref ; // column format name
133 _DtCvFrmtOption f_justify;
134 _DtCvFrmtOption f_vjustify;
147 void append(ColDefn *cd) { f_columns.append (cd); }
149 CC_TPtrSlist<ColDefn> &columns() { return f_columns ; }
151 bool operator==(const RowDefn &r) const
152 { return &r == this ; }
154 _DtCvFrmtOption vjustify ()
155 { return f_vjustify ; }
156 _DtCvFrmtOption vjustify (_DtCvFrmtOption c)
157 { f_vjustify = c ; return c ; }
159 int rowsep() { return f_rowsep; }
160 void rowsep(int v) { f_rowsep = v; }
163 CC_TPtrSlist<ColDefn> f_columns ;
165 _DtCvFrmtOption f_vjustify ;
172 TGDefn (_DtCvFrmtOption justify, _DtCvFrmtOption vjustify);
175 void set_segment (_DtCvSegment *seg) { f_segment = seg ; }
177 void add_row(RowDefn *);
178 void add (ColFormat *);
179 void add (ColDefn *);
181 unsigned numcols () { return f_numcols ; }
182 unsigned numcols (int n) { f_numcols = n ; return n ; }
184 void build(); // fill in the Canvas Segment data
186 void setup_cell(_DtCvSegment*, ColDefn*, RowDefn*, ColFormat*, ColFormat*);
188 bool operator==(const TGDefn& t) const
189 { return &t == this ; }
191 _DtCvFrmtOption justify() { return f_justify; }
192 _DtCvFrmtOption justify(_DtCvFrmtOption c) { f_justify = c ; return c ; }
194 _DtCvFrmtOption vjustify() { return f_vjustify ; }
195 _DtCvFrmtOption vjustify(_DtCvFrmtOption c) { f_vjustify = c ; return c ; }
197 int colsep() { return f_colsep; }
198 void colsep(int v) { f_colsep = v; }
199 int rowsep() { return f_rowsep; }
200 void rowsep(int v) { f_rowsep = v; }
202 TableDefn* table() { return f_table; }
203 void table(TableDefn* t) { f_table = t; }
205 void char_align(const char* s) { f_char_align = *s; }
206 char char_align() const { return f_char_align; }
209 ColFormat *find_format (const char *name, int* index = NULL) ;
214 _DtCvSegment *f_segment ;
215 CC_TPtrSlist<ColFormat> f_colformats ;
216 CC_TPtrSlist<RowDefn> f_rows ;
217 _DtCvFrmtOption f_justify;
218 _DtCvFrmtOption f_vjustify;
222 TableDefn* f_table; // table which contains this tgroup
229 table_frame_default = -1,
230 table_frame_none = 0,
231 table_frame_top = 1 << 0,
232 table_frame_bottom = 1 << 1,
233 table_frame_left = 1 << 2,
234 table_frame_right = 1 << 3,
235 table_frame_topbot = table_frame_top | table_frame_bottom,
236 table_frame_sides = table_frame_left | table_frame_right,
237 table_frame_all = table_frame_topbot | table_frame_sides
240 TableDefn(table_frame_t frame_tok, int colsep = CRSEP_NOT_SPECIFIED,
241 int rowsep = CRSEP_NOT_SPECIFIED) :
242 f_frame(frame_tok), f_colsep(colsep), f_rowsep(rowsep) {}
243 TableDefn(const char* frame_str, int colsep = CRSEP_NOT_SPECIFIED,
244 int rowsep = CRSEP_NOT_SPECIFIED);
247 table_frame_t frame() { return f_frame; }
248 void frame(table_frame_t frame_tok) { f_frame = frame_tok; }
249 void frame(const char* frame_str);
251 int colsep() { return f_colsep; }
252 void colsep(int v) { f_colsep = v; }
253 int rowsep() { return f_rowsep; }
254 void rowsep(int v) { f_rowsep = v; }
258 table_frame_t string_to_token(const char* frame_str);
262 table_frame_t f_frame;