r618: Undo items are only pushed if some time has passed since the last push.
[cinelerra_cv.git] / guicast / bclistboxitem.h
blobe9ff3a92c9e249e05bf2f7ae7e7d84c9f38946ff
1 #ifndef BCLISTBOXITEM_H
2 #define BCLISTBOXITEM_H
4 #include "arraylist.h"
5 #include "bcpixmap.inc"
6 #include "colors.h"
7 #include "vframe.h"
11 // Every item in a list inherits this
12 class BC_ListBoxItem
14 public:
15 BC_ListBoxItem();
16 // New items
17 BC_ListBoxItem(char *text, int color = BLACK);
18 BC_ListBoxItem(char *text,
19 BC_Pixmap *icon,
20 int color = BLACK);
24 // autoplace is always 1 in initialization.
25 // Positions set with the set_ commands cancel autoplacement.
26 // Final positions are calculated in the next draw_items.
28 virtual ~BC_ListBoxItem();
30 friend class BC_ListBox;
32 BC_ListBoxItem& operator=(BC_ListBoxItem& item);
33 void copy_from(BC_ListBoxItem *item);
34 void set_text(char *new_text);
35 char* get_text();
36 void set_icon(BC_Pixmap *icon);
37 void set_icon_vframe(VFrame *icon_vframe);
38 int get_icon_x();
39 int get_icon_y();
40 int get_text_x();
41 int get_text_y();
42 void set_icon_x(int x);
43 void set_icon_y(int y);
44 void set_text_x(int x);
45 void set_text_y(int y);
46 void set_color(int color);
47 void set_searchable(int value);
48 int get_color();
49 void set_selected(int value);
50 int set_autoplace_icon(int value);
51 int set_autoplace_text(int value);
52 void set_selectable(int value);
53 int get_selectable();
55 // The item with the sublist must be in column 0. Only this is searched by
56 // BC_ListBox.
57 // Mind you, sublists are ignored in icon mode.
58 ArrayList<BC_ListBoxItem*>* new_sublist(int columns);
59 ArrayList<BC_ListBoxItem*>* get_sublist();
60 // Return the number of columns in the sublist
61 int get_columns();
62 // Return if it's expanded
63 int get_expand();
64 void set_expand(int value);
66 private:
67 int initialize();
68 int get_icon_w();
69 int get_icon_h();
72 BC_Pixmap *icon;
73 VFrame *icon_vframe;
74 // x and y position in listbox relative to top left
75 // Different positions for icon mode and text mode are maintained
76 int icon_x, icon_y;
77 int text_x, text_y;
78 // If autoplacement should be performed in the next draw
79 int autoplace_icon, autoplace_text;
80 char *text;
81 int color;
82 // 1 - currently selected
83 // 2 - previously selected and now adding selections with shift
84 int selected;
85 // Allow this item to be included in queries. Directories are not
86 // included in queries.
87 int searchable;
89 // Array of one list of pointers for each column for a sublist.
90 // It's an array so we can pass the sublist directly to another listbox.
91 ArrayList<BC_ListBoxItem*> *sublist;
92 // Columns in sublist
93 int columns;
94 // Sublist is visible
95 int expand;
96 // Item is selectable
97 int selectable;
102 #endif