2006-10-29 17:16:03 +03:00
|
|
|
<HTML>
|
|
|
|
<HEAD>
|
|
|
|
<TITLE>Fl_Button</TITLE>
|
|
|
|
</HEAD>
|
|
|
|
<BODY>
|
2001-11-28 21:00:17 +03:00
|
|
|
<!-- NEW PAGE -->
|
1999-01-13 22:28:54 +03:00
|
|
|
<H2><A name=Fl_Button>class Fl_Button</A></H2>
|
|
|
|
<HR>
|
|
|
|
<H3>Class Hierarchy</H3>
|
|
|
|
<UL>
|
|
|
|
<PRE>
|
|
|
|
<A href=Fl_Widget.html#Fl_Widget>Fl_Widget</A>
|
1998-12-29 17:21:17 +03:00
|
|
|
|
|
1999-01-13 22:28:54 +03:00
|
|
|
+----<B>Fl_Button</B>
|
1998-12-29 17:21:17 +03:00
|
|
|
|
|
1999-01-13 22:28:54 +03:00
|
|
|
+----<A href=Fl_Check_Button.html#Fl_Check_Button>Fl_Check_Button</A>, <A href=Fl_Light_Button.html#Fl_Light_Button>Fl_Light_Button</A>, <A href=Fl_Repeat_Button.html#Fl_Repeat_Button>Fl_Repeat_Button</A>,
|
2006-03-29 18:40:44 +04:00
|
|
|
<A href=Fl_Return_Button.html#Fl_Return_Button>Fl_Return_Button</A>, <A href=Fl_Round_Button.html#Fl_Round_Button>Fl_Round_Button</A>, <A href=Fl_Toggle_Button.html#Fl_Toggle_Button>Fl_Toggle_Button</A>
|
1999-01-13 22:28:54 +03:00
|
|
|
</PRE>
|
|
|
|
</UL>
|
|
|
|
<H3>Include Files</H3>
|
|
|
|
<UL>
|
|
|
|
<PRE>
|
|
|
|
#include <FL/Fl_Button.H>
|
|
|
|
</PRE>
|
|
|
|
</UL>
|
|
|
|
<H3>Description</H3>
|
2001-11-29 22:24:00 +03:00
|
|
|
<P>Buttons generate callbacks when they are clicked by the user. You
|
1999-01-13 22:28:54 +03:00
|
|
|
control exactly when and how by changing the values for <TT>type()</TT>
|
|
|
|
and <TT>when()</TT>. </P>
|
|
|
|
<P>Buttons can also generate callbacks in response to <TT>FL_SHORTCUT</TT>
|
|
|
|
events. The button can either have an explicit <A href=#Fl_Button.shortcut>
|
2001-11-29 22:24:00 +03:00
|
|
|
<TT>shortcut()</TT></A> value or a letter shortcut can be indicated in
|
|
|
|
the <TT>label()</TT> with an '&' character before it. For the label
|
|
|
|
shortcut it does not matter if <I>Alt</I> is held down, but if you have
|
1999-01-13 22:28:54 +03:00
|
|
|
an input field in the same window, the user will have to hold down the <I>
|
|
|
|
Alt</I> key so that the input field does not eat the event first as an <TT>
|
|
|
|
FL_KEYBOARD</TT> event. </P>
|
|
|
|
<H3>Methods</H3>
|
|
|
|
<CENTER>
|
2001-05-06 20:25:05 +04:00
|
|
|
<TABLE width=90% summary="Fl_Button methods">
|
1999-01-13 22:28:54 +03:00
|
|
|
<TR><TD align=left valign=top>
|
|
|
|
<UL>
|
|
|
|
<LI><A href=#Fl_Button.Fl_Button>Fl_Button</A></LI>
|
|
|
|
<LI><A href=#Fl_Button.~Fl_Button>~Fl_Button</A></LI>
|
|
|
|
</UL>
|
|
|
|
</TD><TD align=left valign=top>
|
|
|
|
<UL>
|
|
|
|
<LI><A href=#Fl_Button.clear>clear</A></LI>
|
|
|
|
<LI><A href=#Fl_Button.down_box>down_box</A></LI>
|
|
|
|
</UL>
|
|
|
|
</TD><TD align=left valign=top>
|
|
|
|
<UL>
|
|
|
|
<LI><A href=#Fl_Button.set>set</A></LI>
|
|
|
|
<LI><A href=#Fl_Button.setonly>setonly</A></LI>
|
|
|
|
</UL>
|
|
|
|
</TD><TD align=left valign=top>
|
|
|
|
<UL>
|
|
|
|
<LI><A href=#Fl_Button.shortcut>shortcut</A></LI>
|
|
|
|
<LI><A href=#Fl_Button.type>type</A></LI>
|
|
|
|
</UL>
|
|
|
|
</TD><TD align=left valign=top>
|
|
|
|
<UL>
|
|
|
|
<LI><A href=#Fl_Button.value>value</A></LI>
|
|
|
|
<LI><A href=#Fl_Button.when>when</A></LI>
|
|
|
|
</UL>
|
|
|
|
</TD></TR>
|
|
|
|
</TABLE>
|
|
|
|
</CENTER>
|
2001-11-29 22:24:00 +03:00
|
|
|
<H4><A name=Fl_Button.Fl_Button>Fl_Button::Fl_Button(int x, int y, int
|
1999-01-13 22:28:54 +03:00
|
|
|
w, int h, const char *label = 0)</A></H4>
|
2001-11-29 22:24:00 +03:00
|
|
|
The constructor creates the button using the position, size, and
|
|
|
|
label.
|
1999-01-13 22:28:54 +03:00
|
|
|
<H4><A name=Fl_Button.~Fl_Button>Fl_Button::~Fl_Button(void)</A></H4>
|
2002-04-19 00:37:29 +04:00
|
|
|
The destructor removes the button.
|
1999-01-13 22:28:54 +03:00
|
|
|
<H4><A name=Fl_Button.clear>int Fl_Button::clear()</A></H4>
|
2001-11-29 22:24:00 +03:00
|
|
|
Same as <TT>value(0)</TT>.
|
1999-01-13 22:28:54 +03:00
|
|
|
<H4><A name=Fl_Button.down_box>Fl_Boxtype Fl_Button::down_box() const
|
|
|
|
<BR> void Fl_Button::down_box(Fl_Boxtype bt)</A></H4>
|
|
|
|
The first form returns the current down box type, which is drawn when <TT>
|
2001-11-29 22:24:00 +03:00
|
|
|
value()</TT> is non-zero.
|
|
|
|
<P>The second form sets the down box type. The default value of 0
|
1999-01-13 22:28:54 +03:00
|
|
|
causes FLTK to figure out the correct matching down version of <TT>box()</TT>
|
|
|
|
. </P>
|
|
|
|
<H4><A name=Fl_Button.set>int Fl_Button::set()</A></H4>
|
2001-11-29 22:24:00 +03:00
|
|
|
Same as <TT>value(1)</TT>.
|
1999-01-13 22:28:54 +03:00
|
|
|
<H4><A name=Fl_Button.setonly>void Fl_Button::setonly()</A></H4>
|
2001-11-29 22:24:00 +03:00
|
|
|
Turns on this button and turns off all other radio buttons in the
|
|
|
|
group (calling <TT>value(1)</TT> or <TT>set()</TT> does not do this).
|
1999-01-13 22:28:54 +03:00
|
|
|
<H4><A name=Fl_Button.shortcut>ulong Fl_Button::shortcut() const
|
|
|
|
<BR> void Fl_Button::shortcut(ulong key)</A></H4>
|
2001-11-29 22:24:00 +03:00
|
|
|
The first form returns the current shortcut key for the button.
|
|
|
|
<P>The second form sets the shortcut key to <TT>key</TT>. Setting this
|
|
|
|
overrides the use of '&' in the <TT>label()</TT>. The value is a bitwise
|
1999-01-13 22:28:54 +03:00
|
|
|
OR of a key and a set of shift flags, for example <CODE>FL_ALT | 'a'</CODE>
|
2001-11-29 22:24:00 +03:00
|
|
|
, <CODE>FL_ALT | (FL_F + 10)</CODE>, or just <CODE>'a'</CODE>. A value
|
1999-01-13 22:28:54 +03:00
|
|
|
of 0 disables the shortcut. </P>
|
2002-01-15 05:17:19 +03:00
|
|
|
<P>The key can be any value returned by <A href="Fl.html#Fl.event_key">
|
2001-11-29 22:24:00 +03:00
|
|
|
<TT>Fl::event_key()</TT></A>, but will usually be an ASCII letter. Use
|
1999-01-13 22:28:54 +03:00
|
|
|
a lower-case letter unless you require the shift key to be held down. </P>
|
2002-01-15 05:17:19 +03:00
|
|
|
<P>The shift flags can be any set of values accepted by <A href="Fl.html#Fl.event_state">
|
2001-11-29 22:24:00 +03:00
|
|
|
<TT>Fl::event_state()</TT></A>. If the bit is on that shift key must
|
|
|
|
be pushed. Meta, Alt, Ctrl, and Shift must be off if they are not in
|
|
|
|
the shift flags (zero for the other bits indicates a "don't care"
|
1999-01-13 22:28:54 +03:00
|
|
|
setting). </P>
|
|
|
|
<H4><A name=Fl_Button.type>uchar Fl_Button::type() const
|
|
|
|
<BR> void Fl_Button::type(uchar t)</A></H4>
|
2001-11-29 22:24:00 +03:00
|
|
|
The first form of <TT>type()</TT> returns the current button type,
|
|
|
|
which can be one of:
|
1999-01-13 22:28:54 +03:00
|
|
|
<UL>
|
|
|
|
<LI><CODE>0</CODE>: The value is unchanged. </LI>
|
|
|
|
<LI><CODE>FL_TOGGLE_BUTTON</CODE>: The value is inverted. </LI>
|
2001-11-29 22:24:00 +03:00
|
|
|
<LI><CODE>FL_RADIO_BUTTON</CODE>: The value is set to 1, and all other
|
1999-01-13 22:28:54 +03:00
|
|
|
buttons in the current group with <CODE>type() == FL_RADIO_BUTTON</CODE>
|
|
|
|
are set to zero. </LI>
|
|
|
|
</UL>
|
2001-11-29 22:24:00 +03:00
|
|
|
The second form sets the button type to <TT>t</TT>.
|
1999-01-13 22:28:54 +03:00
|
|
|
<H4><A name=Fl_Button.value>char Fl_Button::value() const
|
|
|
|
<BR> int Fl_Button::value(int)</A></H4>
|
2001-11-29 22:24:00 +03:00
|
|
|
The first form returns the current value (0 or 1). The second form
|
|
|
|
sets the current value.
|
1999-01-13 22:28:54 +03:00
|
|
|
<H4><A name=Fl_Button.when>Fl_When Fl_Widget::when() const
|
|
|
|
<BR> void Fl_Widget::when(Fl_When w)</A></H4>
|
2001-11-29 22:24:00 +03:00
|
|
|
Controls when callbacks are done. The following values are useful,
|
|
|
|
the default value is <CODE>FL_WHEN_RELEASE</CODE>:
|
1999-01-13 22:28:54 +03:00
|
|
|
<UL>
|
2001-11-29 22:24:00 +03:00
|
|
|
<LI><CODE>0</CODE>: The callback is not done, instead changed() is
|
1999-01-13 22:28:54 +03:00
|
|
|
turned on. </LI>
|
2001-11-29 22:24:00 +03:00
|
|
|
<LI><CODE>FL_WHEN_RELEASE</CODE>: The callback is done after the user
|
1999-01-13 22:28:54 +03:00
|
|
|
successfully clicks the button, or when a shortcut is typed. </LI>
|
2001-11-29 22:24:00 +03:00
|
|
|
<LI><CODE>FL_WHEN_CHANGED </CODE>: The callback is done each time the
|
|
|
|
value() changes (when the user pushes and releases the button, and as
|
1999-01-13 22:28:54 +03:00
|
|
|
the mouse is dragged around in and out of the button). </LI>
|
|
|
|
</UL>
|
2001-11-28 21:00:17 +03:00
|
|
|
</BODY></HTML>
|