Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

bclistboxitem.h

Go to the documentation of this file.
00001 #ifndef BCLISTBOXITEM_H
00002 #define BCLISTBOXITEM_H
00003 
00004 #include "arraylist.h"
00005 #include "bcpixmap.inc"
00006 #include "colors.h"
00007 #include "vframe.h"
00008 
00009 
00010 
00011 // Every item in a list inherits this
00012 class BC_ListBoxItem
00013 {
00014 public:
00015         BC_ListBoxItem();
00016 // New items
00017         BC_ListBoxItem(char *text, 
00018                 int color = -1);
00019         BC_ListBoxItem(char *text, 
00020                 BC_Pixmap *icon, 
00021                 int color = -1);
00022         
00023 
00024 
00025 // autoplace is always 1 in initialization.
00026 // Positions set with the set_ commands cancel autoplacement.
00027 // Final positions are calculated in the next draw_items.
00028 
00029         virtual ~BC_ListBoxItem();
00030 
00031         friend class BC_ListBox;
00032 
00033         BC_ListBoxItem& operator=(BC_ListBoxItem& item);
00034         void copy_from(BC_ListBoxItem *item);
00035         void set_text(char *new_text);
00036         char* get_text();
00037         void set_icon(BC_Pixmap *icon);
00038         void set_icon_vframe(VFrame *icon_vframe);
00039         int get_icon_x();
00040         int get_icon_y();
00041         int get_text_x();
00042         int get_text_y();
00043         void set_icon_x(int x);
00044         void set_icon_y(int y);
00045         void set_text_x(int x);
00046         void set_text_y(int y);
00047         void set_color(int color);
00048         void set_searchable(int value);
00049         int get_color();
00050         void set_selected(int value);
00051         int set_autoplace_icon(int value);
00052         int set_autoplace_text(int value);
00053         void set_selectable(int value);
00054         int get_selectable();
00055 
00056 // The item with the sublist must be in column 0.  Only this is searched by
00057 // BC_ListBox.
00058 // Mind you, sublists are ignored in icon mode.
00059         ArrayList<BC_ListBoxItem*>* new_sublist(int columns);
00060         ArrayList<BC_ListBoxItem*>* get_sublist();
00061 // Return the number of columns in the sublist
00062         int get_columns();
00063 // Return if it's expanded
00064         int get_expand();
00065         void set_expand(int value);
00066 
00067 private:
00068         int initialize();
00069         int get_icon_w();
00070         int get_icon_h();
00071 
00072 
00073         BC_Pixmap *icon;
00074         VFrame *icon_vframe;
00075 // x and y position in listbox relative to top left
00076 // Different positions for icon mode and text mode are maintained
00077         int icon_x, icon_y;
00078         int text_x, text_y;
00079 // If autoplacement should be performed in the next draw
00080         int autoplace_icon, autoplace_text;
00081         char *text;
00082         int color;
00083 // 1 - currently selected
00084 // 2 - previously selected and now adding selections with shift
00085         int selected;
00086 // Allow this item to be included in queries.  Directories are not
00087 // included in queries.
00088         int searchable;
00089 
00090 // Array of one list of pointers for each column for a sublist.
00091 // It's an array so we can pass the sublist directly to another listbox.
00092         ArrayList<BC_ListBoxItem*> *sublist;
00093 // Columns in sublist
00094         int columns;
00095 // Sublist is visible
00096         int expand;
00097 // Item is selectable
00098         int selectable;
00099 };
00100 
00101 
00102 
00103 #endif

Generated on Sun Jan 8 13:26:32 2006 for Guicast-svn by  doxygen 1.4.4