X-Git-Url: http://git.tdb.fi/?p=libs%2Fgltk.git;a=blobdiff_plain;f=source%2Fpanel.cpp;fp=source%2Fpanel.cpp;h=d4e737bee7de6e9b48ef459b02f35f111a8e453f;hp=56aa2dcb5545003fd3feb2975be9fd451bc029ac;hb=394e5c9969a30b604bfaf78fc05a8c2d5c98ab5b;hpb=90d5f5f2ebaeb8aaa4aa47a0c2207f96758cba8c diff --git a/source/panel.cpp b/source/panel.cpp index 56aa2dc..d4e737b 100644 --- a/source/panel.cpp +++ b/source/panel.cpp @@ -1,6 +1,5 @@ #include #include -#include #include "button.h" #include "column.h" #include "draghandle.h" @@ -32,17 +31,11 @@ Panel::Panel() input_type = INPUT_NAVIGATION; } -Panel::~Panel() -{ - delete layout; - layout = nullptr; -} - Layout &Panel::get_or_create_layout() { if(!layout) { - layout = new Layout; + layout = make_unique(); layout->set_container(*this); } @@ -59,7 +52,7 @@ void Panel::render_special(const Part &part, GL::Renderer &renderer) const { if(part.get_name()=="children") { - for(const Child *c: children) + for(const unique_ptr &c: children) if(c->widget->is_visible()) c->widget->render(renderer); } @@ -140,7 +133,7 @@ Widget *Panel::find_next_child(int origin_x, int origin_y, int origin_dim, int n { Widget *sibling = nullptr; int best_score = 0; - for(const Child *c: children) + for(const unique_ptr &c: children) { if(c->widget==input_focus || !c->widget->is_focusable()) continue; @@ -300,7 +293,7 @@ void Panel::Loader::layout() template<> void Panel::Loader::unnamed_child() { - RefPtr pnl = new Panel(); + unique_ptr pnl = make_unique(); load_sub(*pnl, wdg_map); obj.add(*pnl.get()); last_widget = pnl.release();