Update the changelog
[opencv] / otherlibs / _fltk / include / FL / Fl_Check_Browser.H
1 //
2 // "$Id: Fl_Check_Browser.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $"
3 //
4 // Fl_Check_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 #ifndef Fl_Check_Browser_H
27 #define Fl_Check_Browser_H
28
29 #include "Fl.H"
30 #include "Fl_Browser_.H"
31
32 class FL_EXPORT Fl_Check_Browser : public Fl_Browser_ {
33   /* required routines for Fl_Browser_ subclass: */
34
35   void *item_first() const;
36   void *item_next(void *) const;
37   void *item_prev(void *) const;
38   int item_height(void *) const;
39   int item_width(void *) const;
40   void item_draw(void *, int, int, int, int) const;
41   void item_select(void *, int);
42   int item_selected(void *) const;
43
44   /* private data */
45
46   public: // IRIX 5.3 C++ compiler doesn't support private structures...
47
48   struct cb_item {
49           cb_item *next;
50           cb_item *prev;
51           char checked;
52           char selected;
53           char *text;
54   };
55
56   private:
57
58   cb_item *first;
59   cb_item *last;
60   cb_item *cache;
61   int cached_item;
62   int nitems_;
63   int nchecked_;
64   cb_item *find_item(int) const;
65   int lineno(cb_item *) const;
66
67   public:
68
69   Fl_Check_Browser(int x, int y, int w, int h, const char *l = 0);
70
71   int add(char *s);               // add an (unchecked) item
72   int add(char *s, int b);        // add an item and set checked
73                                   // both return the new nitems()
74
75   // inline const char * methods to avoid breaking binary compatibility...
76   int add(const char *s) { return add((char *)s); }
77   int add(const char *s, int b) { return add((char *)s, b); }
78
79   void clear();                   // delete all items
80   int nitems() const { return nitems_; }
81   int nchecked() const { return nchecked_; }
82   int checked(int item) const;
83   void checked(int item, int b);
84   void set_checked(int item) { checked(item, 1); }
85   void check_all();
86   void check_none();
87   int value() const;              // currently selected item
88   char *text(int item) const;     // returns pointer to internal buffer
89 };
90
91 #endif // Fl_Check_Browser_H
92
93 //
94 // End of "$Id: Fl_Check_Browser.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $".
95 //
96