X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flist.h;h=9bc30c685d146a88d9d3b0fc8b886037f7ffa724;hb=9f38197854e699a6093a906ab43f4238f3cd2388;hp=8b9db4090ecfa7ef9b6ece56ef291366f75313f6;hpb=21cb1e0b6fcc653d1298423dff5af5609389d415;p=libs%2Fgltk.git diff --git a/source/list.h b/source/list.h index 8b9db40..9bc30c6 100644 --- a/source/list.h +++ b/source/list.h @@ -7,7 +7,8 @@ #include "container.h" #include "label.h" #include "listdata.h" -#include "vslider.h" +#include "mspgltk_api.h" +#include "slider.h" namespace Msp { namespace GLtk { @@ -15,7 +16,7 @@ namespace GLtk { /** Thrown if a list's item type is incompatible with its data. */ -class incompatible_data: public std::logic_error +class MSPGLTK_API incompatible_data: public std::logic_error { public: incompatible_data(const std::type_info &); @@ -27,7 +28,7 @@ public: Shows a list of items, allowing the user to select one. A slider is included to allow scrolling through a long list. */ -class List: virtual public Widget, private Container +class MSPGLTK_API List: virtual public Widget, private Container { public: enum ViewMode @@ -80,7 +81,7 @@ public: class SimpleItem: public Item { protected: - SimpleItem() { } + SimpleItem() = default; virtual void on_style_change(); }; @@ -88,7 +89,7 @@ public: class MultiColumnItem: public Item { protected: - MultiColumnItem() { } + MultiColumnItem() = default; virtual void check_widths(std::vector &) const; virtual void set_widths(const std::vector &); @@ -109,9 +110,9 @@ private: class ItemFactory { protected: - ItemFactory() { } + ItemFactory() = default; public: - virtual ~ItemFactory() { } + virtual ~ItemFactory() = default; virtual void set_data(const ListData &) = 0; virtual Item *create_item(unsigned) const = 0; @@ -156,22 +157,22 @@ public: sigc::signal signal_selection_cleared; private: - ListData *data; - bool own_data; - DataObserver *observer; - ItemFactory *item_factory; - ViewMode view_mode; - int sel_index; - int focus_index; - unsigned first_row; - unsigned max_scroll; - unsigned view_rows; - unsigned view_columns; - const Part *items_part; - bool ignore_slider_change; - bool dragging; - int drag_start_x; - int drag_start_y; + ListData *data = 0; + bool own_data = false; + DataObserver *observer = 0; + ItemFactory *item_factory = 0; + ViewMode view_mode = LIST; + int sel_index = -1; + int focus_index = -1; + unsigned first_row = 0; + unsigned max_scroll = 0; + unsigned view_rows = 5; + unsigned view_columns = 5; + const Part *items_part = 0; + bool ignore_slider_change = false; + bool dragging = false; + int drag_start_x = 0; + int drag_start_y = 0; VSlider slider; std::vector items; @@ -180,9 +181,6 @@ private: public: List(); List(ListData &); -private: - void init(); -public: virtual ~List(); virtual const char *get_class() const { return "list"; } @@ -246,7 +244,7 @@ private: static void adjust_index(int &, int, int); }; -void operator>>(const LexicalConverter &, List::ViewMode &); +MSPGLTK_API void operator>>(const LexicalConverter &, List::ViewMode &); } // namespace GLtk } // namespace Msp