00001 #ifndef _FL_LISTVIEW_COLUMN_H_
00002 #define _FL_LISTVIEW_COLUMN_H_
00003
00004 #include <efltk/Fl_String.h>
00005
00006 class Fl_ListView_Column
00007 {
00008 public:
00009 Fl_ListView_Column();
00010
00011 void label(const char *text) { m_label = text; }
00012 void label(const Fl_String &text) { m_label = text; }
00013 const Fl_String &label() const { return m_label; }
00014
00015 void type(Fl_Variant_Type t) { m_type = t; }
00016 Fl_Variant_Type type() const { return m_type; }
00017
00018 Fl_Flags flags(Fl_Flags f) { return m_flags.flags(f); }
00019 Fl_Flags flags() const { return m_flags; }
00020 Fl_Flags set_flag(int f) { return m_flags.set(f); }
00021 Fl_Flags clear_flag(int f) { return m_flags.clear(f); }
00022 Fl_Flags invert_flag(int f) { return m_flags.invert(f); }
00023
00024 int label_size() const { return m_font_size; }
00025 void label_size(int size) { m_font_size = size; }
00026
00027 Fl_Font label_font() const { return m_font; }
00028 void label_font(Fl_Font font) { m_font = font; }
00029
00030 Fl_Color label_color() const { return m_color; }
00031 void label_color(Fl_Color color) { m_color = color; }
00032
00033 void image(Fl_Image *i) { m_image = i; }
00034 void image(Fl_Image &i) { m_image = &i; }
00035 const Fl_Image *image() const { return m_image; }
00036 Fl_Image *image() { return m_image; }
00037
00038 private:
00039 Fl_String m_label;
00040 Fl_Color m_color;
00041 Fl_Font m_font;
00042 int m_font_size;
00043 Fl_Variant_Type m_type;
00044 Fl_Flags m_flags;
00045 Fl_Image *m_image;
00046 };
00047
00050
00051 class FL_API Fl_ListColumn_List : public Fl_Ptr_List {
00052 public:
00053 Fl_ListColumn_List() : Fl_Ptr_List() { }
00054 virtual ~Fl_ListColumn_List() { clear(); }
00055
00056 void append(Fl_ListView_Column *item) { Fl_Ptr_List::append((void *)item); }
00057 void prepend(Fl_ListView_Column *item) { Fl_Ptr_List::prepend((void *)item); }
00058 void insert(uint pos, Fl_ListView_Column *item) { Fl_Ptr_List::insert(pos, (void *)item); }
00059 void replace(uint pos, Fl_ListView_Column *item) { Fl_Ptr_List::replace(pos, (void *)item); }
00060 void remove(uint pos) { Fl_Ptr_List::remove(pos); }
00061 bool remove(Fl_ListView_Column *item) { return Fl_Ptr_List::remove((void *)item); }
00062 int index_of(const Fl_ListView_Column *w) const { return Fl_Ptr_List::index_of((void*)w); }
00063 Fl_ListView_Column *item(uint index) const { return (Fl_ListView_Column*)Fl_Ptr_List::item(index); }
00064 Fl_ListView_Column **data() { return (Fl_ListView_Column**)items; }
00065
00066 Fl_ListView_Column *operator [](unsigned ind) { return (Fl_ListView_Column *)items[ind]; }
00067 const Fl_ListView_Column *operator [](uint ind) const { return (Fl_ListView_Column *)items[ind]; }
00068
00069 protected:
00070 void free_item(Fl_Ptr_List_Item item) { delete (Fl_ListView_Column*)(item); }
00071 };
00072
00073
00074 #endif