~ubuntu-branches/ubuntu/utopic/tcm/utopic

« back to all changes in this revision

Viewing changes to src/tb/cellcolumn.h

  • Committer: Bazaar Package Importer
  • Author(s): Otavio Salvador
  • Date: 2003-07-03 20:08:21 UTC
  • Revision ID: james.westby@ubuntu.com-20030703200821-se4xtqx25e5miczi
Tags: upstream-2.20
ImportĀ upstreamĀ versionĀ 2.20

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//------------------------------------------------------------------------------
 
2
//
 
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).
 
6
//
 
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.
 
11
//
 
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.
 
16
//
 
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
 
20
// 02111-1307, USA.
 
21
//-----------------------------------------------------------------------------
 
22
#ifndef _CELLCOLUMN_H
 
23
#define _CELLCOLUMN_H
 
24
 
 
25
#include "cellvector.h"
 
26
#include "tableviewer.h"
 
27
 
 
28
/// (table) column class.
 
29
class CellColumn: public CellVector {   
 
30
/*@Doc: {\large {\bf scope:} table} */
 
31
public:
 
32
        ///
 
33
        CellColumn(TableViewer *v, unsigned columnNumber, int width);
 
34
 
 
35
        ///
 
36
        friend int Compare(CellColumn *c1, CellColumn *c2) {return *c1 == *c2;}
 
37
 
 
38
        /// make each cell width wide.
 
39
        void UpdateWidth(int width);    
 
40
 
 
41
        /// move each cell delta left/right.
 
42
        void UpdatePosition(int delta); 
 
43
 
 
44
        /// resize all cells from index rownr and lower.
 
45
        void UpdateHeight(unsigned rownr);      
 
46
 
 
47
        /// if (x,y) is on a linepiece, return it.
 
48
        LinePiece *HitLinePiece(int x, int y); 
 
49
 
 
50
        /// append cell to column.
 
51
        void AddCell(Cell *c, bool redraw=True);                
 
52
 
 
53
        /// delete cell from column.
 
54
        void DeleteCell(Cell *c, bool redraw=True);     
 
55
 
 
56
        /// insert cell in column at position n.
 
57
        void InsertCell(Cell *c, unsigned n, bool redraw=True);
 
58
        
 
59
        ///
 
60
        bool ContainsPt(int x, int y) const;
 
61
 
 
62
        /// write attributes (but not cell contents) to file.
 
63
        void Write(OutputFile *f);
 
64
 
 
65
        /// write part of column to file (only given rows).
 
66
        void WritePartial(OutputFile *f, int i, List<int> *rowNumbers);
 
67
 
 
68
        /// read attributes back from file starting at row n.
 
69
        bool Read(InputFile *f, unsigned fromRow, double format);
 
70
 
 
71
        ///
 
72
        int GetMinimalWidth();
 
73
 
 
74
        ///
 
75
        int GetWidth() const {return width;}
 
76
 
 
77
        ///
 
78
        int GetMarginWidth() const {return GetViewer()->GetMarginWidth();}
 
79
 
 
80
        ///
 
81
        void UpdateTextPositions();
 
82
 
 
83
        ///
 
84
        void CalcLabelPositions();
 
85
private:
 
86
        /// width of a column = width of its cells which span 1 column.
 
87
        int width;
 
88
};
 
89
#endif