]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/list.cpp
Make sure classes follow the rule of 0/3/5
[libs/gltk.git] / source / list.cpp
index 897ea39ebadb972decb3e7fe8dd8a876ac58089d..963b442775f982840f27b6d796437f02227e9fac 100644 (file)
@@ -118,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
@@ -162,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
@@ -330,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->find_part("items") : nullptr);
 }
 
 void List::move_focus(Navigation nav, bool select)
@@ -567,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();
 }
@@ -615,7 +615,7 @@ void List::SimpleItem::on_style_change()
 
        Widget *child = children.front()->widget;
        child->autosize();
-       if(const Part *part = style->get_part("children"))
+       if(const Part *part = style->find_part("children"))
        {
                const Sides &margin = part->get_margin();
                child->set_position(margin.left, margin.bottom);
@@ -644,7 +644,7 @@ void List::MultiColumnItem::set_widths(const vector<unsigned> &widths)
        if(!style)
                return;
 
-       const Part *part = style->get_part("children");
+       const Part *part = style->find_part("children");
        if(!part)
                return;