wxMenu::Append (and similar) now return a pointer to the wxMenuItem
that was added. Checked on MSW, GTK, and Mac, other port authors please double check changes. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25341 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -114,6 +114,8 @@ All (GUI):
|
||||
when sizing smaller) (Shane Harper)
|
||||
- dbbrowse demo fixed for Unicode (Wlodzimierz Skiba)
|
||||
- added wxStatusBar support to XRC (Brian Ravnsgaard Riis)
|
||||
- wxMenu::Append and etc. return a pointer to the wxMenuItem that was
|
||||
added or inserted, or NULL on failure.
|
||||
|
||||
wxMSW:
|
||||
|
||||
|
@@ -103,19 +103,19 @@ and recreation of internal data structures.
|
||||
|
||||
\membersection{wxMenu::Append}\label{wxmenuappend}
|
||||
|
||||
\func{void}{Append}{\param{int}{ id}, \param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""},\rtfsp
|
||||
\func{wxMenuItem*}{Append}{\param{int}{ id}, \param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""},\rtfsp
|
||||
\param{wxItemKind}{ kind = wxITEM\_NORMAL}}
|
||||
|
||||
Adds a string item to the end of the menu.
|
||||
|
||||
\func{void}{Append}{\param{int}{ id}, \param{const wxString\& }{ item}, \param{wxMenu *}{subMenu},\rtfsp
|
||||
\func{wxMenuItem*}{Append}{\param{int}{ id}, \param{const wxString\& }{ item}, \param{wxMenu *}{subMenu},\rtfsp
|
||||
\param{const wxString\& }{helpString = ""}}
|
||||
|
||||
Adds a pull-right submenu to the end of the menu. Append the submenu to the parent
|
||||
menu {\it after} you have added your menu items, or accelerators may not be
|
||||
registered properly.
|
||||
|
||||
\func{void}{Append}{\param{wxMenuItem*}{ menuItem}}
|
||||
\func{wxMenuItem*}{Append}{\param{wxMenuItem*}{ menuItem}}
|
||||
|
||||
Adds a menu item object. This is the most generic variant of Append() method
|
||||
because it may be used for both items (including separators) and submenus and
|
||||
@@ -191,7 +191,7 @@ implements the following methods:\par
|
||||
|
||||
\membersection{wxMenu::AppendCheckItem}\label{wxmenuappendcheckitem}
|
||||
|
||||
\func{void}{AppendCheckItem}{\param{int}{ id},\rtfsp
|
||||
\func{wxMenuItem*}{AppendCheckItem}{\param{int}{ id},\rtfsp
|
||||
\param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""}}
|
||||
|
||||
Adds a checkable item to the end of the menu.
|
||||
@@ -203,7 +203,7 @@ Adds a checkable item to the end of the menu.
|
||||
|
||||
\membersection{wxMenu::AppendRadioItem}\label{wxmenuappendradioitem}
|
||||
|
||||
\func{void}{AppendRadioItem}{\param{int}{ id},\rtfsp
|
||||
\func{wxMenuItem*}{AppendRadioItem}{\param{int}{ id},\rtfsp
|
||||
\param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""}}
|
||||
|
||||
Adds a radio item to the end of the menu. All consequent radio items form a
|
||||
@@ -220,7 +220,7 @@ automatically unchecked.
|
||||
|
||||
\membersection{wxMenu::AppendSeparator}\label{wxmenuappendseparator}
|
||||
|
||||
\func{void}{AppendSeparator}{\void}
|
||||
\func{wxMenuItem*}{AppendSeparator}{\void}
|
||||
|
||||
Adds a separator to the end of the menu.
|
||||
|
||||
@@ -423,9 +423,9 @@ menubar.
|
||||
|
||||
\membersection{wxMenu::Insert}\label{wxmenuinsert}
|
||||
|
||||
\func{bool}{Insert}{\param{size\_t }{pos}, \param{wxMenuItem *}{item}}
|
||||
\func{wxMenuItem*}{Insert}{\param{size\_t }{pos}, \param{wxMenuItem *}{item}}
|
||||
|
||||
\func{void}{Insert}{\param{size\_t }{pos}, \param{int}{ id},\rtfsp
|
||||
\func{wxMenuItem*}{Insert}{\param{size\_t }{pos}, \param{int}{ id},\rtfsp
|
||||
\param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""},\rtfsp
|
||||
\param{wxItemKind}{ kind = wxITEM\_NORMAL}}
|
||||
|
||||
@@ -440,7 +440,7 @@ as appending it.
|
||||
|
||||
\membersection{wxMenu::InsertCheckItem}\label{wxmenuinsertcheckitem}
|
||||
|
||||
\func{void}{InsertCheckItem}{\param{size\_t }{pos}, \param{int}{ id},\rtfsp
|
||||
\func{wxMenuItem*}{InsertCheckItem}{\param{size\_t }{pos}, \param{int}{ id},\rtfsp
|
||||
\param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""}}
|
||||
|
||||
Inserts a checkable item at the given position.
|
||||
@@ -452,7 +452,7 @@ Inserts a checkable item at the given position.
|
||||
|
||||
\membersection{wxMenu::InsertRadioItem}\label{wxmenuinsertradioitem}
|
||||
|
||||
\func{void}{InsertRadioItem}{\param{size\_t }{pos}, \param{int}{ id},\rtfsp
|
||||
\func{wxMenuItem*}{InsertRadioItem}{\param{size\_t }{pos}, \param{int}{ id},\rtfsp
|
||||
\param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""}}
|
||||
|
||||
Inserts a radio item at the given position.
|
||||
@@ -464,7 +464,7 @@ Inserts a radio item at the given position.
|
||||
|
||||
\membersection{wxMenu::InsertSeparator}\label{wxmenuinsertseparator}
|
||||
|
||||
\func{void}{InsertSeparator}{\param{size\_t }{pos}}
|
||||
\func{wxMenuItem*}{InsertSeparator}{\param{size\_t }{pos}}
|
||||
|
||||
Inserts a separator at the given position.
|
||||
|
||||
@@ -511,9 +511,9 @@ true if the menu item is enabled, false otherwise.
|
||||
|
||||
\membersection{wxMenu::Prepend}\label{wxmenuprepend}
|
||||
|
||||
\func{bool}{Prepend}{\param{wxMenuItem *}{item}}
|
||||
\func{wxMenuItem*}{Prepend}{\param{wxMenuItem *}{item}}
|
||||
|
||||
\func{void}{Prepend}{\param{int}{ id},\rtfsp
|
||||
\func{wxMenuItem*}{Prepend}{\param{int}{ id},\rtfsp
|
||||
\param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""},\rtfsp
|
||||
\param{wxItemKind}{ kind = wxITEM\_NORMAL}}
|
||||
|
||||
@@ -527,7 +527,7 @@ existing items.
|
||||
|
||||
\membersection{wxMenu::PrependCheckItem}\label{wxmenuprependcheckitem}
|
||||
|
||||
\func{void}{PrependCheckItem}{\param{int}{ id},\rtfsp
|
||||
\func{wxMenuItem*}{PrependCheckItem}{\param{int}{ id},\rtfsp
|
||||
\param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""}}
|
||||
|
||||
Inserts a checkable item at the position $0$.
|
||||
@@ -539,7 +539,7 @@ Inserts a checkable item at the position $0$.
|
||||
|
||||
\membersection{wxMenu::PrependRadioItem}\label{wxmenuprependradioitem}
|
||||
|
||||
\func{void}{PrependRadioItem}{\param{int}{ id},\rtfsp
|
||||
\func{wxMenuItem*}{PrependRadioItem}{\param{int}{ id},\rtfsp
|
||||
\param{const wxString\& }{ item}, \param{const wxString\& }{helpString = ""}}
|
||||
|
||||
Inserts a radio item at the position $0$.
|
||||
@@ -551,7 +551,7 @@ Inserts a radio item at the position $0$.
|
||||
|
||||
\membersection{wxMenu::PrependSeparator}\label{wxmenuprependseparator}
|
||||
|
||||
\func{void}{PrependSeparator}{\param{size\_t }{pos}}
|
||||
\func{wxMenuItem*}{PrependSeparator}{\param{size\_t }{pos}}
|
||||
|
||||
Inserts a separator at the position $0$.
|
||||
|
||||
|
@@ -74,8 +74,8 @@ public:
|
||||
virtual ~wxMenu();
|
||||
|
||||
// implement base class virtuals
|
||||
virtual bool DoAppend(wxMenuItem *item);
|
||||
virtual bool DoInsert(size_t pos, wxMenuItem *item);
|
||||
virtual wxMenuItem* DoAppend(wxMenuItem *item);
|
||||
virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item);
|
||||
virtual wxMenuItem* DoRemove(wxMenuItem *item);
|
||||
|
||||
// TODO: virtual void SetTitle(const wxString& title);
|
||||
|
@@ -74,8 +74,8 @@ public:
|
||||
virtual ~wxMenu();
|
||||
|
||||
// implement base class virtuals
|
||||
virtual bool DoAppend(wxMenuItem *item);
|
||||
virtual bool DoInsert(size_t pos, wxMenuItem *item);
|
||||
virtual wxMenuItem* DoAppend(wxMenuItem *item);
|
||||
virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item);
|
||||
virtual wxMenuItem* DoRemove(wxMenuItem *item);
|
||||
|
||||
// TODO: virtual void SetTitle(const wxString& title);
|
||||
|
@@ -34,8 +34,8 @@ public:
|
||||
virtual ~wxMenu();
|
||||
|
||||
// implement base class virtuals
|
||||
virtual bool DoAppend(wxMenuItem *item);
|
||||
virtual bool DoInsert(size_t pos, wxMenuItem *item);
|
||||
virtual wxMenuItem* DoAppend(wxMenuItem *item);
|
||||
virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item);
|
||||
virtual wxMenuItem* DoRemove(wxMenuItem *item);
|
||||
virtual void Attach(wxMenuBarBase *menubar) ;
|
||||
|
||||
|
@@ -63,142 +63,142 @@ public:
|
||||
// -----------------
|
||||
|
||||
// append any kind of item (normal/check/radio/separator)
|
||||
void Append(int itemid,
|
||||
wxMenuItem* Append(int itemid,
|
||||
const wxString& text,
|
||||
const wxString& help = wxEmptyString,
|
||||
wxItemKind kind = wxITEM_NORMAL)
|
||||
{
|
||||
DoAppend(wxMenuItem::New((wxMenu *)this, itemid, text, help, kind));
|
||||
return DoAppend(wxMenuItem::New((wxMenu *)this, itemid, text, help, kind));
|
||||
}
|
||||
|
||||
// append a separator to the menu
|
||||
void AppendSeparator() { Append(wxID_SEPARATOR, wxEmptyString); }
|
||||
wxMenuItem* AppendSeparator() { return Append(wxID_SEPARATOR, wxEmptyString); }
|
||||
|
||||
// append a check item
|
||||
void AppendCheckItem(int itemid,
|
||||
wxMenuItem* AppendCheckItem(int itemid,
|
||||
const wxString& text,
|
||||
const wxString& help = wxEmptyString)
|
||||
{
|
||||
Append(itemid, text, help, wxITEM_CHECK);
|
||||
return Append(itemid, text, help, wxITEM_CHECK);
|
||||
}
|
||||
|
||||
// append a radio item
|
||||
void AppendRadioItem(int itemid,
|
||||
wxMenuItem* AppendRadioItem(int itemid,
|
||||
const wxString& text,
|
||||
const wxString& help = wxEmptyString)
|
||||
{
|
||||
Append(itemid, text, help, wxITEM_RADIO);
|
||||
return Append(itemid, text, help, wxITEM_RADIO);
|
||||
}
|
||||
|
||||
// append a submenu
|
||||
void Append(int itemid,
|
||||
wxMenuItem* Append(int itemid,
|
||||
const wxString& text,
|
||||
wxMenu *submenu,
|
||||
const wxString& help = wxEmptyString)
|
||||
{
|
||||
DoAppend(wxMenuItem::New((wxMenu *)this, itemid, text, help,
|
||||
return DoAppend(wxMenuItem::New((wxMenu *)this, itemid, text, help,
|
||||
wxITEM_NORMAL, submenu));
|
||||
}
|
||||
|
||||
// the most generic form of Append() - append anything
|
||||
void Append(wxMenuItem *item) { DoAppend(item); }
|
||||
wxMenuItem* Append(wxMenuItem *item) { return DoAppend(item); }
|
||||
|
||||
// insert a break in the menu (only works when appending the items, not
|
||||
// inserting them)
|
||||
virtual void Break() { }
|
||||
|
||||
// insert an item before given position
|
||||
bool Insert(size_t pos, wxMenuItem *item);
|
||||
wxMenuItem* Insert(size_t pos, wxMenuItem *item);
|
||||
|
||||
// insert an item before given position
|
||||
void Insert(size_t pos,
|
||||
wxMenuItem* Insert(size_t pos,
|
||||
int itemid,
|
||||
const wxString& text,
|
||||
const wxString& help = wxEmptyString,
|
||||
wxItemKind kind = wxITEM_NORMAL)
|
||||
{
|
||||
Insert(pos, wxMenuItem::New((wxMenu *)this, itemid, text, help, kind));
|
||||
return Insert(pos, wxMenuItem::New((wxMenu *)this, itemid, text, help, kind));
|
||||
}
|
||||
|
||||
// insert a separator
|
||||
void InsertSeparator(size_t pos)
|
||||
wxMenuItem* InsertSeparator(size_t pos)
|
||||
{
|
||||
Insert(pos, wxMenuItem::New((wxMenu *)this));
|
||||
return Insert(pos, wxMenuItem::New((wxMenu *)this, wxID_SEPARATOR));
|
||||
}
|
||||
|
||||
// insert a check item
|
||||
void InsertCheckItem(size_t pos,
|
||||
wxMenuItem* InsertCheckItem(size_t pos,
|
||||
int itemid,
|
||||
const wxString& text,
|
||||
const wxString& help = wxEmptyString)
|
||||
{
|
||||
Insert(pos, itemid, text, help, wxITEM_CHECK);
|
||||
return Insert(pos, itemid, text, help, wxITEM_CHECK);
|
||||
}
|
||||
|
||||
// insert a radio item
|
||||
void InsertRadioItem(size_t pos,
|
||||
wxMenuItem* InsertRadioItem(size_t pos,
|
||||
int itemid,
|
||||
const wxString& text,
|
||||
const wxString& help = wxEmptyString)
|
||||
{
|
||||
Insert(pos, itemid, text, help, wxITEM_RADIO);
|
||||
return Insert(pos, itemid, text, help, wxITEM_RADIO);
|
||||
}
|
||||
|
||||
// insert a submenu
|
||||
void Insert(size_t pos,
|
||||
wxMenuItem* Insert(size_t pos,
|
||||
int itemid,
|
||||
const wxString& text,
|
||||
wxMenu *submenu,
|
||||
const wxString& help = wxEmptyString)
|
||||
{
|
||||
Insert(pos, wxMenuItem::New((wxMenu *)this, itemid, text, help,
|
||||
return Insert(pos, wxMenuItem::New((wxMenu *)this, itemid, text, help,
|
||||
wxITEM_NORMAL, submenu));
|
||||
}
|
||||
|
||||
// prepend an item to the menu
|
||||
void Prepend(wxMenuItem *item)
|
||||
wxMenuItem* Prepend(wxMenuItem *item)
|
||||
{
|
||||
Insert(0u, item);
|
||||
return Insert(0u, item);
|
||||
}
|
||||
|
||||
// prepend any item to the menu
|
||||
void Prepend(int itemid,
|
||||
wxMenuItem* Prepend(int itemid,
|
||||
const wxString& text,
|
||||
const wxString& help = wxEmptyString,
|
||||
wxItemKind kind = wxITEM_NORMAL)
|
||||
{
|
||||
Insert(0u, itemid, text, help, kind);
|
||||
return Insert(0u, itemid, text, help, kind);
|
||||
}
|
||||
|
||||
// prepend a separator
|
||||
void PrependSeparator()
|
||||
wxMenuItem* PrependSeparator()
|
||||
{
|
||||
InsertSeparator(0u);
|
||||
return InsertSeparator(0u);
|
||||
}
|
||||
|
||||
// prepend a check item
|
||||
void PrependCheckItem(int itemid,
|
||||
wxMenuItem* PrependCheckItem(int itemid,
|
||||
const wxString& text,
|
||||
const wxString& help = wxEmptyString)
|
||||
{
|
||||
InsertCheckItem(0u, itemid, text, help);
|
||||
return InsertCheckItem(0u, itemid, text, help);
|
||||
}
|
||||
|
||||
// prepend a radio item
|
||||
void PrependRadioItem(int itemid,
|
||||
wxMenuItem* PrependRadioItem(int itemid,
|
||||
const wxString& text,
|
||||
const wxString& help = wxEmptyString)
|
||||
{
|
||||
InsertRadioItem(0u, itemid, text, help);
|
||||
return InsertRadioItem(0u, itemid, text, help);
|
||||
}
|
||||
|
||||
// prepend a submenu
|
||||
void Prepend(int itemid,
|
||||
wxMenuItem* Prepend(int itemid,
|
||||
const wxString& text,
|
||||
wxMenu *submenu,
|
||||
const wxString& help = wxEmptyString)
|
||||
{
|
||||
Insert(0u, itemid, text, submenu, help);
|
||||
return Insert(0u, itemid, text, submenu, help);
|
||||
}
|
||||
|
||||
// detach an item from the menu, but don't delete it so that it can be
|
||||
@@ -334,8 +334,8 @@ protected:
|
||||
// virtuals to override in derived classes
|
||||
// ---------------------------------------
|
||||
|
||||
virtual bool DoAppend(wxMenuItem *item);
|
||||
virtual bool DoInsert(size_t pos, wxMenuItem *item);
|
||||
virtual wxMenuItem* DoAppend(wxMenuItem *item);
|
||||
virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item);
|
||||
|
||||
virtual wxMenuItem *DoRemove(wxMenuItem *item);
|
||||
virtual bool DoDelete(wxMenuItem *item);
|
||||
|
@@ -38,8 +38,8 @@ public:
|
||||
virtual ~wxMenu();
|
||||
|
||||
// implement base class virtuals
|
||||
virtual bool DoAppend(wxMenuItem *item);
|
||||
virtual bool DoInsert(size_t pos, wxMenuItem *item);
|
||||
virtual wxMenuItem* DoAppend(wxMenuItem *item);
|
||||
virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item);
|
||||
virtual wxMenuItem* DoRemove(wxMenuItem *item);
|
||||
|
||||
virtual void Break();
|
||||
|
@@ -47,8 +47,8 @@ public:
|
||||
virtual ~wxMenu();
|
||||
|
||||
// implement base class virtuals
|
||||
virtual bool DoAppend(wxMenuItem *item);
|
||||
virtual bool DoInsert(size_t pos, wxMenuItem *item);
|
||||
virtual wxMenuItem* DoAppend(wxMenuItem *item);
|
||||
virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item);
|
||||
virtual wxMenuItem* DoRemove(wxMenuItem *item);
|
||||
|
||||
virtual void Break();
|
||||
|
@@ -55,8 +55,8 @@ public:
|
||||
//
|
||||
// Implement base class virtuals
|
||||
//
|
||||
virtual bool DoAppend(wxMenuItem* pItem);
|
||||
virtual bool DoInsert( size_t nPos
|
||||
virtual wxMenuItem* DoAppend(wxMenuItem* pItem);
|
||||
virtual wxMenuItem* DoInsert( size_t nPos
|
||||
,wxMenuItem* pItem
|
||||
);
|
||||
virtual wxMenuItem* DoRemove(wxMenuItem* pItem);
|
||||
|
@@ -79,8 +79,8 @@ public:
|
||||
|
||||
protected:
|
||||
// implement base class virtuals
|
||||
virtual bool DoAppend(wxMenuItem *item);
|
||||
virtual bool DoInsert(size_t pos, wxMenuItem *item);
|
||||
virtual wxMenuItem* DoAppend(wxMenuItem *item);
|
||||
virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item);
|
||||
virtual wxMenuItem* DoRemove(wxMenuItem *item);
|
||||
|
||||
// common part of DoAppend and DoInsert
|
||||
|
@@ -310,9 +310,9 @@ void wxMenuBase::AddSubMenu(wxMenu *submenu)
|
||||
submenu->SetParent((wxMenu *)this);
|
||||
}
|
||||
|
||||
bool wxMenuBase::DoAppend(wxMenuItem *item)
|
||||
wxMenuItem* wxMenuBase::DoAppend(wxMenuItem *item)
|
||||
{
|
||||
wxCHECK_MSG( item, FALSE, wxT("invalid item in wxMenu::Append()") );
|
||||
wxCHECK_MSG( item, NULL, wxT("invalid item in wxMenu::Append()") );
|
||||
|
||||
m_items.Append(item);
|
||||
item->SetMenu((wxMenu*)this);
|
||||
@@ -321,12 +321,12 @@ bool wxMenuBase::DoAppend(wxMenuItem *item)
|
||||
AddSubMenu(item->GetSubMenu());
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return item;
|
||||
}
|
||||
|
||||
bool wxMenuBase::Insert(size_t pos, wxMenuItem *item)
|
||||
wxMenuItem* wxMenuBase::Insert(size_t pos, wxMenuItem *item)
|
||||
{
|
||||
wxCHECK_MSG( item, FALSE, wxT("invalid item in wxMenu::Insert") );
|
||||
wxCHECK_MSG( item, NULL, wxT("invalid item in wxMenu::Insert") );
|
||||
|
||||
if ( pos == GetMenuItemCount() )
|
||||
{
|
||||
@@ -341,9 +341,9 @@ bool wxMenuBase::Insert(size_t pos, wxMenuItem *item)
|
||||
}
|
||||
}
|
||||
|
||||
bool wxMenuBase::DoInsert(size_t pos, wxMenuItem *item)
|
||||
wxMenuItem* wxMenuBase::DoInsert(size_t pos, wxMenuItem *item)
|
||||
{
|
||||
wxCHECK_MSG( item, FALSE, wxT("invalid item in wxMenu::Insert()") );
|
||||
wxCHECK_MSG( item, NULL, wxT("invalid item in wxMenu::Insert()") );
|
||||
|
||||
wxMenuItemList::compatibility_iterator node = m_items.Item(pos);
|
||||
wxCHECK_MSG( node, FALSE, wxT("invalid index in wxMenu::Insert()") );
|
||||
@@ -355,7 +355,7 @@ bool wxMenuBase::DoInsert(size_t pos, wxMenuItem *item)
|
||||
AddSubMenu(item->GetSubMenu());
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return item;
|
||||
}
|
||||
|
||||
wxMenuItem *wxMenuBase::Remove(wxMenuItem *item)
|
||||
|
@@ -1358,21 +1358,23 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxMenu::DoAppend(wxMenuItem *mitem)
|
||||
wxMenuItem* wxMenu::DoAppend(wxMenuItem *mitem)
|
||||
{
|
||||
return GtkAppend(mitem) && wxMenuBase::DoAppend(mitem);
|
||||
if (!GtkAppend(mitem))
|
||||
return NULL;
|
||||
return wxMenuBase::DoAppend(mitem);
|
||||
}
|
||||
|
||||
bool wxMenu::DoInsert(size_t pos, wxMenuItem *item)
|
||||
wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item)
|
||||
{
|
||||
if ( !wxMenuBase::DoInsert(pos, item) )
|
||||
return FALSE;
|
||||
return NULL;
|
||||
|
||||
// GTK+ doesn't have a function to insert a menu using GtkItemFactory (as
|
||||
// of version 1.2.6), so we first append the item and then change its
|
||||
// index
|
||||
if ( !GtkAppend(item) )
|
||||
return FALSE;
|
||||
return NULL;
|
||||
|
||||
if ( m_style & wxMENU_TEAROFF )
|
||||
{
|
||||
@@ -1385,7 +1387,7 @@ bool wxMenu::DoInsert(size_t pos, wxMenuItem *item)
|
||||
menu_shell->children = g_list_remove(menu_shell->children, data);
|
||||
menu_shell->children = g_list_insert(menu_shell->children, data, pos);
|
||||
|
||||
return TRUE;
|
||||
return item;
|
||||
}
|
||||
|
||||
wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
|
||||
|
@@ -1358,21 +1358,23 @@ bool wxMenu::GtkAppend(wxMenuItem *mitem)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxMenu::DoAppend(wxMenuItem *mitem)
|
||||
wxMenuItem* wxMenu::DoAppend(wxMenuItem *mitem)
|
||||
{
|
||||
return GtkAppend(mitem) && wxMenuBase::DoAppend(mitem);
|
||||
if (!GtkAppend(mitem))
|
||||
return NULL;
|
||||
return wxMenuBase::DoAppend(mitem);
|
||||
}
|
||||
|
||||
bool wxMenu::DoInsert(size_t pos, wxMenuItem *item)
|
||||
wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item)
|
||||
{
|
||||
if ( !wxMenuBase::DoInsert(pos, item) )
|
||||
return FALSE;
|
||||
return NULL;
|
||||
|
||||
// GTK+ doesn't have a function to insert a menu using GtkItemFactory (as
|
||||
// of version 1.2.6), so we first append the item and then change its
|
||||
// index
|
||||
if ( !GtkAppend(item) )
|
||||
return FALSE;
|
||||
return NULL;
|
||||
|
||||
if ( m_style & wxMENU_TEAROFF )
|
||||
{
|
||||
@@ -1385,7 +1387,7 @@ bool wxMenu::DoInsert(size_t pos, wxMenuItem *item)
|
||||
menu_shell->children = g_list_remove(menu_shell->children, data);
|
||||
menu_shell->children = g_list_insert(menu_shell->children, data, pos);
|
||||
|
||||
return TRUE;
|
||||
return item;
|
||||
}
|
||||
|
||||
wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
|
||||
|
@@ -177,9 +177,9 @@ void wxMenu::EndRadioGroup()
|
||||
m_startRadioGroup = -1;
|
||||
}
|
||||
|
||||
bool wxMenu::DoAppend(wxMenuItem *item)
|
||||
wxMenuItem* wxMenu::DoAppend(wxMenuItem *item)
|
||||
{
|
||||
wxCHECK_MSG( item, FALSE, _T("NULL item in wxMenu::DoAppend") );
|
||||
wxCHECK_MSG( item, NULL, _T("NULL item in wxMenu::DoAppend") );
|
||||
|
||||
bool check = FALSE;
|
||||
|
||||
@@ -222,7 +222,7 @@ bool wxMenu::DoAppend(wxMenuItem *item)
|
||||
|
||||
if ( !wxMenuBase::DoAppend(item) || !DoInsertOrAppend(item) )
|
||||
{
|
||||
return FALSE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ( check )
|
||||
@@ -231,12 +231,15 @@ bool wxMenu::DoAppend(wxMenuItem *item)
|
||||
item->Check(TRUE);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return item;
|
||||
}
|
||||
|
||||
bool wxMenu::DoInsert(size_t pos, wxMenuItem *item)
|
||||
wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item)
|
||||
{
|
||||
return wxMenuBase::DoInsert(pos, item) && DoInsertOrAppend(item, pos);
|
||||
if (wxMenuBase::DoInsert(pos, item) && DoInsertOrAppend(item, pos))
|
||||
return item;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
|
||||
|
@@ -177,9 +177,9 @@ void wxMenu::EndRadioGroup()
|
||||
m_startRadioGroup = -1;
|
||||
}
|
||||
|
||||
bool wxMenu::DoAppend(wxMenuItem *item)
|
||||
wxMenuItem* wxMenu::DoAppend(wxMenuItem *item)
|
||||
{
|
||||
wxCHECK_MSG( item, FALSE, _T("NULL item in wxMenu::DoAppend") );
|
||||
wxCHECK_MSG( item, NULL, _T("NULL item in wxMenu::DoAppend") );
|
||||
|
||||
bool check = FALSE;
|
||||
|
||||
@@ -222,7 +222,7 @@ bool wxMenu::DoAppend(wxMenuItem *item)
|
||||
|
||||
if ( !wxMenuBase::DoAppend(item) || !DoInsertOrAppend(item) )
|
||||
{
|
||||
return FALSE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ( check )
|
||||
@@ -231,12 +231,15 @@ bool wxMenu::DoAppend(wxMenuItem *item)
|
||||
item->Check(TRUE);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return item;
|
||||
}
|
||||
|
||||
bool wxMenu::DoInsert(size_t pos, wxMenuItem *item)
|
||||
wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item)
|
||||
{
|
||||
return wxMenuBase::DoInsert(pos, item) && DoInsertOrAppend(item, pos);
|
||||
if (wxMenuBase::DoInsert(pos, item) && DoInsertOrAppend(item, pos))
|
||||
return item;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
|
||||
|
@@ -114,7 +114,7 @@ void wxMenu::Break()
|
||||
}
|
||||
|
||||
// function appends a new item or submenu to the menu
|
||||
bool wxMenu::DoAppend(wxMenuItem *pItem)
|
||||
wxMenuItem* wxMenu::DoAppend(wxMenuItem *pItem)
|
||||
{
|
||||
if (m_menuWidget)
|
||||
{
|
||||
@@ -137,14 +137,14 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
|
||||
return wxMenuBase::DoRemove(item);
|
||||
}
|
||||
|
||||
bool wxMenu::DoInsert(size_t pos, wxMenuItem *item)
|
||||
wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item)
|
||||
{
|
||||
if ( wxMenuBase::DoInsert(pos, item) )
|
||||
return TRUE;
|
||||
return item;
|
||||
|
||||
wxFAIL_MSG(wxT("DoInsert not implemented; or error in wxMenuBase::DoInsert"));
|
||||
|
||||
return FALSE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void wxMenu::SetTitle(const wxString& label)
|
||||
|
@@ -433,9 +433,9 @@ void wxMenu::EndRadioGroup()
|
||||
m_startRadioGroup = -1;
|
||||
}
|
||||
|
||||
bool wxMenu::DoAppend(wxMenuItem *item)
|
||||
wxMenuItem* wxMenu::DoAppend(wxMenuItem *item)
|
||||
{
|
||||
wxCHECK_MSG( item, FALSE, _T("NULL item in wxMenu::DoAppend") );
|
||||
wxCHECK_MSG( item, NULL, _T("NULL item in wxMenu::DoAppend") );
|
||||
|
||||
bool check = FALSE;
|
||||
|
||||
@@ -478,7 +478,7 @@ bool wxMenu::DoAppend(wxMenuItem *item)
|
||||
|
||||
if ( !wxMenuBase::DoAppend(item) || !DoInsertOrAppend(item) )
|
||||
{
|
||||
return FALSE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ( check )
|
||||
@@ -487,12 +487,15 @@ bool wxMenu::DoAppend(wxMenuItem *item)
|
||||
item->Check(TRUE);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return item;
|
||||
}
|
||||
|
||||
bool wxMenu::DoInsert(size_t pos, wxMenuItem *item)
|
||||
wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item)
|
||||
{
|
||||
return wxMenuBase::DoInsert(pos, item) && DoInsertOrAppend(item, pos);
|
||||
if (wxMenuBase::DoInsert(pos, item) && DoInsertOrAppend(item, pos))
|
||||
return item;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
|
||||
|
@@ -415,11 +415,11 @@ void wxMenu::EndRadioGroup()
|
||||
m_nStartRadioGroup = -1;
|
||||
} // end of wxMenu::EndRadioGroup
|
||||
|
||||
bool wxMenu::DoAppend(
|
||||
wxMenuItem* wxMenu::DoAppend(
|
||||
wxMenuItem* pItem
|
||||
)
|
||||
{
|
||||
wxCHECK_MSG( pItem, FALSE, _T("NULL item in wxMenu::DoAppend") );
|
||||
wxCHECK_MSG( pItem, NULL, _T("NULL item in wxMenu::DoAppend") );
|
||||
|
||||
bool bCheck = FALSE;
|
||||
|
||||
@@ -471,7 +471,7 @@ bool wxMenu::DoAppend(
|
||||
|
||||
if (!wxMenuBase::DoAppend(pItem) || !DoInsertOrAppend(pItem))
|
||||
{
|
||||
return FALSE;
|
||||
return NULL;
|
||||
}
|
||||
if (bCheck)
|
||||
{
|
||||
@@ -480,20 +480,22 @@ bool wxMenu::DoAppend(
|
||||
//
|
||||
pItem->Check(TRUE);
|
||||
}
|
||||
return TRUE;
|
||||
return pItem;
|
||||
} // end of wxMenu::DoAppend
|
||||
|
||||
bool wxMenu::DoInsert(
|
||||
wxMenuItem* wxMenu::DoInsert(
|
||||
size_t nPos
|
||||
, wxMenuItem* pItem
|
||||
)
|
||||
{
|
||||
return ( wxMenuBase::DoInsert( nPos
|
||||
if ( wxMenuBase::DoInsert( nPos
|
||||
,pItem) &&
|
||||
DoInsertOrAppend( pItem
|
||||
,nPos
|
||||
)
|
||||
);
|
||||
))
|
||||
return pItem;
|
||||
else
|
||||
return NULL;
|
||||
} // end of wxMenu::DoInsert
|
||||
|
||||
wxMenuItem* wxMenu::DoRemove(
|
||||
|
@@ -1110,7 +1110,7 @@ void wxMenu::EndRadioGroup()
|
||||
m_startRadioGroup = -1;
|
||||
}
|
||||
|
||||
bool wxMenu::DoAppend(wxMenuItem *item)
|
||||
wxMenuItem* wxMenu::DoAppend(wxMenuItem *item)
|
||||
{
|
||||
#if 0
|
||||
// not used at all
|
||||
@@ -1158,21 +1158,21 @@ bool wxMenu::DoAppend(wxMenuItem *item)
|
||||
}
|
||||
|
||||
if ( !wxMenuBase::DoAppend(item) )
|
||||
return FALSE;
|
||||
return NULL;
|
||||
|
||||
OnItemAdded(item);
|
||||
|
||||
return TRUE;
|
||||
return item;
|
||||
}
|
||||
|
||||
bool wxMenu::DoInsert(size_t pos, wxMenuItem *item)
|
||||
wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item)
|
||||
{
|
||||
if ( !wxMenuBase::DoInsert(pos, item) )
|
||||
return FALSE;
|
||||
return NULL;
|
||||
|
||||
OnItemAdded(item);
|
||||
|
||||
return TRUE;
|
||||
return item;
|
||||
}
|
||||
|
||||
wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
|
||||
|
Reference in New Issue
Block a user