+ cursor_blink = (state&FOCUS);
+ if((state&FOCUS) && style && has_blink)
+ {
+ set_animation_interval(Time::sec/2);
+ mark_rebuild();
+ }
+ else
+ {
+ if(has_blink)
+ mark_rebuild();
+ stop_animation();
+ }
+}
+
+void Entry::check_view_range()
+{
+ if(!multiline || !text_part)
+ return;
+
+ visible_rows = text.get_visible_lines(*text_part, geom, 0);
+
+ unsigned row, col;
+ text.offset_to_coords(edit_pos, row, col);
+
+ unsigned old_first_row = first_row;
+ 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;
+ if(first_row>scroll)
+ first_row = scroll;
+
+ if(first_row!=old_first_row)
+ signal_scroll_position_changed.emit(first_row);
+
+ slider->set_range(0, scroll);
+ slider->set_page_size(visible_rows);
+ slider->set_value(scroll-first_row);
+}
+
+void Entry::slider_value_changed(double value)
+{
+ if(text.get_n_lines()>visible_rows)
+ {
+ unsigned old_first_row = first_row;
+ first_row = text.get_n_lines()-visible_rows-static_cast<unsigned>(value);
+ if(first_row!=old_first_row)
+ signal_scroll_position_changed.emit(first_row);
+ mark_rebuild();
+ }
+}
+
+
+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);
+}