#endif /* wxMGL */
/* Hopefully we can emulate these dialogs in due course */
-#if wxUSE_SMARTPHONE
+#ifdef __SMARTPHONE__
# ifdef wxUSE_COLOURDLG
# undef wxUSE_COLOURDLG
# define wxUSE_COLOURDLG 0
# endif
-#endif /* wxUSE_SMARTPHONE */
+#endif /* __SMARTPHONE__ */
/* generic controls dependencies */
// override base class virtuals
virtual void DoGetClientSize(int *width, int *height) const;
virtual void DoSetClientSize(int width, int height);
+ virtual wxPoint GetClientAreaOrigin() const;
#if wxUSE_MENUS_NATIVE
// perform MSW-specific action when menubar is changed
virtual void Detach();
virtual void Attach(wxFrame *frame);
-#if wxUSE_TOOLBAR && defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
+#if wxUSE_TOOLBAR && defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__))
// Under WinCE, a menubar is owned by the frame's toolbar
void SetToolBar(wxToolBar* toolBar) { m_toolBar = toolBar; }
wxToolBar* GetToolBar() const { return m_toolBar; }
#endif
-#if defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(WIN32_PLATFORM_PSPC) && !defined(WIN32_PLATFORM_WFSP))
+#if defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__))
WXHWND GetCommandBar() const { return m_commandBar; }
+ bool AddAdornments(long style);
#endif
#if wxUSE_ACCEL
// Not using a combined wxToolBar/wxMenuBar? then use
// a commandbar in WinCE .NET to implement the
// menubar, since there is no ::SetMenu function.
-#if defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(WIN32_PLATFORM_PSPC) && !defined(WIN32_PLATFORM_WFSP))
+#if defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__))
WXHWND m_commandBar;
+ bool m_adornmentsAdded;
#endif
private:
#pragma comment(lib,"commdlg.lib")
#endif
-#if defined(WCE_PLATFORM_STANDARDSDK)
+#if defined(__WINCE_STANDARDSDK__)
// DoDragDrop:
#pragma comment(lib,"olece400.lib")
-#elif defined(WIN32_PLATFORM_PSPC)
+#elif defined(__POCKETPC__)
// PocketPC build:
// DoDragDrop:
#pragma comment(lib,"ceshell.lib")
#pragma comment(lib,"aygshell.lib")
-#elif defined(WIN32_PLATFORM_WFSP)
+#elif defined(__SMARTPHONE__)
// Smartphone build:
#pragma comment(lib,"ceshell.lib")
#pragma comment(lib,"aygshell.lib")
return FALSE;
}
-#ifdef WIN32_PLATFORM_PSPC
+#ifdef __POCKETPC__
#define SM_CXCURSOR 13
#define SM_CYCURSOR 14
#endif
// (notably, wxNotebook pages)
#define wxUSE_UXTHEME_AUTO 0
-// Set to 1 if you want to maintain a PocketPC-style UI on
-// Windows CE .NET. If 0, wxWidgets will use a commandbar
-// for the menubar, and a normal separate toolbar as per the
-// desktop implementation. If 1, wxWidgets will combine
-// the toolbar and menubar as per the PocketPC implementation.
-//
-// Note that at present, the dynamic loading of PocketPC
-// shell functions on WinCE .NET is not yet done, and a
-// simple commandbar implementation is used instead of the
-// PocketPC one. The intention is to use the PocketPC style
-// when available (when wxUSE_POCKETPC_UI is 1).
-//
-// So if you're using WinCE .NET, and wxUSE_POCKETPC_UI is 0,
-// you will be able to create separate toolbars and menubars,
-// but _not_ the combined toolbar/menubar.
-
-// NOW OBSOLETE: we test WIN32_PLATFORM_PSPC and WIN32_PLATFORM_WFSP
-// instead
-
-// #define wxUSE_POCKETPC_UI 1
-
// ----------------------------------------------------------------------------
// obsolete settings
// ----------------------------------------------------------------------------
# endif
#endif
+/* detect PocketPC */
+#if defined( WIN32_PLATFORM_PSPC )
+# ifndef __POCKETPC__
+# define __POCKETPC__
+# endif
+#endif
+
+/* detect Standard WinCE SDK */
+#if defined( WCE_PLATFORM_STANDARDSDK )
+# ifndef __WINCE_STANDARDSDK__
+# define __WINCE_STANDARDSDK__
+# endif
+#endif
+
/*
Include wx/setup.h for the Unix platform defines generated by configure and
the library compilation options
#else // wxUSE_TOOLBAR_NATIVE
#if defined(__WXUNIVERSAL__)
#include "wx/univ/toolbar.h"
- #elif defined(__WXMSW__) && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 400 && !defined(WIN32_PLATFORM_PSPC) && !defined(WIN32_PLATFORM_WFSP)))
+ #elif defined(__WXMSW__) && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__)))
#include "wx/msw/tbar95.h"
#elif defined(__WXWINCE__)
#include "wx/msw/wince/tbarwce.h"
// "correctly", i.e. as full screen windows with a "hide" button (same as
// "close" but round instead of squared and just hides the applications
// instead of closing it) in the title bar
-#if defined(__WXWINCE__) && !defined(WCE_PLATFORM_STANDARDSDK)
- #ifdef __SMARTPHONE__
+#if defined(__WXWINCE__)
+ #if defined(__SMARTPHONE__)
#define wxDEFAULT_FRAME_STYLE (wxMAXIMIZE)
+ #elif defined(__WINCE_STANDARDSDK__)
+ #define wxDEFAULT_FRAME_STYLE (wxMAXIMIZE|wxCLOSE_BOX)
#else
#define wxDEFAULT_FRAME_STYLE (0)
#endif
{
wxPoint pt = wxTopLevelWindow::GetClientAreaOrigin();
-#if wxUSE_TOOLBAR && !defined(__WXUNIVERSAL__) && \
- (!defined(__WXWINCE__) || (_WIN32_WCE >= 400 && !defined(WIN32_PLATFORM_PSPC) && !defined(WIN32_PLATFORM_WFSP)))
+#if wxUSE_TOOLBAR && !defined(__WXUNIVERSAL__)
wxToolBar *toolbar = GetToolBar();
if ( toolbar && toolbar->IsShown() )
{
}
#endif // wxUSE_TOOLBAR
-#if defined(__WXWINCE__) && defined(WCE_PLATFORM_STANDARDSDK)
- if (GetMenuBar() && GetMenuBar()->GetCommandBar())
- {
- RECT rect;
- ::GetWindowRect((HWND) GetMenuBar()->GetCommandBar(), &rect);
- pt.y += (rect.bottom - rect.top);
- }
-#endif
-
return pt;
}
0, NULL);
// copy it to our buffer and free memory
- if( lpMsgBuf != 0 ) {
+ // Crashes on SmartPhone
+#if !defined(__SMARTPHONE__)
+ if( lpMsgBuf != 0 ) {
wxStrncpy(s_szBuf, (const wxChar *)lpMsgBuf, WXSIZEOF(s_szBuf) - 1);
s_szBuf[WXSIZEOF(s_szBuf) - 1] = wxT('\0');
s_szBuf[len - 2] = wxT('\0');
}
}
- else {
+ else
+#endif
+ {
s_szBuf[0] = wxT('\0');
}
void wxFrame::AttachMenuBar(wxMenuBar *menubar)
{
-#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
+#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__))
if (!GetToolBar())
{
wxToolBar* toolBar = new wxToolBar(this, -1,
}
else // set new non NULL menu bar
{
-#if !defined(__WXWINCE__) || (_WIN32_WCE >= 400 && !defined(WIN32_PLATFORM_PSPC) && !defined(WIN32_PLATFORM_WFSP))
+#if !defined(__WXWINCE__) || (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__))
// Can set a menubar several times.
if ( menubar->GetHMenu() )
{
if (show)
{
#if wxUSE_TOOLBAR
-#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
+#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__))
// TODO: hide commandbar
#else
wxToolBar *theToolBar = GetToolBar();
else
{
#if wxUSE_TOOLBAR
-#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
+#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__))
// TODO: show commandbar
#else
wxToolBar *theToolBar = GetToolBar();
wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
{
-#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
+#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__))
// We may already have a toolbar from calling SetMenuBar.
if (GetToolBar())
return GetToolBar();
wxToolBar *toolbar = GetToolBar();
if ( toolbar && toolbar->IsShown() )
{
-#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
+#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__))
// We want to do something different in WinCE, because
// the toolbar should be associated with the commandbar,
// and not an independent window.
PositionToolBar();
#endif // wxUSE_TOOLBAR
-#if defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(WIN32_PLATFORM_PSPC) && !defined(WIN32_PLATFORM_WFSP))
+#if defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__))
// Position the menu command bar
if (GetMenuBar() && GetMenuBar()->GetCommandBar())
{
return GetEventHandler()->ProcessEvent(event);
}
+
+// ----------------------------------------------------------------------------
+// wxFrame size management: we exclude the areas taken by menu/status/toolbars
+// from the client area, so the client area is what's really available for the
+// frame contents
+// ----------------------------------------------------------------------------
+
+// get the origin of the client area in the client coordinates
+wxPoint wxFrame::GetClientAreaOrigin() const
+{
+ wxPoint pt = wxTopLevelWindow::GetClientAreaOrigin();
+
+#if wxUSE_TOOLBAR && !defined(__WXUNIVERSAL__) && \
+ (!defined(__WXWINCE__) || (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__)))
+ wxToolBar *toolbar = GetToolBar();
+ if ( toolbar && toolbar->IsShown() )
+ {
+ int w, h;
+ toolbar->GetSize(&w, &h);
+
+ if ( toolbar->GetWindowStyleFlag() & wxTB_VERTICAL )
+ {
+ pt.x += w;
+ }
+ else
+ {
+ pt.y += h;
+ }
+ }
+#endif // wxUSE_TOOLBAR
+
+#if defined(__WXWINCE__) && defined(__WINCE_STANDARDSDK__)
+ if (GetMenuBar() && GetMenuBar()->GetCommandBar())
+ {
+ RECT rect;
+ ::GetWindowRect((HWND) GetMenuBar()->GetCommandBar(), &rect);
+ pt.y += (rect.bottom - rect.top);
+ }
+#endif
+
+ return pt;
+}
{
m_eventHandler = this;
m_hMenu = 0;
-#if wxUSE_TOOLBAR && defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
+#if wxUSE_TOOLBAR && defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__))
m_toolBar = NULL;
#endif
// Not using a combined wxToolBar/wxMenuBar? then use
// a commandbar in WinCE .NET just to implement the
// menubar.
-#if defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(WIN32_PLATFORM_PSPC) && !defined(WIN32_PLATFORM_WFSP))
+#if defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__))
m_commandBar = NULL;
+ m_adornmentsAdded = false;
#endif
}
{
// In Windows CE (not .NET), the menubar is always associated
// with a toolbar, which destroys the menu implicitly.
-#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
+#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__))
if (GetToolBar())
GetToolBar()->SetMenuBar(NULL);
#else
// which happens if we're attached to a frame
if (m_hMenu && !IsAttached())
{
-#if defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(WIN32_PLATFORM_PSPC) && !defined(WIN32_PLATFORM_WFSP))
+#if defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__))
::DestroyWindow((HWND) m_commandBar);
m_commandBar = (WXHWND) NULL;
#else
{
wxCHECK_RET( IsAttached(), wxT("can't refresh unattached menubar") );
-#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
+#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__))
if (GetToolBar())
{
CommandBar_DrawMenuBar((HWND) GetToolBar()->GetHWND(), 0);
}
-#elif defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(WIN32_PLATFORM_PSPC) && !defined(WIN32_PLATFORM_WFSP))
+#elif defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__))
if (m_commandBar)
DrawMenuBar((HWND) m_commandBar);
#else
// since you have to use resources.
// We'll have to find another way to add a menu
// by changing/adding menu items to an existing menu.
-#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
+#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__))
if ( m_hMenu != 0 )
return m_hMenu;
if ( IsAttached() )
{
-#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
+#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__))
if (!GetToolBar())
return FALSE;
TBBUTTON tbButton;
if ( IsAttached() )
{
-#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
+#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__))
if (!GetToolBar())
return FALSE;
TBBUTTON tbButton;
if ( IsAttached() )
{
-#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
+#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__))
if (GetToolBar())
{
if (!::SendMessage((HWND) GetToolBar()->GetHWND(), TB_DELETEBUTTON, (UINT) pos, (LPARAM) 0))
#if defined(__WXWINCE__)
if (!m_hMenu)
this->Create();
-#if _WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)
+#if _WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__)
// No idea why this was here, but it seems to be obsolete.
// Remove after testing with other WinCE combinations - April 2004
#endif // wxUSE_ACCEL
}
+#if defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__))
+bool wxMenuBar::AddAdornments(long style)
+{
+ if (m_adornmentsAdded || !m_commandBar)
+ return false;
+
+ if (style & wxCLOSE_BOX)
+ {
+ if (!CommandBar_AddAdornments((HWND) m_commandBar, 0, 0))
+ wxLogLastError(wxT("CommandBar_AddAdornments"));
+ else
+ return true;
+ }
+ return false;
+}
+#endif
+
void wxMenuBar::Detach()
{
wxMenuBarBase::Detach();
int wx2msPenStyle(int wx_style)
{
- int cstyle;
+ int cstyle = PS_SOLID;
switch (wx_style)
{
#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
#include "wx/control.h"
#endif
-#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 400 && !defined(WIN32_PLATFORM_PSPC) && !defined(WIN32_PLATFORM_WFSP)))
+#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__)))
#include "wx/toolbar.h"
#include "wx/sysopt.h"
#include <ole2.h>
#include <shellapi.h>
// Standard SDK doesn't have aygshell.dll: see include/wx/msw/wince/libraries.h
- #if _WIN32_WCE < 400 || !defined(WCE_PLATFORM_STANDARDSDK)
+ #if _WIN32_WCE < 400 || !defined(__WINCE_STANDARDSDK__)
#include <aygshell.h>
#endif
#include "wx/msw/wince/missing.h"
y = (sizeDpy.y - h) / 2;
}
-#if !defined(__WXWINCE__) || defined(WCE_PLATFORM_STANDARDSDK)
+#if !defined(__WXWINCE__) || defined(__WINCE_STANDARDSDK__)
if ( !::MoveWindow(GetHwnd(), x, y, w, h, FALSE) )
{
wxLogLastError(wxT("MoveWindow"));
WXDWORD flags = MSWGetCreateWindowFlags(&exflags);
#if (defined(_WIN32_WCE) && _WIN32_WCE < 400) || \
- defined(WIN32_PLATFORM_PSPC) || \
+ defined(__POCKETPC__) || \
defined(__SMARTPHONE__)
// Always expand to fit the screen in PocketPC or SmartPhone
wxSize sz(wxDefaultSize);
);
}
- // Native look is full screen window on Smartphones
-#ifdef __SMARTPHONE__
+ // Native look is full screen window on Smartphones and Standard SDK
+#if defined(__WXWINCE__)
if ( style & wxMAXIMIZE )
- Maximize();
+ {
+ this->Maximize();
+ }
#endif
return ret;
// show and maximize
nShowCmd = SW_MAXIMIZE;
+ // This is necessary, or no window appears
+#ifdef __WINCE_STANDARDSDK__
+ DoShowWindow(SW_SHOW);
+#endif
+
m_maximizeOnShow = FALSE;
}
else // just show
DoShowWindow(nShowCmd);
+#if defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__))
+ // Addornments have to be added when the frame is the correct size
+ wxFrame* frame = wxDynamicCast(this, wxFrame);
+ if (frame && frame->GetMenuBar())
+ frame->GetMenuBar()->AddAdornments(GetWindowStyleFlag());
+#endif
+
if ( show )
{
::BringWindowToTop(GetHwnd());
// Standard SDK doesn't have aygshell.dll: see
// include/wx/msw/wince/libraries.h
-#if defined(__WXWINCE__) && !defined(WCE_PLATFORM_STANDARDSDK)
+#if defined(__WXWINCE__) && !defined(__WINCE_STANDARDSDK__)
SHINITDLGINFO shidi;
shidi.dwMask = SHIDIM_FLAGS;
shidi.dwFlags = SHIDIF_DONEBUTTON |
// Use the WinCE-specific toolbar only if we're either compiling
// with a WinCE earlier than 4, or we wish to emulate a PocketPC-style UI
-#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
+#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && (_WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__))
#include "wx/toolbar.h"
#include <ole2.h>
#include <shellapi.h>
#include <commctrl.h>
-#if _WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)
+#if _WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__)
#include <aygshell.h>
#endif
#include "wx/msw/wince/missing.h"
if (m_menuBar)
m_menuBar->SetToolBar(this);
-#if _WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)
+#if _WIN32_WCE < 400 || defined(__POCKETPC__) || defined(__SMARTPHONE__)
// Create the menubar.
SHMENUBARINFO mbi;