]> git.saurik.com Git - wxWidgets.git/commitdiff
Added support for SCROLL_TOP and _BOTTOM events
authorRobert Roebling <robert@roebling.de>
Wed, 18 Nov 1998 17:37:48 +0000 (17:37 +0000)
committerRobert Roebling <robert@roebling.de>
Wed, 18 Nov 1998 17:37:48 +0000 (17:37 +0000)
  Corrected behaviour for Blit with LogicalFunctions

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1012 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/dcclient.cpp
src/gtk/scrolbar.cpp
src/gtk/slider.cpp
src/gtk/window.cpp
src/gtk1/dcclient.cpp
src/gtk1/scrolbar.cpp
src/gtk1/slider.cpp
src/gtk1/window.cpp

index 0d0d479bf7d6b3961637564e68412b4a8dfee4a9..452f2bde090ed72703f1084b73550dd91915f785 100644 (file)
@@ -868,6 +868,7 @@ void wxPaintDC::SetLogicalFunction( int function )
     m_logicalFunction = function;
     gdk_gc_set_function( m_penGC, mode );
     gdk_gc_set_function( m_brushGC, mode );
+    gdk_gc_set_function( m_textGC, mode );
 }
 
 void wxPaintDC::SetTextForeground( const wxColour &col )
index 49cee3a201400f0831935f0aaa138c4609726767..312985e972cdc0cece952e6a6743e6bf90bd28fa 100644 (file)
@@ -39,7 +39,9 @@ static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *wi
   float line_step = win->m_adjust->step_increment;
   float page_step = win->m_adjust->page_increment;
   
-  if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
+  if (fabs(win->m_adjust->value-win->m_adjust->lower) < 0.2) command = wxEVT_SCROLL_BOTTOM;
+  else if (fabs(win->m_adjust->value-win->m_adjust->upper) < 0.2) command = wxEVT_SCROLL_TOP;
+  else if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
   else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP;
   else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN;
   else if (fabs(diff+page_step) < 0.2) command = wxEVT_SCROLL_PAGEUP;
index d1532a77026410976aaa003e4f8a197aaeb26146..d94ac244defafcb8b58764ab6142e6baa2c36506 100644 (file)
@@ -38,7 +38,9 @@ static void gtk_slider_callback( GtkWidget *WXUNUSED(widget), wxSlider *win )
   float line_step = win->m_adjust->step_increment;
   float page_step = win->m_adjust->page_increment;
   
-  if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
+  if (fabs(win->m_adjust->value-win->m_adjust->lower) < 0.2) command = wxEVT_SCROLL_BOTTOM;
+  else if (fabs(win->m_adjust->value-win->m_adjust->upper) < 0.2) command = wxEVT_SCROLL_TOP;
+  else if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
   else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP;
   else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN;
   else if (fabs(diff+page_step) < 0.2) command = wxEVT_SCROLL_PAGEUP;
index 6da95fff04c8967a783dd110217cd7eb36a95a44..451e4313fdc1b41e17ac8b16744a987ce2bde7ab 100644 (file)
@@ -26,6 +26,7 @@
 #include "wx/menu.h"
 #include "wx/statusbr.h"
 #include "wx/intl.h"
+#include "wx/settings.h"
 #include "gdk/gdkprivate.h"
 #include "gdk/gdkkeysyms.h"
 
@@ -713,7 +714,9 @@ static void gtk_window_vscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *
     float line_step = win->m_vAdjust->step_increment;
     float page_step = win->m_vAdjust->page_increment;
 
-    if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
+    if (fabs(win->m_vAdjust->value-win->m_vAdjust->lower) < 0.2) command = wxEVT_SCROLL_BOTTOM;
+    else if (fabs(win->m_vAdjust->value-win->m_vAdjust->upper) < 0.2) command = wxEVT_SCROLL_TOP;
+    else if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
     else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP;
     else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN;
     else if (fabs(diff+page_step) < 0.2) command = wxEVT_SCROLL_PAGEUP;
@@ -750,8 +753,10 @@ static void gtk_window_hscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *
 
     float line_step = win->m_hAdjust->step_increment;
     float page_step = win->m_hAdjust->page_increment;
-
-    if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
+    
+    if (fabs(win->m_hAdjust->value-win->m_hAdjust->lower) < 0.2) command = wxEVT_SCROLL_BOTTOM;
+    else if (fabs(win->m_hAdjust->value-win->m_hAdjust->upper) < 0.2) command = wxEVT_SCROLL_TOP;
+    else if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
     else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP;
     else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN;
     else if (fabs(diff+page_step) < 0.2) command = wxEVT_SCROLL_PAGEUP;
