info.nMax = range - 1; // as both nMax and nMax are inclusive
info.nPos = pos;
- // enable the scrollbar if it had been disabled before by specifying
- // SIF_DISABLENOSCROLL below: as we can't know whether this had been
- // done or not just do it always
- ::EnableScrollBar(hwnd, WXOrientToSB(orient), ESB_ENABLE_BOTH);
+ // We normally also reenable scrollbar in case it had been previously
+ // disabled by specifying SIF_DISABLENOSCROLL below but we should only
+ // do this if it has valid range, otherwise it would be enabled but not
+ // do anything.
+ if ( range >= pageSize )
+ {
+ ::EnableScrollBar(hwnd, WXOrientToSB(orient), ESB_ENABLE_BOTH);
+ }
}
//else: leave all the fields to be 0
wxWindow * const parent = GetParent();
wxPoint pos;
+#if wxUSE_DEFERRED_SIZING
if ( m_pendingPosition != wxDefaultPosition )
{
pos = m_pendingPosition;
}
else // use current position
+#endif // wxUSE_DEFERRED_SIZING
{
RECT rect = wxGetWindowRect(GetHwnd());
// trace all messages: useful for the debugging but noticeably slows down
// the code so don't do it by default
#if wxDEBUG_LEVEL >= 2
+ // notice that we cast wParam and lParam to long to avoid mismatch with
+ // format specifiers in 64 bit builds where they are both int64 quantities
+ //
+ // casting like this loses information, of course, but it shouldn't matter
+ // much for this diagnostic code and it keeps the code simple
wxLogTrace("winmsg",
wxT("Processing %s(hWnd=%p, wParam=%08lx, lParam=%08lx)"),
- wxGetMessageName(message), hWnd, (long)wParam, lParam);
+ wxGetMessageName(message), hWnd, (long)wParam, (long)lParam);
#endif // wxDEBUG_LEVEL >= 2
wxWindowMSW *wnd = wxFindWinFromHandle(hWnd);
{
m_dropTarget->Revoke(m_hWnd);
- delete m_dropTarget;
- m_dropTarget = NULL;
+ wxDELETE(m_dropTarget);
}
#endif // wxUSE_DRAG_AND_DROP
}
WXHBRUSH
-wxWindowMSW::MSWGetBgBrushForChild(WXHDC WXUNUSED(hDC), wxWindowMSW *child)
+wxWindowMSW::MSWGetBgBrushForChild(WXHDC WXUNUSED(hDC),
+ wxWindowMSW * WXUNUSED(child))
{
if ( m_hasBgCol )
{
- // our background colour applies to:
- // 1. this window itself, always
- // 2. all children unless the colour is "not inheritable"
- // 3. even if it is not inheritable, our immediate transparent
- // children should still inherit it -- but not any transparent
- // children because it would look wrong if a child of non
- // transparent child would show our bg colour when the child itself
- // does not
- if ( child == this ||
- m_inheritBgCol ||
- (child->HasTransparentBackground() &&
- child->GetParent() == this) )
- {
- // draw children with the same colour as the parent
- wxBrush *
- brush = wxTheBrushList->FindOrCreateBrush(GetBackgroundColour());
+ wxBrush *
+ brush = wxTheBrushList->FindOrCreateBrush(GetBackgroundColour());
- return (WXHBRUSH)GetHbrushOf(*brush);
- }
+ return (WXHBRUSH)GetHbrushOf(*brush);
}
return 0;
}
-WXHBRUSH wxWindowMSW::MSWGetBgBrush(WXHDC hDC, wxWindowMSW *child)
+WXHBRUSH wxWindowMSW::MSWGetBgBrush(WXHDC hDC)
{
for ( wxWindowMSW *win = this; win; win = win->GetParent() )
{
- WXHBRUSH hBrush = win->MSWGetBgBrushForChild(hDC, child);
+ WXHBRUSH hBrush = win->MSWGetBgBrushForChild(hDC, this);
if ( hBrush )
return hBrush;
+ // don't use the parent background if we're not transparent
+ if ( !win->HasTransparentBackground() )
+ break;
+
// background is not inherited beyond top level windows
if ( win->IsTopLevel() )
break;
// menu creation code
wxMenuItem *item = (wxMenuItem*)mii.dwItemData;
- const wxChar *p = wxStrchr(item->GetItemLabel().wx_str(), wxT('&'));
+ const wxString label(item->GetItemLabel());
+ const wxChar *p = wxStrchr(label.wx_str(), wxT('&'));
while ( p++ )
{
if ( *p == wxT('&') )