<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> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <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>fxdefs.h</h1><div class="fragment"><pre>00001 <span class="comment">/********************************************************************************</span> 00002 <span class="comment">* *</span> 00003 <span class="comment">* FOX Definitions, Types, and Macros *</span> 00004 <span class="comment">* *</span> 00005 <span class="comment">*********************************************************************************</span> 00006 <span class="comment">* Copyright (C) 1997,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: fxdefs.h,v 1.130 2004/02/08 17:17:34 fox Exp $ *</span> 00023 <span class="comment">********************************************************************************/</span> 00024 <span class="preprocessor">#ifndef FXDEFS_H</span> 00025 <span class="preprocessor"></span><span class="preprocessor">#define FXDEFS_H</span> 00026 <span class="preprocessor"></span> 00027 00028 <span class="comment">/******************************** Definitions ********************************/</span> 00029 00030 <span class="comment">// Truth values</span> 00031 <span class="preprocessor">#ifndef TRUE</span> 00032 <span class="preprocessor"></span><span class="preprocessor">#define TRUE 1</span> 00033 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 00034 <span class="preprocessor"></span><span class="preprocessor">#ifndef FALSE</span> 00035 <span class="preprocessor"></span><span class="preprocessor">#define FALSE 0</span> 00036 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 00037 <span class="preprocessor"></span><span class="preprocessor">#ifndef MAYBE</span> 00038 <span class="preprocessor"></span><span class="preprocessor">#define MAYBE 2</span> 00039 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 00040 <span class="preprocessor"></span><span class="preprocessor">#ifndef NULL</span> 00041 <span class="preprocessor"></span><span class="preprocessor">#define NULL 0</span> 00042 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 00043 <span class="preprocessor"></span><span class="comment"></span> 00044 <span class="comment">/// Pi</span> 00045 <span class="comment"></span><span class="preprocessor">#ifndef PI</span> 00046 <span class="preprocessor"></span><span class="preprocessor">#define PI 3.1415926535897932384626433833</span> 00047 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 00048 <span class="preprocessor"></span><span class="comment"></span> 00049 <span class="comment">/// Euler constant</span> 00050 <span class="comment"></span><span class="preprocessor">#define EULER 2.7182818284590452353602874713</span> 00051 <span class="preprocessor"></span><span class="comment"></span> 00052 <span class="comment">/// Multiplier for degrees to radians</span> 00053 <span class="comment"></span><span class="preprocessor">#define DTOR 0.0174532925199432957692369077</span> 00054 <span class="preprocessor"></span><span class="comment"></span> 00055 <span class="comment">/// Multiplier for radians to degrees</span> 00056 <span class="comment"></span><span class="preprocessor">#define RTOD 57.295779513082320876798154814</span> 00057 <span class="preprocessor"></span> 00058 00059 <span class="comment">// Path separator</span> 00060 <span class="preprocessor">#ifdef WIN32</span> 00061 <span class="preprocessor"></span><span class="preprocessor">#define PATHSEP '\\'</span> 00062 <span class="preprocessor"></span><span class="preprocessor">#define PATHSEPSTRING "\\"</span> 00063 <span class="preprocessor"></span><span class="preprocessor">#define PATHLISTSEP ';'</span> 00064 <span class="preprocessor"></span><span class="preprocessor">#define PATHLISTSEPSTRING ";"</span> 00065 <span class="preprocessor"></span><span class="preprocessor">#define ISPATHSEP(c) ((c)=='/' || (c)=='\\')</span> 00066 <span class="preprocessor"></span><span class="preprocessor">#else</span> 00067 <span class="preprocessor"></span><span class="preprocessor">#define PATHSEP '/'</span> 00068 <span class="preprocessor"></span><span class="preprocessor">#define PATHSEPSTRING "/"</span> 00069 <span class="preprocessor"></span><span class="preprocessor">#define PATHLISTSEP ':'</span> 00070 <span class="preprocessor"></span><span class="preprocessor">#define PATHLISTSEPSTRING ":"</span> 00071 <span class="preprocessor"></span><span class="preprocessor">#define ISPATHSEP(c) ((c)=='/')</span> 00072 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 00073 <span class="preprocessor"></span> 00074 00075 <span class="comment">// End Of Line</span> 00076 <span class="preprocessor">#ifdef WIN32</span> 00077 <span class="preprocessor"></span><span class="preprocessor">#define EOLSTRING "\r\n"</span> 00078 <span class="preprocessor"></span><span class="preprocessor">#else</span> 00079 <span class="preprocessor"></span><span class="preprocessor">#define EOLSTRING "\n"</span> 00080 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 00081 <span class="preprocessor"></span> 00082 00083 <span class="comment">// For Windows</span> 00084 <span class="preprocessor">#ifdef _DEBUG</span> 00085 <span class="preprocessor"></span><span class="preprocessor">#ifndef DEBUG</span> 00086 <span class="preprocessor"></span><span class="preprocessor">#define DEBUG</span> 00087 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 00088 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 00089 <span class="preprocessor"></span><span class="preprocessor">#ifdef _NDEBUG</span> 00090 <span class="preprocessor"></span><span class="preprocessor">#ifndef NDEBUG</span> 00091 <span class="preprocessor"></span><span class="preprocessor">#define NDEBUG</span> 00092 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 00093 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 00094 <span class="preprocessor"></span> 00095 00096 <span class="comment">// Shared library support</span> 00097 <span class="preprocessor">#ifdef WIN32</span> 00098 <span class="preprocessor"></span><span class="preprocessor">#define FXEXPORT __declspec(dllexport)</span> 00099 <span class="preprocessor"></span><span class="preprocessor">#define FXIMPORT __declspec(dllimport)</span> 00100 <span class="preprocessor"></span><span class="preprocessor">#else</span> 00101 <span class="preprocessor"></span><span class="preprocessor">#define FXEXPORT</span> 00102 <span class="preprocessor"></span><span class="preprocessor">#define FXIMPORT</span> 00103 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 00104 <span class="preprocessor"></span> 00105 <span class="comment">// Define FXAPI for DLL builds</span> 00106 <span class="preprocessor">#ifdef FOXDLL</span> 00107 <span class="preprocessor"></span><span class="preprocessor">#ifdef FOXDLL_EXPORTS</span> 00108 <span class="preprocessor"></span><span class="preprocessor">#define FXAPI FXEXPORT</span> 00109 <span class="preprocessor"></span><span class="preprocessor">#else</span> 00110 <span class="preprocessor"></span><span class="preprocessor">#define FXAPI FXIMPORT</span> 00111 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 00112 <span class="preprocessor"></span><span class="preprocessor">#else</span> 00113 <span class="preprocessor"></span><span class="preprocessor">#define FXAPI</span> 00114 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 00115 <span class="preprocessor"></span> 00116 <span class="comment">// Callback</span> 00117 <span class="preprocessor">#ifdef WIN32</span> 00118 <span class="preprocessor"></span><span class="preprocessor">#ifndef CALLBACK</span> 00119 <span class="preprocessor"></span><span class="preprocessor">#define CALLBACK __stdcall</span> 00120 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 00121 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 00122 <span class="preprocessor"></span> 00123 00124 <span class="comment">// Checking printf and scanf format strings</span> 00125 <span class="preprocessor">#if defined(_CC_GNU_) || defined(__GNUG__) || defined(__GNUC__)</span> 00126 <span class="preprocessor"></span><span class="preprocessor">#define FX_PRINTF(fmt,arg) __attribute__((format(printf,fmt,arg)))</span> 00127 <span class="preprocessor"></span><span class="preprocessor">#define FX_SCANF(fmt,arg) __attribute__((format(scanf,fmt,arg)))</span> 00128 <span class="preprocessor"></span><span class="preprocessor">#else</span> 00129 <span class="preprocessor"></span><span class="preprocessor">#define FX_PRINTF(fmt,arg)</span> 00130 <span class="preprocessor"></span><span class="preprocessor">#define FX_SCANF(fmt,arg)</span> 00131 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 00132 <span class="preprocessor"></span> 00133 <span class="comment">// Raw event type</span> 00134 <span class="preprocessor">#ifndef WIN32</span> 00135 <span class="preprocessor"></span><span class="keyword">union </span>_XEvent; 00136 <span class="preprocessor">#else</span> 00137 <span class="preprocessor"></span><span class="keyword">struct </span>tagMSG; 00138 <span class="preprocessor">#endif</span> 00139 <span class="preprocessor"></span> 00140 00141 <span class="keyword">namespace </span>FX { 00142 00143 00144 <span class="comment">// FOX System Defined Selector Types</span> 00145 <span class="keyword">enum</span> <a class="code" href="group__fxdefs__0.html#a0">FXSelType</a> { 00146 SEL_NONE, 00147 <a class="code" href="group__fxdefs__0.html#a0a189">SEL_KEYPRESS</a>, <span class="comment">/// Key pressed</span> <a name="l00148"></a><a class="code" href="group__fxdefs__0.html#a0">00148</a> <span class="comment"></span> <a class="code" href="group__fxdefs__0.html#a0a190">SEL_KEYRELEASE</a>, <span class="comment">/// Key released</span> 00149 <span class="comment"></span> <a class="code" href="group__fxdefs__0.html#a0a191">SEL_LEFTBUTTONPRESS</a>, <span class="comment">/// Left mouse button pressed</span> 00150 <span class="comment"></span> <a class="code" href="group__fxdefs__0.html#a0a192">SEL_LEFTBUTTONRELEASE</a>, <span class="comment">/// Left mouse button released</span> 00151 <span class="comment"></span> <a class="code" href="group__fxdefs__0.html#a0a193">SEL_MIDDLEBUTTONPRESS</a>, <span class="comment">/// Middle mouse button pressed</span> 00152 <span class="comment"></span> <a class="code" href="group__fxdefs__0.html#a0a194">SEL_MIDDLEBUTTONRELEASE</a>, <span class="comment">/// Middle mouse button released</span> 00153 <span class="comment"></span> <a class="code" href="group__fxdefs__0.html#a0a195">SEL_RIGHTBUTTONPRESS</a>, <span class="comment">/// Right mouse button pressed</span> 00154 <span class="comment"></span> <a class="code" href="group__fxdefs__0.html#a0a196">SEL_RIGHTBUTTONRELEASE</a>, <span class="comment">/// Right mouse button released</span> 00155 <span class="comment"></span> <a class="code" href="group__fxdefs__0.html#a0a197">SEL_MOTION</a>, <span class="comment">/// Mouse motion</span> 00156 <span class="comment"></span> <a class="code" href="group__fxdefs__0.html#a0a198">SEL_ENTER</a>, <span class="comment">/// Mouse entered window</span> 00157 <span class="comment"></span> <a class="code" href="group__fxdefs__0.html#a0a199">SEL_LEAVE</a>, <span class="comment">/// Mouse left window</span> 00158 <span class="comment"></span> <a class="code" href="group__fxdefs__0.html#a0a200">SEL_FOCUSIN</a>, <span class="comment">/// Focus into window</span> 00159 <span class="comment"></span> <a class="code" href="group__fxdefs__0.html#a0a201">SEL_FOCUSOUT</a>, <span class="comment">/// Focus out of window</span> 00160 <span class="comment"></span> SEL_KEYMAP, 00161 <a class="code" href="group__fxdefs__0.html#a0a203">SEL_UNGRABBED</a>, <span class="comment">/// Lost the grab (Windows)</span> 00162 <span class="comment"></span> <a class="code" href="group__fxdefs__0.html#a0a204">SEL_PAINT</a>, <span class="comment">/// Must repaint window</span> 00163 <span class="comment"></span> SEL_CREATE, 00164 SEL_DESTROY, 00165 SEL_UNMAP, 00166 SEL_MAP, 00167 <a class="code" href="group__fxdefs__0.html#a0a209">SEL_CONFIGURE</a>, <span class="comment">// Resize</span> 00168 <a class="code" href="group__fxdefs__0.html#a0a210">SEL_SELECTION_LOST</a>, <span class="comment">// Widget lost selection</span> 00169 <a class="code" href="group__fxdefs__0.html#a0a211">SEL_SELECTION_GAINED</a>, <span class="comment">// Widget gained selection</span> 00170 <a class="code" href="group__fxdefs__0.html#a0a212">SEL_SELECTION_REQUEST</a>, <span class="comment">// Inquire selection data</span> 00171 <a class="code" href="group__fxdefs__0.html#a0a213">SEL_RAISED</a>, <span class="comment">// Window to top of stack</span> 00172 <a class="code" href="group__fxdefs__0.html#a0a214">SEL_LOWERED</a>, <span class="comment">// Window to bottom of stack</span> 00173 <a class="code" href="group__fxdefs__0.html#a0a215">SEL_CLOSE</a>, <span class="comment">// Close window</span> 00174 <a class="code" href="group__fxdefs__0.html#a0a216">SEL_DELETE</a>, <span class="comment">// Delete window</span> 00175 <a class="code" href="group__fxdefs__0.html#a0a217">SEL_MINIMIZE</a>, <span class="comment">// Iconified</span> 00176 <a class="code" href="group__fxdefs__0.html#a0a218">SEL_RESTORE</a>, <span class="comment">// No longer iconified or maximized</span> 00177 <a class="code" href="group__fxdefs__0.html#a0a219">SEL_MAXIMIZE</a>, <span class="comment">// Maximized</span> 00178 <a class="code" href="group__fxdefs__0.html#a0a220">SEL_UPDATE</a>, <span class="comment">// GUI update</span> 00179 <a class="code" href="group__fxdefs__0.html#a0a221">SEL_COMMAND</a>, <span class="comment">// GUI command</span> 00180 <a class="code" href="group__fxdefs__0.html#a0a222">SEL_CLICKED</a>, <span class="comment">// Clicked</span> 00181 <a class="code" href="group__fxdefs__0.html#a0a223">SEL_DOUBLECLICKED</a>, <span class="comment">// Double-clicked</span> 00182 <a class="code" href="group__fxdefs__0.html#a0a224">SEL_TRIPLECLICKED</a>, <span class="comment">// Triple-clicked</span> 00183 <a class="code" href="group__fxdefs__0.html#a0a225">SEL_MOUSEWHEEL</a>, <span class="comment">// Mouse wheel</span> 00184 <a class="code" href="group__fxdefs__0.html#a0a226">SEL_CHANGED</a>, <span class="comment">// GUI has changed</span> 00185 <a class="code" href="group__fxdefs__0.html#a0a227">SEL_VERIFY</a>, <span class="comment">// Verify change</span> 00186 <a class="code" href="group__fxdefs__0.html#a0a228">SEL_DESELECTED</a>, <span class="comment">// Deselected</span> 00187 <a class="code" href="group__fxdefs__0.html#a0a229">SEL_SELECTED</a>, <span class="comment">// Selected</span> 00188 <a class="code" href="group__fxdefs__0.html#a0a230">SEL_INSERTED</a>, <span class="comment">// Inserted</span> 00189 <a class="code" href="group__fxdefs__0.html#a0a231">SEL_REPLACED</a>, <span class="comment">// Replaced</span> 00190 <a class="code" href="group__fxdefs__0.html#a0a232">SEL_DELETED</a>, <span class="comment">// Deleted</span> 00191 <a class="code" href="group__fxdefs__0.html#a0a233">SEL_OPENED</a>, <span class="comment">// Opened</span> 00192 <a class="code" href="group__fxdefs__0.html#a0a234">SEL_CLOSED</a>, <span class="comment">// Closed</span> 00193 <a class="code" href="group__fxdefs__0.html#a0a235">SEL_EXPANDED</a>, <span class="comment">// Expanded</span> 00194 <a class="code" href="group__fxdefs__0.html#a0a236">SEL_COLLAPSED</a>, <span class="comment">// Collapsed</span> 00195 <a class="code" href="group__fxdefs__0.html#a0a237">SEL_BEGINDRAG</a>, <span class="comment">// Start a drag</span> 00196 <a class="code" href="group__fxdefs__0.html#a0a238">SEL_ENDDRAG</a>, <span class="comment">// End a drag</span> 00197 <a class="code" href="group__fxdefs__0.html#a0a239">SEL_DRAGGED</a>, <span class="comment">// Dragged</span> 00198 <a class="code" href="group__fxdefs__0.html#a0a240">SEL_LASSOED</a>, <span class="comment">// Lassoed</span> 00199 <a class="code" href="group__fxdefs__0.html#a0a241">SEL_TIMEOUT</a>, <span class="comment">// Timeout occurred</span> 00200 <a class="code" href="group__fxdefs__0.html#a0a242">SEL_SIGNAL</a>, <span class="comment">// Signal received</span> 00201 <a class="code" href="group__fxdefs__0.html#a0a243">SEL_CLIPBOARD_LOST</a>, <span class="comment">// Widget lost clipboard</span> 00202 <a class="code" href="group__fxdefs__0.html#a0a244">SEL_CLIPBOARD_GAINED</a>, <span class="comment">// Widget gained clipboard</span> 00203 <a class="code" href="group__fxdefs__0.html#a0a245">SEL_CLIPBOARD_REQUEST</a>, <span class="comment">// Inquire clipboard data</span> 00204 <a class="code" href="group__fxdefs__0.html#a0a246">SEL_CHORE</a>, <span class="comment">// Background chore</span> 00205 <a class="code" href="group__fxdefs__0.html#a0a247">SEL_FOCUS_SELF</a>, <span class="comment">// Focus on widget itself</span> 00206 <a class="code" href="group__fxdefs__0.html#a0a248">SEL_FOCUS_RIGHT</a>, <span class="comment">// Focus movements</span> 00207 SEL_FOCUS_LEFT, 00208 SEL_FOCUS_DOWN, 00209 SEL_FOCUS_UP, 00210 SEL_FOCUS_NEXT, 00211 SEL_FOCUS_PREV, 00212 <a class="code" href="group__fxdefs__0.html#a0a254">SEL_DND_ENTER</a>, <span class="comment">// Drag action entering potential drop target</span> 00213 <a class="code" href="group__fxdefs__0.html#a0a255">SEL_DND_LEAVE</a>, <span class="comment">// Drag action leaving potential drop target</span> 00214 <a class="code" href="group__fxdefs__0.html#a0a256">SEL_DND_DROP</a>, <span class="comment">// Drop on drop target</span> 00215 <a class="code" href="group__fxdefs__0.html#a0a257">SEL_DND_MOTION</a>, <span class="comment">// Drag position changed over potential drop target</span> 00216 <a class="code" href="group__fxdefs__0.html#a0a258">SEL_DND_REQUEST</a>, <span class="comment">// Inquire drag and drop data</span> 00217 <a class="code" href="group__fxdefs__0.html#a0a259">SEL_IO_READ</a>, <span class="comment">// Read activity on a pipe</span> 00218 <a class="code" href="group__fxdefs__0.html#a0a260">SEL_IO_WRITE</a>, <span class="comment">// Write activity on a pipe</span> 00219 <a class="code" href="group__fxdefs__0.html#a0a261">SEL_IO_EXCEPT</a>, <span class="comment">// Except activity on a pipe</span> 00220 <a class="code" href="group__fxdefs__0.html#a0a262">SEL_PICKED</a>, <span class="comment">// Picked some location</span> 00221 <a class="code" href="group__fxdefs__0.html#a0a263">SEL_LAST</a> <span class="comment">// Last message</span> 00222 }; 00223 00224 <span class="comment"></span> 00225 <span class="comment">/// FOX Keyboard and Button states</span> 00226 <span class="comment"></span><span class="keyword">enum</span> { 00227 <a class="code" href="group__fxdefs__1.html#a0a264">SHIFTMASK</a> = 0x001, <span class="comment">/// Shift key is down</span> 00228 <span class="comment"></span> <a class="code" href="group__fxdefs__1.html#a0a265">CAPSLOCKMASK</a> = 0x002, <span class="comment">/// Caps Lock key is down</span> 00229 <span class="comment"></span> <a class="code" href="group__fxdefs__1.html#a0a266">CONTROLMASK</a> = 0x004, <span class="comment">/// Ctrl key is down</span> 00230 <span class="comment"></span> <a class="code" href="group__fxdefs__1.html#a0a267">ALTMASK</a> = 0x008, <span class="comment">/// Alt key is down</span> 00231 <span class="comment"></span> <a class="code" href="group__fxdefs__1.html#a0a268">METAMASK</a> = 0x040, <span class="comment">/// Meta key is down</span> 00232 <span class="comment"></span> <a class="code" href="group__fxdefs__1.html#a0a269">NUMLOCKMASK</a> = 0x010, <span class="comment">/// Num Lock key is down</span> 00233 <span class="comment"></span> <a class="code" href="group__fxdefs__1.html#a0a270">SCROLLLOCKMASK</a> = 0x0E0, <span class="comment">/// Scroll Lock key is down (seems to vary)</span> 00234 <span class="comment"></span> <a class="code" href="group__fxdefs__1.html#a0a271">LEFTBUTTONMASK</a> = 0x100, <span class="comment">/// Left mouse button is down</span> 00235 <span class="comment"></span> <a class="code" href="group__fxdefs__1.html#a0a272">MIDDLEBUTTONMASK</a> = 0x200, <span class="comment">/// Middle mouse button is down</span> 00236 <span class="comment"></span> <a class="code" href="group__fxdefs__1.html#a0a273">RIGHTBUTTONMASK</a> = 0x400 <span class="comment">/// Right mouse button is down</span> 00237 <span class="comment"></span> }; 00238 00239 <span class="comment"></span> 00240 <span class="comment">/// FOX Mouse buttons</span> 00241 <span class="comment"></span><span class="keyword">enum</span> { 00242 LEFTBUTTON = 1, 00243 MIDDLEBUTTON = 2, 00244 RIGHTBUTTON = 3 00245 }; 00246 00247 <span class="comment"></span> 00248 <span class="comment">/// FOX window crossing modes</span> 00249 <span class="comment"></span><span class="keyword">enum</span> { 00250 <a class="code" href="group__fxdefs__3.html#a0a277">CROSSINGNORMAL</a>, <span class="comment">/// Normal crossing event</span> 00251 <span class="comment"></span> <a class="code" href="group__fxdefs__3.html#a0a278">CROSSINGGRAB</a>, <span class="comment">/// Crossing due to mouse grab</span> 00252 <span class="comment"></span> <a class="code" href="group__fxdefs__3.html#a0a279">CROSSINGUNGRAB</a> <span class="comment">/// Crossing due to mouse ungrab</span> 00253 <span class="comment"></span> }; 00254 00255 <span class="comment"></span> 00256 <span class="comment">/// FOX window visibility modes</span> 00257 <span class="comment"></span><span class="keyword">enum</span> { 00258 VISIBILITYTOTAL, 00259 VISIBILITYPARTIAL, 00260 VISIBILITYNONE 00261 }; 00262 00263 <span class="comment"></span> 00264 <span class="comment">/// Options for fxfilematch</span> 00265 <span class="comment"></span><span class="keyword">enum</span> { 00266 <a class="code" href="group__fxdefs__5.html#a0a283">FILEMATCH_FILE_NAME</a> = 1, <span class="comment">/// No wildcard can ever match `/'</span> 00267 <span class="comment"></span> <a class="code" href="group__fxdefs__5.html#a0a284">FILEMATCH_NOESCAPE</a> = 2, <span class="comment">/// Backslashes don't quote special chars</span> 00268 <span class="comment"></span> <a class="code" href="group__fxdefs__5.html#a0a285">FILEMATCH_PERIOD</a> = 4, <span class="comment">/// Leading `.' is matched only explicitly</span> 00269 <span class="comment"></span> <a class="code" href="group__fxdefs__5.html#a0a286">FILEMATCH_LEADING_DIR</a> = 8, <span class="comment">/// Ignore `/...' after a match</span> 00270 <span class="comment"></span> <a class="code" href="group__fxdefs__5.html#a0a287">FILEMATCH_CASEFOLD</a> = 16 <span class="comment">/// Compare without regard to case</span> 00271 <span class="comment"></span> }; 00272 00273 <span class="comment"></span> 00274 <span class="comment">/// Drag and drop actions</span> 00275 <span class="comment"></span><span class="keyword">enum</span> <a class="code" href="group__fxdefs__6.html#a0">FXDragAction</a> { 00276 <a class="code" href="group__fxdefs__6.html#a0a288">DRAG_REJECT</a> = 0, <span class="comment">/// Reject all drop actions</span> 00277 <span class="comment"></span> <a class="code" href="group__fxdefs__6.html#a0a289">DRAG_ACCEPT</a> = 1, <span class="comment">/// Accept any drop action</span> 00278 <span class="comment"></span> <a class="code" href="group__fxdefs__6.html#a0a290">DRAG_COPY</a> = 2, <span class="comment">/// Copy</span> 00279 <span class="comment"></span> <a class="code" href="group__fxdefs__6.html#a0a291">DRAG_MOVE</a> = 3, <span class="comment">/// Move</span> 00280 <span class="comment"></span> <a class="code" href="group__fxdefs__6.html#a0a292">DRAG_LINK</a> = 4, <span class="comment">/// Link</span> 00281 <span class="comment"></span> <a class="code" href="group__fxdefs__6.html#a0a293">DRAG_PRIVATE</a> = 5 <span class="comment">/// Private</span> 00282 <span class="comment"></span> }; 00283 00284 <span class="comment"></span> 00285 <span class="comment">/// Origin of data</span> 00286 <span class="comment"></span><span class="keyword">enum</span> <a class="code" href="group__fxdefs__7.html#a0">FXDNDOrigin</a> { 00287 <a class="code" href="group__fxdefs__7.html#a0a294">FROM_SELECTION</a> = 0, <span class="comment">/// Primary selection</span> 00288 <span class="comment"></span> <a class="code" href="group__fxdefs__7.html#a0a295">FROM_CLIPBOARD</a> = 1, <span class="comment">/// Clipboard</span> 00289 <span class="comment"></span> <a class="code" href="group__fxdefs__7.html#a0a296">FROM_DRAGNDROP</a> = 2 <span class="comment">/// Drag and drop source</span> 00290 <span class="comment"></span> }; 00291 00292 <span class="comment"></span> 00293 <span class="comment">/// Exponent display</span> 00294 <span class="comment"></span><span class="keyword">enum</span> <a class="code" href="group__fxdefs__8.html#a0">FXExponent</a> { 00295 <a class="code" href="group__fxdefs__8.html#a0a297">EXP_NEVER</a>=FALSE, <span class="comment">/// Never use exponential notation</span> 00296 <span class="comment"></span> <a class="code" href="group__fxdefs__8.html#a0a298">EXP_ALWAYS</a>=TRUE, <span class="comment">/// Always use exponential notation</span> 00297 <span class="comment"></span> <a class="code" href="group__fxdefs__8.html#a0a299">EXP_AUTO</a>=MAYBE <span class="comment">/// Use exponential notation if needed</span> 00298 <span class="comment"></span> }; 00299 00300 <span class="comment"></span> 00301 <span class="comment">/// Search modes for search/replace dialogs</span> <a name="l00302"></a><a class="code" href="group__fxdefs__6.html#a0">00302</a> <span class="comment"></span><span class="keyword">enum</span> { 00303 <a class="code" href="group__fxdefs__9.html#a0a300">SEARCH_FORWARD</a> = 0, <span class="comment">/// Search forward (default)</span> 00304 <span class="comment"></span> <a class="code" href="group__fxdefs__9.html#a0a301">SEARCH_BACKWARD</a> = 1, <span class="comment">/// Search backward</span> 00305 <span class="comment"></span> <a class="code" href="group__fxdefs__9.html#a0a302">SEARCH_NOWRAP</a> = 0, <span class="comment">/// Don't wrap (default)</span> 00306 <span class="comment"></span> <a class="code" href="group__fxdefs__9.html#a0a303">SEARCH_WRAP</a> = 2, <span class="comment">/// Wrap around to start</span> 00307 <span class="comment"></span> <a class="code" href="group__fxdefs__9.html#a0a304">SEARCH_EXACT</a> = 0, <span class="comment">/// Exact match (default)</span> 00308 <span class="comment"></span> <a class="code" href="group__fxdefs__9.html#a0a305">SEARCH_IGNORECASE</a> = 4, <span class="comment">/// Ignore case</span> 00309 <span class="comment"></span> <a class="code" href="group__fxdefs__9.html#a0a306">SEARCH_REGEX</a> = 8, <span class="comment">/// Regular expression match</span> 00310 <span class="comment"></span> <a class="code" href="group__fxdefs__9.html#a0a307">SEARCH_PREFIX</a> = 16 <span class="comment">/// Prefix of subject string</span> 00311 <span class="comment"></span> }; 00312 00313 00314 <span class="comment">/********************************* Typedefs **********************************/</span> 00315 00316 <span class="comment">// Forward declarations</span> <a name="l00317"></a><a class="code" href="group__fxdefs__7.html#a0">00317</a> <span class="keyword">class </span>FXObject; 00318 <span class="keyword">class </span>FXStream; 00319 <span class="keyword">class </span>FXString; 00320 00321 00322 <span class="comment">// Streamable types; these are fixed size!</span> 00323 <span class="keyword">typedef</span> <span class="keywordtype">char</span> FXchar; 00324 <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> FXuchar; 00325 <span class="keyword">typedef</span> FXuchar FXbool; 00326 <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> FXushort; 00327 <span class="keyword">typedef</span> <span class="keywordtype">short</span> FXshort; 00328 <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> FXuint; <a name="l00329"></a><a class="code" href="group__fxdefs__8.html#a0">00329</a> <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> FXwchar; 00330 <span class="keyword">typedef</span> <span class="keywordtype">int</span> FXint; 00331 <span class="keyword">typedef</span> <span class="keywordtype">float</span> FXfloat; 00332 <span class="keyword">typedef</span> <span class="keywordtype">double</span> FXdouble; 00333 <span class="keyword">typedef</span> FXObject *<a class="code" href="classFX_1_1FXObject.html">FXObjectPtr</a>; 00334 <span class="preprocessor">#if defined(_MSC_VER) || (defined(__BCPLUSPLUS__) && __BORLANDC__ > 0x500) || defined(__WATCOM_INT64__)</span> 00335 <span class="preprocessor"></span><span class="preprocessor">#define FX_LONG</span> 00336 <span class="preprocessor"></span><span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> __int64 FXulong; 00337 <span class="keyword">typedef</span> __int64 FXlong; 00338 <span class="preprocessor">#elif defined(__GNUG__) || defined(__GNUC__) || defined(__SUNPRO_CC) || defined(__MWERKS__) || defined(__SC__)</span> 00339 <span class="preprocessor"></span><span class="preprocessor">#define FX_LONG</span> 00340 <span class="preprocessor"></span><span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> FXulong; 00341 <span class="keyword">typedef</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> FXlong; 00342 <span class="preprocessor">#endif</span> 00343 <span class="preprocessor"></span> 00344 <span class="comment">// Integral types large enough to hold value of a pointer</span> 00345 <span class="preprocessor">#if defined(_MSC_VER) && defined(_WIN64)</span> 00346 <span class="preprocessor"></span><span class="keyword">typedef</span> __int64 FXival; 00347 <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> __int64 FXuval; 00348 <span class="preprocessor">#else</span> 00349 <span class="preprocessor"></span><span class="keyword">typedef</span> <span class="keywordtype">long</span> FXival; 00350 <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> FXuval; 00351 <span class="preprocessor">#endif</span> 00352 <span class="preprocessor"></span> 00353 00354 <span class="comment">// Handle to something in server</span> 00355 <span class="preprocessor">#ifndef WIN32</span> 00356 <span class="preprocessor"></span><span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> FXID; 00357 <span class="preprocessor">#else</span> 00358 <span class="preprocessor"></span><span class="keyword">typedef</span> <span class="keywordtype">void</span>* FXID; 00359 <span class="preprocessor">#endif</span> 00360 <span class="preprocessor"></span> 00361 <span class="comment">// Time since January 1, 1970 (UTC)</span> 00362 <span class="keyword">typedef</span> <span class="keywordtype">long</span> FXTime; 00363 00364 <span class="comment">// Pixel type (could be color index)</span> 00365 <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> FXPixel; 00366 00367 <span class="comment">// RGBA pixel value</span> 00368 <span class="keyword">typedef</span> FXuint FXColor; 00369 00370 <span class="comment">// Hot key</span> 00371 <span class="keyword">typedef</span> FXuint FXHotKey; 00372 00373 <span class="comment">// Drag type</span> 00374 <span class="preprocessor">#ifndef WIN32</span> 00375 <span class="preprocessor"></span><span class="keyword">typedef</span> FXID FXDragType; 00376 <span class="preprocessor">#else</span> 00377 <span class="preprocessor"></span><span class="keyword">typedef</span> FXushort FXDragType; 00378 <span class="preprocessor">#endif</span> 00379 <span class="preprocessor"></span> 00380 <span class="comment">// Input source handle type</span> 00381 <span class="preprocessor">#ifndef WIN32</span> 00382 <span class="preprocessor"></span><span class="keyword">typedef</span> FXint FXInputHandle; 00383 <span class="preprocessor">#else</span> 00384 <span class="preprocessor"></span><span class="keyword">typedef</span> <span class="keywordtype">void</span>* FXInputHandle; 00385 <span class="preprocessor">#endif</span> 00386 <span class="preprocessor"></span> 00387 <span class="comment">// Raw event type</span> 00388 <span class="preprocessor">#ifndef WIN32</span> 00389 <span class="preprocessor"></span><span class="keyword">typedef</span> _XEvent FXRawEvent; 00390 <span class="preprocessor">#else</span> 00391 <span class="preprocessor"></span><span class="keyword">typedef</span> tagMSG FXRawEvent; 00392 <span class="preprocessor">#endif</span> 00393 <span class="preprocessor"></span> 00394 00395 <span class="comment">/********************************** Macros ***********************************/</span> 00396 00397 <span class="comment"></span> 00398 <span class="comment">/// Abolute value</span> 00399 <span class="comment"></span><span class="preprocessor">#define FXABS(val) (((val)>=0)?(val):-(val))</span> 00400 <span class="preprocessor"></span><span class="comment"></span> 00401 <span class="comment">/// Return the maximum of a or b</span> 00402 <span class="comment"></span><span class="preprocessor">#define FXMAX(a,b) (((a)>(b))?(a):(b))</span> 00403 <span class="preprocessor"></span><span class="comment"></span> 00404 <span class="comment">/// Return the minimum of a or b</span> 00405 <span class="comment"></span><span class="preprocessor">#define FXMIN(a,b) (((a)>(b))?(b):(a))</span> 00406 <span class="preprocessor"></span><span class="comment"></span> 00407 <span class="comment">/// Return the minimum of x, y and z</span> 00408 <span class="comment"></span><span class="preprocessor">#define FXMIN3(x,y,z) ((x)<(y)?FXMIN(x,z):FXMIN(y,z))</span> 00409 <span class="preprocessor"></span><span class="comment"></span> 00410 <span class="comment">/// Return the maximum of x, y and z</span> 00411 <span class="comment"></span><span class="preprocessor">#define FXMAX3(x,y,z) ((x)>(y)?FXMAX(x,z):FXMAX(y,z))</span> 00412 <span class="preprocessor"></span><span class="comment"></span> 00413 <span class="comment">/// Return minimum and maximum of a, b</span> 00414 <span class="comment"></span><span class="preprocessor">#define FXMINMAX(lo,hi,a,b) ((a)<(b)?((lo)=(a),(hi)=(b)):((lo)=(b),(hi)=(a)))</span> 00415 <span class="preprocessor"></span><span class="comment"></span> 00416 <span class="comment">/// Clamp value x to range [lo..hi]</span> 00417 <span class="comment"></span><span class="preprocessor">#define FXCLAMP(lo,x,hi) ((x)<(lo)?(lo):((x)>(hi)?(hi):(x)))</span> 00418 <span class="preprocessor"></span><span class="comment"></span> 00419 <span class="comment">/// Swap a pair of numbers</span> 00420 <span class="comment"></span><span class="preprocessor">#define FXSWAP(a,b,t) ((t)=(a),(a)=(b),(b)=(t))</span> 00421 <span class="preprocessor"></span><span class="comment"></span> 00422 <span class="comment">/// Linear interpolation between a and b, where 0<=f<=1</span> 00423 <span class="comment"></span><span class="preprocessor">#define FXLERP(a,b,f) ((a)+((b)-(a))*(f))</span> 00424 <span class="preprocessor"></span><span class="comment"></span> 00425 <span class="comment">/// Offset of member in a structure</span> 00426 <span class="comment"></span><span class="preprocessor">#define STRUCTOFFSET(str,member) (((char *)(&(((str *)0)->member)))-((char *)0))</span> 00427 <span class="preprocessor"></span><span class="comment"></span> 00428 <span class="comment">/// Number of elements in a static array</span> 00429 <span class="comment"></span><span class="preprocessor">#define ARRAYNUMBER(array) (sizeof(array)/sizeof(array[0]))</span> 00430 <span class="preprocessor"></span><span class="comment"></span> 00431 <span class="comment">/// Container class of a member class</span> 00432 <span class="comment"></span><span class="preprocessor">#define CONTAINER(ptr,str,mem) ((str*)(((char*)(ptr))-STRUCTOFFSET(str,mem)))</span> 00433 <span class="preprocessor"></span><span class="comment"></span> 00434 <span class="comment">/// Make int out of two shorts</span> 00435 <span class="comment"></span><span class="preprocessor">#define MKUINT(l,h) ((((FX::FXuint)(l))&0xffff) | (((FX::FXuint)(h))<<16))</span> 00436 <span class="preprocessor"></span><span class="comment"></span> 00437 <span class="comment">/// Make selector from message type and message id</span> 00438 <span class="comment"></span><span class="preprocessor">#define FXSEL(type,id) ((((FX::FXuint)(id))&0xffff) | (((FX::FXuint)(type))<<16))</span> 00439 <span class="preprocessor"></span><span class="comment"></span> 00440 <span class="comment">/// Get type from selector</span> 00441 <span class="comment"></span><span class="preprocessor">#define FXSELTYPE(s) ((FX::FXushort)(((s)>>16)&0xffff))</span> 00442 <span class="preprocessor"></span><span class="comment"></span> 00443 <span class="comment">/// Get ID from selector</span> 00444 <span class="comment"></span><span class="preprocessor">#define FXSELID(s) ((FX::FXushort)((s)&0xffff))</span> 00445 <span class="preprocessor"></span><span class="comment"></span> 00446 <span class="comment">/// Reverse bits in byte</span> 00447 <span class="comment"></span><span class="preprocessor">#define FXBITREVERSE(b) (((b&0x01)<<7)|((b&0x02)<<5)|((b&0x04)<<3)|((b&0x08)<<1)|((b&0x10)>>1)|((b&0x20)>>3)|((b&0x40)>>5)|((b&0x80)>>7))</span> 00448 <span class="preprocessor"></span> 00449 <span class="comment">// The order in memory is [R G B A] matches that in FXColor</span> 00450 00451 <span class="comment">// Definitions for big-endian machines</span> 00452 <span class="preprocessor">#if FOX_BIGENDIAN == 1</span> 00453 <span class="preprocessor"></span><span class="comment"></span> 00454 <span class="comment">/// Make RGBA color</span> 00455 <span class="comment"></span><span class="preprocessor">#define FXRGBA(r,g,b,a) (((FX::FXuint)(FX::FXuchar)(r)<<24) | ((FX::FXuint)(FX::FXuchar)(g)<<16) | ((FX::FXuint)(FX::FXuchar)(b)<<8) | ((FX::FXuint)(FX::FXuchar)(a)))</span> 00456 <span class="preprocessor"></span><span class="comment"></span> 00457 <span class="comment">/// Make RGB color</span> 00458 <span class="comment"></span><span class="preprocessor">#define FXRGB(r,g,b) (((FX::FXuint)(FX::FXuchar)(r)<<24) | ((FX::FXuint)(FX::FXuchar)(g)<<16) | ((FX::FXuint)(FX::FXuchar)(b)<<8) | 0x000000ff)</span> 00459 <span class="preprocessor"></span><span class="comment"></span> 00460 <span class="comment">/// Get red value from RGBA color</span> 00461 <span class="comment"></span><span class="preprocessor">#define FXREDVAL(rgba) ((FX::FXuchar)(((rgba)>>24)&0xff))</span> 00462 <span class="preprocessor"></span><span class="comment"></span> 00463 <span class="comment">/// Get green value from RGBA color</span> 00464 <span class="comment"></span><span class="preprocessor">#define FXGREENVAL(rgba) ((FX::FXuchar)(((rgba)>>16)&0xff))</span> 00465 <span class="preprocessor"></span><span class="comment"></span> 00466 <span class="comment">/// Get blue value from RGBA color</span> 00467 <span class="comment"></span><span class="preprocessor">#define FXBLUEVAL(rgba) ((FX::FXuchar)(((rgba)>>8)&0xff))</span> 00468 <span class="preprocessor"></span><span class="comment"></span> 00469 <span class="comment">/// Get alpha value from RGBA color</span> 00470 <span class="comment"></span><span class="preprocessor">#define FXALPHAVAL(rgba) ((FX::FXuchar)((rgba)&0xff))</span> 00471 <span class="preprocessor"></span><span class="comment"></span> 00472 <span class="comment">/// Get component value of RGBA color</span> 00473 <span class="comment"></span><span class="preprocessor">#define FXRGBACOMPVAL(rgba,comp) ((FX::FXuchar)(((rgba)>>((3-(comp))<<3))&0xff))</span> 00474 <span class="preprocessor"></span> 00475 <span class="preprocessor">#endif</span> 00476 <span class="preprocessor"></span> 00477 <span class="comment">// Definitions for little-endian machines</span> 00478 <span class="preprocessor">#if FOX_BIGENDIAN == 0</span> 00479 <span class="preprocessor"></span><span class="comment"></span> 00480 <span class="comment">/// Make RGBA color</span> 00481 <span class="comment"></span><span class="preprocessor">#define FXRGBA(r,g,b,a) (((FX::FXuint)(FX::FXuchar)(r)) | ((FX::FXuint)(FX::FXuchar)(g)<<8) | ((FX::FXuint)(FX::FXuchar)(b)<<16) | ((FX::FXuint)(FX::FXuchar)(a)<<24))</span> 00482 <span class="preprocessor"></span><span class="comment"></span> 00483 <span class="comment">/// Make RGB color</span> 00484 <span class="comment"></span><span class="preprocessor">#define FXRGB(r,g,b) (((FX::FXuint)(FX::FXuchar)(r)) | ((FX::FXuint)(FX::FXuchar)(g)<<8) | ((FX::FXuint)(FX::FXuchar)(b)<<16) | 0xff000000)</span> 00485 <span class="preprocessor"></span><span class="comment"></span> 00486 <span class="comment">/// Get red value from RGBA color</span> 00487 <span class="comment"></span><span class="preprocessor">#define FXREDVAL(rgba) ((FX::FXuchar)((rgba)&0xff))</span> 00488 <span class="preprocessor"></span><span class="comment"></span> 00489 <span class="comment">/// Get green value from RGBA color</span> 00490 <span class="comment"></span><span class="preprocessor">#define FXGREENVAL(rgba) ((FX::FXuchar)(((rgba)>>8)&0xff))</span> 00491 <span class="preprocessor"></span><span class="comment"></span> 00492 <span class="comment">/// Get blue value from RGBA color</span> 00493 <span class="comment"></span><span class="preprocessor">#define FXBLUEVAL(rgba) ((FX::FXuchar)(((rgba)>>16)&0xff))</span> 00494 <span class="preprocessor"></span><span class="comment"></span> 00495 <span class="comment">/// Get alpha value from RGBA color</span> 00496 <span class="comment"></span><span class="preprocessor">#define FXALPHAVAL(rgba) ((FX::FXuchar)(((rgba)>>24)&0xff))</span> 00497 <span class="preprocessor"></span><span class="comment"></span> 00498 <span class="comment">/// Get component value of RGBA color</span> 00499 <span class="comment"></span><span class="preprocessor">#define FXRGBACOMPVAL(rgba,comp) ((FX::FXuchar)(((rgba)>>((comp)<<3))&0xff))</span> 00500 <span class="preprocessor"></span> 00501 <span class="preprocessor">#endif</span> 00502 <span class="preprocessor"></span> 00503 <span class="comment"></span> 00504 <span class="comment">/**</span> 00505 <span class="comment">* FXASSERT() prints out a message when the expression fails,</span> 00506 <span class="comment">* and nothing otherwise. Unlike assert(), FXASSERT() will not</span> 00507 <span class="comment">* terminate the execution of the application.</span> 00508 <span class="comment">* When compiling your application for release, all assertions</span> 00509 <span class="comment">* are compiled out; thus there is no impact on execution speed.</span> 00510 <span class="comment">*/</span> 00511 <span class="preprocessor">#ifndef NDEBUG</span> 00512 <span class="preprocessor"></span><span class="preprocessor">#define FXASSERT(exp) ((exp)?((void)0):(void)FX::fxassert(#exp,__FILE__,__LINE__))</span> 00513 <span class="preprocessor"></span><span class="preprocessor">#else</span> 00514 <span class="preprocessor"></span><span class="preprocessor">#define FXASSERT(exp) ((void)0)</span> 00515 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 00516 <span class="preprocessor"></span> 00517 <span class="comment"></span> 00518 <span class="comment">/**</span> 00519 <span class="comment">* FXTRACE() allows you to trace the execution of your application</span> 00520 <span class="comment">* with increasing levels of detail the higher the trace level.</span> 00521 <span class="comment">* The trace level is determined by variable fxTraceLevel, which</span> 00522 <span class="comment">* may be set from the command line with "-tracelevel <level>".</span> 00523 <span class="comment">* When compiling your application for release, all trace statements</span> 00524 <span class="comment">* are compiled out, just like FXASSERT.</span> 00525 <span class="comment">* A statement like: FXTRACE((10,"The value of x=%d\n",x)) will</span> 00526 <span class="comment">* generate output only if fxTraceLevel is set to 11 or greater.</span> 00527 <span class="comment">* The default value fxTraceLevel=0 will block all trace outputs.</span> 00528 <span class="comment">* Note the double parentheses!</span> 00529 <span class="comment">*/</span> 00530 <span class="preprocessor">#ifndef NDEBUG</span> 00531 <span class="preprocessor"></span><span class="preprocessor">#define FXTRACE(arguments) FX::fxtrace arguments</span> 00532 <span class="preprocessor"></span><span class="preprocessor">#else</span> 00533 <span class="preprocessor"></span><span class="preprocessor">#define FXTRACE(arguments) ((void)0)</span> 00534 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 00535 <span class="preprocessor"></span> 00536 <span class="comment"></span> 00537 <span class="comment">/**</span> 00538 <span class="comment">* Allocate no elements of type to the specified pointer.</span> 00539 <span class="comment">* Return FALSE if size!=0 and allocation fails, TRUE otherwise.</span> 00540 <span class="comment">* An allocation of a zero size block returns a NULL pointer.</span> 00541 <span class="comment">*/</span> 00542 <span class="preprocessor">#define FXMALLOC(ptr,type,no) (FX::fxmalloc((void **)(ptr),sizeof(type)*(no)))</span> 00543 <span class="preprocessor"></span><span class="comment"></span> 00544 <span class="comment">/**</span> 00545 <span class="comment">* Allocate no elements of type to the specified pointer, and clear this memory to zero.</span> 00546 <span class="comment">* Return FALSE if size!=0 and allocation fails, TRUE otherwise.</span> 00547 <span class="comment">* An allocation of a zero size block returns a NULL pointer.</span> 00548 <span class="comment">*/</span> 00549 <span class="preprocessor">#define FXCALLOC(ptr,type,no) (FX::fxcalloc((void **)(ptr),sizeof(type)*(no)))</span> 00550 <span class="preprocessor"></span><span class="comment"></span> 00551 <span class="comment">/**</span> 00552 <span class="comment">* Resize a previously allocated block of memory.</span> 00553 <span class="comment">* Returns FALSE if size!=0 and reallocation fails, TRUE otherwise.</span> 00554 <span class="comment">* If reallocation fails, pointer is left to point to old block; a reallocation</span> 00555 <span class="comment">* to a zero size block has the effect of freeing it.</span> 00556 <span class="comment">*/</span> 00557 <span class="preprocessor">#define FXRESIZE(ptr,type,no) (FX::fxresize((void **)(ptr),sizeof(type)*(no)))</span> 00558 <span class="preprocessor"></span><span class="comment"></span> 00559 <span class="comment">/**</span> 00560 <span class="comment">* Allocate and initialize memory from another block.</span> 00561 <span class="comment">* Return FALSE if size!=0 and source!=NULL and allocation fails, TRUE otherwise.</span> 00562 <span class="comment">* An allocation of a zero size block returns a NULL pointer.</span> 00563 <span class="comment">*/</span> 00564 <span class="preprocessor">#define FXMEMDUP(ptr,src,type,no) (FX::fxmemdup((void **)(ptr),(const void*)(src),sizeof(type)*(no)))</span> 00565 <span class="preprocessor"></span><span class="comment"></span> 00566 <span class="comment">/**</span> 00567 <span class="comment">* Free a block of memory allocated with either FXMALLOC, FXCALLOC, FXRESIZE, or FXMEMDUP.</span> 00568 <span class="comment">* It is OK to call free a NULL pointer.</span> 00569 <span class="comment">*/</span> 00570 <span class="preprocessor">#define FXFREE(ptr) (FX::fxfree((void **)(ptr)))</span> 00571 <span class="preprocessor"></span> 00572 <span class="comment"></span> 00573 <span class="comment">/**</span> 00574 <span class="comment">* These are some of the ISO C99 standard single-precision transcendental functions.</span> 00575 <span class="comment">* On LINUX, specify _GNU_SOURCE or _ISOC99_SOURCE to enable native implementation;</span> 00576 <span class="comment">* otherwise, these macros will be used.</span> 00577 <span class="comment">*/</span> 00578 <span class="preprocessor">#ifndef __USE_ISOC99</span> 00579 <span class="preprocessor"></span><span class="preprocessor">#define sqrtf(x) ((float)sqrt((double)(x)))</span> 00580 <span class="preprocessor"></span><span class="preprocessor">#define fabsf(x) ((float)fabs((double)(x)))</span> 00581 <span class="preprocessor"></span><span class="preprocessor">#define ceilf(x) ((float)ceil((double)(x)))</span> 00582 <span class="preprocessor"></span><span class="preprocessor">#define floorf(x) ((float)floor((double)(x)))</span> 00583 <span class="preprocessor"></span><span class="preprocessor">#define sinf(x) ((float)sin((double)(x)))</span> 00584 <span class="preprocessor"></span><span class="preprocessor">#define cosf(x) ((float)cos((double)(x)))</span> 00585 <span class="preprocessor"></span><span class="preprocessor">#define tanf(x) ((float)tan((double)(x)))</span> 00586 <span class="preprocessor"></span><span class="preprocessor">#define asinf(x) ((float)asin((double)(x)))</span> 00587 <span class="preprocessor"></span><span class="preprocessor">#define acosf(x) ((float)acos((double)(x)))</span> 00588 <span class="preprocessor"></span><span class="preprocessor">#define atanf(x) ((float)atan((double)(x)))</span> 00589 <span class="preprocessor"></span><span class="preprocessor">#define atan2f(y,x) ((float)atan2((double)(y),(double)(x)))</span> 00590 <span class="preprocessor"></span><span class="preprocessor">#define powf(x,y) ((float)pow((double)(x),(double)(y)))</span> 00591 <span class="preprocessor"></span><span class="preprocessor">#define expf(x) ((float)exp((double)(x)))</span> 00592 <span class="preprocessor"></span><span class="preprocessor">#define fmodf(x,y) ((float)fmod((double)(x),(double)(y)))</span> 00593 <span class="preprocessor"></span><span class="preprocessor">#define logf(x) ((float)log((double)(x)))</span> 00594 <span class="preprocessor"></span><span class="preprocessor">#define log10f(x) ((float)log10((double)(x)))</span> 00595 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 00596 <span class="preprocessor"></span> 00597 <span class="comment">/********************************** Globals **********************************/</span> 00598 <span class="comment"></span> 00599 <span class="comment">/// Simple, thread-safe, random number generator</span> 00600 <span class="comment"></span><span class="keyword">extern</span> FXAPI FXuint fxrandom(FXuint& seed); 00601 <span class="comment"></span> 00602 <span class="comment">/// Allocate memory</span> 00603 <span class="comment"></span><span class="keyword">extern</span> FXAPI FXint fxmalloc(<span class="keywordtype">void</span>** ptr,<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> size); 00604 <span class="comment"></span> 00605 <span class="comment">/// Allocate cleaned memory</span> 00606 <span class="comment"></span><span class="keyword">extern</span> FXAPI FXint fxcalloc(<span class="keywordtype">void</span>** ptr,<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> size); 00607 <span class="comment"></span> 00608 <span class="comment">/// Resize memory</span> 00609 <span class="comment"></span><span class="keyword">extern</span> FXAPI FXint fxresize(<span class="keywordtype">void</span>** ptr,<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> size); 00610 <span class="comment"></span> 00611 <span class="comment">/// Duplicate memory</span> 00612 <span class="comment"></span><span class="keyword">extern</span> FXAPI FXint fxmemdup(<span class="keywordtype">void</span>** ptr,<span class="keyword">const</span> <span class="keywordtype">void</span>* src,<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> size); 00613 <span class="comment"></span> 00614 <span class="comment">/// Free memory, resets ptr to NULL afterward</span> 00615 <span class="comment"></span><span class="keyword">extern</span> FXAPI <span class="keywordtype">void</span> fxfree(<span class="keywordtype">void</span>** ptr); 00616 <span class="comment"></span> 00617 <span class="comment">/// Error routine</span> 00618 <span class="comment"></span><span class="keyword">extern</span> FXAPI <span class="keywordtype">void</span> fxerror(<span class="keyword">const</span> <span class="keywordtype">char</span>* format,...) FX_PRINTF(1,2) ; 00619 <span class="comment"></span> 00620 <span class="comment">/// Warning routine</span> 00621 <span class="comment"></span><span class="keyword">extern</span> FXAPI <span class="keywordtype">void</span> fxwarning(<span class="keyword">const</span> <span class="keywordtype">char</span>* format,...) FX_PRINTF(1,2) ; 00622 <span class="comment"></span> 00623 <span class="comment">/// Log message to [typically] stderr</span> 00624 <span class="comment"></span><span class="keyword">extern</span> FXAPI <span class="keywordtype">void</span> fxmessage(<span class="keyword">const</span> <span class="keywordtype">char</span>* format,...) FX_PRINTF(1,2) ; 00625 <span class="comment"></span> 00626 <span class="comment">/// Assert failed routine:- usually not called directly but called through FXASSERT</span> 00627 <span class="comment"></span><span class="keyword">extern</span> FXAPI <span class="keywordtype">void</span> fxassert(<span class="keyword">const</span> <span class="keywordtype">char</span>* expression,<span class="keyword">const</span> <span class="keywordtype">char</span>* filename,<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> lineno); 00628 <span class="comment"></span> 00629 <span class="comment">/// Trace printout routine:- usually not called directly but called through FXTRACE</span> 00630 <span class="comment"></span><span class="keyword">extern</span> FXAPI <span class="keywordtype">void</span> fxtrace(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> level,<span class="keyword">const</span> <span class="keywordtype">char</span>* format,...) FX_PRINTF(2,3) ; 00631 <span class="comment"></span> 00632 <span class="comment">/// Sleep n microseconds</span> 00633 <span class="comment"></span><span class="keyword">extern</span> FXAPI <span class="keywordtype">void</span> fxsleep(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> n); 00634 <span class="comment"></span> 00635 <span class="comment">/// Match a file name with a pattern</span> 00636 <span class="comment"></span><span class="keyword">extern</span> FXAPI FXint fxfilematch(<span class="keyword">const</span> <span class="keywordtype">char</span> *pattern,<span class="keyword">const</span> <span class="keywordtype">char</span> *string,FXuint flags=(FILEMATCH_NOESCAPE|FILEMATCH_FILE_NAME)); 00637 <span class="comment"></span> 00638 <span class="comment">/// Get highlight color</span> 00639 <span class="comment"></span><span class="keyword">extern</span> FXAPI FXColor makeHiliteColor(FXColor clr); 00640 <span class="comment"></span> 00641 <span class="comment">/// Get shadow color</span> 00642 <span class="comment"></span><span class="keyword">extern</span> FXAPI FXColor makeShadowColor(FXColor clr); 00643 <span class="comment"></span> 00644 <span class="comment">/// Get process id</span> 00645 <span class="comment"></span><span class="keyword">extern</span> FXAPI FXint fxgetpid(); 00646 <span class="comment"></span> 00647 <span class="comment">/// Duplicate string</span> 00648 <span class="comment"></span><span class="keyword">extern</span> FXAPI FXchar *fxstrdup(<span class="keyword">const</span> FXchar* str); 00649 <span class="comment"></span> 00650 <span class="comment">/// Calculate a hash value from a string</span> 00651 <span class="comment"></span><span class="keyword">extern</span> FXAPI FXuint fxstrhash(<span class="keyword">const</span> FXchar* str); 00652 <span class="comment"></span> 00653 <span class="comment">/// Get RGB value from color name</span> 00654 <span class="comment"></span><span class="keyword">extern</span> FXAPI FXColor fxcolorfromname(<span class="keyword">const</span> FXchar* colorname); 00655 <span class="comment"></span> 00656 <span class="comment">/// Get name of (closest) color to RGB</span> 00657 <span class="comment"></span><span class="keyword">extern</span> FXAPI FXchar* fxnamefromcolor(FXchar *colorname,FXColor color); 00658 <span class="comment"></span> 00659 <span class="comment">/// Convert RGB to HSV</span> 00660 <span class="comment"></span><span class="keyword">extern</span> FXAPI <span class="keywordtype">void</span> fxrgb_to_hsv(FXfloat& h,FXfloat& s,FXfloat& v,FXfloat r,FXfloat g,FXfloat b); 00661 <span class="comment"></span> 00662 <span class="comment">/// Convert HSV to RGB</span> 00663 <span class="comment"></span><span class="keyword">extern</span> FXAPI <span class="keywordtype">void</span> fxhsv_to_rgb(FXfloat& r,FXfloat& g,FXfloat& b,FXfloat h,FXfloat s,FXfloat v); 00664 <span class="comment"></span> 00665 <span class="comment">/// Floating point number classification: 0=OK, +/-1=Inf, +/-2=NaN</span> 00666 <span class="comment"></span><span class="keyword">extern</span> FXAPI FXint fxieeefloatclass(FXfloat number); 00667 <span class="keyword">extern</span> FXAPI FXint fxieeedoubleclass(FXdouble number); 00668 <span class="comment"></span> 00669 <span class="comment">/// Parse geometry, a-la X11 geometry specification</span> 00670 <span class="comment"></span><span class="keyword">extern</span> FXAPI FXint fxparsegeometry(<span class="keyword">const</span> FXchar *string,FXint& x,FXint& y,FXint& w,FXint& h); 00671 <span class="comment"></span> 00672 <span class="comment">/// True if executable with given path is a console application</span> 00673 <span class="comment"></span><span class="keyword">extern</span> FXbool fxisconsole(<span class="keyword">const</span> FXchar *path); 00674 <span class="comment"></span> 00675 <span class="comment">/// Version number that the library has been compiled with</span> 00676 <span class="comment"></span><span class="keyword">extern</span> FXAPI <span class="keyword">const</span> FXuchar fxversion[3]; 00677 00678 <span class="comment"></span> 00679 <span class="comment">/// Controls tracing level</span> 00680 <span class="comment"></span><span class="keyword">extern</span> FXAPI <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> fxTraceLevel; 00681 <span class="comment"></span> 00682 <span class="comment">/**</span> 00683 <span class="comment">* Parse accelerator from string, yielding modifier and</span> 00684 <span class="comment">* key code. For example, fxparseAccel("Ctl+Shift+X")</span> 00685 <span class="comment">* yields MKUINT(KEY_X,CONTROLMASK|SHIFTMASK).</span> 00686 <span class="comment">*/</span> 00687 <span class="keyword">extern</span> FXAPI FXHotKey fxparseAccel(<span class="keyword">const</span> FXString& string); 00688 <span class="comment"></span> 00689 <span class="comment">/**</span> 00690 <span class="comment">* Parse hot key from string, yielding modifier and</span> 00691 <span class="comment">* key code. For example, fxparseHotKey(""Salt && &Pepper!"")</span> 00692 <span class="comment">* yields MKUINT(KEY_p,ALTMASK).</span> 00693 <span class="comment">*/</span> 00694 <span class="keyword">extern</span> FXAPI FXHotKey fxparseHotKey(<span class="keyword">const</span> FXString& string); 00695 <span class="comment"></span> 00696 <span class="comment">/**</span> 00697 <span class="comment">* Obtain hot key offset in string, or -1 if not found.</span> 00698 <span class="comment">* For example, findHotKey("Salt && &Pepper!") yields 7.</span> 00699 <span class="comment">*/</span> 00700 <span class="keyword">extern</span> FXAPI FXint fxfindHotKey(<span class="keyword">const</span> FXString& string); 00701 <span class="comment"></span> 00702 <span class="comment">/**</span> 00703 <span class="comment">* Strip hot key combination from the string.</span> 00704 <span class="comment">* For example, stripHotKey("Salt && &Pepper") should</span> 00705 <span class="comment">* yield "Salt & Pepper".</span> 00706 <span class="comment">*/</span> 00707 <span class="keyword">extern</span> FXAPI FXString fxstripHotKey(<span class="keyword">const</span> FXString& string); 00708 00709 } 00710 00711 <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 © 1997-2004 Jeroen van der Zijp</font> </td></tr></table> </p> <!--- COPYRIGHT --> </body> </html>