@@ -2002,47 +2007,54 @@ bool wxWindow::IsExposed( const wxRect& rect ) const
 
 void wxWindow::Clear()
 {
-  wxCHECK_RET( m_widget != NULL, "invalid window" );
+    wxCHECK_RET( m_widget != NULL, "invalid window" );
 
-  if (m_wxwindow && m_wxwindow->window) gdk_window_clear( m_wxwindow->window );
+    if (m_wxwindow && m_wxwindow->window) gdk_window_clear( m_wxwindow->window );
 }
 
 wxColour wxWindow::GetBackgroundColour() const
 {
-  return m_backgroundColour;
+    return m_backgroundColour;
 }
 
 void wxWindow::SetBackgroundColour( const wxColour &colour )
 {
-  wxCHECK_RET( m_widget != NULL, "invalid window" );
+    wxCHECK_RET( m_widget != NULL, "invalid window" );
 
-  m_backgroundColour = colour;
-  if (!m_backgroundColour.Ok()) return;
+    if (m_backgroundColour == colour) return;
+    
+    if (!m_backgroundColour.Ok())
+        if (wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ) == colour) return;
   
-  if (m_wxwindow)
-  {
-    GdkWindow *window = m_wxwindow->window;
-    m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
-    gdk_window_set_background( window, m_backgroundColour.GetColor() );
-    gdk_window_clear( window );
-  }
+    m_backgroundColour = colour;
+    if (!m_backgroundColour.Ok()) return;
   
-  ApplyWidgetStyle();
+    if (m_wxwindow)
+    {
+        GdkWindow *window = m_wxwindow->window;
+        m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
+        gdk_window_set_background( window, m_backgroundColour.GetColor() );
+        gdk_window_clear( window );
+    }
+  
+    ApplyWidgetStyle();
 }
 
 wxColour wxWindow::GetForegroundColour() const
 {
-  return m_foregroundColour;
+    return m_foregroundColour;
 }
 
 void wxWindow::SetForegroundColour( const wxColour &colour )
 {
-  wxCHECK_RET( m_widget != NULL, "invalid window" );
+    wxCHECK_RET( m_widget != NULL, "invalid window" );
 
-  m_foregroundColour = colour;
-  if (!m_foregroundColour.Ok()) return;
+    if (m_foregroundColour == colour) return;
   
-  ApplyWidgetStyle();
+    m_foregroundColour = colour;
+    if (!m_foregroundColour.Ok()) return;
+  
+    ApplyWidgetStyle();
 }
 
 GtkStyle *wxWindow::GetWidgetStyle()
index 0d0d479bf7d6b3961637564e68412b4a8dfee4a9..452f2bde090ed72703f1084b73550dd91915f785 100644 (file)
@@ -868,6 +868,7 @@ void wxPaintDC::SetLogicalFunction( int function )
     m_logicalFunction = function;
     gdk_gc_set_function( m_penGC, mode );
     gdk_gc_set_function( m_brushGC, mode );
+    gdk_gc_set_function( m_textGC, mode );
 }
 
 void wxPaintDC::SetTextForeground( const wxColour &col )
index 49cee3a201400f0831935f0aaa138c4609726767..312985e972cdc0cece952e6a6743e6bf90bd28fa 100644 (file)
@@ -39,7 +39,9 @@ static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *wi
   float line_step = win->m_adjust->step_increment;
   float page_step = win->m_adjust->page_increment;
   
-  if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
+  if (fabs(win->m_adjust->value-win->m_adjust->lower) < 0.2) command = wxEVT_SCROLL_BOTTOM;
+  else if (fabs(win->m_adjust->value-win->m_adjust->upper) < 0.2) command = wxEVT_SCROLL_TOP;
+  else if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
   else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP;
   else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN;
   else if (fabs(diff+page_step) < 0.2) command = wxEVT_SCROLL_PAGEUP;
index d1532a77026410976aaa003e4f8a197aaeb26146..d94ac244defafcb8b58764ab6142e6baa2c36506 100644 (file)
@@ -38,7 +38,9 @@ static void gtk_slider_callback( GtkWidget *WXUNUSED(widget), wxSlider *win )
   float line_step = win->m_adjust->step_increment;
   float page_step = win->m_adjust->page_increment;
   
