using namespace std;
-#include <iostream>
-
namespace Msp {
namespace GLtk {
Entry::Entry(const Resources &r, const string &t):
Widget(r),
- text(t),
- edit_pos(text.size())
+ text(),
+ edit_pos(0)
{
update_style();
+ set_text(t);
}
void Entry::set_text(const string &t)
void Entry::render_special(const Part &part) const
{
if(part.get_name()=="text")
- render_text(part, text);
+ text.render(part, geom);
else if(part.get_name()=="cursor")
{
if(!part.get_graphic(state))
const float font_size=font->get_default_size();
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.x=static_cast<unsigned>(font->get_string_width(text.get().substr(0, edit_pos))*font_size);
+ rgeom.w=static_cast<unsigned>(font->get_string_width(text.get())*font_size);
part.get_alignment().apply(rgeom, geom, part.get_margin());
GL::push_matrix();
}
}
+void Entry::on_style_change()
+{
+ text.set_style(style);
+}
+
Entry::Loader::Loader(Entry &ent):
Widget::Loader(ent)