FLTK 1.3.2

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

Fl_Check_Browser.H

    00001 //
    00002 // "$Id: Fl_Check_Browser.H 8864 2011-07-19 04:49:30Z greg.ercolano $"
    00003 //
    00004 // Fl_Check_Browser header file for the Fast Light Tool Kit (FLTK).
    00005 //
    00006 // Copyright 1998-2010 by Bill Spitzak and others.
    00007 //
    00008 // This library is free software. Distribution and use rights are outlined in
    00009 // the file "COPYING" which should have been included with this file.  If this
    00010 // file is missing or damaged, see the license at:
    00011 //
    00012 //     http://www.fltk.org/COPYING.php
    00013 //
    00014 // Please report all bugs and problems on the following page:
    00015 //
    00016 //     http://www.fltk.org/str.php
    00017 //
    00018
    00019 /* \file
    00020    Fl_Check_Browser widget . */
    00021
    00022 #ifndef Fl_Check_Browser_H
    00023 #define Fl_Check_Browser_H
    00024
    00025 #include "Fl.H"
    00026 #include "Fl_Browser_.H"
    00027
    00032 class FL_EXPORT Fl_Check_Browser : public Fl_Browser_ {
    00033   /* required routines for Fl_Browser_ subclass: */
    00034
    00035   void *item_first() const;
    00036   void *item_next(void *) const;
    00037   void *item_prev(void *) const;
    00038   int item_height(void *) const;
    00039   int item_width(void *) const;
    00040   void item_draw(void *, int, int, int, int) const;
    00041   void item_select(void *, int);
    00042   int item_selected(void *) const;
    00043
    00044   /* private data */
    00045
    00046   public: // IRIX 5.3 C++ compiler doesn't support private structures...
    00047
    00048 #ifndef FL_DOXYGEN
    00049
    00050   struct cb_item {
    00051           cb_item *next;
    00052           cb_item *prev;
    00053           char checked;
    00054           char selected;
    00055           char *text;
    00056   };
    00057 #endif // !FL_DOXYGEN
    00058
    00059   private:
    00060
    00061   cb_item *first;
    00062   cb_item *last;
    00063   cb_item *cache;
    00064   int cached_item;
    00065   int nitems_;
    00066   int nchecked_;
    00067   cb_item *find_item(int) const;
    00068   int lineno(cb_item *) const;
    00069
    00070   public:
    00071
    00072   Fl_Check_Browser(int x, int y, int w, int h, const char *l = 0);
    00074   ~Fl_Check_Browser() { clear(); }
    00075   int add(char *s);               // add an (unchecked) item
    00076   int add(char *s, int b);        // add an item and set checked
    00077                                   // both return the new nitems()
    00078   int remove(int item);           // delete an item. Returns nitems()
    00079
    00080   // inline const char * methods to avoid breaking binary compatibility...
    00082   int add(const char *s) { return add((char *)s); }
    00084   int add(const char *s, int b) { return add((char *)s, b); }
    00085
    00086   void clear();                   // delete all items
    00091   int nitems() const { return nitems_; }
    00093   int nchecked() const { return nchecked_; }
    00094   int checked(int item) const;
    00095   void checked(int item, int b);
    00097   void set_checked(int item) { checked(item, 1); }
    00098   void check_all();
    00099   void check_none();
    00100   int value() const;              // currently selected item
    00101   char *text(int item) const;     // returns pointer to internal buffer
    00102
    00103   protected:
    00104
    00105   int handle(int);
    00106 };
    00107
    00108 #endif // Fl_Check_Browser_H
    00109
    00110 //
    00111 // End of "$Id: Fl_Check_Browser.H 8864 2011-07-19 04:49:30Z greg.ercolano $".
    00112 //
    00113