LONG APIENTRY _EXPORT
wxDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
-// ----------------------------------------------------------------------------
-// globals
-// ----------------------------------------------------------------------------
-
-// the name of the default wxWidgets class
-#ifdef __WXWINCE__
-extern wxChar *wxCanvasClassName;
-#else
-extern const wxChar *wxCanvasClassName;
-#endif
-
// ----------------------------------------------------------------------------
// wxTLWHiddenParentModule: used to manage the hidden parent window (we need a
// module to ensure that the window is always deleted)
m_fsIsMaximized = false;
m_fsIsShowing = false;
- m_winLastFocused = (wxWindow *)NULL;
+ m_winLastFocused = NULL;
#if defined(__SMARTPHONE__) && defined(__WXWINCE__)
m_MenuBarHWND = 0;
exflags |= WS_EX_LAYOUTRTL;
#endif
- return MSWCreate(wxCanvasClassName, title.wx_str(), pos, sz, flags, exflags);
+ return MSWCreate(MSWGetRegisteredClassName(),
+ title.wx_str(), pos, sz, flags, exflags);
}
bool wxTopLevelWindowMSW::Create(wxWindow *parent,
wxTopLevelWindowMSW::~wxTopLevelWindowMSW()
{
+ SendDestroyEvent();
+
#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
SHACTIVATEINFO* info = (SHACTIVATEINFO*) m_activateInfo;
delete info;
m_maximizeOnShow = false;
}
+ else if ( m_iconized )
+ {
+ // iconize and show
+ nShowCmd = SW_MINIMIZE;
+ }
else // just show
{
// we shouldn't use SW_SHOW which also activates the window for
void wxTopLevelWindowMSW::Iconize(bool iconize)
{
- DoShowWindow(iconize ? SW_MINIMIZE : SW_RESTORE);
+ if ( IsShown() )
+ {
+ // change the window state immediately
+ DoShowWindow(iconize ? SW_MINIMIZE : SW_RESTORE);
+ }
+ else // hidden
+ {
+ // iconizing the window shouldn't show it so just remember that we need
+ // to become iconized when shown later
+ m_iconized = true;
+ }
}
bool wxTopLevelWindowMSW::IsIconized() const
#ifdef __WXWINCE__
return false;
#else
+ if ( !IsShown() )
+ return m_iconized;
+
// don't use m_iconized, it may be briefly out of sync with the real state
// as it's only modified when we receive a WM_SIZE and we could be called
// from an event handler from one of the messages we receive before it,
return GetLabel();
}
-void wxTopLevelWindowMSW::DoSelectAndSetIcon(const wxIconBundle& icons,
+bool wxTopLevelWindowMSW::DoSelectAndSetIcon(const wxIconBundle& icons,
int smX,
int smY,
int i)
if ( icon.Ok() )
{
::SendMessage(GetHwnd(), WM_SETICON, i, (LPARAM)GetHiconOf(icon));
+ return true;
}
+
+ return false;
}
void wxTopLevelWindowMSW::SetIcons(const wxIconBundle& icons)
{
wxTopLevelWindowBase::SetIcons(icons);
- DoSelectAndSetIcon(icons, SM_CXSMICON, SM_CYSMICON, ICON_SMALL);
- DoSelectAndSetIcon(icons, SM_CXICON, SM_CYICON, ICON_BIG);
+ if ( icons.IsEmpty() )
+ {
+ // FIXME: SetIcons(wxNullIconBundle) should unset existing icons,
+ // but we currently don't do that
+ wxASSERT_MSG( m_icons.IsEmpty(), "unsetting icons doesn't work" );
+ return;
+ }
+
+ if ( !DoSelectAndSetIcon(icons, SM_CXSMICON, SM_CYSMICON, ICON_SMALL) &&
+ !DoSelectAndSetIcon(icons, SM_CXICON, SM_CYICON, ICON_BIG) )
+ {
+ wxFAIL_MSG( "icon bundle doesn't contain any suitable icon" );
+ }
}
bool wxTopLevelWindowMSW::EnableCloseButton(bool enable)