summaryrefslogtreecommitdiff
path: root/src/Fl_Check_Browser.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/Fl_Check_Browser.cxx')
-rw-r--r--src/Fl_Check_Browser.cxx21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/Fl_Check_Browser.cxx b/src/Fl_Check_Browser.cxx
index a95feabee..4476df196 100644
--- a/src/Fl_Check_Browser.cxx
+++ b/src/Fl_Check_Browser.cxx
@@ -85,7 +85,8 @@ int Fl_Check_Browser::lineno(cb_item *p0) const {
}
Fl_Check_Browser::Fl_Check_Browser(int X, int Y, int W, int H, const char *l)
- : Fl_Browser_(X, Y, W, H, l) {
+/** The constructor makes an empty browser.*/
+: Fl_Browser_(X, Y, W, H, l) {
type(FL_SELECT_BROWSER);
when(FL_WHEN_NEVER);
first = last = 0;
@@ -164,11 +165,16 @@ int Fl_Check_Browser::item_selected(void *v) const {
cb_item *i = (cb_item *)v;
return i->selected;
}
-
+/**
+ Add a new unchecked line to the end of the browser. The text is copied
+ using the strdup() function. It may also be NULL to make
+ a blank line. The second form can set the item checked.
+*/
int Fl_Check_Browser::add(char *s) {
return (add(s, 0));
}
+/** See int Fl_Check_Browser::add(char *s) */
int Fl_Check_Browser::add(char *s, int b) {
cb_item *p = (cb_item *)malloc(sizeof(cb_item));
p->next = 0;
@@ -193,6 +199,10 @@ int Fl_Check_Browser::add(char *s, int b) {
return (nitems_);
}
+/**
+ Remove line n and make the browser one line shorter. Returns the
+ number of lines left in the browser.
+*/
int Fl_Check_Browser::remove(int item) {
cb_item *p = find_item(item);
@@ -225,6 +235,7 @@ int Fl_Check_Browser::remove(int item) {
return (nitems_);
}
+/** Remove every item from the browser.*/
void Fl_Check_Browser::clear() {
cb_item *p = first;
cb_item *next;
@@ -246,6 +257,7 @@ void Fl_Check_Browser::clear() {
cached_item = -1;
}
+/** Gets the current status of item item. */
int Fl_Check_Browser::checked(int i) const {
cb_item *p = find_item(i);
@@ -253,6 +265,7 @@ int Fl_Check_Browser::checked(int i) const {
return 0;
}
+/** Sets the check status of item item to b. */
void Fl_Check_Browser::checked(int i, int b) {
cb_item *p = find_item(i);
@@ -267,10 +280,12 @@ void Fl_Check_Browser::checked(int i, int b) {
}
}
+/** Returns the index of the currently selected item.*/
int Fl_Check_Browser::value() const {
return lineno((cb_item *)selection());
}
+/** Return a pointer to an internal buffer holding item item's text.*/
char *Fl_Check_Browser::text(int i) const {
cb_item *p = find_item(i);
@@ -278,6 +293,7 @@ char *Fl_Check_Browser::text(int i) const {
return 0;
}
+/** Sets all the items checked.*/
void Fl_Check_Browser::check_all() {
cb_item *p;
@@ -288,6 +304,7 @@ void Fl_Check_Browser::check_all() {
redraw();
}
+/** Sets all the items unchecked.*/
void Fl_Check_Browser::check_none() {
cb_item *p;