+ if(nav==NAV_LEFT || nav==NAV_RIGHT || ((nav==NAV_DOWN || nav==NAV_UP) && multiline))
+ move_edit_position(nav, false);
+ else if(nav==NAV_ACCEPT && !signal_enter.empty())
+ signal_enter.emit();
+ else
+ return false;
+
+ return true;
+}
+
+void Entry::animate(const Time::TimeDelta &)
+{
+ cursor_blink = !cursor_blink;
+ rebuild();
+}
+
+void Entry::on_geometry_change()
+{
+ if(multiline)
+ check_view_range();
+}
+
+void Entry::on_style_change()
+{
+ text.set_style(style);
+
+ if(!style)
+ {
+ text_part = 0;
+ return;
+ }
+
+ text_part = style->get_part("text");
+
+ if(multiline)
+ check_view_range();
+
+ check_cursor_blink();
+}
+
+void Entry::move_edit_position(Navigation nav, bool select)
+{
+ if(nav==NAV_LEFT)
+ set_edit_position(text.move_offset(edit_pos, -1), select);
+ else if(nav==NAV_RIGHT)
+ set_edit_position(text.move_offset(edit_pos, 1), select);
+ else if(nav==NAV_DOWN)
+ {
+ unsigned row, col;
+ text.offset_to_coords(edit_pos, row, col);
+ set_edit_position(text.coords_to_offset(row+1, col), select);
+ }
+ else if(nav==NAV_UP)
+ {
+ unsigned row, col;
+ text.offset_to_coords(edit_pos, row, col);
+ set_edit_position((row>0 ? text.coords_to_offset(row-1, col) : 0), select);
+ }
+ else
+ throw invalid_argument("Entry::move_edit_position");
+}
+
+void Entry::set_edit_position(unsigned ep, bool select)
+{
+ if(select && !selection_active)
+ selection_pos = edit_pos;
+ selection_active = select;
+
+ unsigned old_edit_pos = edit_pos;
+ edit_pos = min(ep, text.size());
+
+ if(edit_pos!=old_edit_pos)
+ signal_edit_position_changed.emit(edit_pos);
+
+ if(multiline)
+ check_view_range();
+ rebuild();
+}
+
+void Entry::erase_selection(bool emit_change)
+{
+ unsigned start, end;
+ if(!get_selection(start, end))
+ return;
+
+ text.erase(start, end-start);
+ if(emit_change)
+ signal_text_changed.emit(text.get());
+ set_edit_position(start, false);
+}
+
+void Entry::check_cursor_blink()
+{
+ cursor_blink = (state&FOCUS);
+ if((state&FOCUS) && style)