#endif
#include "wx/msw/private.h"
+#include "wx/msw/dcclient.h"
#if wxUSE_TOOLTIPS
#include "wx/tooltip.h"
// ---------------------------------------------------------------------------
#if wxUSE_MENUS_NATIVE
-wxMenu *wxCurrentPopupMenu = NULL;
-#endif // wxUSE_MENUS_NATIVE
+extern wxMenu *wxCurrentPopupMenu;
+#endif
#ifdef __WXWINCE__
extern wxChar *wxCanvasClassName;
m_mouseInWindow = false;
m_lastKeydownProcessed = false;
- m_frozenness = 0;
-
m_hWnd = 0;
m_hDWP = 0;
static bool s_initDone = false;
if ( !s_initDone )
{
- wxLogNull noLog;
-
- wxDynamicLibrary dllUser32(_T("user32.dll"), wxDL_VERBATIM);
+ wxDynamicLibrary dllUser32(_T("user32.dll"), wxDL_VERBATIM | wxDL_QUIET);
wxDL_INIT_FUNC(s_pfn, AnimateWindow, dllUser32);
s_initDone = true;
#endif
}
-void wxWindowMSW::Freeze()
+void wxWindowMSW::DoFreeze()
{
- if ( !m_frozenness++ )
- {
- if ( IsShown() )
- SendSetRedraw(GetHwnd(), false);
- }
+ if ( IsShown() )
+ SendSetRedraw(GetHwnd(), false);
}
-void wxWindowMSW::Thaw()
+void wxWindowMSW::DoThaw()
{
- wxASSERT_MSG( m_frozenness > 0, _T("Thaw() without matching Freeze()") );
-
- if ( --m_frozenness == 0 )
+ if ( IsShown() )
{
- if ( IsShown() )
- {
- SendSetRedraw(GetHwnd(), true);
+ SendSetRedraw(GetHwnd(), true);
- // we need to refresh everything or otherwise the invalidated area
- // is not going to be repainted
- Refresh();
- }
+ // we need to refresh everything or otherwise the invalidated area
+ // is not going to be repainted
+ Refresh();
}
}
void wxWindowMSW::GetTextExtent(const wxString& string,
int *x, int *y,
int *descent, int *externalLeading,
- const wxFont *theFont) const
+ const wxFont *fontToUse) const
{
- wxASSERT_MSG( !theFont || theFont->Ok(),
+ wxASSERT_MSG( !fontToUse || fontToUse->Ok(),
_T("invalid font in GetTextExtent()") );
- wxFont fontToUse;
- if (theFont)
- fontToUse = *theFont;
+ HFONT hfontToUse;
+ if ( fontToUse )
+ hfontToUse = GetHfontOf(*fontToUse);
else
- fontToUse = GetFont();
+ hfontToUse = GetHfontOf(GetFont());
WindowHDC hdc(GetHwnd());
- SelectInHDC selectFont(hdc, GetHfontOf(fontToUse));
+ SelectInHDC selectFont(hdc, hfontToUse);
SIZE sizeRect;
TEXTMETRIC tm;
point.x = x;
point.y = y;
::ClientToScreen(hWnd, &point);
- wxCurrentPopupMenu = menu;
#if defined(__WXWINCE__)
static const UINT flags = 0;
#else // !__WXWINCE__
// for example) and so we do need to process the event immediately
wxYieldForCommandsOnly();
- wxCurrentPopupMenu = NULL;
-
menu->SetInvokingWindow(NULL);
return true;
wxUxThemeHandle hTheme((wxWindow *)this, L"EDIT");
RECT rcClient = { 0, 0, 0, 0 };
wxClientDC dc((wxWindow *)this);
+ wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl();
if (theme->GetThemeBackgroundContentRect(
- hTheme, GetHdcOf(dc), EP_EDITTEXT, ETS_NORMAL,
+ hTheme, GetHdcOf(*impl), EP_EDITTEXT, ETS_NORMAL,
&rect, &rcClient) == S_OK)
{
InflateRect(&rcClient, -1, -1);
wxUxThemeHandle hTheme((wxWindow *)this, L"EDIT");
wxWindowDC dc((wxWindow *)this);
+ wxMSWDCImpl *impl = (wxMSWDCImpl*) dc.GetImpl();
// Clip the DC so that you only draw on the non-client area
RECT rcBorder;
RECT rcClient;
theme->GetThemeBackgroundContentRect(
- hTheme, GetHdcOf(dc), EP_EDITTEXT, ETS_NORMAL, &rcBorder, &rcClient);
+ hTheme, GetHdcOf(*impl), EP_EDITTEXT, ETS_NORMAL, &rcBorder, &rcClient);
InflateRect(&rcClient, -1, -1);
- ::ExcludeClipRect(GetHdcOf(dc), rcClient.left, rcClient.top,
+ ::ExcludeClipRect(GetHdcOf(*impl), rcClient.left, rcClient.top,
rcClient.right, rcClient.bottom);
// Make sure the background is in a proper state
if (theme->IsThemeBackgroundPartiallyTransparent(hTheme, EP_EDITTEXT, ETS_NORMAL))
{
- theme->DrawThemeParentBackground(GetHwnd(), GetHdcOf(dc), &rcBorder);
+ theme->DrawThemeParentBackground(GetHwnd(), GetHdcOf(*impl), &rcBorder);
}
// Draw the border
// nState = ETS_READONLY;
else
nState = ETS_NORMAL;
- theme->DrawThemeBackground(hTheme, GetHdcOf(dc), EP_EDITTEXT, nState, &rcBorder, NULL);
+ theme->DrawThemeBackground(hTheme, GetHdcOf(*impl), EP_EDITTEXT, nState, &rcBorder, NULL);
}
}
break;
}
#endif // wxUSE_CARET
-#if wxUSE_TEXTCTRL
- // If it's a wxTextCtrl don't send the event as it will be done
- // after the control gets to process it from EN_FOCUS handler
- if ( wxDynamicCastThis(wxTextCtrl) )
- {
- return false;
- }
-#endif // wxUSE_TEXTCTRL
-
wxFocusEvent event(wxEVT_SET_FOCUS, m_windowId);
event.SetEventObject(this);
}
#endif // wxUSE_CARET
-#if wxUSE_TEXTCTRL
- // If it's a wxTextCtrl don't send the event as it will be done
- // after the control gets to process it.
- wxTextCtrl *ctrl = wxDynamicCastThis(wxTextCtrl);
- if ( ctrl )
- {
- return false;
- }
-#endif
-
// Don't send the event when in the process of being deleted. This can
// only cause problems if the event handler tries to access the object.
if ( m_isBeingDeleted )
#ifdef __WXUNIVERSAL__
event.Skip();
#else
- HDC hDC = (HDC) wxPaintDC::FindDCInCache((wxWindow*) event.GetEventObject());
+ HDC hDC = (HDC) wxPaintDCImpl::FindDCInCache((wxWindow*) event.GetEventObject());
if (hDC != 0)
{
MSWDefWindowProc(WM_PAINT, (WPARAM) hDC, 0);
bool wxWindowMSW::HandleEraseBkgnd(WXHDC hdc)
{
wxDCTemp dc(hdc, GetClientSize());
+ wxDCTempImpl *impl = (wxDCTempImpl*) dc.GetImpl();
- dc.SetHDC(hdc);
- dc.SetWindow((wxWindow *)this);
+ impl->SetHDC(hdc);
+ impl->SetWindow((wxWindow *)this);
wxEraseEvent event(m_windowId, &dc);
event.SetEventObject(this);
bool rc = HandleWindowEvent(event);
// must be called manually as ~wxDC doesn't do anything for wxDCTemp
- dc.SelectOldObjects(hdc);
+ impl->SelectOldObjects(hdc);
return rc;
}
return;
}
+ wxDC *dc = event.GetDC();
+ if (!dc) return;
+ wxMSWDCImpl *impl = (wxMSWDCImpl*) dc->GetImpl();
// do default background painting
- if ( !DoEraseBackground(GetHdcOf(*event.GetDC())) )
+ if ( !DoEraseBackground(GetHdcOf(*impl)) )
{
// let the system paint the background
event.Skip();
break;
default:
- if ( isVirtual )
- *isVirtual = false;
- vk = (WXWORD)wxk;
- break;
+ // check to see if its one of the OEM key codes.
+ BYTE vks = LOBYTE(VkKeyScan(wxk));
+ if ( vks != 0xff )
+ {
+ vk = vks;
+ }
+ else
+ {
+ if ( isVirtual )
+ *isVirtual = false;
+ vk = (WXWORD)wxk;
+ }
}
return vk;