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:
Włodzimierz Skiba
2005-03-10 19:59:01 +00:00
parent 9600e53035
commit 17131ffd75
4 changed files with 84 additions and 27 deletions

View File

@@ -76,8 +76,6 @@ public:
// semi-private accessors
// get the window which contains this menu
wxWindow *GetWindow() const;
// get the menu handle
WXHMENU GetHMenu() const { return m_hMenu; }
#if wxUSE_ACCEL
// 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
int m_startRadioGroup;
// the menu handle of this menu
WXHMENU m_hMenu;
#if wxUSE_ACCEL
// the accelerators for our menu items
wxAcceleratorArray m_accels;
@@ -183,9 +178,6 @@ public:
void RebuildAccelTable();
#endif // wxUSE_ACCEL
// get the menu handle
WXHMENU GetHMenu() const { return m_hMenu; }
// if the menubar is modified, the display is not updated automatically,
// call this function to update it (m_menuBarFrame should be !NULL)
void Refresh();
@@ -201,8 +193,6 @@ protected:
wxArrayString m_titles ;
wxMenuInfoList m_menuInfos;
WXHMENU m_hMenu;
// Return the Palm position for a wxMenu which is sometimes different from
// the wxWidgets position.
int PalmPositionForWxMenu(wxMenu *menu, int wxpos);

View File

@@ -55,11 +55,6 @@ public:
// wxMenuItemBase::IsCheckable() and wxOwnerDrawn::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
void SetAsRadioGroupStart();
void SetRadioGroupStart(int start);

View File

@@ -42,11 +42,6 @@
#include "wx/ownerdrw.h"
#endif
// other standard headers
#include <string.h>
#include <Menu.h>
// ----------------------------------------------------------------------------
// global variables
// ----------------------------------------------------------------------------
@@ -654,6 +649,89 @@ void wxMenuBar::LoadMenu()
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);
LoadMenu();

View File

@@ -72,7 +72,7 @@
bool wxMenuItemStreamingCallback( const wxObject *object, wxWriter * , wxPersister * , wxxVariantArray & )
{
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
if ( mitem->GetMenu()->FindItemByPosition(0) == mitem || mitem->GetMenu()->FindItemByPosition(1) == mitem )
@@ -155,12 +155,6 @@ wxMenuItem::~wxMenuItem()
// misc
// ----
// return the id for calling Win32 API functions
int wxMenuItem::GetRealId() const
{
return 0;
}
// get item state
// --------------