- GL::pop_matrix();
- render_text(part, text);
- }*/
- /*else if(part.get_name()=="cursor")
- {
- unsigned gw=part.get_width();
- unsigned gh=(part.get_fill_y() ? geom.h : part.get_height());
-
- const float font_size=font->get_default_size();
- unsigned text_w=static_cast<unsigned>(font->get_string_width(text)*font_size);
-
- GL::push_matrix();
- GL::translate((geom.w-gw)*(value-min)/(max-min), (geom.h-gh)*(part.get_alignment().y+1)/2, 0);
- const Graphic *graphic=part.get_graphic(state);
- graphic->render(gw, gh);
- GL::pop_matrix();
- }*/
- else
- Widget::render_part(part);
+ stop_animation();
+}
+
+void Entry::check_view_range()
+{
+ if(!multiline || !text_part)
+ return;
+
+ float font_size = style->get_font_size();
+ unsigned line_spacing = static_cast<unsigned>(font_size*6/5);
+
+ const Sides &margin = text_part->get_margin();
+ visible_rows = max((geom.h-margin.top-margin.bottom)/line_spacing, 1U);
+
+ unsigned row, col;
+ text.offset_to_coords(edit_pos, row, col);
+
+ if(first_row>row)
+ first_row = row;
+ else if(row>=first_row+visible_rows)
+ first_row = row+1-visible_rows;
+
+ unsigned scroll = max(text.get_n_lines(), visible_rows)-visible_rows;
+ slider->set_range(0, scroll);
+ slider->set_value(scroll-first_row);
+}
+
+void Entry::slider_value_changed(double value)
+{
+ if(text.get_n_lines()>visible_rows)
+ first_row = text.get_n_lines()-visible_rows-static_cast<unsigned>(value);
+}
+
+
+Entry::Loader::Loader(Entry &e):
+ DataFile::DerivedObjectLoader<Entry, Widget::Loader>(e)
+{
+ add("edit_size", &Entry::edit_width, &Entry::edit_height);
+ add("multiline", &Loader::multiline);
+}
+
+void Entry::Loader::multiline(bool m)
+{
+ obj.set_multiline(m);