Update the changelog
[opencv] / otherlibs / _fltk / include / FL / Fl_Browser.H
1 //
2 // "$Id: Fl_Browser.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $"
3 //
4 // Browser header file for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2002 by Bill Spitzak and others.
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 // Library General Public License for more details.
17 //
18 // You should have received a copy of the GNU Library General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 // USA.
22 //
23 // Please report all bugs and problems to "fltk-bugs@fltk.org".
24 //
25
26 // Forms-compatable browser.  Probably useful for other
27 // lists of textual data.  Notice that the line numbers
28 // start from 1, and 0 means "no line".
29
30 #ifndef Fl_Browser_H
31 #define Fl_Browser_H
32
33 #include "Fl_Browser_.H"
34
35 struct FL_BLINE;
36
37 class FL_EXPORT Fl_Browser : public Fl_Browser_ {
38
39   FL_BLINE *first;              // the array of lines
40   FL_BLINE *last;
41   FL_BLINE *cache;
42   int cacheline;                // line number of cache
43   int lines;                    // Number of lines
44   int full_height_;
45   const int* column_widths_;
46   char format_char_;            // alternative to @-sign
47   char column_char_;            // alternative to tab
48
49 protected:
50
51   // required routines for Fl_Browser_ subclass:
52   void* item_first() const ;
53   void* item_next(void*) const ;
54   void* item_prev(void*) const ;
55   int item_selected(void*) const ;
56   void item_select(void*, int);
57   int item_height(void*) const ;
58   int item_width(void*) const ;
59   void item_draw(void*, int, int, int, int) const ;
60   int full_height() const ;
61   int incr_height() const ;
62
63   FL_BLINE* find_line(int) const ;
64   FL_BLINE* _remove(int) ;
65   void insert(int, FL_BLINE*);
66   int lineno(void*) const ;
67
68 public:
69
70   void remove(int);
71   void add(const char*, void* = 0);
72   void insert(int, const char*, void* = 0);
73   void move(int to, int from);
74   int  load(const char* filename);
75   void clear();
76
77   int size() const {return lines;}
78   
79   int topline() const ;
80   enum Fl_Line_Position { TOP, BOTTOM, MIDDLE };
81   void lineposition(int, Fl_Line_Position);
82   void topline(int l) { lineposition(l, TOP); }
83   void bottomline(int l) { lineposition(l, BOTTOM); }
84   void middleline(int l) { lineposition(l, MIDDLE); }
85
86   int select(int, int=1);
87   int selected(int) const ;
88   void show(int n);
89   void show() {Fl_Widget::show();}
90   void hide(int n);
91   void hide() {Fl_Widget::hide();}
92   int visible(int n) const ;
93
94   int value() const ;
95   void value(int v) {select(v);}
96   const char* text(int) const ;
97   void text(int, const char*);
98   void* data(int) const ;
99   void data(int, void* v);
100
101   Fl_Browser(int, int, int, int, const char* = 0);
102   ~Fl_Browser() { clear(); }
103
104   char format_char() const {return format_char_;}
105   void format_char(char c) {format_char_ = c;}
106   char column_char() const {return column_char_;}
107   void column_char(char c) {column_char_ = c;}
108   const int* column_widths() const {return column_widths_;}
109   void column_widths(const int* l) {column_widths_ = l;}
110
111   int displayed(int n) const {return Fl_Browser_::displayed(find_line(n));}
112   void make_visible(int n) {
113         if (n < 1) Fl_Browser_::display(find_line(1));
114         else if (n > lines) Fl_Browser_::display(find_line(lines));
115         else Fl_Browser_::display(find_line(n));
116   }
117
118   // for back compatability only:
119   void replace(int a, const char* b) {text(a, b);}
120   void display(int, int=1);
121 };
122
123 #endif
124
125 //
126 // End of "$Id: Fl_Browser.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $".
127 //