-  if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
+  if (fabs(win->m_adjust->value-win->m_adjust->lower) < 0.2) command = wxEVT_SCROLL_BOTTOM;
+  else if (fabs(win->m_adjust->value-win->m_adjust->upper) < 0.2) command = wxEVT_SCROLL_TOP;
+  else if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
   else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP;
   else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN;
   else if (fabs(diff+page_step) < 0.2) command = wxEVT_SCROLL_PAGEUP;
index 6da95fff04c8967a783dd110217cd7eb36a95a44..451e4313fdc1b41e17ac8b16744a987ce2bde7ab 100644 (file)
@@ -26,6 +26,7 @@
 #include "wx/menu.h"
 #include "wx/statusbr.h"
 #include "wx/intl.h"
+#include "wx/settings.h"
 #include "gdk/gdkprivate.h"
 #include "gdk/gdkkeysyms.h"
 
@@ -713,7 +714,9 @@ static void gtk_window_vscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *
     float line_step = win->m_vAdjust->step_increment;
     float page_step = win->m_vAdjust->page_increment;
 
-    if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
+    if (fabs(win->m_vAdjust->value-win->m_vAdjust->lower) < 0.2) command = wxEVT_SCROLL_BOTTOM;
+    else if (fabs(win->m_vAdjust->value-win->m_vAdjust->upper) < 0.2) command = wxEVT_SCROLL_TOP;
+    else if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
     else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP;
     else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN;
     else if (fabs(diff+page_step) < 0.2) command = wxEVT_SCROLL_PAGEUP;
@@ -750,8 +753,10 @@ static void gtk_window_hscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *
 
     float line_step = win->m_hAdjust->step_increment;
     float page_step = win->m_hAdjust->page_increment;
-
-    if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
+    
+    if (fabs(win->m_hAdjust->value-win->m_hAdjust->lower) < 0.2) command = wxEVT_SCROLL_BOTTOM;
+    else if (fabs(win->m_hAdjust->value-win->m_hAdjust->upper) < 0.2) command = wxEVT_SCROLL_TOP;
+    else if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
     else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP;
     else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN;
     else if (fabs(diff+page_step) < 0.2) command = wxEVT_SCROLL_PAGEUP;
@@ -2002,47 +2007,54 @@ bool wxWindow::IsExposed( const wxRect& rect ) const
 
 void wxWindow::Clear()
 {
-  wxCHECK_RET( m_widget != NULL, "invalid window" );
+    wxCHECK_RET( m_widget != NULL, "invalid window" );
 
-  if (m_wxwindow && m_wxwindow->window) gdk_window_clear( m_wxwindow->window );
+    if (m_wxwindow && m_wxwindow->window) gdk_window_clear( m_wxwindow->window );
 }
 
 wxColour wxWindow::GetBackgroundColour() const
 {
-  return m_backgroundColour;
+    return m_backgroundColour;
 }
 
 void wxWindow::SetBackgroundColour( const wxColour &colour )
 {
-  wxCHECK_RET( m_widget != NULL, "invalid window" );
+    wxCHECK_RET( m_widget != NULL, "invalid window" );
 
-  m_backgroundColour = colour;
-  if (!m_backgroundColour.Ok()) return;
+    if (m_backgroundColour == colour) return;
+    
+    if (!m_backgroundColour.Ok())
+        if (wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ) == colour) return;
   
-  if (m_wxwindow)
-  {
-    GdkWindow *window = m_wxwindow->window;
-    m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
-    gdk_window_set_background( window, m_backgroundColour.GetColor() );
-    gdk_window_clear( window );
-  }
+    m_backgroundColour = colour;
+    if (!m_backgroundColour.Ok()) return;
   
-  ApplyWidgetStyle();
+    if (m_wxwindow)
+    {
+        GdkWindow *window = m_wxwindow->window;
+        m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
+        gdk_window_set_background( window, m_backgroundColour.GetColor() );
+        gdk_window_clear( window );
+    }
+  
+    ApplyWidgetStyle();
 }
 
 wxColour wxWindow::GetForegroundColour() const
 {
-  return m_foregroundColour;
+    return m_foregroundColour;
 }
 
 void wxWindow::SetForegroundColour( const wxColour &colour )
 {
-  wxCHECK_RET( m_widget != NULL, "invalid window" );
+    wxCHECK_RET( m_widget != NULL, "invalid window" );
 
-  m_foregroundColour = colour;
-  if (!m_foregroundColour.Ok()) return;
+    if (m_foregroundColour == colour) return;
   
-  ApplyWidgetStyle();
+    m_foregroundColour = colour;
+    if (!m_foregroundColour.Ok()) return;
+  
+    ApplyWidgetStyle();
 }
 
 GtkStyle *wxWindow::GetWidgetStyle()