]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/entry.cpp
Refactor filling from Part to Alignment
[libs/gltk.git] / source / entry.cpp
index eed2c39a942ced2e7299a6f357be9142cd6b4c15..7e503b3dbc0e960b8c04397dc27b0ff14e640436 100644 (file)
@@ -81,21 +81,14 @@ void Entry::render_special(const Part &part) const
                const GL::Font *const font=style->get_font();
                const float font_size=font->get_default_size();
 
-               const Geometry &pgeom=part.get_geometry();
-               unsigned gw=pgeom.w;
-               unsigned gh=(part.get_fill_y() ? geom.h : pgeom.h);
-
-               Geometry rgeom;
+               Geometry rgeom=part.get_geometry();
+               rgeom.x=static_cast<unsigned>(font->get_string_width(text.substr(0, edit_pos))*font_size);
                rgeom.w=static_cast<unsigned>(font->get_string_width(text)*font_size);
-               rgeom.h=(part.get_fill_y() ? geom.h : pgeom.h);
                part.get_alignment().apply(rgeom, geom, part.get_margin());
-               rgeom.x+=static_cast<unsigned>(font->get_string_width(text.substr(0, edit_pos))*font_size);
 
                GL::push_matrix();
                GL::translate(rgeom.x, rgeom.y, 0);
-
-               part.get_graphic(state)->render(gw, gh);
-
+               part.get_graphic(state)->render(part.get_geometry().w, rgeom.h);
                GL::pop_matrix();
        }
 }