X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6f85e712009f9b66c200302e75ae9dfbf5cc9c8d..5d4c08332644042aec31e82c59b2290a9dfc14ab:/src/gtk/textctrl.cpp diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 74425264af..d36c312925 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -618,7 +618,10 @@ bool wxTextCtrl::Create( wxWindow *parent, PostCreation(size); if (multi_line) + { gtk_widget_show(m_text); + SetVScrollAdjustment(gtk_scrolled_window_get_vadjustment((GtkScrolledWindow*)m_widget)); + } if (!value.empty()) { @@ -1704,64 +1707,6 @@ void wxTextCtrl::OnUrlMouseEvent(wxMouseEvent& event) GetEventHandler()->ProcessEvent(url_event); } -// ---------------------------------------------------------------------------- -// scrolling -// ---------------------------------------------------------------------------- - -GtkAdjustment *wxTextCtrl::GetVAdj() const -{ - if ( !IsMultiLine() ) - return NULL; - - return gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(m_widget)); -} - -bool wxTextCtrl::DoScroll(GtkAdjustment *adj, int diff) -{ - float value = adj->value + diff; - - if ( value < 0 ) - value = 0; - - float upper = adj->upper - adj->page_size; - if ( value > upper ) - value = upper; - - // did we noticeably change the scroll position? - if ( fabs(adj->value - value) < 0.2 ) - { - // well, this is what Robert does in wxScrollBar, so it must be good... - return false; - } - - adj->value = value; - - gtk_adjustment_value_changed(GTK_ADJUSTMENT(adj)); - - return true; -} - -bool wxTextCtrl::ScrollLines(int lines) -{ - GtkAdjustment *adj = GetVAdj(); - if ( !adj ) - return false; - - int diff = (int)ceil(lines*adj->step_increment); - - return DoScroll(adj, diff); -} - -bool wxTextCtrl::ScrollPages(int pages) -{ - GtkAdjustment *adj = GetVAdj(); - if ( !adj ) - return false; - - return DoScroll(adj, (int)ceil(pages*adj->page_increment)); -} - - // static wxVisualAttributes wxTextCtrl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))