]> git.saurik.com Git - wxWidgets.git/commitdiff
More tests in erase sample.
authorRobert Roebling <robert@roebling.de>
Sun, 24 Feb 2002 11:06:55 +0000 (11:06 +0000)
committerRobert Roebling <robert@roebling.de>
Sun, 24 Feb 2002 11:06:55 +0000 (11:06 +0000)
  Added wxControlStr to data.cpp.
  Fixed scrolling for window with a border. The
    area which was copied was off by the border
    width sometimes.
  Added two more AddTool() variants to wxToolBar
    when used with universal. It compiles now,
    but doesn't work...

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

include/wx/toolbar.h
samples/erase/erase.cpp
src/x11/data.cpp
src/x11/window.cpp

index e7872223aa5b6d9f0c21deec32dbf3ccd8fe2ea7..ab920c591a6e16b367cbf6ff2ba2d13fc3e5620c 100644 (file)
                       const wxString& name = wxToolBarNameStr)
                 : wxToolBarSimple(parent, id, pos, size, style, name) { }
 
+            // the most commonly used version of AddTool()
+            wxToolBarToolBase *AddTool(int id,
+                               const wxBitmap& bitmap,
+                               const wxString& shortHelpString = wxEmptyString,
+                               const wxString& longHelpString = wxEmptyString)
+            {
+                return wxToolBarSimple::AddTool(id, bitmap, wxNullBitmap, FALSE, -1, -1, NULL,
+                       shortHelpString, longHelpString);
+            }
+            
+            // old form
+            wxToolBarToolBase *AddTool
+                               (
+                                   int id,
+                                   const wxBitmap& bitmap,
+                                   const wxBitmap& pushedBitmap,
+                                   bool toggle,
+                                   wxObject *clientData = NULL,
+                                   const wxString& shortHelpString = wxEmptyString,
+                                   const wxString& longHelpString = wxEmptyString
+                               )
+            {
+                return wxToolBarSimple::AddTool(id, bitmap, pushedBitmap, toggle, -1, -1, clientData,
+                       shortHelpString, longHelpString);
+            }
+            
+            // virtual overridden
+            virtual wxToolBarToolBase *AddTool
+                               (
+                                   int id,
+                                   const wxBitmap& bitmap,
+                                   const wxBitmap& pushedBitmap,
+                                   bool toggle,
+                                   wxCoord xPos,
+                                   wxCoord yPos = -1,
+                                   wxObject *clientData = NULL,
+                                   const wxString& shortHelpString = wxEmptyString,
+                                   const wxString& longHelpString = wxEmptyString
+                               )
+            {
+                return wxToolBarSimple::AddTool(id, bitmap, pushedBitmap, toggle, xPos, yPos, clientData,
+                       shortHelpString, longHelpString);
+            }
+            
         private:
             DECLARE_DYNAMIC_CLASS(wxToolBar)
         };
index f25a7927394886ccc6073af133a04c147e7f0b27..54c6dfbbbceed09965231ebf0b78b761136706f7 100644 (file)
@@ -171,7 +171,7 @@ END_EVENT_TABLE()
 
 MyCanvas::MyCanvas( MyFrame *parent )
  : wxScrolledWindow( parent, -1, wxDefaultPosition, wxDefaultSize, 
-                    wxScrolledWindowStyle|wxNO_FULL_REPAINT_ON_RESIZE )
+                    wxScrolledWindowStyle|wxNO_FULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER )
 {
     SetScrollbars( 10, 10, 40, 100, 0, 0 );
 }
