X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flist.h;h=ef4311e0702c73b818a19ab3abaadb07e1427abb;hb=7e328215742ee672b1a93e5f5f358828c53ce921;hp=246a7294d6da99e457d81d6f0e529bb78e4fbf67;hpb=08b48157dc9ca5a4bd59d8eec9fa4e3bff8f0503;p=libs%2Fgltk.git diff --git a/source/list.h b/source/list.h index 246a729..ef4311e 100644 --- a/source/list.h +++ b/source/list.h @@ -68,6 +68,12 @@ public: virtual void render_special(const Part &, GL::Renderer &) const; }; + class SimpleItem: public Item + { + private: + virtual void on_style_change(); + }; + class MultiColumnItem: public Item { protected: @@ -79,16 +85,13 @@ public: }; private: - class BasicItem: public Item + class BasicItem: public SimpleItem { private: Label label; public: BasicItem(const std::string &); - - private: - virtual void on_style_change(); }; class ItemFactory @@ -128,6 +131,14 @@ private: } }; + struct Row + { + unsigned first; + unsigned height; + + Row(unsigned f): first(f), height(0) { } + }; + public: sigc::signal signal_item_selected; sigc::signal signal_selection_cleared; @@ -138,13 +149,19 @@ private: DataObserver *observer; ItemFactory *item_factory; int sel_index; - unsigned first; + int focus_index; + unsigned first_row; unsigned max_scroll; - unsigned view_size; + unsigned view_rows; + const Part *items_part; bool ignore_slider_change; + bool dragging; + int drag_start_x; + int drag_start_y; VSlider slider; std::vector items; + std::vector rows; public: List(); @@ -183,18 +200,34 @@ public: void set_selected_index(int); int get_selected_index() const { return sel_index; } - private: + void set_selected_item(Widget *); + virtual void rebuild_special(const Part &); virtual void render_special(const Part &, GL::Renderer &) const; public: + virtual bool key_press(unsigned, unsigned); virtual void button_press(int, int, unsigned); - + virtual void touch_press(int, int, unsigned); + virtual void touch_release(int, int, unsigned); + virtual void touch_motion(int, int, unsigned); + virtual void focus_in(); + virtual bool navigate(Navigation); private: + virtual void on_style_change(); + + void move_focus(Navigation, bool); + void set_focus_index(int); + void item_autosize_changed(Item *); + void reposition_items(bool); + unsigned last_to_first_row(unsigned) const; + unsigned item_index_to_row(unsigned) const; void check_view_range(); + void scroll_to_focus(); void slider_value_changed(double); + static void adjust_index(int &, int, int); }; } // namespace GLtk