X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fdropdown.cpp;h=b911df370de3579e89d3430a8882362346071e14;hb=ae991f3bbd83fa0afff5e1fc31be50e1f2d17875;hp=5e19ed9ca8534a1aeb27bf8aa8b72a63e16ab4a3;hpb=1e06dc208a02e68cf1bb127927e3ad5af3657c58;p=libs%2Fgltk.git diff --git a/source/dropdown.cpp b/source/dropdown.cpp index 5e19ed9..b911df3 100644 --- a/source/dropdown.cpp +++ b/source/dropdown.cpp @@ -81,15 +81,15 @@ void Dropdown::button_press(int x, int y, unsigned btn) Container::button_press(x, y, btn); if(!click_focus) { - dropped=false; - state&=~ACTIVE; + dropped = false; + state &= ~ACTIVE; signal_ungrab_pointer.emit(); } } else if(btn==1) { - dropped=true; - state|=ACTIVE; + dropped = true; + state |= ACTIVE; signal_grab_pointer.emit(); } } @@ -99,8 +99,7 @@ void Dropdown::render_special(const Part &part) const if(part.get_name()=="text") { if(list.get_selected_index()>=0) - Text(style, list.get_selected()).render(part, geom); - //render_text(part, list.get_selected()); + Text(*style, list.get_selected()).render(part, geom); } else if(part.get_name()=="list" && dropped) list.render(); @@ -114,15 +113,15 @@ void Dropdown::on_geometry_change() void Dropdown::resize_list() { // XXX This is a hack. - unsigned n_items=list.get_n_items(); - const Style &stl=list.get_style(); - const GL::Font &font=*stl.get_font(); - unsigned h=min(max(n_items, 1U), 10U)*static_cast((font.get_ascent()-font.get_descent())*font.get_default_size()); + unsigned n_items = list.get_n_items(); + const Style &stl = list.get_style(); + const GL::Font &font = *stl.get_font(); + unsigned h = min(max(n_items, 1U), 10U)*static_cast((font.get_ascent()-font.get_descent())*font.get_default_size()); for(std::list::const_iterator i=stl.get_parts().begin(); i!=stl.get_parts().end(); ++i) if(i->get_name()=="items") { - const Sides &margin=i->get_margin(); - h+=margin.top+margin.bottom; + const Sides &margin = i->get_margin(); + h += margin.top+margin.bottom; } list.set_geometry(Geometry(0, -h, geom.w, h)); } @@ -131,8 +130,8 @@ void Dropdown::list_item_selected(unsigned index, const std::string &item) { if(dropped) { - dropped=false; - state&=~ACTIVE; + dropped = false; + state &= ~ACTIVE; signal_ungrab_pointer.emit(); }