menu.tex

来自「Wxpython Implemented on Windows CE, Sou」· TEX 代码 · 共 1,140 行 · 第 1/3 页

TEX
1,140
字号

\docparam{style}{If {\tt wxMB\_DOCKABLE} the menu bar can be detached (wxGTK only).}

\pythonnote{Only the default constructor is supported in wxPython.
Use \helpref{wxMenuBar::Append}{wxmenubarappend} instead.}

\perlnote{wxPerl only supports the first constructor: 
use \helpref{wxMenuBar::Append}{wxmenubarappend} instead.}


\membersection{wxMenuBar::\destruct{wxMenuBar}}\label{wxmenubardtor}

\func{void}{\destruct{wxMenuBar}}{\void}

Destructor, destroying the menu bar and removing it from the parent frame (if any).


\membersection{wxMenuBar::Append}\label{wxmenubarappend}

\func{bool}{Append}{\param{wxMenu *}{menu}, \param{const wxString\& }{title}}

Adds the item to the end of the menu bar.

\wxheading{Parameters}

\docparam{menu}{The menu to add. Do not deallocate this menu after calling {\bf Append}.}

\docparam{title}{The title of the menu.}

\wxheading{Return value}

true on success, false if an error occurred.

\wxheading{See also}

\helpref{wxMenuBar::Insert}{wxmenubarinsert}


\membersection{wxMenuBar::Check}\label{wxmenubarcheck}

\func{void}{Check}{\param{int}{ id}, \param{const bool}{ check}}

Checks or unchecks a menu item.

\wxheading{Parameters}

\docparam{id}{The menu item identifier.}

\docparam{check}{If true, checks the menu item, otherwise the item is unchecked.}

\wxheading{Remarks}

Only use this when the menu bar has been associated
with a frame; otherwise, use the wxMenu equivalent call.


\membersection{wxMenuBar::Enable}\label{wxmenubarenable}

\func{void}{Enable}{\param{int}{ id}, \param{const bool}{ enable}}

Enables or disables (greys out) a menu item.

\wxheading{Parameters}

\docparam{id}{The menu item identifier.}

\docparam{enable}{true to enable the item, false to disable it.}

\wxheading{Remarks}

Only use this when the menu bar has been
associated with a frame; otherwise, use the wxMenu equivalent call.


\membersection{wxMenuBar::EnableTop}\label{wxmenubarenabletop}

\func{void}{EnableTop}{\param{int}{ pos}, \param{const bool}{ enable}}

Enables or disables a whole menu.

\wxheading{Parameters}

\docparam{pos}{The position of the menu, starting from zero.}

\docparam{enable}{true to enable the menu, false to disable it.}

\wxheading{Remarks}

Only use this when the menu bar has been
associated with a frame.


\membersection{wxMenuBar::FindMenu}\label{wxmenubarfindmenu}

\constfunc{int}{FindMenu}{\param{const wxString\& }{title}}

Returns the index of the menu with the given {\it title} or {\tt wxNOT\_FOUND} if no
such menu exists in this menubar. The {\it title} parameter may specify either
the menu title (with accelerator characters, i.e. {\tt "\&File"}) or just the
menu label ({\tt "File"}) indifferently.


\membersection{wxMenuBar::FindMenuItem}\label{wxmenubarfindmenuitem}

\constfunc{int}{FindMenuItem}{\param{const wxString\& }{menuString}, \param{const wxString\& }{itemString}}

Finds the menu item id for a menu name/menu item string pair.

\wxheading{Parameters}

\docparam{menuString}{Menu title to find.}

\docparam{itemString}{Item to find.}

\wxheading{Return value}

The menu item identifier, or {\tt wxNOT\_FOUND} if none was found.

\wxheading{Remarks}

Any special menu codes are stripped out of source and target strings
before matching.


\membersection{wxMenuBar::FindItem}\label{wxmenubarfinditem}

\constfunc{wxMenuItem *}{FindItem}{\param{int}{ id}, \param{wxMenu}{ **menu = NULL}}

Finds the menu item object associated with the given menu item identifier.

\wxheading{Parameters}

\docparam{id}{Menu item identifier.}

\docparam{menu}{If not NULL, menu will get set to the associated menu.}

\wxheading{Return value}

The found menu item object, or NULL if one was not found.


\membersection{wxMenuBar::GetHelpString}\label{wxmenubargethelpstring}

\constfunc{wxString}{GetHelpString}{\param{int}{ id}}

Gets the help string associated with the menu item identifier.

\wxheading{Parameters}

\docparam{id}{The menu item identifier.}

\wxheading{Return value}

The help string, or the empty string if there was no help string or the menu item
was not found.

\wxheading{See also}

\helpref{wxMenuBar::SetHelpString}{wxmenubarsethelpstring}


\membersection{wxMenuBar::GetLabel}\label{wxmenubargetlabel}

\constfunc{wxString}{GetLabel}{\param{int}{ id}}

Gets the label associated with a menu item.

\wxheading{Parameters}

\docparam{id}{The menu item identifier.}

\wxheading{Return value}

The menu item label, or the empty string if the item was not found.

\wxheading{Remarks}

Use only after the menubar has been associated with a frame.


\membersection{wxMenuBar::GetLabelTop}\label{wxmenubargetlabeltop}

\constfunc{wxString}{GetLabelTop}{\param{int}{ pos}}

