From 84efdbf195e14d0104a3c79040afffe29c167af0 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Sat, 12 Sep 1998 20:38:55 +0000 Subject: [PATCH] Next try at removing the dancing sliders git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@733 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/scrolbar.cpp | 6 +++--- src/gtk/slider.cpp | 2 +- src/gtk/window.cpp | 12 +++++++++--- src/gtk1/scrolbar.cpp | 6 +++--- src/gtk1/slider.cpp | 2 +- src/gtk1/window.cpp | 12 +++++++++--- 6 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/gtk/scrolbar.cpp b/src/gtk/scrolbar.cpp index c8bc130f5c..98a3d091bc 100644 --- a/src/gtk/scrolbar.cpp +++ b/src/gtk/scrolbar.cpp @@ -48,7 +48,7 @@ static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *wi int value = (int)(win->m_adjust->value+0.5); int orient = wxHORIZONTAL; - if (win->GetWindowStyleFlag() & wxSB_VERTICAL == wxSB_VERTICAL) orient = wxHORIZONTAL; + if (win->GetWindowStyleFlag() & wxSB_VERTICAL == wxSB_VERTICAL) orient = wxVERTICAL; wxScrollEvent event( command, win->GetId(), value, orient ); event.SetEventObject( win ); @@ -180,14 +180,14 @@ void wxScrollBar::SetScrollbar( int position, int thumbSize, int range, int page SetPosition( position ); return; } - + m_oldPos = fpos; m_adjust->lower = 0.0; m_adjust->upper = frange; m_adjust->value = fpos; m_adjust->step_increment = 1.0; - m_adjust->page_increment = (float)(wxMax(fpage-2,0)); + m_adjust->page_increment = (float)(wxMax(fpage,0)); m_adjust->page_size = fthumb; gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" ); diff --git a/src/gtk/slider.cpp b/src/gtk/slider.cpp index e9997178d2..3f2b9b84f8 100644 --- a/src/gtk/slider.cpp +++ b/src/gtk/slider.cpp @@ -48,7 +48,7 @@ static void gtk_slider_callback( GtkWidget *WXUNUSED(widget), wxSlider *win ) int value = (int)(win->m_adjust->value+0.5); int orient = wxHORIZONTAL; - if (win->GetWindowStyleFlag() & wxSB_VERTICAL == wxSB_VERTICAL) orient = wxHORIZONTAL; + if (win->GetWindowStyleFlag() & wxSB_VERTICAL == wxSB_VERTICAL) orient = wxVERTICAL; wxScrollEvent event( command, win->GetId(), value, orient ); event.SetEventObject( win ); diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 3633598be7..e382126ada 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -806,7 +806,7 @@ static void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxW static gint gtk_scrollbar_button_press_callback( GtkRange *widget, GdkEventButton *gdk_event, wxWindow *win ) { if (gdk_event->window != widget->slider) return FALSE; - + win->m_isScrolling = TRUE; return FALSE; @@ -930,6 +930,12 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id, gtk_signal_connect( GTK_OBJECT(s_window->vscrollbar), "button_press_event", (GtkSignalFunc)gtk_scrollbar_button_press_callback, (gpointer) this ); + gtk_signal_connect( GTK_OBJECT(s_window->hscrollbar), "button_press_event", + (GtkSignalFunc)gtk_scrollbar_button_press_callback, (gpointer) this ); + + gtk_signal_connect( GTK_OBJECT(s_window->vscrollbar), "button_release_event", + (GtkSignalFunc)gtk_scrollbar_button_release_callback, (gpointer) this ); + gtk_signal_connect( GTK_OBJECT(s_window->hscrollbar), "button_release_event", (GtkSignalFunc)gtk_scrollbar_button_release_callback, (gpointer) this ); @@ -2264,7 +2270,7 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible, m_hAdjust->upper = frange; m_hAdjust->value = fpos; m_hAdjust->step_increment = 1.0; - m_hAdjust->page_increment = (float)(wxMax(fthumb-2,0)); + m_hAdjust->page_increment = (float)(wxMax(fthumb,0)); m_hAdjust->page_size = fthumb; } else @@ -2286,7 +2292,7 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible, m_vAdjust->upper = frange; m_vAdjust->value = fpos; m_vAdjust->step_increment = 1.0; - m_vAdjust->page_increment = (float)(wxMax(fthumb-2,0)); + m_vAdjust->page_increment = (float)(wxMax(fthumb,0)); m_vAdjust->page_size = fthumb; } diff --git a/src/gtk1/scrolbar.cpp b/src/gtk1/scrolbar.cpp index c8bc130f5c..98a3d091bc 100644 --- a/src/gtk1/scrolbar.cpp +++ b/src/gtk1/scrolbar.cpp @@ -48,7 +48,7 @@ static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *wi int value = (int)(win->m_adjust->value+0.5); int orient = wxHORIZONTAL; - if (win->GetWindowStyleFlag() & wxSB_VERTICAL == wxSB_VERTICAL) orient = wxHORIZONTAL; + if (win->GetWindowStyleFlag() & wxSB_VERTICAL == wxSB_VERTICAL) orient = wxVERTICAL; wxScrollEvent event( command, win->GetId(), value, orient ); event.SetEventObject( win ); @@ -180,14 +180,14 @@ void wxScrollBar::SetScrollbar( int position, int thumbSize, int range, int page SetPosition( position ); return; } - + m_oldPos = fpos; m_adjust->lower = 0.0; m_adjust->upper = frange; m_adjust->value = fpos; m_adjust->step_increment = 1.0; - m_adjust->page_increment = (float)(wxMax(fpage-2,0)); + m_adjust->page_increment = (float)(wxMax(fpage,0)); m_adjust->page_size = fthumb; gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" ); diff --git a/src/gtk1/slider.cpp b/src/gtk1/slider.cpp index e9997178d2..3f2b9b84f8 100644 --- a/src/gtk1/slider.cpp +++ b/src/gtk1/slider.cpp @@ -48,7 +48,7 @@ static void gtk_slider_callback( GtkWidget *WXUNUSED(widget), wxSlider *win ) int value = (int)(win->m_adjust->value+0.5); int orient = wxHORIZONTAL; - if (win->GetWindowStyleFlag() & wxSB_VERTICAL == wxSB_VERTICAL) orient = wxHORIZONTAL; + if (win->GetWindowStyleFlag() & wxSB_VERTICAL == wxSB_VERTICAL) orient = wxVERTICAL; wxScrollEvent event( command, win->GetId(), value, orient ); event.SetEventObject( win ); diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 3633598be7..e382126ada 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -806,7 +806,7 @@ static void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxW static gint gtk_scrollbar_button_press_callback( GtkRange *widget, GdkEventButton *gdk_event, wxWindow *win ) { if (gdk_event->window != widget->slider) return FALSE; - + win->m_isScrolling = TRUE; return FALSE; @@ -930,6 +930,12 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id, gtk_signal_connect( GTK_OBJECT(s_window->vscrollbar), "button_press_event", (GtkSignalFunc)gtk_scrollbar_button_press_callback, (gpointer) this ); + gtk_signal_connect( GTK_OBJECT(s_window->hscrollbar), "button_press_event", + (GtkSignalFunc)gtk_scrollbar_button_press_callback, (gpointer) this ); + + gtk_signal_connect( GTK_OBJECT(s_window->vscrollbar), "button_release_event", + (GtkSignalFunc)gtk_scrollbar_button_release_callback, (gpointer) this ); + gtk_signal_connect( GTK_OBJECT(s_window->hscrollbar), "button_release_event", (GtkSignalFunc)gtk_scrollbar_button_release_callback, (gpointer) this ); @@ -2264,7 +2270,7 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible, m_hAdjust->upper = frange; m_hAdjust->value = fpos; m_hAdjust->step_increment = 1.0; - m_hAdjust->page_increment = (float)(wxMax(fthumb-2,0)); + m_hAdjust->page_increment = (float)(wxMax(fthumb,0)); m_hAdjust->page_size = fthumb; } else @@ -2286,7 +2292,7 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible, m_vAdjust->upper = frange; m_vAdjust->value = fpos; m_vAdjust->step_increment = 1.0; - m_vAdjust->page_increment = (float)(wxMax(fthumb-2,0)); + m_vAdjust->page_increment = (float)(wxMax(fthumb,0)); m_vAdjust->page_size = fthumb; } -- 2.45.2