virtual void Detach();
virtual void Attach(wxFrame *frame);
-#if wxUSE_TOOLBAR && defined(__WXWINCE__) && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
+#if wxUSE_TOOLBAR && defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
// Under WinCE, a menubar is owned by the frame's toolbar
void SetToolBar(wxToolBar* toolBar) { m_toolBar = toolBar; }
wxToolBar* GetToolBar() const { return m_toolBar; }
// 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 && !wxUSE_POCKETPC_UI)
+#if defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(WIN32_PLATFORM_PSPC) && defined(WIN32_PLATFORM_WFSP))
WXHWND m_commandBar;
#endif
// 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.
-#define wxUSE_POCKETPC_UI 1
+
+// NOW OBSOLETE: we test WIN32_PLATFORM_PSPC and WIN32_PLATFORM_WFSP
+// instead
+
+// #define wxUSE_POCKETPC_UI 1
// ----------------------------------------------------------------------------
// obsolete settings
#else // wxUSE_TOOLBAR_NATIVE
#if defined(__WXUNIVERSAL__)
#include "wx/univ/toolbar.h"
- #elif defined(__WXMSW__) && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 400 && !wxUSE_POCKETPC_UI))
+ #elif defined(__WXMSW__) && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 400 && !defined(WIN32_PLATFORM_PSPC) && !defined(WIN32_PLATFORM_WFSP)))
#include "wx/msw/tbar95.h"
#elif defined(__WXWINCE__)
#include "wx/msw/wince/tbarwce.h"
wxPoint pt = wxTopLevelWindow::GetClientAreaOrigin();
#if wxUSE_TOOLBAR && !defined(__WXUNIVERSAL__) && \
- (!defined(__WXWINCE__) || (_WIN32_WCE >= 400 && !wxUSE_POCKETPC_UI))
+ (!defined(__WXWINCE__) || (_WIN32_WCE >= 400 && !defined(WIN32_PLATFORM_PSPC) && !defined(WIN32_PLATFORM_WFSP)))
wxToolBar *toolbar = GetToolBar();
if ( toolbar && toolbar->IsShown() )
{
void wxFrame::AttachMenuBar(wxMenuBar *menubar)
{
-#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
+#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
if (!GetToolBar())
{
wxToolBar* toolBar = new wxToolBar(this, -1,
SetToolBar(toolBar);
menubar->SetToolBar(toolBar);
}
+ // Now adjust size for menu bar
+ int menuHeight = 26;
+
+ //When the main window is created using CW_USEDEFAULT the height of the
+ // is created is not taken into account). So we resize the window after
+ // if a menubar is present
+ {
+ RECT rc;
+ ::GetWindowRect((HWND) GetHWND(), &rc);
+ // adjust for menu / titlebar height
+ rc.bottom -= (2*menuHeight-1);
+
+ MoveWindow((HWND) GetHWND(), rc.left, rc.top, rc.right, rc.bottom, FALSE);
+ }
#endif
wxFrameBase::AttachMenuBar(menubar);
}
else // set new non NULL menu bar
{
-#if !defined(__WXWINCE__) || (_WIN32_WCE >= 400 && !wxUSE_POCKETPC_UI)
+#if !defined(__WXWINCE__) || (_WIN32_WCE >= 400 && !defined(WIN32_PLATFORM_PSPC) && !defined(WIN32_PLATFORM_WFSP))
// Can set a menubar several times.
if ( menubar->GetHMenu() )
{
if (show)
{
#if wxUSE_TOOLBAR
-#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
+#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
// TODO: hide commandbar
#else
wxToolBar *theToolBar = GetToolBar();
else
{
#if wxUSE_TOOLBAR
-#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
+#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
// TODO: show commandbar
#else
wxToolBar *theToolBar = GetToolBar();
wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
{
-#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
+#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
// 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 || wxUSE_POCKETPC_UI)
+#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
// We want to do something different in WinCE, because
// the toolbar should be associated with the commandbar,
// and not an independent window.
{
m_eventHandler = this;
m_hMenu = 0;
-#if wxUSE_TOOLBAR && defined(__WXWINCE__) && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
+#if wxUSE_TOOLBAR && defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
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 && !wxUSE_POCKETPC_UI)
+#if defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(WIN32_PLATFORM_PSPC) && !defined(WIN32_PLATFORM_WFSP))
m_commandBar = NULL;
#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 || wxUSE_POCKETPC_UI)
+#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
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 && !wxUSE_POCKETPC_UI)
+#if defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(WIN32_PLATFORM_PSPC) && !defined(WIN32_PLATFORM_WFSP))
::DestroyWindow((HWND) m_commandBar);
m_commandBar = (WXHWND) NULL;
#else
{
wxCHECK_RET( IsAttached(), wxT("can't refresh unattached menubar") );
-#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
+#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
if (GetToolBar())
{
CommandBar_DrawMenuBar((HWND) GetToolBar()->GetHWND(), 0);
}
-#elif defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !wxUSE_POCKETPC_UI)
+#elif defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(WIN32_PLATFORM_PSPC) && !defined(WIN32_PLATFORM_WFSP))
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
+#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
if ( m_hMenu != 0 )
return m_hMenu;
if ( IsAttached() )
{
-#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
+#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
if (!GetToolBar())
return FALSE;
TBBUTTON tbButton;
if ( IsAttached() )
{
-#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
+#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
if (!GetToolBar())
return FALSE;
TBBUTTON tbButton;
if ( IsAttached() )
{
-#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || wxUSE_POCKETPC_UI)
+#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
if (GetToolBar())
{
if (!::SendMessage((HWND) GetToolBar()->GetHWND(), TB_DELETEBUTTON, (UINT) pos, (LPARAM) 0))
{
wxMenuBarBase::Attach(frame);
-#if defined(__WXWINCE__) && _WIN32_WCE >= 400
+#if defined(__WXWINCE__)
if (!m_hMenu)
this->Create();
-#if wxUSE_POCKETPC_UI
+#if _WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)
+
+ // No idea why this was here, but it seems to be obsolete.
+ // Remove after testing with other WinCE combinations - April 2004
+#if 0
if (GetToolBar())
{
HWND hCommandBar = (HWND) GetToolBar()->GetHWND();
wxLogLastError(wxT("CommandBar_InsertMenubarEx"));
}
}
+#endif
#else
if (!m_commandBar)
m_commandBar = (WXHWND) CommandBar_Create(wxGetInstance(), (HWND) frame->GetHWND(), NewControlId());
}
}
#endif
- // wxUSE_POCKETPC_UI
+ // PSPC/WFSP
#endif
// __WXWINCE__ && _WIN32_WCE >= 400
#include "wx/control.h"
#endif
-#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 400 && !wxUSE_POCKETPC_UI))
+#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && (!defined(_WIN32_WCE) || (_WIN32_WCE >= 400 && !defined(WIN32_PLATFORM_PSPC) && defined(WIN32_PLATFORM_WFSP)))
#include "wx/toolbar.h"
#include "wx/sysopt.h"
WXDWORD exflags;
WXDWORD flags = MSWGetCreateWindowFlags(&exflags);
- return MSWCreate(wxCanvasClassName, title, pos, size, flags, exflags);
+ wxSize sz(size);
+#if _WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)
+ // Always expand to fit the screen in PocketPC or SmartPhone
+ sz = wxDefaultSize;
+#endif
+
+ return MSWCreate(wxCanvasClassName, title, pos, sz, flags, exflags);
}
bool wxTopLevelWindowMSW::Create(wxWindow *parent,
return FALSE;
}
-
+#ifndef __WXWINCE__
// update appearance immediately
if ( !::DrawMenuBar(GetHwnd()) )
{
wxLogLastError(_T("DrawMenuBar"));
}
+#endif
#endif // !__WXMICROWIN__
return TRUE;
// 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 || wxUSE_POCKETPC_UI)
+#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
#include "wx/toolbar.h"
#include <ole2.h>
#include <shellapi.h>
#include <commctrl.h>
-#if _WIN32_WCE < 400
+#if _WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)
#include <aygshell.h>
#endif
#include "wx/msw/wince/missing.h"
if (m_menuBar)
m_menuBar->SetToolBar(this);
-#if _WIN32_WCE >= 400
- HWND hWnd = CommandBar_Create(wxGetInstance(), (HWND) GetParent()->GetHWND(), GetId());
- SetHWND((WXHWND) hWnd);
-#else
+#if _WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP)
// Create the menubar.
SHMENUBARINFO mbi;
memset (&mbi, 0, sizeof (SHMENUBARINFO));
mbi.cbSize = sizeof (SHMENUBARINFO);
mbi.hwndParent = (HWND) GetParent()->GetHWND();
-#if wxUSE_SMARTPHONE
+#if defined(WIN32_PLATFORM_WFSP)
mbi.nToolBarId = 5002;
#else
mbi.nToolBarId = 5000;
}
SetHWND((WXHWND) mbi.hwndMB);
+#else
+ HWND hWnd = CommandBar_Create(wxGetInstance(), (HWND) GetParent()->GetHWND(), GetId());
+ SetHWND((WXHWND) hWnd);
#endif
// install wxWindows window proc for this window
// level window in some smart way which we can't do, but we can
// guess a reasonably good size for a new window just as well
// ourselves
+
+ // However, on PocketPC devices, we must use the default
+ // size if possible.
+#ifdef _WIN32_WCE
+ if (size.x == -1)
+ w = CW_USEDEFAULT;
+ else
+ w = size.x;
+ if (size.y == -1)
+ h = CW_USEDEFAULT;
+ else
+ h = size.y;
+#else
if ( size.x == -1 || size.y == -1)
{
nonDefault = true;
}
w = WidthDefault(size.x);
h = HeightDefault(size.y);
+#endif
AdjustForParentClientOrigin(x, y);