Returns the label of a top-level menu. Note that the returned string does not
include the accelerator characters which could have been specified in the menu
title string during its construction.

\wxheading{Parameters}

\docparam{pos}{Position of the menu on the menu bar, starting from zero.}

\wxheading{Return value}

The menu label, or the empty string if the menu was not found.

\wxheading{Remarks}

Use only after the menubar has been associated with a frame.

\wxheading{See also}

\helpref{wxMenuBar::SetLabelTop}{wxmenubarsetlabeltop}


\membersection{wxMenuBar::GetMenu}\label{wxmenubargetmenu}

\constfunc{wxMenu*}{GetMenu}{\param{int}{ menuIndex}}

Returns the menu at {\it menuIndex} (zero-based).


\membersection{wxMenuBar::GetMenuCount}\label{wxmenubargetmenucount}

\constfunc{int}{GetMenuCount}{\void}

Returns the number of menus in this menubar.


\membersection{wxMenuBar::Insert}\label{wxmenubarinsert}

\func{bool}{Insert}{\param{size\_t }{pos}, \param{wxMenu *}{menu}, \param{const wxString\& }{title}}

Inserts the menu at the given position into the menu bar. Inserting menu at
position $0$ will insert it in the very beginning of it, inserting at position 
\helpref{GetMenuCount()}{wxmenubargetmenucount} is the same as calling 
\helpref{Append()}{wxmenubarappend}.

\wxheading{Parameters}

\docparam{pos}{The position of the new menu in the menu bar}

\docparam{menu}{The menu to add. wxMenuBar owns the menu and will free it.}

\docparam{title}{The title of the menu.}

\wxheading{Return value}

true on success, false if an error occurred.

\wxheading{See also}

\helpref{wxMenuBar::Append}{wxmenubarappend}


\membersection{wxMenuBar::IsChecked}\label{wxmenubarischecked}

\constfunc{bool}{IsChecked}{\param{int}{ id}}

Determines whether an item is checked.

\wxheading{Parameters}

\docparam{id}{The menu item identifier.}

\wxheading{Return value}

true if the item was found and is checked, false otherwise.


\membersection{wxMenuBar::IsEnabled}\label{wxmenubarisenabled}

\constfunc{bool}{IsEnabled}{\param{int}{ id}}

Determines whether an item is enabled.

\wxheading{Parameters}

\docparam{id}{The menu item identifier.}

\wxheading{Return value}

true if the item was found and is enabled, false otherwise.


\membersection{wxMenuBar::Refresh}\label{wxmenubarrefresh}

\func{void}{Refresh}{\void}

Redraw the menu bar


\membersection{wxMenuBar::Remove}\label{wxmenubarremove}

\func{wxMenu *}{Remove}{\param{size\_t }{pos}}

Removes the menu from the menu bar and returns the menu object - the caller is
responsible for deleting it. This function may be used together with 
\helpref{wxMenuBar::Insert}{wxmenubarinsert} to change the menubar
dynamically.

\wxheading{See also}

\helpref{wxMenuBar::Replace}{wxmenubarreplace}


\membersection{wxMenuBar::Replace}\label{wxmenubarreplace}

\func{wxMenu *}{Replace}{\param{size\_t }{pos}, \param{wxMenu *}{menu}, \param{const wxString\& }{title}}

Replaces the menu at the given position with another one.

\wxheading{Parameters}

\docparam{pos}{The position of the new menu in the menu bar}

\docparam{menu}{The menu to add.}

\docparam{title}{The title of the menu.}

\wxheading{Return value}

The menu which was previously at position {\it pos}. The caller is
responsible for deleting it.

\wxheading{See also}

\helpref{wxMenuBar::Insert}{wxmenubarinsert},\rtfsp
\helpref{wxMenuBar::Remove}{wxmenubarremove}


\membersection{wxMenuBar::SetHelpString}\label{wxmenubarsethelpstring}

\func{void}{SetHelpString}{\param{int}{ id}, \param{const wxString\& }{helpString}}

Sets the help string associated with a menu item.

\wxheading{Parameters}

\docparam{id}{Menu item identifier.}

\docparam{helpString}{Help string to associate with the menu item.}

\wxheading{See also}

\helpref{wxMenuBar::GetHelpString}{wxmenubargethelpstring}


\membersection{wxMenuBar::SetLabel}\label{wxmenubarsetlabel}

\func{void}{SetLabel}{\param{int}{ id}, \param{const wxString\& }{label}}

Sets the label of a menu item.

\wxheading{Parameters}

\docparam{id}{Menu item identifier.}

\docparam{label}{Menu item label.}

\wxheading{Remarks}

Use only after the menubar has been associated with a frame.

\wxheading{See also}

\helpref{wxMenuBar::GetLabel}{wxmenubargetlabel}


\membersection{wxMenuBar::SetLabelTop}\label{wxmenubarsetlabeltop}

\func{void}{SetLabelTop}{\param{int}{ pos}, \param{const wxString\& }{label}}

Sets the label of a top-level menu.

\wxheading{Parameters}

\docparam{pos}{The position of a menu on the menu bar, starting from zero.}

\docparam{label}{The menu label.}

\wxheading{Remarks}

Use only after the menubar has been associated with a frame.

\wxheading{See also}

\helpref{wxMenuBar::GetLabelTop}{wxmenubargetlabeltop}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?