*/
while ( parent && !parent->IsTopLevel() )
{
- LONG exStyle = ::GetWindowLong(GetHwndOf(parent), GWL_EXSTYLE);
+ LONG exStyle = wxGetWindowExStyle(parent);
if ( !(exStyle & WS_EX_CONTROLPARENT) )
{
// force the parent to have this style
- ::SetWindowLong(GetHwndOf(parent), GWL_EXSTYLE,
- exStyle | WS_EX_CONTROLPARENT);
+ wxSetWindowExStyle(parent, exStyle | WS_EX_CONTROLPARENT);
}
parent = parent->GetParent();
if ( !s_pfnAnimateWindow )
return Show(show);
+ // Show() has a side effect of sending a WM_SIZE to the window, which helps
+ // ensuring that it's laid out correctly, but AnimateWindow() doesn't do
+ // this so send the event ourselves
+ SendSizeEvent();
+
// prepare to use AnimateWindow()
if ( !timeout )
HWND hWnd = GetHwnd();
if ( hWnd != 0 )
{
- WXHANDLE hFont = m_font.GetResourceHandle();
+ // note the use of GetFont() instead of m_font: our own font could have
+ // just been reset and in this case we need to change the font used by
+ // the native window to the default for this class, i.e. exactly what
+ // GetFont() returns
+ WXHANDLE hFont = GetFont().GetResourceHandle();
wxASSERT_MSG( hFont, wxT("should have valid font") );
#ifdef __WXWINCE__
wxUnusedVar(dir);
#else
- const HWND hwnd = GetHwnd();
- wxCHECK_RET( hwnd, _T("layout direction must be set after window creation") );
+ wxCHECK_RET( GetHwnd(),
+ _T("layout direction must be set after window creation") );
- LONG styleOld = ::GetWindowLong(hwnd, GWL_EXSTYLE);
+ LONG styleOld = wxGetWindowExStyle(this);
LONG styleNew = styleOld;
switch ( dir )
if ( styleNew != styleOld )
{
- ::SetWindowLong(hwnd, GWL_EXSTYLE, styleNew);
+ wxSetWindowExStyle(this, styleNew);
}
#endif
}
#ifdef __WXWINCE__
return wxLayout_Default;
#else
- const HWND hwnd = GetHwnd();
- wxCHECK_MSG( hwnd, wxLayout_Default, _T("invalid window") );
+ wxCHECK_MSG( GetHwnd(), wxLayout_Default, _T("invalid window") );
- return ::GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_LAYOUTRTL
- ? wxLayout_RightToLeft
- : wxLayout_LeftToRight;
+ return wxHasWindowExStyle(this, WS_EX_LAYOUTRTL) ? wxLayout_RightToLeft
+ : wxLayout_LeftToRight;
#endif
}
}
// and the extended style
- long exstyleReal = ::GetWindowLong(GetHwnd(), GWL_EXSTYLE);
+ long exstyleReal = wxGetWindowExStyle(this);
if ( exstyle != exstyleOld )
{
exstyleReal &= ~exstyleOld;
exstyleReal |= exstyle;
- ::SetWindowLong(GetHwnd(), GWL_EXSTYLE, exstyleReal);
+ wxSetWindowExStyle(this, exstyleReal);
// ex style changes don't take effect without calling SetWindowPos
callSWP = true;
::SetParent(hWndChild, hWndParent);
#ifndef __WXWINCE__
- if ( ::GetWindowLong(hWndChild, GWL_EXSTYLE) & WS_EX_CONTROLPARENT )
+ if ( wxHasWindowExStyle(this, WS_EX_CONTROLPARENT) )
{
EnsureParentHasControlParentStyle(GetParent());
}
{
wxWindow * const win = node->GetData();
if ( win->CanAcceptFocus() &&
- !(::GetWindowLong(GetHwndOf(win), GWL_EXSTYLE) &
- WS_EX_CONTROLPARENT) )
+ !wxHasWindowExStyle(win, WS_EX_CONTROLPARENT) )
{
// it shouldn't hang...
canSafelyCallIsDlgMsg = true;
bool wxWindowMSW::IsDoubleBuffered() const
{
- for ( const wxWindowMSW *wnd = this;
- wnd && !wnd->IsTopLevel(); wnd =
- wnd->GetParent() )
+ for ( const wxWindowMSW *win = this; win; win = win->GetParent() )
{
- if ( ::GetWindowLong(GetHwndOf(wnd), GWL_EXSTYLE) & WS_EX_COMPOSITED )
+ if ( wxHasWindowExStyle(win, WS_EX_COMPOSITED) )
return true;
+
+ if ( win->IsTopLevel() )
+ break;
}
return false;
}
+void wxWindowMSW::SetDoubleBuffered(bool on)
+{
+ // Get the current extended style bits
+ long exstyle = wxGetWindowExStyle(this);
+
+ // Twiddle the bit as needed
+ if ( on )
+ exstyle |= WS_EX_COMPOSITED;
+ else
+ exstyle &= ~WS_EX_COMPOSITED;
+
+ // put it back
+ wxSetWindowExStyle(this, exstyle);
+}
+
// ---------------------------------------------------------------------------
// owner drawn stuff
// ---------------------------------------------------------------------------
// coming from a control to wxEVT_COMMAND_MENU_SELECTED
if ( !control )
{
- // If no child window, it may be an accelerator, e.g. for a popup menu
- // command
-
- wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED);
+ wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED, id);
event.SetEventObject(this);
- event.SetId(id);
event.SetInt(id);
return HandleWindowEvent(event);
return wxNOT_FOUND;
}
-bool wxWindowMSW::HandleClipboardEvent( WXUINT nMsg )
+#endif // wxUSE_MENUS
+
+bool wxWindowMSW::HandleClipboardEvent(WXUINT nMsg)
{
- const wxEventType type = ( nMsg == WM_CUT ) ? wxEVT_COMMAND_TEXT_CUT :
- ( nMsg == WM_COPY ) ? wxEVT_COMMAND_TEXT_COPY :
- /*( nMsg == WM_PASTE ) ? */ wxEVT_COMMAND_TEXT_PASTE;
+ const wxEventType type = nMsg == WM_CUT ? wxEVT_COMMAND_TEXT_CUT
+ : nMsg == WM_COPY ? wxEVT_COMMAND_TEXT_COPY
+ : /* nMsg == WM_PASTE */ wxEVT_COMMAND_TEXT_PASTE;
wxClipboardTextEvent evt(type, GetId());
evt.SetEventObject(this);
return HandleWindowEvent(evt);
}
-#endif // wxUSE_MENUS
// ---------------------------------------------------------------------------
// joystick