More tests in erase sample.
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
This commit is contained in:
@@ -31,6 +31,50 @@
|
||||
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)
|
||||
};
|
||||
|
@@ -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 );
|
||||
|
||||
|
@@ -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";
|
||||
|
@@ -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 );
|
||||
|
Reference in New Issue
Block a user