X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftoggle.cpp;h=fe6518dda722b57fc6ffda3c2481d4e42ae63047;hb=754751fd474c6eac073fa7e89a18142fc89cb4fb;hp=e34b43ae38cc743ef721216e5b3d41b1b662ce26;hpb=df07e8f3e239b146cbc458d3cbd69758e590d255;p=libs%2Fgltk.git diff --git a/source/toggle.cpp b/source/toggle.cpp index e34b43a..fe6518d 100644 --- a/source/toggle.cpp +++ b/source/toggle.cpp @@ -17,21 +17,10 @@ Toggle::Toggle(const string &t): set_text(t); } -void Toggle::autosize() +void Toggle::autosize_special(const Part &part, Geometry &ageom) { - if(!style) - return; - - Widget::autosize(); - - if(const Part *text_part = style->get_part("text")) - { - const Sides &margin = text_part->get_margin(); - geom.w = max(geom.w, text.get_width()+margin.left+margin.right); - geom.h = max(geom.h, text.get_height()+margin.top+margin.bottom); - } - - rebuild(); + if(part.get_name()=="text") + text.autosize(part, ageom); } void Toggle::set_text(const string &t) @@ -70,10 +59,10 @@ void Toggle::set_value(bool v) clear_state(ACTIVE); } -void Toggle::rebuild_special(const Part &part, CachedPart &cache) +void Toggle::rebuild_special(const Part &part) { if(part.get_name()=="text") - text.build(part, geom, cache); + text.build(part, geom, part_cache); } void Toggle::button_press(int, int, unsigned btn)