Sophie

Sophie

distrib > Mandriva > 10.0-com > i586 > by-pkgid > af7a4b7f1ee5a4a084c41b9005da5527 > files > 1514

libfox1.1_46-devel-1.1.46-1mdk.i586.rpm

<html>
<head>
<link rel="stylesheet" href="page.css" type="text/css">
<title>fox-toolkit.org - Documentation</title>
</head>
<body bgcolor=#ffffff link=#990033 vlink=#990033 alink=#990033 text=#000000>
<font face='verdana,sans-serif' size=2 >

<!---- TOPIC TITLE WITH LOGO--->
<table border=0 cellpadding= cellspacing=2 width=100% ><tr><td><a href='http://www.fox-toolkit.org/doc.html'><img src='../art/foxlogo_small.jpg' border=0></a></td><td width=100% valign=bottom><font face='verdana,sans-serif' size=2 ><b>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a>
<br><img src='../art/line.gif' width=100% height=1></b></font></td></tr></table>
<p>
<!--- TOPIC TITLE WITH LOGO --->
<!-- Generated by Doxygen 1.3.3 -->
<h1>FXMenuButton.h</h1><div class="fragment"><pre>00001 <span class="comment">/********************************************************************************</span>
00002 <span class="comment">*                                                                               *</span>
00003 <span class="comment">*                        M e n u B u t t o n   W i d g e t                      *</span>
00004 <span class="comment">*                                                                               *</span>
00005 <span class="comment">*********************************************************************************</span>
00006 <span class="comment">* Copyright (C) 1998,2004 by Jeroen van der Zijp.   All Rights Reserved.        *</span>
00007 <span class="comment">*********************************************************************************</span>
00008 <span class="comment">* This library is free software; you can redistribute it and/or                 *</span>
00009 <span class="comment">* modify it under the terms of the GNU Lesser General Public                    *</span>
00010 <span class="comment">* License as published by the Free Software Foundation; either                  *</span>
00011 <span class="comment">* version 2.1 of the License, or (at your option) any later version.            *</span>
00012 <span class="comment">*                                                                               *</span>
00013 <span class="comment">* This library is distributed in the hope that it will be useful,               *</span>
00014 <span class="comment">* but WITHOUT ANY WARRANTY; without even the implied warranty of                *</span>
00015 <span class="comment">* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *</span>
00016 <span class="comment">* Lesser General Public License for more details.                               *</span>
00017 <span class="comment">*                                                                               *</span>
00018 <span class="comment">* You should have received a copy of the GNU Lesser General Public              *</span>
00019 <span class="comment">* License along with this library; if not, write to the Free Software           *</span>
00020 <span class="comment">* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *</span>
00021 <span class="comment">*********************************************************************************</span>
00022 <span class="comment">* $Id: FXMenuButton.h,v 1.20 2004/02/08 17:17:33 fox Exp $                      *</span>
00023 <span class="comment">********************************************************************************/</span>
00024 <span class="preprocessor">#ifndef FXMENUBUTTON_H</span>
00025 <span class="preprocessor"></span><span class="preprocessor">#define FXMENUBUTTON_H</span>
00026 <span class="preprocessor"></span>
00027 <span class="preprocessor">#ifndef FXLABEL_H</span>
00028 <span class="preprocessor"></span><span class="preprocessor">#include "FXLabel.h"</span>
00029 <span class="preprocessor">#endif</span>
00030 <span class="preprocessor"></span>
00031 <span class="keyword">namespace </span>FX {
00032 
00033 
00034 <span class="keyword">class </span>FXPopup;
00035 
00036 
00037 <span class="comment">// Menu button options</span>
00038 <span class="keyword">enum</span> {
00039   <a class="code" href="group__FXMenuButton__0.html#a0a1879">MENUBUTTON_AUTOGRAY</a>      = 0x00800000,                                      <span class="comment">/// Automatically gray out when no target</span>
00040 <span class="comment"></span>  <a class="code" href="group__FXMenuButton__0.html#a0a1880">MENUBUTTON_AUTOHIDE</a>      = 0x01000000,                                      <span class="comment">/// Automatically hide when no target</span>
00041 <span class="comment"></span>  <a class="code" href="group__FXMenuButton__0.html#a0a1881">MENUBUTTON_TOOLBAR</a>       = 0x02000000,                                      <span class="comment">/// Toolbar style</span>
00042 <span class="comment"></span>  <a class="code" href="group__FXMenuButton__0.html#a0a1882">MENUBUTTON_DOWN</a>          = 0,                                               <span class="comment">/// Popup window appears below menu button</span>
00043 <span class="comment"></span>  <a class="code" href="group__FXMenuButton__0.html#a0a1883">MENUBUTTON_UP</a>            = 0x04000000,                                      <span class="comment">/// Popup window appears above menu button</span>
00044 <span class="comment"></span>  <a class="code" href="group__FXMenuButton__0.html#a0a1884">MENUBUTTON_LEFT</a>          = 0x08000000,                                      <span class="comment">/// Popup window to the left of the menu button</span>
00045 <span class="comment"></span>  <a class="code" href="group__FXMenuButton__0.html#a0a1885">MENUBUTTON_RIGHT</a>         = <a class="code" href="group__FXMenuButton__0.html#a0a1884">MENUBUTTON_LEFT</a>|<a class="code" href="group__FXMenuButton__0.html#a0a1883">MENUBUTTON_UP</a>,                   <span class="comment">/// Popup window to the right of the menu button</span>
00046 <span class="comment"></span>  <a class="code" href="group__FXMenuButton__0.html#a0a1886">MENUBUTTON_NOARROWS</a>      = 0x10000000,                                      <span class="comment">/// Do not show arrows</span>
00047 <span class="comment"></span>  <a class="code" href="group__FXMenuButton__0.html#a0a1887">MENUBUTTON_ATTACH_LEFT</a>   = 0,                                               <span class="comment">/// Popup attaches to the left side of the menu button</span>
00048 <span class="comment"></span>  <a class="code" href="group__FXMenuButton__0.html#a0a1888">MENUBUTTON_ATTACH_TOP</a>    = <a class="code" href="group__FXMenuButton__0.html#a0a1887">MENUBUTTON_ATTACH_LEFT</a>,                          <span class="comment">/// Popup attaches to the top of the menu button</span>
00049 <span class="comment"></span>  <a class="code" href="group__FXMenuButton__0.html#a0a1889">MENUBUTTON_ATTACH_RIGHT</a>  = 0x20000000,                                      <span class="comment">/// Popup attaches to the right side of the menu button</span>
00050 <span class="comment"></span>  <a class="code" href="group__FXMenuButton__0.html#a0a1890">MENUBUTTON_ATTACH_BOTTOM</a> = <a class="code" href="group__FXMenuButton__0.html#a0a1889">MENUBUTTON_ATTACH_RIGHT</a>,                         <span class="comment">/// Popup attaches to the bottom of the menu button</span>
00051 <span class="comment"></span>  <a class="code" href="group__FXMenuButton__0.html#a0a1891">MENUBUTTON_ATTACH_CENTER</a> = 0x40000000,                                      <span class="comment">/// Popup attaches to the center of the menu button</span>
00052 <span class="comment"></span>  <a class="code" href="group__FXMenuButton__0.html#a0a1892">MENUBUTTON_ATTACH_BOTH</a>   = <a class="code" href="group__FXMenuButton__0.html#a0a1891">MENUBUTTON_ATTACH_CENTER</a>|<a class="code" href="group__FXMenuButton__0.html#a0a1889">MENUBUTTON_ATTACH_RIGHT</a> <span class="comment">/// Popup attaches to both sides of the menu button</span>
00053 <span class="comment"></span>  };
00054 
00055 
00056 <span class="comment"></span>
00057 <span class="comment">/**</span>
00058 <span class="comment">* A menu button posts a popup menu when clicked.</span>
00059 <span class="comment">* There are many ways to control the placement where the popup will appear;</span>
00060 <span class="comment">* first, the popup may be placed on either of the four sides relative to the</span>
00061 <span class="comment">* menu button; this is controlled by the flags MENUBUTTON_DOWN, etc.</span>
00062 <span class="comment">* Next, there are several attachment modes; the popup's left/bottom edge may</span>
00063 <span class="comment">* attach to the menu button's left/top edge, or the popup's right/top edge may</span>
00064 <span class="comment">* attach to the menu button's right/bottom edge, or both.</span>
00065 <span class="comment">* Also, the popup may apear centered relative to the menu button.</span>
00066 <span class="comment">* Finally, a small offset may be specified to displace the location of the</span>
00067 <span class="comment">* popup by a few pixels so as to account for borders and so on.</span>
00068 <span class="comment">* Normally, the menu button shows an arrow pointing to the direction where</span>
00069 <span class="comment">* the popup is set to appear; this can be turned off by passing the option</span>
00070 <span class="comment">* MENUBUTTON_NOARROWS.</span>
00071 <span class="comment">*/</span>
00072 <span class="keyword">class </span>FXAPI FXMenuButton : <span class="keyword">public</span> FXLabel {
00073   FXDECLARE(FXMenuButton)
00074 <span class="keyword">protected</span>:
00075   FXPopup *pane;                  <span class="comment">// Pane to pop up</span>
00076   FXint    offsetx;               <span class="comment">// Shift attachment point x</span>
00077   FXint    offsety;               <span class="comment">// Shift attachment point y</span>
00078   FXbool   state;                 <span class="comment">// Pane was popped</span>
<a name="l00079"></a><a class="code" href="classFX_1_1FXMenuButton.html">00079</a> <span class="keyword">protected</span>:
00080   FXMenuButton();
00081 <span class="keyword">private</span>:
00082   FXMenuButton(<span class="keyword">const</span> FXMenuButton&amp;);
00083   FXMenuButton &amp;operator=(<span class="keyword">const</span> FXMenuButton&amp;);
00084 <span class="keyword">public</span>:
00085   <span class="keywordtype">long</span> onPaint(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*);
00086   <span class="keywordtype">long</span> onUpdate(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*);
00087   <span class="keywordtype">long</span> onEnter(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*);
00088   <span class="keywordtype">long</span> onLeave(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*);
00089   <span class="keywordtype">long</span> onFocusIn(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*);
00090   <span class="keywordtype">long</span> onFocusOut(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*);
00091   <span class="keywordtype">long</span> onUngrabbed(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*);
00092   <span class="keywordtype">long</span> onMotion(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*);
00093   <span class="keywordtype">long</span> onLeftBtnPress(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*);
00094   <span class="keywordtype">long</span> onLeftBtnRelease(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*);
00095   <span class="keywordtype">long</span> onKeyPress(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*);
00096   <span class="keywordtype">long</span> onKeyRelease(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*);
00097   <span class="keywordtype">long</span> onHotKeyPress(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*);
00098   <span class="keywordtype">long</span> onHotKeyRelease(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*);
00099   <span class="keywordtype">long</span> onCmdPost(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*);
00100   <span class="keywordtype">long</span> onCmdUnpost(<a class="code" href="classFX_1_1FXObject.html">FXObject</a>*,FXSelector,<span class="keywordtype">void</span>*);
00101 <span class="keyword">public</span>:
00102 <span class="comment"></span>
00103 <span class="comment">  /// Constructor</span>
00104 <span class="comment"></span>  FXMenuButton(<a class="code" href="classFX_1_1FXComposite.html">FXComposite</a>* p,<span class="keyword">const</span> <a class="code" href="classFX_1_1FXString.html">FXString</a>&amp; text,<a class="code" href="classFX_1_1FXIcon.html">FXIcon</a>* ic=NULL,<a class="code" href="classFX_1_1FXPopup.html">FXPopup</a>* pup=NULL,FXuint opts=JUSTIFY_NORMAL|ICON_BEFORE_TEXT|MENUBUTTON_DOWN,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD);
00105 <span class="comment"></span>
00106 <span class="comment">  /// Create server-side resources</span>
00107 <span class="comment"></span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> create();
00108 <span class="comment"></span>
00109 <span class="comment">  /// Detach server-side resources</span>
00110 <span class="comment"></span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> detach();
00111 <span class="comment"></span>
00112 <span class="comment">  /// Return default width</span>
00113 <span class="comment"></span>  <span class="keyword">virtual</span> FXint getDefaultWidth();
00114 <span class="comment"></span>
00115 <span class="comment">  /// Return default height</span>
00116 <span class="comment"></span>  <span class="keyword">virtual</span> FXint getDefaultHeight();
00117 <span class="comment"></span>
00118 <span class="comment">  /// Returns true because a menu button can receive focus</span>
00119 <span class="comment"></span>  <span class="keyword">virtual</span> FXbool canFocus() <span class="keyword">const</span>;
00120 <span class="comment"></span>
00121 <span class="comment">  /// Remove the focus from this window</span>
00122 <span class="comment"></span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> killFocus();
00123 <span class="comment"></span>
00124 <span class="comment">  /// Return true if window logically contains the given point</span>
<a name="l00125"></a><a class="code" href="classFX_1_1FXMenuButton.html#a8">00125</a> <span class="comment"></span>  <span class="keyword">virtual</span> FXbool contains(FXint parentx,FXint parenty) <span class="keyword">const</span>;
00126 <span class="comment"></span>
00127 <span class="comment">  /// Change the popup menu</span>
<a name="l00128"></a><a class="code" href="classFX_1_1FXMenuButton.html#a9">00128</a> <span class="comment"></span>  <span class="keywordtype">void</span> setMenu(<a class="code" href="classFX_1_1FXPopup.html">FXPopup</a> *pup){ pane=pup; }
00129 <span class="comment"></span>
00130 <span class="comment">  /// Return current popup menu</span>
<a name="l00131"></a><a class="code" href="classFX_1_1FXMenuButton.html#a10">00131</a> <span class="comment"></span>  <a class="code" href="classFX_1_1FXPopup.html">FXPopup</a>* getMenu()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> pane; }
00132 <span class="comment"></span>
00133 <span class="comment">  /// Set X offset where menu pops up relative to button</span>
<a name="l00134"></a><a class="code" href="classFX_1_1FXMenuButton.html#a11">00134</a> <span class="comment"></span>  <span class="keywordtype">void</span> setXOffset(FXint offx){ offsetx=offx; }
00135 <span class="comment"></span>
00136 <span class="comment">  /// Return current X offset</span>
<a name="l00137"></a><a class="code" href="classFX_1_1FXMenuButton.html#a12">00137</a> <span class="comment"></span>  FXint getXOffset()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> offsetx; }
00138 <span class="comment"></span>
00139 <span class="comment">  /// Set Y offset where menu pops up relative to button</span>
<a name="l00140"></a><a class="code" href="classFX_1_1FXMenuButton.html#a13">00140</a> <span class="comment"></span>  <span class="keywordtype">void</span> setYOffset(FXint offy){ offsety=offy; }
00141 <span class="comment"></span>
00142 <span class="comment">  /// Return current Y offset</span>
00143 <span class="comment"></span>  FXint getYOffset()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> offsety; }
00144 <span class="comment"></span>
00145 <span class="comment">  /// Change menu button style</span>
00146 <span class="comment"></span>  <span class="keywordtype">void</span> setButtonStyle(FXuint style);
00147 <span class="comment"></span>
00148 <span class="comment">  /// Get menu button style</span>
00149 <span class="comment"></span>  FXuint getButtonStyle() <span class="keyword">const</span>;
00150 <span class="comment"></span>
00151 <span class="comment">  /// Change popup style</span>
00152 <span class="comment"></span>  <span class="keywordtype">void</span> setPopupStyle(FXuint style);
00153 <span class="comment"></span>
00154 <span class="comment">  /// Get popup style</span>
00155 <span class="comment"></span>  FXuint getPopupStyle() <span class="keyword">const</span>;
00156 <span class="comment"></span>
00157 <span class="comment">  /// Change attachment</span>
00158 <span class="comment"></span>  <span class="keywordtype">void</span> setAttachment(FXuint att);
00159 <span class="comment"></span>
00160 <span class="comment">  /// Get attachment</span>
00161 <span class="comment"></span>  FXuint getAttachment() <span class="keyword">const</span>;
00162 <span class="comment"></span>
00163 <span class="comment">  /// Save menu button to a stream</span>
00164 <span class="comment"></span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> save(FXStream&amp; store) <span class="keyword">const</span>;
00165 <span class="comment"></span>
00166 <span class="comment">  /// Load menu button from a stream</span>
00167 <span class="comment"></span>  <span class="keyword">virtual</span> <span class="keywordtype">void</span> load(FXStream&amp; store);
00168 <span class="comment"></span>
00169 <span class="comment">  /// Destructor</span>
00170 <span class="comment"></span>  <span class="keyword">virtual</span> ~FXMenuButton();
00171   };
00172 
00173 }
00174 
00175 <span class="preprocessor">#endif</span>
</pre></div></font>

<!--- COPYRIGHT -->
<p>
<table width=100% cellpadding=0 cellspacing=0><tr><td width=100% valign=top id=HEADLINE align=right>
<img src='../art/line.gif' width=100% height=1><font size=-1>
Copyright &copy; 1997-2004 Jeroen van der Zijp</font>
</td></tr></table>
</p>
<!--- COPYRIGHT -->
</body>
</html>