+ GtkAdjustment* adj = ((GtkRange*)m_widget)->adjustment;
+ return int(adj->upper);
+}
+
+void wxScrollBar::SetThumbPosition( int viewStart )
+{
+ if (GetThumbPosition() != viewStart)
+ {
+ GtkAdjustment* adj = ((GtkRange*)m_widget)->adjustment;
+ const int i = (GtkRange*)m_widget == m_scrollBar[1];
+ const int max = int(adj->upper - adj->page_size);
+ if (viewStart > max)
+ viewStart = max;
+ if (viewStart < 0)
+ viewStart = 0;
+
+ m_scrollPos[i] =
+ adj->value = viewStart;
+
+ g_signal_handlers_disconnect_by_func( m_widget,
+ (gpointer)gtk_value_changed, this);
+
+ gtk_adjustment_value_changed(adj);
+
+ g_signal_connect_after(m_widget, "value_changed",
+ G_CALLBACK(gtk_value_changed), this);
+ }
+}
+
+void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageSize, bool)
+{
+ if (range == 0)
+ {
+ // GtkRange requires upper > lower
+ range =
+ thumbSize = 1;
+ }
+ if (position > range - thumbSize)
+ position = range - thumbSize;
+ if (position < 0)
+ position = 0;
+ GtkAdjustment* adj = ((GtkRange*)m_widget)->adjustment;
+ adj->step_increment = 1;
+ adj->page_increment = pageSize;
+ adj->page_size = thumbSize;
+ adj->upper = range;
+ SetThumbPosition(position);
+ gtk_adjustment_changed(adj);