1
//------------------------------------------------------------------------------
3
// This file is part of Toolkit for Conceptual Modeling (TCM).
4
// (c) copyright 1996, Vrije Universiteit Amsterdam.
5
// Author: Frank Dehne (frank@cs.vu.nl).
7
// TCM is free software; you can redistribute it and/or modify
8
// it under the terms of the GNU General Public License as published by
9
// the Free Software Foundation; either version 2 of the License, or
10
// (at your option) any later version.
12
// TCM is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
// GNU General Public License for more details.
17
// You should have received a copy of the GNU General Public License
18
// along with TCM; if not, write to the Free Software
19
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21
//-----------------------------------------------------------------------------
25
#include "cellvector.h"
26
#include "tableviewer.h"
28
/// (table) column class.
29
class CellColumn: public CellVector {
30
/*@Doc: {\large {\bf scope:} table} */
33
CellColumn(TableViewer *v, unsigned columnNumber, int width);
36
friend int Compare(CellColumn *c1, CellColumn *c2) {return *c1 == *c2;}
38
/// make each cell width wide.
39
void UpdateWidth(int width);
41
/// move each cell delta left/right.
42
void UpdatePosition(int delta);
44
/// resize all cells from index rownr and lower.
45
void UpdateHeight(unsigned rownr);
47
/// if (x,y) is on a linepiece, return it.
48
LinePiece *HitLinePiece(int x, int y);
50
/// append cell to column.
51
void AddCell(Cell *c, bool redraw=True);
53
/// delete cell from column.
54
void DeleteCell(Cell *c, bool redraw=True);
56
/// insert cell in column at position n.
57
void InsertCell(Cell *c, unsigned n, bool redraw=True);
60
bool ContainsPt(int x, int y) const;
62
/// write attributes (but not cell contents) to file.
63
void Write(OutputFile *f);
65
/// write part of column to file (only given rows).
66
void WritePartial(OutputFile *f, int i, List<int> *rowNumbers);
68
/// read attributes back from file starting at row n.
69
bool Read(InputFile *f, unsigned fromRow, double format);
72
int GetMinimalWidth();
75
int GetWidth() const {return width;}
78
int GetMarginWidth() const {return GetViewer()->GetMarginWidth();}
81
void UpdateTextPositions();
84
void CalcLabelPositions();
86
/// width of a column = width of its cells which span 1 column.