mirror of
https://github.com/fltk/fltk.git
synced 2026-06-07 00:55:23 +08:00
Updated all links so they work between files.
Revision 1. git-svn-id: file:///fltk/svn/fltk/trunk@219 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
+161
-218
@@ -1,220 +1,163 @@
|
||||
<html>
|
||||
<body>
|
||||
|
||||
<hr break>
|
||||
|
||||
<h2><a name="Fl_Menu_">class Fl_Menu_</a></h2>
|
||||
|
||||
<hr>
|
||||
|
||||
<h3>Class Hierarchy</h3>
|
||||
|
||||
<ul><pre>
|
||||
<a href="#Fl_Widget">Fl_Widget</a>
|
||||
<HTML><BODY>
|
||||
<HR break>
|
||||
<H2><A name=Fl_Menu_>class Fl_Menu_</A></H2>
|
||||
<HR>
|
||||
<H3>Class Hierarchy</H3>
|
||||
<UL>
|
||||
<PRE>
|
||||
<A href=Fl_Widget.html#Fl_Widget>Fl_Widget</A>
|
||||
|
|
||||
+----<b>Fl_Menu_</b>----<a href="#Fl_Menu_Item">Fl_Menu_Item</a>
|
||||
+----<B>Fl_Menu_</B>----<A href=Fl_Menu_Item.html#Fl_Menu_Item>Fl_Menu_Item</A>
|
||||
|
|
||||
+----<a href="#Fl_Choice">Fl_Choice</a>, <a href="#Fl_Menu_Bar">Fl_Menu_Bar</a>, <a href="#Fl_Menu_Button">Fl_Menu_Button</a>
|
||||
</pre></ul>
|
||||
|
||||
<h3>Include Files</h3>
|
||||
|
||||
<ul><pre>
|
||||
#include <FL/Fl_Menu_.H>
|
||||
</pre></ul>
|
||||
|
||||
<h3>Description</h3>
|
||||
|
||||
All widgets that have a menu in FLTK are subclassed off of this class.
|
||||
Currently FLTK provides you with
|
||||
<a href="#Fl_Menu_Button"><tt>Fl_Menu_Button</tt></a>,
|
||||
<a href="#Fl_Menu_Bar"><tt>Fl_Menu_Bar</tt></a>, and
|
||||
<a href="#Fl_Choice"><tt>Fl_Choice</tt></a>.
|
||||
|
||||
<p>The class contains a pointer to an array of structures of type
|
||||
<a href="#Fl_Menu_Item"><tt>Fl_Menu_Item</tt></a>.
|
||||
These describe the contents of the menu. Usually the array is a large
|
||||
initialization constant, but there are methods to build it
|
||||
dynamically.
|
||||
|
||||
<h3>Methods</h3>
|
||||
|
||||
<center>
|
||||
<table width=90%>
|
||||
<tr>
|
||||
<td align=left valign=top>
|
||||
<ul>
|
||||
<li><a href="#Fl_Menu_.Fl_Menu_">Fl_Menu_</a>
|
||||
<li><a href="#Fl_Menu_.~Fl_Menu_">~Fl_Menu_</a>
|
||||
<li><a href="#Fl_Menu_.add">add</a>
|
||||
<li><a href="#Fl_Menu_.clear">clear</a>
|
||||
</ul>
|
||||
</td>
|
||||
<td align=left valign=top>
|
||||
<ul>
|
||||
<li><a href="#Fl_Menu_.down_box">down_box</a>
|
||||
<li><a href="#Fl_Menu_.global">global</a>
|
||||
<li><a href="#Fl_Menu_.menu">menu</a>
|
||||
<li><a href="#Fl_Menu_.mode">mode</a>
|
||||
</ul>
|
||||
</td>
|
||||
<td align=left valign=top>
|
||||
<ul>
|
||||
<li><a href="#Fl_Menu_.remove">remove</a>
|
||||
<li><a href="#Fl_Menu_.replace">replace</a>
|
||||
<li><a href="#Fl_Menu_.shortcut">shortcut</a>
|
||||
<li><a href="#Fl_Menu_.size">size</a>
|
||||
</ul>
|
||||
</td>
|
||||
<td align=left valign=top>
|
||||
<ul>
|
||||
<li><a href="#Fl_Menu_.test_shortcut">test_shortcut</a>
|
||||
<li><a href="#Fl_Menu_.text">text</a>
|
||||
<li><a href="#Fl_Menu_.textcolor">textcolor</a>
|
||||
</ul>
|
||||
</td>
|
||||
<td align=left valign=top>
|
||||
<ul>
|
||||
<li><a href="#Fl_Menu_.textfont">textfont</a>
|
||||
<li><a href="#Fl_Menu_.textsize">textsize</a>
|
||||
<li><a href="#Fl_Menu_.value">value</a>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<h4><a name="Fl_Menu_.Fl_Menu_">Fl_Menu_::Fl_Menu_(int x, int y, int w, int h, const char *label = 0)</a></h4>
|
||||
|
||||
Creates a new <tt>Fl_Menu_</tt> widget using the given position, size, and
|
||||
label string. The default boxtype is <tt>FL_NO_BOX</tt>.
|
||||
|
||||
<h4><a name="Fl_Menu_.~Fl_Menu_">virtual Fl_Menu_::~Fl_Menu_()</a></h4>
|
||||
|
||||
Destroys the menu and its items.
|
||||
|
||||
<h4><a name="Fl_Menu_.menu">const Fl_Menu_Item* Fl_Menu_::menu() const<br>
|
||||
void Fl_Menu_::menu(const Fl_Menu_Item*)</a></h4>
|
||||
|
||||
Get or set the menu array directly. Setting it to <tt>NULL</tt> indicates that
|
||||
you want the widget to allocate its own array.
|
||||
|
||||
<h4><a name="Fl_Menu_.value">int Fl_Menu_::value() const<br>
|
||||
int Fl_Menu_::value(int)<br>
|
||||
int Fl_Menu_::value(const Fl_Menu_Item*)</a></h4>
|
||||
|
||||
The value is the index into <tt>menu()</tt> of the last item chosen by the
|
||||
user. It is zero initially. You can set it as an integer, or set it
|
||||
with a pointer to a menu item. The set routines return non-zero if
|
||||
the new value is different than the old one.
|
||||
|
||||
<h4><a name="Fl_Menu_.test_shortcut">const Fl_Menu_Item* Fl_Menu_::test_shortcut()</a></h4>
|
||||
|
||||
Only call this in response to <tt>FL_SHORTCUT events</tt>. If the event
|
||||
matches an entry in the menu that entry is selected and the callback
|
||||
will be done (or <tt>changed()</tt> will be set). This allows shortcuts
|
||||
directed at one window to call menus in another.
|
||||
|
||||
<h4><a name="Fl_Menu_.global">void Fl_Menu_::global()</a></h4>
|
||||
|
||||
Make the shortcuts for this menu work no matter what window has the
|
||||
focus when you type it. This is done by using <a
|
||||
href="#add_handler"><tt>Fl::add_handler()</tt></a>. This
|
||||
<tt>Fl_Menu_</tt> widget does not have to be visible (ie the window it
|
||||
is in can be hidden, or it does not have to be put in a window at all).
|
||||
|
||||
<p>Currently there can be only one <tt>global()<tt> menu. Setting a new one
|
||||
will replace the old one. There is no way to remove the <tt>global()</tt>
|
||||
setting (including destroying the menu).
|
||||
|
||||
<h4><a name="Fl_Menu_.text">const char* Fl_Menu_::text() const<br>
|
||||
const char* Fl_Menu_::text(int i) const</a></h4>
|
||||
|
||||
Returns the title of the last item chosen, or of item <tt>i</tt>.
|
||||
|
||||
<h4><a name="Fl_Menu_.size">int Fl_Menu_::size() const</a></h4>
|
||||
|
||||
This returns <tt>menu()->size()</tt>, which is how many entries are in
|
||||
the array, not counting the <tt>NULL</tt> ending, but including all
|
||||
submenus titles and the <tt>NULL</tt>'s that end them. If the menu is
|
||||
<tt>NULL</tt> this returns zero.
|
||||
|
||||
<h4><a name="Fl_Menu_.add">int Fl_Menu_::add(const char *,const char *,Fl_Callback *,void *v=0,int f=0)<br>
|
||||
int Fl_Menu_::add(const char *)</a></h4>
|
||||
|
||||
The first form adds a new menu item, with a <tt>title</tt> string,
|
||||
<tt>shortcut</tt> string, <tt>callback</tt>, argument to the callback,
|
||||
and flags. If <tt>menu()</tt> was originally set with <tt>NULL</tt>
|
||||
then space is allocated for the new item. If instead you gave it an
|
||||
array then the array must have enough empty space for the new item.
|
||||
The title string is copied, but the shortcut is not.
|
||||
|
||||
<p>The second form splits the string at any | characters and then does
|
||||
<tt>add(s,0,0,0,0)</tt> with each section. This is often useful if you
|
||||
are just using the value, and is compatable with some Forms programs.
|
||||
|
||||
<p>Text is a string of the form "foo/bar/baz", this example will result
|
||||
in a submenu called "foo" and one in that called "bar" and and entry
|
||||
called "baz". The text is copied to new memory and can be freed. The
|
||||
other arguments are copied into the menu item unchanged.
|
||||
|
||||
<P>If an item exists already with that name then it is replaced with
|
||||
this new one. Otherwise this new one is added to the end of the
|
||||
correct menu or submenu. The return value is the offset into the
|
||||
array that the new entry was placed at.
|
||||
|
||||
<p>No bounds checking is done, the table must be big enough for all the
|
||||
entries you plan to add. Don't forget that there is a <tt>NULL</tt> terminator
|
||||
on the end, and the first time a item is added to a submenu three
|
||||
items are added (the title and the <tt>NULL</tt> terminator, as well as the
|
||||
actual menu item)
|
||||
|
||||
<P>The return value is the index into the array that the entry was put.
|
||||
|
||||
<h4><a name="Fl_Menu_.clear">void Fl_Menu_::clear()</a></h4>
|
||||
|
||||
Delete all the menu items. Don't do this if you used <tt>menu(x)</tt> to
|
||||
set it to your own array. You should do this before destroying the
|
||||
<tt>Fl_Menu_</tt> widget if it uses it's own array.
|
||||
|
||||
<h4><a name="Fl_Menu_.replace">void Fl_Menu_::replace(int n, const char *)</a></h4>
|
||||
|
||||
Changes the text of item <tt>n</tt>. The passed string is copied.
|
||||
|
||||
<h4><a name="Fl_Menu_.remove">void Fl_Menu_::remove(int n)</a></h4>
|
||||
|
||||
Deletes item <tt>n</tt> from the menu.
|
||||
|
||||
<h4><a name="Fl_Menu_.shortcut">void Fl_Menu_::shortcut(int i, int n);</a></h4>
|
||||
|
||||
Changes the shortcut of item <tt>i</tt> to <tt>n</tt>.
|
||||
|
||||
<h4><a name="Fl_Menu_.mode">void Fl_Menu_::mode(int i,int x);</a></h4>
|
||||
|
||||
Changes the flags of item <tt>i</tt>.
|
||||
|
||||
<h4><a name="Fl_Menu_.textcolor">Fl_Color Fl_Menu_::textcolor() const<br>
|
||||
void Fl_Menu_::textcolor(Fl_Color)</a></h4>
|
||||
|
||||
Get or set the current color of menu item labels.
|
||||
|
||||
<h4><a name="Fl_Menu_.textfont">Fl_Font Fl_Menu_::textfont() const<br>
|
||||
void Fl_Menu_::textfont(Fl_Font)</a></h4>
|
||||
|
||||
Get or set the current font of menu item labels.
|
||||
|
||||
<h4><a name="Fl_Menu_.textsize">uchar Fl_Menu_::textsize() const<br>
|
||||
void Fl_Menu_::textsize(uchar)</a></h4>
|
||||
|
||||
Get or set the font size of menu item labels.
|
||||
|
||||
<h4><a name="Fl_Menu_.down_box">Fl_Boxtype Fl_Menu_::down_box() const<br>
|
||||
void Fl_Menu_::down_box(Fl_Boxtype)</a></h4>
|
||||
|
||||
This box type is used to surround the currently-selected items in the
|
||||
menus. If this is <tt>FL_NO_BOX</tt> then it acts like
|
||||
<tt>FL_THIN_UP_BOX</tt> and <tt>selection_color()</tt> acts like
|
||||
<tt>FL_WHITE</tt>, for back compatability.
|
||||
|
||||
</body>
|
||||
</html>
|
||||
+----<A href=functions.html#Fl_Choice>Fl_Choice</A>, <A href=Fl_Menu_Bar.html#Fl_Menu_Bar>Fl_Menu_Bar</A>, <A href=Fl_Menu_Button.html#Fl_Menu_Button>Fl_Menu_Button</A>
|
||||
</PRE>
|
||||
</UL>
|
||||
<H3>Include Files</H3>
|
||||
<UL>
|
||||
<PRE>
|
||||
#include <FL/Fl_Menu_.H>
|
||||
</PRE>
|
||||
</UL>
|
||||
<H3>Description</H3>
|
||||
All widgets that have a menu in FLTK are subclassed off of this class.
|
||||
Currently FLTK provides you with <A href=Fl_Menu_Button.html#Fl_Menu_Button>
|
||||
<TT>Fl_Menu_Button</TT></A>, <A href=Fl_Menu_Bar.html#Fl_Menu_Bar><TT>
|
||||
Fl_Menu_Bar</TT></A>, and <A href=functions.html#Fl_Choice><TT>Fl_Choice</TT>
|
||||
</A>.
|
||||
<P>The class contains a pointer to an array of structures of type <A href=Fl_Menu_Item.html#Fl_Menu_Item>
|
||||
<TT>Fl_Menu_Item</TT></A>. These describe the contents of the menu.
|
||||
Usually the array is a large initialization constant, but there are
|
||||
methods to build it dynamically. </P>
|
||||
<H3>Methods</H3>
|
||||
<CENTER>
|
||||
<TABLE width=90%>
|
||||
<TR><TD align=left valign=top>
|
||||
<UL>
|
||||
<LI><A href=#Fl_Menu_.Fl_Menu_>Fl_Menu_</A></LI>
|
||||
<LI><A href=#Fl_Menu_.~Fl_Menu_>~Fl_Menu_</A></LI>
|
||||
<LI><A href=#Fl_Menu_.add>add</A></LI>
|
||||
<LI><A href=#Fl_Menu_.clear>clear</A></LI>
|
||||
</UL>
|
||||
</TD><TD align=left valign=top>
|
||||
<UL>
|
||||
<LI><A href=#Fl_Menu_.down_box>down_box</A></LI>
|
||||
<LI><A href=#Fl_Menu_.global>global</A></LI>
|
||||
<LI><A href=#Fl_Menu_.menu>menu</A></LI>
|
||||
<LI><A href=#Fl_Menu_.mode>mode</A></LI>
|
||||
</UL>
|
||||
</TD><TD align=left valign=top>
|
||||
<UL>
|
||||
<LI><A href=#Fl_Menu_.remove>remove</A></LI>
|
||||
<LI><A href=#Fl_Menu_.replace>replace</A></LI>
|
||||
<LI><A href=#Fl_Menu_.shortcut>shortcut</A></LI>
|
||||
<LI><A href=#Fl_Menu_.size>size</A></LI>
|
||||
</UL>
|
||||
</TD><TD align=left valign=top>
|
||||
<UL>
|
||||
<LI><A href=#Fl_Menu_.test_shortcut>test_shortcut</A></LI>
|
||||
<LI><A href=#Fl_Menu_.text>text</A></LI>
|
||||
<LI><A href=#Fl_Menu_.textcolor>textcolor</A></LI>
|
||||
</UL>
|
||||
</TD><TD align=left valign=top>
|
||||
<UL>
|
||||
<LI><A href=#Fl_Menu_.textfont>textfont</A></LI>
|
||||
<LI><A href=#Fl_Menu_.textsize>textsize</A></LI>
|
||||
<LI><A href=#Fl_Menu_.value>value</A></LI>
|
||||
</UL>
|
||||
</TD></TR>
|
||||
</TABLE>
|
||||
</CENTER>
|
||||
<H4><A name=Fl_Menu_.Fl_Menu_>Fl_Menu_::Fl_Menu_(int x, int y, int w,
|
||||
int h, const char *label = 0)</A></H4>
|
||||
Creates a new <TT>Fl_Menu_</TT> widget using the given position, size,
|
||||
and label string. The default boxtype is <TT>FL_NO_BOX</TT>.
|
||||
<H4><A name=Fl_Menu_.~Fl_Menu_>virtual Fl_Menu_::~Fl_Menu_()</A></H4>
|
||||
Destroys the menu and its items.
|
||||
<H4><A name=Fl_Menu_.menu>const Fl_Menu_Item* Fl_Menu_::menu() const
|
||||
<BR> void Fl_Menu_::menu(const Fl_Menu_Item*)</A></H4>
|
||||
Get or set the menu array directly. Setting it to <TT>NULL</TT>
|
||||
indicates that you want the widget to allocate its own array.
|
||||
<H4><A name=Fl_Menu_.value>int Fl_Menu_::value() const
|
||||
<BR> int Fl_Menu_::value(int)
|
||||
<BR> int Fl_Menu_::value(const Fl_Menu_Item*)</A></H4>
|
||||
The value is the index into <TT>menu()</TT> of the last item chosen by
|
||||
the user. It is zero initially. You can set it as an integer, or set
|
||||
it with a pointer to a menu item. The set routines return non-zero if
|
||||
the new value is different than the old one.
|
||||
<H4><A name=Fl_Menu_.test_shortcut>const Fl_Menu_Item*
|
||||
Fl_Menu_::test_shortcut()</A></H4>
|
||||
Only call this in response to <TT>FL_SHORTCUT events</TT>. If the
|
||||
event matches an entry in the menu that entry is selected and the
|
||||
callback will be done (or <TT>changed()</TT> will be set). This allows
|
||||
shortcuts directed at one window to call menus in another.
|
||||
<H4><A name=Fl_Menu_.global>void Fl_Menu_::global()</A></H4>
|
||||
Make the shortcuts for this menu work no matter what window has the
|
||||
focus when you type it. This is done by using <A href=osissues.html#add_handler>
|
||||
<TT>Fl::add_handler()</TT></A>. This <TT>Fl_Menu_</TT> widget does not
|
||||
have to be visible (ie the window it is in can be hidden, or it does
|
||||
not have to be put in a window at all).
|
||||
<P>Currently there can be only one <TT>global()<TT>menu. Setting a new
|
||||
one will replace the old one. There is no way to remove the <TT>
|
||||
global()</TT> setting (including destroying the menu). </TT></TT></P>
|
||||
<H4><A name=Fl_Menu_.text>const char* Fl_Menu_::text() const
|
||||
<BR> const char* Fl_Menu_::text(int i) const</A></H4>
|
||||
Returns the title of the last item chosen, or of item <TT>i</TT>.
|
||||
<H4><A name=Fl_Menu_.size>int Fl_Menu_::size() const</A></H4>
|
||||
This returns <TT>menu()->size()</TT>, which is how many entries are in
|
||||
the array, not counting the <TT>NULL</TT> ending, but including all
|
||||
submenus titles and the <TT>NULL</TT>'s that end them. If the menu is <TT>
|
||||
NULL</TT> this returns zero.
|
||||
<H4><A name=Fl_Menu_.add>int Fl_Menu_::add(const char *,const char
|
||||
*,Fl_Callback *,void *v=0,int f=0)
|
||||
<BR> int Fl_Menu_::add(const char *)</A></H4>
|
||||
The first form adds a new menu item, with a <TT>title</TT> string, <TT>
|
||||
shortcut</TT> string, <TT>callback</TT>, argument to the callback, and
|
||||
flags. If <TT>menu()</TT> was originally set with <TT>NULL</TT> then
|
||||
space is allocated for the new item. If instead you gave it an array
|
||||
then the array must have enough empty space for the new item. The
|
||||
title string is copied, but the shortcut is not.
|
||||
<P>The second form splits the string at any | characters and then does <TT>
|
||||
add(s,0,0,0,0)</TT> with each section. This is often useful if you are
|
||||
just using the value, and is compatable with some Forms programs. </P>
|
||||
<P>Text is a string of the form "foo/bar/baz", this example will result
|
||||
in a submenu called "foo" and one in that called "bar" and and entry
|
||||
called "baz". The text is copied to new memory and can be freed. The
|
||||
other arguments are copied into the menu item unchanged. </P>
|
||||
<P>If an item exists already with that name then it is replaced with
|
||||
this new one. Otherwise this new one is added to the end of the
|
||||
correct menu or submenu. The return value is the offset into the array
|
||||
that the new entry was placed at. </P>
|
||||
<P>No bounds checking is done, the table must be big enough for all the
|
||||
entries you plan to add. Don't forget that there is a <TT>NULL</TT>
|
||||
terminator on the end, and the first time a item is added to a submenu
|
||||
three items are added (the title and the <TT>NULL</TT> terminator, as
|
||||
well as the actual menu item) </P>
|
||||
<P>The return value is the index into the array that the entry was put. </P>
|
||||
<H4><A name=Fl_Menu_.clear>void Fl_Menu_::clear()</A></H4>
|
||||
Delete all the menu items. Don't do this if you used <TT>menu(x)</TT>
|
||||
to set it to your own array. You should do this before destroying the <TT>
|
||||
Fl_Menu_</TT> widget if it uses it's own array.
|
||||
<H4><A name=Fl_Menu_.replace>void Fl_Menu_::replace(int n, const char *)</A>
|
||||
</H4>
|
||||
Changes the text of item <TT>n</TT>. The passed string is copied.
|
||||
<H4><A name=Fl_Menu_.remove>void Fl_Menu_::remove(int n)</A></H4>
|
||||
Deletes item <TT>n</TT> from the menu.
|
||||
<H4><A name=Fl_Menu_.shortcut>void Fl_Menu_::shortcut(int i, int n);</A></H4>
|
||||
Changes the shortcut of item <TT>i</TT> to <TT>n</TT>.
|
||||
<H4><A name=Fl_Menu_.mode>void Fl_Menu_::mode(int i,int x);</A></H4>
|
||||
Changes the flags of item <TT>i</TT>.
|
||||
<H4><A name=Fl_Menu_.textcolor>Fl_Color Fl_Menu_::textcolor() const
|
||||
<BR> void Fl_Menu_::textcolor(Fl_Color)</A></H4>
|
||||
Get or set the current color of menu item labels.
|
||||
<H4><A name=Fl_Menu_.textfont>Fl_Font Fl_Menu_::textfont() const
|
||||
<BR> void Fl_Menu_::textfont(Fl_Font)</A></H4>
|
||||
Get or set the current font of menu item labels.
|
||||
<H4><A name=Fl_Menu_.textsize>uchar Fl_Menu_::textsize() const
|
||||
<BR> void Fl_Menu_::textsize(uchar)</A></H4>
|
||||
Get or set the font size of menu item labels.
|
||||
<H4><A name=Fl_Menu_.down_box>Fl_Boxtype Fl_Menu_::down_box() const
|
||||
<BR> void Fl_Menu_::down_box(Fl_Boxtype)</A></H4>
|
||||
This box type is used to surround the currently-selected items in the
|
||||
menus. If this is <TT>FL_NO_BOX</TT> then it acts like <TT>
|
||||
FL_THIN_UP_BOX</TT> and <TT>selection_color()</TT> acts like <TT>
|
||||
FL_WHITE</TT>, for back compatability. </BODY></HTML>
|
||||
Reference in New Issue
Block a user