implemented wxMenuBar ctor taking array of menus/titles for all ports; added optional flags argument to it (patch 1162726)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32880 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
e71693c340
commit
294ea16de3
@ -702,7 +702,7 @@ menu shortcuts may cease to work.
|
||||
|
||||
Default constructor.
|
||||
|
||||
\func{}{wxMenuBar}{\param{int}{ n}, \param{wxMenu*}{ menus[]}, \param{const wxString }{titles[]}}
|
||||
\func{}{wxMenuBar}{\param{size\_t}{ n}, \param{wxMenu*}{ menus[]}, \param{const wxString }{titles[]}, \param{long }{style = 0}}
|
||||
|
||||
Construct a menu bar from arrays of menus and titles.
|
||||
|
||||
@ -718,10 +718,10 @@ menu bar.}
|
||||
\docparam{style}{If {\tt wxMB\_DOCKABLE} the menu bar can be detached (wxGTK only).}
|
||||
|
||||
\pythonnote{Only the default constructor is supported in wxPython.
|
||||
Use wxMenuBar.Append instead.}
|
||||
Use \helpref{wxMenuBar::Append}{wxmenubarappend} instead.}
|
||||
|
||||
\perlnote{wxPerl only supports the first constructor:
|
||||
use {\tt Append} instead.}
|
||||
use \helpref{wxMenuBar::Append}{wxmenubarappend} instead.}
|
||||
|
||||
\membersection{wxMenuBar::\destruct{wxMenuBar}}\label{wxmenubardtor}
|
||||
|
||||
|
@ -78,6 +78,7 @@ class WXDLLEXPORT wxMenuBar : public wxMenuBarBase, public wxCocoaNSMenu
|
||||
public:
|
||||
// ctors and dtor
|
||||
wxMenuBar(long style = 0) { Create(style); }
|
||||
wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0)
|
||||
bool Create(long style = 0);
|
||||
virtual ~wxMenuBar();
|
||||
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
// ctors
|
||||
wxMenuBar();
|
||||
wxMenuBar(long style);
|
||||
wxMenuBar(int n, wxMenu *menus[], const wxString titles[]);
|
||||
wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0);
|
||||
virtual ~wxMenuBar();
|
||||
|
||||
// implement base class (pure) virtuals
|
||||
@ -56,6 +56,8 @@ public:
|
||||
wxWindow *m_invokingWindow;
|
||||
|
||||
private:
|
||||
void Init(size_t n, wxMenu *menus[], const wxString titles[], long style);
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxMenuBar)
|
||||
};
|
||||
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
// ctors
|
||||
wxMenuBar();
|
||||
wxMenuBar(long style);
|
||||
wxMenuBar(int n, wxMenu *menus[], const wxString titles[]);
|
||||
wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0);
|
||||
virtual ~wxMenuBar();
|
||||
|
||||
// implement base class (pure) virtuals
|
||||
@ -56,6 +56,8 @@ public:
|
||||
wxWindow *m_invokingWindow;
|
||||
|
||||
private:
|
||||
void Init(size_t n, wxMenu *menus[], const wxString titles[], long style);
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxMenuBar)
|
||||
};
|
||||
|
||||
|
@ -108,7 +108,7 @@ public:
|
||||
// unused under MSW
|
||||
wxMenuBar(long style);
|
||||
// menubar takes ownership of the menus arrays but copies the titles
|
||||
wxMenuBar(int n, wxMenu *menus[], const wxString titles[]);
|
||||
wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0);
|
||||
virtual ~wxMenuBar();
|
||||
|
||||
// menubar construction
|
||||
|
@ -108,7 +108,7 @@ public:
|
||||
// unused under MSW
|
||||
wxMenuBar(long style);
|
||||
// menubar takes ownership of the menus arrays but copies the titles
|
||||
wxMenuBar(int n, wxMenu *menus[], const wxString titles[]);
|
||||
wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0);
|
||||
virtual ~wxMenuBar();
|
||||
|
||||
// menubar construction
|
||||
|
@ -117,8 +117,8 @@ class wxMenuBar : public wxMenuBarBase
|
||||
public:
|
||||
wxMenuBar() { Init(); }
|
||||
wxMenuBar(long WXUNUSED(style)) { Init(); }
|
||||
wxMenuBar(int n, wxMenu *menus[], const wxString titles[]);
|
||||
wxMenuBar(int n, wxMenu *menus[], const wxArrayString& titles);
|
||||
wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0);
|
||||
wxMenuBar(size_t n, wxMenu *menus[], const wxArrayString& titles, long style = 0);
|
||||
virtual ~wxMenuBar();
|
||||
|
||||
// implement base class (pure) virtuals
|
||||
|
@ -165,7 +165,7 @@ public:
|
||||
// unused under MSW
|
||||
wxMenuBar(long style);
|
||||
// menubar takes ownership of the menus arrays but copies the titles
|
||||
wxMenuBar(int n, wxMenu *menus[], const wxString titles[]);
|
||||
wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0);
|
||||
virtual ~wxMenuBar();
|
||||
|
||||
// menubar construction
|
||||
|
@ -194,6 +194,7 @@ public:
|
||||
wxMenuBar( int n
|
||||
,wxMenu* vMenus[]
|
||||
,const wxString sTitles[]
|
||||
,long lStyle = 0
|
||||
);
|
||||
virtual ~wxMenuBar();
|
||||
|
||||
|
@ -146,7 +146,7 @@ public:
|
||||
|
||||
wxMenuBar(long style);
|
||||
// menubar takes ownership of the menus arrays but copies the titles
|
||||
wxMenuBar(int n, wxMenu *menus[], const wxString titles[]);
|
||||
wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0);
|
||||
virtual ~wxMenuBar();
|
||||
|
||||
// menubar construction
|
||||
|
@ -147,6 +147,7 @@ class WXDLLEXPORT wxMenuBar : public wxMenuBarBase
|
||||
public:
|
||||
// ctors and dtor
|
||||
wxMenuBar(long WXUNUSED(style) = 0) { Init(); }
|
||||
wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0)
|
||||
virtual ~wxMenuBar();
|
||||
|
||||
// implement base class virtuals
|
||||
|
@ -128,6 +128,14 @@ bool wxMenuBar::Create(long style)
|
||||
return true;
|
||||
}
|
||||
|
||||
wxMenuBar::wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long WXUNUSED(style))
|
||||
{
|
||||
Create(style);
|
||||
|
||||
for(size_t i = 0; i < n; ++i )
|
||||
Append(menus[i], titles[i]);
|
||||
}
|
||||
|
||||
wxMenuBar::~wxMenuBar()
|
||||
{
|
||||
[m_cocoaNSMenu release];
|
||||
|
@ -170,7 +170,7 @@ static void gtk_menu_open_callback( GtkWidget *widget, wxMenu *menu )
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMenuBar,wxWindow)
|
||||
|
||||
wxMenuBar::wxMenuBar( long style )
|
||||
void wxMenuBar::Init(size_t n, wxMenu *menus[], const wxString titles[], long style)
|
||||
{
|
||||
// the parent window is known after wxFrame::SetMenu()
|
||||
m_needParent = FALSE;
|
||||
@ -203,32 +203,24 @@ wxMenuBar::wxMenuBar( long style )
|
||||
PostCreation();
|
||||
|
||||
ApplyWidgetStyle();
|
||||
|
||||
for (size_t i = 0; i < n; ++i )
|
||||
Append(menus[i], titles[i]);
|
||||
}
|
||||
|
||||
wxMenuBar::wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style)
|
||||
{
|
||||
Init(n, menus, titles, style);
|
||||
}
|
||||
|
||||
wxMenuBar::wxMenuBar(long style)
|
||||
{
|
||||
Init(0, NULL, NULL, style);
|
||||
}
|
||||
|
||||
wxMenuBar::wxMenuBar()
|
||||
{
|
||||
// the parent window is known after wxFrame::SetMenu()
|
||||
m_needParent = FALSE;
|
||||
m_style = 0;
|
||||
m_invokingWindow = (wxWindow*) NULL;
|
||||
|
||||
if (!PreCreation( (wxWindow*) NULL, wxDefaultPosition, wxDefaultSize ) ||
|
||||
!CreateBase( (wxWindow*) NULL, -1, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxT("menubar") ))
|
||||
{
|
||||
wxFAIL_MSG( wxT("wxMenuBar creation failed") );
|
||||
return;
|
||||
}
|
||||
|
||||
m_menubar = gtk_menu_bar_new();
|
||||
#ifndef __WXGTK20__
|
||||
m_accel = gtk_accel_group_new();
|
||||
#endif
|
||||
|
||||
m_widget = GTK_WIDGET(m_menubar);
|
||||
|
||||
PostCreation();
|
||||
|
||||
ApplyWidgetStyle();
|
||||
Init(0, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
wxMenuBar::~wxMenuBar()
|
||||
|
@ -170,7 +170,7 @@ static void gtk_menu_open_callback( GtkWidget *widget, wxMenu *menu )
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMenuBar,wxWindow)
|
||||
|
||||
wxMenuBar::wxMenuBar( long style )
|
||||
void wxMenuBar::Init(size_t n, wxMenu *menus[], const wxString titles[], long style)
|
||||
{
|
||||
// the parent window is known after wxFrame::SetMenu()
|
||||
m_needParent = FALSE;
|
||||
@ -203,32 +203,24 @@ wxMenuBar::wxMenuBar( long style )
|
||||
PostCreation();
|
||||
|
||||
ApplyWidgetStyle();
|
||||
|
||||
for (size_t i = 0; i < n; ++i )
|
||||
Append(menus[i], titles[i]);
|
||||
}
|
||||
|
||||
wxMenuBar::wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style)
|
||||
{
|
||||
Init(n, menus, titles, style);
|
||||
}
|
||||
|
||||
wxMenuBar::wxMenuBar(long style)
|
||||
{
|
||||
Init(0, NULL, NULL, style);
|
||||
}
|
||||
|
||||
wxMenuBar::wxMenuBar()
|
||||
{
|
||||
// the parent window is known after wxFrame::SetMenu()
|
||||
m_needParent = FALSE;
|
||||
m_style = 0;
|
||||
m_invokingWindow = (wxWindow*) NULL;
|
||||
|
||||
if (!PreCreation( (wxWindow*) NULL, wxDefaultPosition, wxDefaultSize ) ||
|
||||
!CreateBase( (wxWindow*) NULL, -1, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, wxT("menubar") ))
|
||||
{
|
||||
wxFAIL_MSG( wxT("wxMenuBar creation failed") );
|
||||
return;
|
||||
}
|
||||
|
||||
m_menubar = gtk_menu_bar_new();
|
||||
#ifndef __WXGTK20__
|
||||
m_accel = gtk_accel_group_new();
|
||||
#endif
|
||||
|
||||
m_widget = GTK_WIDGET(m_menubar);
|
||||
|
||||
PostCreation();
|
||||
|
||||
ApplyWidgetStyle();
|
||||
Init(0, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
wxMenuBar::~wxMenuBar()
|
||||
|
@ -589,7 +589,7 @@ wxMenuBar::wxMenuBar( long WXUNUSED(style) )
|
||||
}
|
||||
|
||||
|
||||
wxMenuBar::wxMenuBar(int count, wxMenu *menus[], const wxString titles[])
|
||||
wxMenuBar::wxMenuBar(size_t count, wxMenu *menus[], const wxString titles[], long WXUNUSED(style))
|
||||
{
|
||||
Init();
|
||||
|
||||
|
@ -463,7 +463,7 @@ wxMenuBar::wxMenuBar( long WXUNUSED(style) )
|
||||
}
|
||||
|
||||
|
||||
wxMenuBar::wxMenuBar(int count, wxMenu *menus[], const wxString titles[])
|
||||
wxMenuBar::wxMenuBar(size_t count, wxMenu *menus[], const wxString titles[], long WXUNUSED(style))
|
||||
{
|
||||
Init();
|
||||
|
||||
|
@ -209,7 +209,7 @@ void wxMenuBar::Init()
|
||||
m_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
|
||||
}
|
||||
|
||||
wxMenuBar::wxMenuBar(int n, wxMenu *menus[], const wxArrayString& titles)
|
||||
wxMenuBar::wxMenuBar(size_t n, wxMenu *menus[], const wxArrayString& titles, long WXUNUSED(style))
|
||||
{
|
||||
wxASSERT( size_t(n) == titles.GetCount() );
|
||||
|
||||
@ -220,7 +220,7 @@ wxMenuBar::wxMenuBar(int n, wxMenu *menus[], const wxArrayString& titles)
|
||||
m_menus.Append(menus[i]);
|
||||
}
|
||||
|
||||
wxMenuBar::wxMenuBar(int n, wxMenu *menus[], const wxString titles[])
|
||||
wxMenuBar::wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long WXUNUSED(style))
|
||||
{
|
||||
Init();
|
||||
|
||||
|
@ -697,7 +697,7 @@ wxMenuBar::wxMenuBar( long WXUNUSED(style) )
|
||||
Init();
|
||||
}
|
||||
|
||||
wxMenuBar::wxMenuBar(int count, wxMenu *menus[], const wxString titles[])
|
||||
wxMenuBar::wxMenuBar(size_t count, wxMenu *menus[], const wxString titles[], long WXUNUSED(style))
|
||||
{
|
||||
Init();
|
||||
|
||||
|
@ -697,6 +697,7 @@ wxMenuBar::wxMenuBar(
|
||||
int nCount
|
||||
, wxMenu* vMenus[]
|
||||
, const wxString sTitles[]
|
||||
, long WXUNUSED(lStyle)
|
||||
)
|
||||
{
|
||||
Init();
|
||||
|
@ -332,7 +332,7 @@ wxMenuBar::wxMenuBar( long WXUNUSED(style) )
|
||||
{
|
||||
}
|
||||
|
||||
wxMenuBar::wxMenuBar(int count, wxMenu *menus[], const wxString titles[])
|
||||
wxMenuBar::wxMenuBar(size_t count, wxMenu *menus[], const wxString titles[], long WXUNUSED(style))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1678,6 +1678,14 @@ void wxMenuBar::Init()
|
||||
m_shouldShowMenu = false;
|
||||
}
|
||||
|
||||
wxMenuBar::wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long WXUNUSED(style))
|
||||
{
|
||||
Init();
|
||||
|
||||
for (size_t i = 0; i < n; ++i )
|
||||
Append(menus[i], titles[i]);
|
||||
}
|
||||
|
||||
void wxMenuBar::Attach(wxFrame *frame)
|
||||
{
|
||||
// maybe you really wanted to call Detach()?
|
||||
|
Loading…
Reference in New Issue
Block a user