Disable wxID_EXIT on PalmOS with all consequences in content of menu (separators). Remove msw related code in wxPalmOS.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32730 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -76,8 +76,6 @@ public:
|
|||||||
// semi-private accessors
|
// semi-private accessors
|
||||||
// get the window which contains this menu
|
// get the window which contains this menu
|
||||||
wxWindow *GetWindow() const;
|
wxWindow *GetWindow() const;
|
||||||
// get the menu handle
|
|
||||||
WXHMENU GetHMenu() const { return m_hMenu; }
|
|
||||||
|
|
||||||
#if wxUSE_ACCEL
|
#if wxUSE_ACCEL
|
||||||
// called by wxMenuBar to build its accel table from the accels of all menus
|
// called by wxMenuBar to build its accel table from the accels of all menus
|
||||||
@@ -108,9 +106,6 @@ private:
|
|||||||
// the position of the first item in the current radio group or -1
|
// the position of the first item in the current radio group or -1
|
||||||
int m_startRadioGroup;
|
int m_startRadioGroup;
|
||||||
|
|
||||||
// the menu handle of this menu
|
|
||||||
WXHMENU m_hMenu;
|
|
||||||
|
|
||||||
#if wxUSE_ACCEL
|
#if wxUSE_ACCEL
|
||||||
// the accelerators for our menu items
|
// the accelerators for our menu items
|
||||||
wxAcceleratorArray m_accels;
|
wxAcceleratorArray m_accels;
|
||||||
@@ -183,9 +178,6 @@ public:
|
|||||||
void RebuildAccelTable();
|
void RebuildAccelTable();
|
||||||
#endif // wxUSE_ACCEL
|
#endif // wxUSE_ACCEL
|
||||||
|
|
||||||
// get the menu handle
|
|
||||||
WXHMENU GetHMenu() const { return m_hMenu; }
|
|
||||||
|
|
||||||
// if the menubar is modified, the display is not updated automatically,
|
// if the menubar is modified, the display is not updated automatically,
|
||||||
// call this function to update it (m_menuBarFrame should be !NULL)
|
// call this function to update it (m_menuBarFrame should be !NULL)
|
||||||
void Refresh();
|
void Refresh();
|
||||||
@@ -201,8 +193,6 @@ protected:
|
|||||||
wxArrayString m_titles ;
|
wxArrayString m_titles ;
|
||||||
wxMenuInfoList m_menuInfos;
|
wxMenuInfoList m_menuInfos;
|
||||||
|
|
||||||
WXHMENU m_hMenu;
|
|
||||||
|
|
||||||
// Return the Palm position for a wxMenu which is sometimes different from
|
// Return the Palm position for a wxMenu which is sometimes different from
|
||||||
// the wxWidgets position.
|
// the wxWidgets position.
|
||||||
int PalmPositionForWxMenu(wxMenu *menu, int wxpos);
|
int PalmPositionForWxMenu(wxMenu *menu, int wxpos);
|
||||||
|
@@ -55,11 +55,6 @@ public:
|
|||||||
// wxMenuItemBase::IsCheckable() and wxOwnerDrawn::IsCheckable()
|
// wxMenuItemBase::IsCheckable() and wxOwnerDrawn::IsCheckable()
|
||||||
bool IsCheckable() const { return wxMenuItemBase::IsCheckable(); }
|
bool IsCheckable() const { return wxMenuItemBase::IsCheckable(); }
|
||||||
|
|
||||||
// the id for a popup menu is really its menu handle (as required by
|
|
||||||
// ::AppendMenu() API), so this function will return either the id or the
|
|
||||||
// menu handle depending on what we're
|
|
||||||
int GetRealId() const;
|
|
||||||
|
|
||||||
// mark item as belonging to the given radio group
|
// mark item as belonging to the given radio group
|
||||||
void SetAsRadioGroupStart();
|
void SetAsRadioGroupStart();
|
||||||
void SetRadioGroupStart(int start);
|
void SetRadioGroupStart(int start);
|
||||||
|
@@ -42,11 +42,6 @@
|
|||||||
#include "wx/ownerdrw.h"
|
#include "wx/ownerdrw.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// other standard headers
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <Menu.h>
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// global variables
|
// global variables
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -654,6 +649,89 @@ void wxMenuBar::LoadMenu()
|
|||||||
|
|
||||||
void wxMenuBar::Attach(wxFrame *frame)
|
void wxMenuBar::Attach(wxFrame *frame)
|
||||||
{
|
{
|
||||||
|
// before attaching preprocess menus to not include wxID_EXIT item
|
||||||
|
// as PalmOS guidelines suggest
|
||||||
|
|
||||||
|
wxMenuItem *item;
|
||||||
|
wxMenu *menu;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
while( item = FindItem(wxID_EXIT) )
|
||||||
|
{
|
||||||
|
menu = item->GetMenu();
|
||||||
|
if( !menu ) break; // something broken ?
|
||||||
|
|
||||||
|
size_t count = menu->GetMenuItemCount();
|
||||||
|
if( count == 0 ) break; // something broken ?
|
||||||
|
|
||||||
|
// if EXIT is last item in menu
|
||||||
|
if( menu->FindItemByPosition( count - 1 ) == item )
|
||||||
|
{
|
||||||
|
menu->Destroy( item );
|
||||||
|
|
||||||
|
// was more than one item?
|
||||||
|
// was previous separator ?
|
||||||
|
if( count > 2 )
|
||||||
|
{
|
||||||
|
item = menu->FindItemByPosition( count - 2 );
|
||||||
|
if(item && item->IsSeparator())
|
||||||
|
menu->Destroy( item );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if EXIT is first item in menu
|
||||||
|
else if( menu->FindItemByPosition( 0 ) == item )
|
||||||
|
{
|
||||||
|
menu->Destroy( item );
|
||||||
|
|
||||||
|
// was more than one item?
|
||||||
|
// was previous separator ?
|
||||||
|
if( count > 2 )
|
||||||
|
{
|
||||||
|
item = menu->FindItemByPosition( 0 );
|
||||||
|
if(item && item->IsSeparator())
|
||||||
|
menu->Destroy( item );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if EXIT is in the middle but before and after are selectors
|
||||||
|
else
|
||||||
|
{
|
||||||
|
i = 1; // 0 case already done
|
||||||
|
while ( (i < count) && (menu->FindItemByPosition( 0 ) != item) )
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i >= count) break;
|
||||||
|
if (menu->FindItemByPosition( i ) != item) break;
|
||||||
|
menu->Destroy( item );
|
||||||
|
item = menu->FindItemByPosition( i );
|
||||||
|
if ( item &&
|
||||||
|
item->IsSeparator() &&
|
||||||
|
menu->FindItemByPosition( i-1 )->IsSeparator() )
|
||||||
|
{
|
||||||
|
// noe need for two neighbouring separators
|
||||||
|
menu->Destroy( item );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if we received any empty menu!
|
||||||
|
i = 0;
|
||||||
|
while(i < GetMenuCount())
|
||||||
|
{
|
||||||
|
menu = GetMenu(i);
|
||||||
|
|
||||||
|
if( menu && (menu->GetMenuItemCount()==0) )
|
||||||
|
{
|
||||||
|
menu = Remove( i );
|
||||||
|
delete menu;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
wxMenuBarBase::Attach(frame);
|
wxMenuBarBase::Attach(frame);
|
||||||
|
|
||||||
LoadMenu();
|
LoadMenu();
|
||||||
|
@@ -72,7 +72,7 @@
|
|||||||
bool wxMenuItemStreamingCallback( const wxObject *object, wxWriter * , wxPersister * , wxxVariantArray & )
|
bool wxMenuItemStreamingCallback( const wxObject *object, wxWriter * , wxPersister * , wxxVariantArray & )
|
||||||
{
|
{
|
||||||
const wxMenuItem * mitem = dynamic_cast<const wxMenuItem*>(object) ;
|
const wxMenuItem * mitem = dynamic_cast<const wxMenuItem*>(object) ;
|
||||||
if ( mitem->GetMenu() && !mitem->GetMenu()->GetTitle().IsEmpty() )
|
if ( mitem->GetMenu() && !mitem->GetMenu()->GetTitle().empty() )
|
||||||
{
|
{
|
||||||
// we don't stream out the first two items for menus with a title, they will be reconstructed
|
// we don't stream out the first two items for menus with a title, they will be reconstructed
|
||||||
if ( mitem->GetMenu()->FindItemByPosition(0) == mitem || mitem->GetMenu()->FindItemByPosition(1) == mitem )
|
if ( mitem->GetMenu()->FindItemByPosition(0) == mitem || mitem->GetMenu()->FindItemByPosition(1) == mitem )
|
||||||
@@ -155,12 +155,6 @@ wxMenuItem::~wxMenuItem()
|
|||||||
// misc
|
// misc
|
||||||
// ----
|
// ----
|
||||||
|
|
||||||
// return the id for calling Win32 API functions
|
|
||||||
int wxMenuItem::GetRealId() const
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// get item state
|
// get item state
|
||||||
// --------------
|
// --------------
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user