// headers
// ----------------------------------------------------------------------------
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "tbarwce.h"
#endif
#include "wx/control.h"
#endif
-#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE
+// 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)
#include "wx/toolbar.h"
#include <windowsx.h>
#include <tchar.h>
#include <ole2.h>
+#include <shellapi.h>
#include <commctrl.h>
-#include <aygshell.h>
+#if _WIN32_WCE < 400
+ #include <aygshell.h>
+#endif
+#include "wx/msw/wince/missing.h"
#include "wx/msw/winundef.h"
// wxWin macros
// ----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxToolBarBase)
+IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl)
BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase)
EVT_MOUSE_EVENTS(wxToolBar::OnMouseEvent)
if (m_menuBar)
m_menuBar->SetToolBar(this);
+#if _WIN32_WCE >= 400
+ HWND hWnd = CommandBar_Create(wxGetInstance(), (HWND) GetParent()->GetHWND(), GetId());
+ SetHWND((WXHWND) hWnd);
+#else
// Create the menubar.
SHMENUBARINFO mbi;
memset (&mbi, 0, sizeof (SHMENUBARINFO));
mbi.cbSize = sizeof (SHMENUBARINFO);
mbi.hwndParent = (HWND) GetParent()->GetHWND();
+#if wxUSE_SMARTPHONE
+ mbi.nToolBarId = 5002;
+#else
mbi.nToolBarId = 5000;
+#endif
mbi.nBmpId = 0;
mbi.cBmpImages = 0;
mbi.dwFlags = 0 ; // SHCMBF_EMPTYBAR;
}
SetHWND((WXHWND) mbi.hwndMB);
-/*
- if (!::SendMessage((HWND) GetHWND(), TB_DELETEBUTTON, 0, (LPARAM) 0))
- {
- wxLogLastError(wxT("TB_DELETEBUTTON"));
- }
-*/
+#endif
+
// install wxWindows window proc for this window
SubclassWin(m_hWnd);
}
}
-long wxToolBar::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
+WXLRESULT wxToolBar::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
#if 0
switch ( nMsg )