X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fbclistbox.h;h=6bdd2c041a35e0d202310a27b9c199d3bc7e864d;hp=e815a7f7edd1935616c4f4d5efb5096116f480b0;hb=a19a685a46ddc630010788707d9e5b9d2342af46;hpb=25bafacda1fe9d8a9520cad451547a75d934c1bb diff --git a/cinelerra-5.1/guicast/bclistbox.h b/cinelerra-5.1/guicast/bclistbox.h index e815a7f7..6bdd2c04 100644 --- a/cinelerra-5.1/guicast/bclistbox.h +++ b/cinelerra-5.1/guicast/bclistbox.h @@ -27,48 +27,41 @@ #include "bcscrollbar.h" #include "bcsubwindow.h" #include "bctoggle.h" -#include "colors.h" +#include "bccolors.h" #define BCPOPUPLISTBOX_W 25 #define BCPOPUPLISTBOX_H 25 +class BC_ListBoxYScroll; +class BC_ListBoxXScroll; +class BC_ListBoxToggle; +class BC_ListBox; #define MIN_COLUMN_WIDTH 10 class BC_ListBoxYScroll : public BC_ScrollBar { + BC_ListBox *listbox; public: - BC_ListBoxYScroll(BC_ListBox *listbox, - int total_height, - int view_height, - int position); + BC_ListBoxYScroll(BC_ListBox *listbox); ~BC_ListBoxYScroll(); int handle_event(); -private: - BC_ListBox *listbox; }; class BC_ListBoxXScroll : public BC_ScrollBar { + BC_ListBox *listbox; public: - BC_ListBoxXScroll(BC_ListBox *listbox, - int total_width, - int view_width, - int position); + BC_ListBoxXScroll(BC_ListBox *listbox); ~BC_ListBoxXScroll(); int handle_event(); -private: - BC_ListBox *listbox; }; class BC_ListBoxToggle { public: - BC_ListBoxToggle(BC_ListBox *listbox, - BC_ListBoxItem *item, - int x, - int y); + BC_ListBoxToggle(BC_ListBox *listbox, BC_ListBoxItem *item, int x, int y); int cursor_motion_event(int *redraw_toggles); int cursor_leave_event(int *redraw_toggles); @@ -96,11 +89,11 @@ public: class BC_ListBox : public BC_SubWindow { + friend class BC_ListBoxYScroll; + friend class BC_ListBoxXScroll; + friend class BC_ListBoxToggle; public: - BC_ListBox(int x, - int y, - int w, - int h, + BC_ListBox(int x, int y, int w, int h, int display_format, // Display text list or icons ArrayList *data = 0, // Each column has an ArrayList of BC_ListBoxItems. const char **column_titles = 0, // Titles for columns. Set to 0 for no titles @@ -113,8 +106,6 @@ public: int allow_drag = 0); // Allow user to drag icons around virtual ~BC_ListBox(); - friend class BC_ListBoxToggle; - int initialize(); // User event handler for new selections @@ -132,6 +123,8 @@ public: virtual int sort_order_event() { return 0; }; // Column moved virtual int move_column_event() { return 0; }; +// item highlight changed + virtual int mouse_over_event(int no) { return 0; } int enable(); int disable(); @@ -198,6 +191,12 @@ public: int activate(int x, int y, int w=-1, int h=-1); int deactivate(); int is_active(); + int expander_active(); + +// get item no at current cursor position + int get_cursor_item_no(); +// get top data item no, and item at current cursor position + int get_cursor_data_item_no(BC_ListBoxItem **item_return=0); int translation_event(); int repeat_event(int64_t duration); @@ -206,18 +205,17 @@ public: // Must be called in the constructor. void set_use_button(int value); void set_is_suggestions(int value); - + void set_scroll_repeat(); + void unset_scroll_repeat(); + int scroll_repeat; // change the contents int update(ArrayList *data, - const char **column_titles, - int *column_widths, - int columns, - int xposition = 0, - int yposition = 0, - int highlighted_number = -1, // Flat index of item cursor is over - int recalc_positions = 0, // set all autoplace flags to 1 - int draw = 1); + const char **column_titles, int *column_widths, int columns, + int xposition = 0, int yposition = 0, + int highlighted_number = -1, // Flat index of item cursor is over + int recalc_positions = 0, // set all autoplace flags to 1 + int draw = 1); void center_selection(); void update_format(int display_format, int redraw); int get_format(); @@ -246,6 +244,7 @@ public: int get_xscroll_x(); int get_xscroll_y(); int get_xscroll_width(); + void set_scroll_stretch(int xv, int yv); int get_column_offset(int column); int get_column_width(int column, int clamp_right = 0); int get_title_h(); @@ -253,6 +252,9 @@ public: void set_justify(int value); int get_w() { return is_popup ? BCPOPUPLISTBOX_W : popup_w; } int get_h() { return is_popup ? BCPOPUPLISTBOX_H : popup_h; } + int gui_tooltip(const char *text) { + return is_popup && gui ? gui->show_tooltip(text, gui->get_w(),0, -1,-1) : -1; + } int get_view_w() { return view_w; } int get_view_h() { return view_h; } int get_row_height() { return row_height; } @@ -261,7 +263,6 @@ public: int get_first_visible() { return first_in_view; } int get_last_visible() { return last_in_view; } - enum { SORT_ASCENDING, @@ -275,6 +276,9 @@ public: void reset_query(); + int get_show_query() { return show_query; } + void set_show_query(int v) { show_query = v; } + int reposition_window(int x, int y, int w = -1, @@ -320,6 +324,12 @@ public: int indent /* = 0 */, int master_column); + int get_icon_x(BC_ListBoxItem *item); + int get_icon_y(BC_ListBoxItem *item); + int get_icon_w(BC_ListBoxItem *item); + int get_icon_h(BC_ListBoxItem *item); + int get_text_w(BC_ListBoxItem *item); + int get_text_h(BC_ListBoxItem *item); int get_item_x(BC_ListBoxItem *item); int get_item_y(BC_ListBoxItem *item); int get_item_w(BC_ListBoxItem *item); @@ -327,6 +337,7 @@ public: // Draw the list items int draw_items(int flash, int bg_draw=0); + int is_highlighted(); private: void delete_columns(); @@ -407,10 +418,6 @@ private: int get_items_height(ArrayList *data, int columns, int *result = 0); - int get_icon_w(BC_ListBoxItem *item); - int get_icon_h(BC_ListBoxItem *item); - int get_text_w(BC_ListBoxItem *item); - int get_text_h(BC_ListBoxItem *item); int get_baseline(BC_ListBoxItem *item); int get_item_highlight(ArrayList *data, int column, int item); int get_item_color(ArrayList *data, int column, int item); @@ -438,7 +445,8 @@ private: // Points *item_return to the first item in the row or 0 if no item was found. // if it's nonzero. Returns -1 if no item was found. Clamps the y coordinate // only if the current operation is not SELECT, so scrolling is possible. -// expanded - 1 if items in this table should be tested for cursor coverage +// expanded = 1 if items in this table should be tested for cursor coverage +// expanded = -1 returns only the top level master column index/item int get_cursor_item(ArrayList *data, int cursor_x, int cursor_y, @@ -503,7 +511,7 @@ private: BC_ListBoxYScroll *yscrollbar; ArrayList expanders; char query[BCTEXTLEN]; - + int show_query; // Window containing the listbox BC_WindowBase *gui; @@ -511,7 +519,7 @@ private: // Size of the popup if there is one char **column_titles; int *column_width; - int default_column_width[1]; + int default_column_width[32]; int columns; int master_column; int search_column; @@ -525,6 +533,7 @@ private: // In BCLISTBOX_SELECT mode determines the value to set items to int new_value; int need_xscroll, need_yscroll; + int xscroll_orientation, yscroll_orientation; // Move items during drag operation of text items. int process_drag; int allow_drag; @@ -534,7 +543,6 @@ private: int list_background; - // Popup button BC_Pixmap *button_images[4]; // Expander @@ -592,6 +600,7 @@ private: // More state variables int button_highlighted; int list_highlighted; + int packed_icons; // item cursor is over. May not exist in tables. // Must be an index since this is needed to change the database. int highlighted_item;