// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWidgets licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ===========================================================================
#include <ole2.h>
#include <shellapi.h>
#include <commctrl.h>
-#if _WIN32_WCE < 400
+#if (_WIN32_WCE < 400) && !defined(__HANDHELDPC__)
#include <aygshell.h>
#endif
{
wxLogLastError(wxT("SetMenuItemInfo"));
}
+#else
+ wxUnusedVar(hmenu);
+ wxUnusedVar(id);
#endif
}
}
wxBEGIN_PROPERTIES_TABLE(wxMenu)
- wxEVENT_PROPERTY( Select , wxEVT_COMMAND_MENU_SELECTED , wxCommandEvent)
+ wxEVENT_PROPERTY( Select , wxEVT_COMMAND_MENU_SELECTED , wxCommandEvent)
wxPROPERTY( Title, wxString , SetTitle, GetTitle, wxString(), 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
wxREADONLY_PROPERTY_FLAGS( MenuStyle , wxMenuStyle , long , GetStyle , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
wxPROPERTY_COLLECTION( MenuItems , wxMenuItemList , wxMenuItem* , Append , GetMenuItems , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
{
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__)
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(WINCE_WITH_COMMANDBAR)
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(WINCE_WITHOUT_COMMANDBAR)
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(WINCE_WITH_COMMANDBAR)
::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(WINCE_WITHOUT_COMMANDBAR)
if (GetToolBar())
{
CommandBar_DrawMenuBar((HWND) GetToolBar()->GetHWND(), 0);
}
-#elif defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(WIN32_PLATFORM_PSPC) && !defined(WIN32_PLATFORM_WFSP))
+#elif defined(WINCE_WITH_COMMANDBAR)
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(WINCE_WITHOUT_COMMANDBAR)
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(WINCE_WITHOUT_COMMANDAR)
if (!GetToolBar())
return FALSE;
TBBUTTON tbButton;
if ( IsAttached() )
{
-#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
+#if defined(WINCE_WITHOUT_COMMANDAR)
if (!GetToolBar())
return FALSE;
TBBUTTON tbButton;
if ( IsAttached() )
{
-#if defined(__WXWINCE__) && (_WIN32_WCE < 400 || defined(WIN32_PLATFORM_PSPC) || defined(WIN32_PLATFORM_WFSP))
+#if defined(WINCE_WITHOUT_COMMANDAR)
if (GetToolBar())
{
if (!::SendMessage((HWND) GetToolBar()->GetHWND(), TB_DELETEBUTTON, (UINT) pos, (LPARAM) 0))
{
wxMenuBarBase::Attach(frame);
-#if defined(__WXWINCE__)
+#if defined(WINCE_WITH_COMMANDBAR)
if (!m_hMenu)
this->Create();
-#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();
- if (!CommandBar_InsertMenubarEx(hCommandBar, NULL, (LPTSTR) m_hMenu, 0))
- {
- wxLogLastError(wxT("CommandBar_InsertMenubarEx"));
- }
- }
-#endif
-#else
if (!m_commandBar)
m_commandBar = (WXHWND) CommandBar_Create(wxGetInstance(), (HWND) frame->GetHWND(), NewControlId());
if (m_commandBar)
}
}
#endif
- // PSPC/WFSP
-#endif
- // __WXWINCE__ && _WIN32_WCE >= 400
#if wxUSE_ACCEL
RebuildAccelTable();
#endif // wxUSE_ACCEL
}
+#if defined(WINCE_WITH_COMMANDBAR)
+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();