@@ -180,6 +180,17 @@ void MyCanvas::OnPaint( wxPaintEvent &event )
 {
     wxPaintDC dc(this);
     PrepareDC( dc );
+        
+    wxRegionIterator upd( GetUpdateRegion() );
+    while (upd)
+    {
+        wxLogDebug( "Paint: %d %d %d %d", upd.GetX(), upd.GetY(), upd.GetWidth(), upd.GetHeight() );
+        upd ++;
+    }
+    
+    dc.SetPen( *wxWHITE_PEN );
+    for (int i = 0; i < 20; i += 2)
+       dc.DrawLine( i,i, i+100,i );
     
     wxRegion region( 110, 110, 80, 80 );
     wxRegion hole( 130, 130, 40, 1 );
@@ -189,7 +200,7 @@ void MyCanvas::OnPaint( wxPaintEvent &event )
     dc.SetBrush( *wxRED_BRUSH );
     dc.DrawRectangle( 100, 100, 200, 200 );
     
-    dc.DestroyClipingRegion();
+    dc.DestroyClippingRegion();
 
     dc.SetPen( *wxTRANSPARENT_PEN );
     
index b094b7389edfb5593e0acc0536bdedb42f43a98d..3cbdf91ef430ae406a549f14accd8e7c4fed4fa0 100644 (file)
@@ -86,6 +86,7 @@ wxFont   wxNullFont;
 wxColour wxNullColour;
 
 // Default window names
+const char *wxControlNameStr = "control";
 const char *wxButtonNameStr = "button";
 const char *wxCanvasNameStr = "canvas";
 const char *wxCheckBoxNameStr = "check";
@@ -113,9 +114,6 @@ const char *wxButtonBarNameStr = "buttonbar";
 const char *wxEnhDialogNameStr = "Shell";
 const char *wxToolBarNameStr = "toolbar";
 const char *wxStatusLineNameStr = "status_line";
-#if 0  // this is defined in string.cpp
-const char *wxEmptyString = "";
-#endif
 const char *wxGetTextFromUserPromptStr = "Input Text";
 const char *wxMessageBoxCaptionStr = "Message";
 const char *wxFileSelectorPromptStr = "Select a file";
index ba61bd393903be355631335f2f4476b3a4ab5c55..05a8a767f9fa662f7cf4ba53c43d4815f65b949d 100644 (file)
@@ -479,7 +479,7 @@ bool wxWindowX11::SetCursor(const wxCursor& cursor)
 
     Cursor xcursor = (Cursor) cursorToUse.GetCursor();
 
-    XDefineCursor( (Display*) wxGlobalDisplay(), xwindow, xcursor );
+    XDefineCursor( wxGlobalDisplay(), xwindow, xcursor );
 
     return TRUE;
 }
@@ -529,14 +529,15 @@ void wxWindowX11::ScrollWindow(int dx, int dy, const wxRect *rect)
     GC xgc = XCreateGC( xdisplay, xwindow, 0, NULL );
     XSetGraphicsExposures( xdisplay, xgc, True );
 
-    int s_x;
-    int s_y;
+    int s_x = 0;
+    int s_y = 0;
     int cw;
     int ch;
     if (rect)
     {
         s_x = rect->x;
         s_y = rect->y;
+        
         cw = rect->width;
         ch = rect->height;
     }
@@ -550,7 +551,7 @@ void wxWindowX11::ScrollWindow(int dx, int dy, const wxRect *rect)
     wxPoint offset = GetClientAreaOrigin();
     s_x += offset.x;
     s_y += offset.y;
-
+        
     int w = cw - abs(dx);
     int h = ch - abs(dy);
         
@@ -568,16 +569,17 @@ void wxWindowX11::ScrollWindow(int dx, int dy, const wxRect *rect)
     
         int d_x = s_x;
         int d_y = s_y;
+        
         if (dx < 0) s_x += -dx;
         if (dy < 0) s_y += -dy;
-        if (dx > 0) d_x = dx;
-        if (dy > 0) d_y = dy;
+        if (dx > 0) d_x = dx + offset.x;
+        if (dy > 0) d_y = dy + offset.y;
 
         XCopyArea( xdisplay, xwindow, xwindow, xgc, s_x, s_y, w, h, d_x, d_y );
         
-        // printf( "s_x %d s_y %d w %d h %d d_x %d d_y %d\n", s_x, s_y, w, h, d_x, d_y );
+        // wxLogDebug( "Copy: s_x %d s_y %d w %d h %d d_x %d d_y %d", s_x, s_y, w, h, d_x, d_y );
 
-        // printf( "rect %d %d %d %d\n", rect.x, rect.y, rect.width, rect.height );
+        // wxLogDebug( "Update: %d %d %d %d", rect.x, rect.y, rect.width, rect.height );
 
         m_updateRegion.Union( rect );
         m_clearRegion.Union( rect );