- // I _really_ don't want scrollbars in the beginning
- m_vAdjust->lower = 0.0;
- m_vAdjust->upper = 1.0;
- m_vAdjust->value = 0.0;
- m_vAdjust->step_increment = 1.0;
- m_vAdjust->page_increment = 1.0;
- m_vAdjust->page_size = 5.0;
- g_signal_emit_by_name (m_vAdjust, "changed");
- m_hAdjust->lower = 0.0;
- m_hAdjust->upper = 1.0;
- m_hAdjust->value = 0.0;
- m_hAdjust->step_increment = 1.0;
- m_hAdjust->page_increment = 1.0;
- m_hAdjust->page_size = 5.0;
- g_signal_emit_by_name (m_hAdjust, "changed");
-
- // these handlers block mouse events to any window during scrolling such as
- // motion events and prevent GTK and wxWidgets from fighting over where the
- // slider should be
- g_signal_connect (scrolledWindow->vscrollbar, "button_press_event",
- G_CALLBACK (gtk_scrollbar_button_press_callback), this);
- g_signal_connect (scrolledWindow->hscrollbar, "button_press_event",
- G_CALLBACK (gtk_scrollbar_button_press_callback), this);
- g_signal_connect (scrolledWindow->vscrollbar, "button_release_event",
- G_CALLBACK (gtk_scrollbar_button_release_callback), this);
- g_signal_connect (scrolledWindow->hscrollbar, "button_release_event",
- G_CALLBACK (gtk_scrollbar_button_release_callback), this);
-
- // these handlers get notified when screen updates are required either when
- // scrolling or when the window size (and therefore scrollbar configuration)
- // has changed
-
- g_signal_connect (m_hAdjust, "value_changed",
- G_CALLBACK (gtk_window_hscroll_callback), this);
- g_signal_connect (m_vAdjust, "value_changed",
- G_CALLBACK (gtk_window_vscroll_callback), this);
+ // connect various scroll-related events
+ for ( int dir = 0; dir < ScrollDir_Max; dir++ )
+ {
+ // these handlers block mouse events to any window during scrolling
+ // such as motion events and prevent GTK and wxWidgets from fighting
+ // over where the slider should be
+ g_signal_connect(m_scrollBar[dir], "button_press_event",
+ G_CALLBACK(gtk_scrollbar_button_press_event), this);
+ g_signal_connect(m_scrollBar[dir], "button_release_event",
+ G_CALLBACK(gtk_scrollbar_button_release_event), this);
+
+ gulong handler_id = g_signal_connect(m_scrollBar[dir], "event_after",
+ G_CALLBACK(gtk_scrollbar_event_after), this);
+ g_signal_handler_block(m_scrollBar[dir], handler_id);
+
+ // these handlers get notified when scrollbar slider moves
+ g_signal_connect(m_scrollBar[dir], "value_changed",
+ G_CALLBACK(gtk_scrollbar_value_changed), this);
+ }