X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flist.cpp;h=e0d2bd81c150d62918bedd77b7eebe3b1537baac;hb=81c4024fb6acf37df702a803dc4efdf82a81525a;hp=5dd6d3ead5619927d7f31ed1747c2c72d221c885;hpb=b4a3d651f57c46507aaa99a71a14fea15f0e430d;p=libs%2Fgltk.git diff --git a/source/list.cpp b/source/list.cpp index 5dd6d3e..e0d2bd8 100644 --- a/source/list.cpp +++ b/source/list.cpp @@ -21,39 +21,17 @@ incompatible_data::incompatible_data(const type_info &ti): List::List(): - data(new BasicListData), - own_data(true) + List(*new BasicListData) { - init(); + own_data = true; } List::List(ListData &d): data(&d), - own_data(false) -{ - init(); -} - -void List::init() + observer(new DataObserver(*this)) { input_type = INPUT_NAVIGATION; - item_factory = 0; - view_mode = LIST; - sel_index = -1; - focus_index = -1; - first_row = 0; - max_scroll = 0; - view_rows = 5; - view_columns = 5; - items_part = 0; - ignore_slider_change = false; - dragging = false; - drag_start_x = 0; - drag_start_y = 0; - - observer = new DataObserver(*this); - add(slider); slider.set_step(1); slider.signal_value_changed.connect(sigc::mem_fun(this, &List::slider_value_changed)); @@ -140,7 +118,7 @@ void List::items_changed() List::Item *List::create_item(unsigned index) { - Item *item = 0; + Item *item = nullptr; if(item_factory) item = item_factory->create_item(index); else @@ -184,7 +162,7 @@ void List::set_selected_index(int i) { sel_index = -1; focus_index = -1; - set_input_focus(0); + set_input_focus(nullptr); signal_selection_cleared.emit(); } else @@ -352,7 +330,7 @@ bool List::navigate(Navigation nav) void List::on_style_change() { - items_part = (style ? style->get_part("items") : 0); + items_part = (style ? style->get_part("items") : nullptr); } void List::move_focus(Navigation nav, bool select) @@ -589,7 +567,7 @@ void List::DataObserver::refresh_item(unsigned i) { delete list.items[i]; // Avoid stale pointer while create_item is executing - list.items[i] = 0; + list.items[i] = nullptr; list.items[i] = list.create_item(i); list.items_changed(); }