#include "wx/module.h"
#include "wx/msw/private.h"
-
#if defined(__WXWINCE__)
#include <ole2.h>
#include <shellapi.h>
#include "wx/msw/wince/missing.h"
#endif
+#include "wx/msw/missing.h"
#include "wx/msw/winundef.h"
-// This can't be undefed in winundef.h or
-// there are further errors
-#if defined(__WXWINCE__) && defined(CreateDialog)
-#undef CreateDialog
-#endif
-
#include "wx/display.h"
#ifndef ICON_BIG
m_iconized =
m_maximizeOnShow = FALSE;
- // unlike (almost?) all other windows, frames are created hidden
- m_isShown = FALSE;
-
// Data to save/restore when calling ShowFullScreen
m_fsStyle = 0;
m_fsOldWindowStyle = 0;
msflags |= WS_POPUP;
else
{
-#ifdef __WXWINCE__
if (msflags & WS_BORDER)
-#endif
msflags |= WS_OVERLAPPED;
}
// border and caption styles
if ( style & wxRESIZE_BORDER )
- {
-#ifndef __WXWINCE__
msflags |= WS_THICKFRAME;
-#endif
- }
else if ( exflags && ((style & wxBORDER_DOUBLE) || (style & wxBORDER_RAISED)) )
*exflags |= WS_EX_DLGMODALFRAME;
else if ( !(style & wxBORDER_NONE) )
msflags |= WS_BORDER;
-#ifndef __WXWINCE__
else
msflags |= WS_POPUP;
-#endif
if ( style & wxCAPTION )
msflags |= WS_CAPTION;
-#ifndef __WXWINCE__
else
msflags |= WS_POPUP;
-#endif
// next translate the individual flags
if ( style & wxMINIMIZE_BOX )
msflags |= WS_MAXIMIZEBOX;
if ( style & wxSYSTEM_MENU )
msflags |= WS_SYSMENU;
-#ifndef __WXWINCE__
+
+ // under CE these 2 styles are not defined currently
+#ifdef WS_MINIMIZE
if ( style & wxMINIMIZE )
msflags |= WS_MINIMIZE;
+#endif // WS_MINIMIZE
+#ifdef WS_MAXIMIZE
if ( style & wxMAXIMIZE )
msflags |= WS_MAXIMIZE;
-#endif
+#endif // WS_MAXIMIZE
// Keep this here because it saves recoding this function in wxTinyFrame
-#if wxUSE_ITSY_BITSY && !defined(__WIN32__)
- if ( style & wxTINY_CAPTION_VERT )
- msflags |= IBS_VERTCAPTION;
- if ( style & wxTINY_CAPTION_HORIZ )
- msflags |= IBS_HORZCAPTION;
-#else
if ( style & (wxTINY_CAPTION_VERT | wxTINY_CAPTION_HORIZ) )
msflags |= WS_CAPTION;
-#endif
if ( exflags )
{
-#if !defined(__WIN16__)
if ( !(GetExtraStyle() & wxTOPLEVEL_EX_DIALOG) )
{
if ( style & wxFRAME_TOOL_WINDOW )
style |= wxFRAME_NO_TASKBAR;
}
+ // again, support for this is missing under CE
+#ifdef WS_EX_APPWINDOW
// We have to solve 2 different problems here:
//
// 1. frames with wxFRAME_NO_TASKBAR flag shouldn't appear in the
// The second one is solved here by using WS_EX_APPWINDOW flag, the
// first one is dealt with in our MSWGetParent() method
// implementation
-#ifndef __WXWINCE__
if ( !(style & wxFRAME_NO_TASKBAR) && GetParent() )
{
// need to force the frame to appear in the taskbar
*exflags |= WS_EX_APPWINDOW;
}
-#endif
//else: nothing to do [here]
+#endif // WS_EX_APPWINDOW
}
-#endif // !Win16
if ( style & wxSTAY_ON_TOP )
*exflags |= WS_EX_TOPMOST;
-#ifdef __WIN32__
if ( GetExtraStyle() & wxFRAME_EX_CONTEXTHELP )
*exflags |= WS_EX_CONTEXTHELP;
-#endif // __WIN32__
}
return msflags;
// move the dialog to its initial position without forcing repainting
int x, y, w, h;
- if ( !MSWGetCreateWindowCoords(pos, size, x, y, w, h) )
- {
- x =
- w = (int)CW_USEDEFAULT;
- }
-
- // we can't use CW_USEDEFAULT here as we're not calling CreateWindow()
- // and passing CW_USEDEFAULT to MoveWindow() results in resizing the
- // window to (0, 0) size which breaks quite a lot of things, e.g. the
- // sizer calculation in wxSizer::Fit()
- if ( w == (int)CW_USEDEFAULT )
- {
- // the exact number doesn't matter, the dialog will be resized
- // again soon anyhow but it should be big enough to allow
- // calculation relying on "totalSize - clientSize > 0" work, i.e.
- // at least greater than the title bar height
- w =
- h = 100;
- }
+ (void)MSWGetCreateWindowCoords(pos, size, x, y, w, h);
if ( x == (int)CW_USEDEFAULT )
{
// init our fields
Init();
+ wxSize sizeReal = size;
+ if ( !sizeReal.IsFullySpecified() )
+ {
+ sizeReal.SetDefaults(GetDefaultSize());
+ }
+
m_windowStyle = style;
SetName(name);
if ( style & (wxRESIZE_BORDER | wxCAPTION) )
dlgTemplate->style |= DS_MODALFRAME;
- ret = CreateDialog(dlgTemplate, title, pos, size);
+ ret = CreateDialog(dlgTemplate, title, pos, sizeReal);
free(dlgTemplate);
}
else // !dialog
{
- ret = CreateFrame(title, pos, size);
+ ret = CreateFrame(title, pos, sizeReal);
}
if ( ret && !(GetWindowStyleFlag() & wxCLOSE_BOX) )
EnableCloseButton(false);
}
+ // for some reason we need to manually send ourselves this message as
+ // otherwise the mnemonics are always shown -- even if they're configured
+ // to be hidden until "Alt" is pressed in the control panel
+ //
+ // this could indicate a bug somewhere else but for now this is the only
+ // fix we have
+ if ( ret )
+ {
+ SendMessage
+ (
+ GetHwnd(),
+ WM_UPDATEUISTATE,
+ MAKEWPARAM(UIS_INITIALIZE, UISF_HIDEFOCUS | UISF_HIDEACCEL),
+ 0
+ );
+ }
+
return ret;
}
return TRUE;
}
+#ifndef __WXWINCE__
+
bool wxTopLevelWindowMSW::SetShape(const wxRegion& region)
{
-#ifdef __WXWINCE__
- return FALSE;
-#else
wxCHECK_MSG( HasFlag(wxFRAME_SHAPED), FALSE,
_T("Shaped windows must be created with the wxFRAME_SHAPED style."));
return FALSE;
}
return TRUE;
-#endif
}
+#endif // !__WXWINCE__
+
// ----------------------------------------------------------------------------
// wxTopLevelWindow event handling
// ----------------------------------------------------------------------------