FLTK 1.3.11
Loading...
Searching...
No Matches
Fl_Check_Browser.H
1//
2// "$Id$"
3//
4// Fl_Check_Browser header file for the Fast Light Tool Kit (FLTK).
5//
6// Copyright 1998-2010 by Bill Spitzak and others.
7//
8// This library is free software. Distribution and use rights are outlined in
9// the file "COPYING" which should have been included with this file. If this
10// file is missing or damaged, see the license at:
11//
12// http://www.fltk.org/COPYING.php
13//
14// Please report all bugs and problems on the following page:
15//
16// http://www.fltk.org/str.php
17//
18
19/* \file
20 Fl_Check_Browser widget . */
21
22#ifndef Fl_Check_Browser_H
23#define Fl_Check_Browser_H
24
25#include "Fl.H"
26#include "Fl_Browser_.H"
27
32class 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#ifndef FL_DOXYGEN
50 struct cb_item {
51 cb_item *next;
52 cb_item *prev;
53 char checked;
54 char selected;
55 char *text;
56 };
57#endif // !FL_DOXYGEN
58
59 private:
60
61 cb_item *first;
62 cb_item *last;
63 cb_item *cache;
64 int cached_item;
65 int nitems_;
66 int nchecked_;
67 cb_item *find_item(int) const;
68 int lineno(cb_item *) const;
69
70 public:
71
72 Fl_Check_Browser(int x, int y, int w, int h, const char *l = 0);
75 int add(char *s); // add an (unchecked) item
76 int add(char *s, int b); // add an item and set checked
77 // both return the new nitems()
78 int remove(int item); // delete an item. Returns nitems()
79
80 // inline const char * methods to avoid breaking binary compatibility...
82 int add(const char *s) { return add((char *)s); }
84 int add(const char *s, int b) { return add((char *)s, b); }
85
86 void clear(); // delete all items
91 int nitems() const { return nitems_; }
93 int nchecked() const { return nchecked_; }
94 int checked(int item) const;
95 void checked(int item, int b);
97 void set_checked(int item) { checked(item, 1); }
98 void check_all();
99 void check_none();
100 int value() const; // currently selected item
101 char *text(int item) const; // returns pointer to internal buffer
102
103 protected:
104
105 int handle(int);
106};
107
108#endif // Fl_Check_Browser_H
109
110//
111// End of "$Id$".
112//
113
Fl static class.
Fl_Browser_(int X, int Y, int W, int H, const char *L=0)
The constructor makes an empty browser.
Definition Fl_Browser_.cxx:955
int nchecked() const
Returns how many items are currently checked.
Definition Fl_Check_Browser.H:93
int checked(int item) const
Gets the current status of item item.
Definition Fl_Check_Browser.cxx:255
char * text(int item) const
Return a pointer to an internal buffer holding item item's text.
Definition Fl_Check_Browser.cxx:283
void clear()
Remove every item from the browser.
Definition Fl_Check_Browser.cxx:233
int nitems() const
Returns how many lines are in the browser.
Definition Fl_Check_Browser.H:91
int add(const char *s)
See int Fl_Check_Browser::add(char *s).
Definition Fl_Check_Browser.H:82
Fl_Check_Browser(int x, int y, int w, int h, const char *l=0)
The constructor makes an empty browser.
Definition Fl_Check_Browser.cxx:78
~Fl_Check_Browser()
The destructor deletes all list items and destroys the browser.
Definition Fl_Check_Browser.H:74
void set_checked(int item)
Equivalent to Fl_Check_Browser::checked(item, 1).
Definition Fl_Check_Browser.H:97
int add(const char *s, int b)
See int Fl_Check_Browser::add(char *s).
Definition Fl_Check_Browser.H:84
void x(int v)
Internal use only.
Definition Fl_Widget.H:139
void w(int v)
Internal use only.
Definition Fl_Widget.H:143
void y(int v)
Internal use only.
Definition Fl_Widget.H:141
void h(int v)
Internal use only.
Definition Fl_Widget.H:145