#include "container.h"
#include "label.h"
#include "listdata.h"
-#include "vslider.h"
+#include "mspgltk_api.h"
+#include "slider.h"
namespace Msp {
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 &);
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
class Item: virtual public Widget, protected Container
{
protected:
- Item() { }
+ Item();
public:
virtual const char *get_class() const { return "listitem"; }
class SimpleItem: public Item
{
protected:
- SimpleItem() { }
+ SimpleItem() = default;
virtual void on_style_change();
};
class MultiColumnItem: public Item
{
protected:
- MultiColumnItem() { }
+ MultiColumnItem() = default;
virtual void check_widths(std::vector<unsigned> &) const;
virtual void set_widths(const std::vector<unsigned> &);
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;
sigc::signal<void> 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<Item *> items;
public:
List();
List(ListData &);
-private:
- void init();
-public:
virtual ~List();
virtual const char *get_class() const { return "list"; }
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