fltk/documentation/enumerations.html

252 lines
11 KiB
HTML

<HTML><BODY>
<H1 ALIGN=RIGHT><A NAME=Enumerations>C - FLTK Enumerations</A></H1>
This appendix lists the enumerations provided in the <TT>
&lt;FL/Enumerations.H&gt;</TT> header file, organized by section.
Constants whose value is zero are marked with "(0)", this is often
useful to know when programming.
<H2>Version Numbers</H2>
The FLTK version number is stored in a number of compile-time
constants:
<UL>
<LI><TT>FL_MAJOR_VERSION</TT> - The major release number, currently 1. </LI>
<LI><TT>FL_MINOR_VERSION</TT> - The minor release number, currently 0. </LI>
<LI><TT>FL_PATCH_VERSION</TT> - The patch release number, currently 0. </LI>
<LI><TT>FL_VERSION</TT> - A combined floating-point version number for
the major and minor release numbers, currently 1.0. </LI>
</UL>
<H2>Events</H2>
Events are identified by an <TT>Fl_Event</TT> enumeration value. The
following events are currently defined:
<UL>
<LI><TT>FL_NO_EVENT</TT> - No event (or an event fltk does not
understand) occurred (0).</LI>
<LI><TT>FL_PUSH</TT> - A mouse button was pushed. </LI>
<LI><TT>FL_RELEASE</TT> - A mouse button was released. </LI>
<LI><TT>FL_ENTER</TT> - The mouse pointer entered a widget. </LI>
<LI><TT>FL_LEAVE</TT> - The mouse pointer left a widget. </LI>
<LI><TT>FL_DRAG</TT> - The mouse pointer was moved with a button
pressed. </LI>
<LI><TT>FL_FOCUS</TT> - A widget should receive keyboard focus. </LI>
<LI><TT>FL_UNFOCUS</TT> - A widget loses keyboard focus. </LI>
<LI><TT>FL_KEYBOARD</TT> - A key was pressed. </LI>
<LI><TT>FL_CLOSE</TT> - A window was closed. </LI>
<LI><TT>FL_MOVE</TT> - The mouse pointer was moved with no buttons
pressed. </LI>
<LI><TT>FL_SHORTCUT</TT> - The user pressed a shortcut key. </LI>
<LI><TT>FL_DEACTIVATE</TT> - The widget has been deactivated. </LI>
<LI><TT>FL_ACTIVATE</TT> - The widget has been activated. </LI>
<LI><TT>FL_HIDE</TT> - The widget has been hidden. </LI>
<LI><TT>FL_SHOW</TT> - The widget has been shown. </LI>
<LI><TT>FL_PASTE</TT> - The widget should paste the contents of the
clipboard. </LI>
<LI><TT>FL_SELECTIONCLEAR</TT> - The widget should clear any selections
made for the clipboard. </LI>
</UL>
<H2><a name=when>Callback &quot;When&quot; Conditions</H2>
The following constants determine when a callback is performed:
<UL>
<LI><TT>FL_WHEN_NEVER</TT> - Never call the callback (0). </LI>
<LI><TT>FL_WHEN_CHANGED</TT> - Do the callback only when the widget
value changes. </LI>
<LI><TT>FL_WHEN_NOT_CHANGED</TT> - Do the callback whenever the user
interacts with the widget. </LI>
<LI><TT>FL_WHEN_RELEASE</TT> - Do the callback when the button or key
is released and the value changes. </LI>
<LI><TT>FL_WHEN_ENTER_KEY</TT> - Do the callback when the user presses
the ENTER key and the value changes. </LI>
<LI><TT>FL_WHEN_RELEASE_ALWAYS</TT> - Do the callback when the button
or key is released, even if the value doesn't change. </LI>
<LI><TT>FL_WHEN_ENTER_KEY_ALWAYS</TT> - Do the callback when the user
presses the ENTER key, even if the value doesn't change. </LI>
</UL>
<H2><A NAME="button_values">Fl::event_button() Values</A></H2>
<P>The following constants define the button numbers for <TT>FL_PUSH</TT> and
<TT>FL_RELEASE</TT> events:
<UL>
<LI><TT>FL_LEFT_MOUSE</TT> - the left mouse button
<LI><TT>FL_MIDDLE_MOUSE</TT> - the middle mouse button
<LI><TT>FL_RIGHT_MOUSE</TT> - the right mouse button
</UL>
<H2><A NAME="key_values">Fl::event_key() Values</A></H2>
The following constants define the non-ASCII keys on the keyboard for <TT>
FL_KEYBOARD</TT> and <TT>FL_SHORTCUT</TT> events:
<UL>
<LI><TT>FL_Button</TT> - A mouse button; use <TT>Fl_Button + n</TT>
for mouse button <TT>n</TT>. </LI>
<LI><TT>FL_BackSpace</TT> - The backspace key. </LI>
<LI><TT>FL_Tab</TT> - The tab key. </LI>
<LI><TT>FL_Enter</TT> - The enter key. </LI>
<LI><TT>FL_Pause</TT> - The pause key. </LI>
<LI><TT>FL_Scroll_Lock</TT> - The scroll lock key. </LI>
<LI><TT>FL_Escape</TT> - The escape key. </LI>
<LI><TT>FL_Home</TT> - The home key. </LI>
<LI><TT>FL_Left</TT> - The left arrow key. </LI>
<LI><TT>FL_Up</TT> - The up arrow key. </LI>
<LI><TT>FL_Right</TT> - The right arrow key. </LI>
<LI><TT>FL_Down</TT> - The down arrow key. </LI>
<LI><TT>FL_Page_Up</TT> - The page-up key. </LI>
<LI><TT>FL_Page_Down</TT> - The page-down key. </LI>
<LI><TT>FL_End</TT> - The end key. </LI>
<LI><TT>FL_Print</TT> - The print (or print-screen) key. </LI>
<LI><TT>FL_Insert</TT> - The insert key. </LI>
<LI><TT>FL_Menu</TT> - The menu key. </LI>
<LI><TT>FL_Num_Lock</TT> - The num lock key. </LI>
<LI><TT>FL_KP</TT> - One of the keypad numbers; use <TT>FL_KP + n</TT>
for number <TT>n</TT>. </LI>
<LI><TT>FL_KP_Enter</TT> - The enter key on the keypad. </LI>
<LI><TT>FL_F</TT> - One of the function keys; use <TT>FL_F + n</TT>
for function key <TT>n</TT>. </LI>
<LI><TT>FL_Shift_L</TT> - The lefthand shift key. </LI>
<LI><TT>FL_Shift_R</TT> - The righthand shift key. </LI>
<LI><TT>FL_Control_L</TT> - The lefthand control key. </LI>
<LI><TT>FL_Control_R</TT> - The righthand control key. </LI>
<LI><TT>FL_Caps_Lock</TT> - The caps lock key. </LI>
<LI><TT>FL_Meta_L</TT> - The left meta/Windows key. </LI>
<LI><TT>FL_Meta_R</TT> - The right meta/Windows key. </LI>
<LI><TT>FL_Alt_L</TT> - The left alt key. </LI>
<LI><TT>FL_Alt_R</TT> - The right alt key. </LI>
<LI><TT>FL_Delete</TT> - The delete key. </LI>
</UL>
<H2>Fl::event_state() Values</H2>
The following constants define bits in the <TT>Fl::event_state()</TT>
value:
<UL>
<LI><TT>FL_SHIFT</TT> - One of the shift keys is down. </LI>
<LI><TT>FL_CAPS_LOCK</TT> - The caps lock is on. </LI>
<LI><TT>FL_CTRL</TT> - One of the ctrl keys is down. </LI>
<LI><TT>FL_ALT</TT> - One of the alt keys is down. </LI>
<LI><TT>FL_NUM_LOCK</TT> - The num lock is on. </LI>
<LI><TT>FL_META</TT> - One of the meta/Windows keys is down. </LI>
<LI><TT>FL_SCROLL_LOCK</TT> - The scroll lock is on. </LI>
<LI><TT>FL_BUTTON1</TT> - Mouse button 1 is pushed. </LI>
<LI><TT>FL_BUTTON2</TT> - Mouse button 2 is pushed. </LI>
<LI><TT>FL_BUTTON3</TT> - Mouse button 3 is pushed. </LI>
</UL>
<H2><a name=align>Alignment Values</H2>
The following constants define bits that can be used with <A href=Fl_Widget.html#Fl_Widget.align>
<TT>Fl_Widget::align()</TT></A> to control the positioning of the
label:
<UL>
<LI><TT>FL_ALIGN_CENTER</TT> - The label is centered (0). </LI>
<LI><TT>FL_ALIGN_TOP</TT> - The label is top-aligned. </LI>
<LI><TT>FL_ALIGN_BOTTOM</TT> - The label is bottom-aligned. </LI>
<LI><TT>FL_ALIGN_LEFT</TT> - The label is left-aligned. </LI>
<LI><TT>FL_ALIGN_RIGHT</TT> - The label is right-aligned. </LI>
<LI><TT>FL_ALIGN_CLIP</TT> - The label is clipped to the widget. </LI>
<LI><TT>FL_ALIGN_WRAP</TT> - The label text is wrapped as needed. </LI>
<LI><TT>FL_ALIGN_TOP_LEFT</TT></LI>
<LI><TT>FL_ALIGN_TOP_RIGHT</TT></LI>
<LI><TT>FL_ALIGN_BOTTOM_LEFT</TT></LI>
<LI><TT>FL_ALIGN_BOTTOM_RIGHT</TT></LI>
<LI><TT>FL_ALIGN_LEFT_TOP</TT></LI>
<LI><TT>FL_ALIGN_RIGHT_TOP</TT></LI>
<LI><TT>FL_ALIGN_LEFT_BOTTOM</TT></LI>
<LI><TT>FL_ALIGN_RIGHT_BOTTOM</TT></LI>
<LI><TT>FL_ALIGN_INSIDE</TT> - 'or' this with other values to put
label inside the widget. </LI>
</UL>
<H2><a name=fonts>Fonts</H2>
The following constants define the standard FLTK fonts:
<ul>
<LI><TT>FL_HELVETICA</TT> - Helvetica (or Arial) normal (0). </LI>
<LI><TT>FL_HELVETICA_BOLD</TT> - Helvetica (or Arial) bold. </LI>
<LI><TT>FL_HELVETICA_ITALIC</TT> - Helvetica (or Arial) oblique. </LI>
<LI><TT>FL_HELVETICA_BOLD_ITALIC</TT> - Helvetica (or Arial)
bold-oblique. </LI>
<LI><TT>FL_COURIER</TT> - Courier normal. </LI>
<LI><TT>FL_COURIER_BOLD</TT> - Courier bold. </LI>
<LI><TT>FL_COURIER_ITALIC</TT> - Courier italic. </LI>
<LI><TT>FL_COURIER_BOLD_ITALIC</TT> - Courier bold-italic. </LI>
<LI><TT>FL_TIMES</TT> - Times roman. </LI>
<LI><TT>FL_TIMES_BOLD</TT> - Times bold. </LI>
<LI><TT>FL_TIMES_ITALIC</TT> - Times italic. </LI>
<LI><TT>FL_TIMES_BOLD_ITALIC</TT> - Times bold-italic. </LI>
<LI><TT>FL_SYMBOL</TT> - Standard symbol font. </LI>
<LI><TT>FL_SCREEN</TT> - Default monospaced screen font. </LI>
<LI><TT>FL_SCREEN_BOLD</TT> - Default monospaced bold screen font. </LI>
<LI><TT>FL_ZAPF_DINGBATS</TT> - Zapf-dingbats font.
</ul>
<H2><a name=colors>Colors</H2>
The following color constants can be used to access the colors in the
FLTK standard color palette:
<UL>
<LI><TT>FL_BLACK</TT> - the default label color (0)</LI>
<LI><TT>FL_RED</TT></LI>
<LI><TT>FL_GREEN</TT></LI>
<LI><TT>FL_YELLOW</TT></LI>
<LI><TT>FL_BLUE</TT></LI>
<LI><TT>FL_MAGENTA</TT></LI>
<LI><TT>FL_CYAN</TT></LI>
<LI><TT>FL_WHITE</TT> - the default background for text</LI>
<LI><TT>FL_SELECTION_COLOR</TT> - change to dark blue for Windows style</LI>
<LI><TT>FL_GRAY</TT> - the default color.</LI>
</UL>
In addition there are two inline functions to allow you to select
grays or colors from the FLTK colormap:
<p><b>Fl_Color fl_gray_ramp(int i)</b>
<br>Returns a gray color. Returns black for zero, returns white for
<tt>FL_NUM_GRAY</tt> (which is 24) minus 1. To get the closest to an
8-bit gray value 'I' use
<tt>fl_gray_ramp(I*FL_NUM_GRAY/256)</tt>
<p><b>Fl_Color fl_color_cube(int r, int g, int b)</b>
<br>Returns a color out of the color cube.
<tt>r</tt> must be in the range 0 to FL_NUM_RED (5) minus 1.
<tt>g</tt> must be in the range 0 to FL_NUM_GREEN (8) minus 1.
<tt>b</tt> must be in the range 0 to FL_NUM_BLUE (5) minus 1.
To get the closest color to a 8-bit set of R,G,B values use
<tt>fl_color_cube(R*FL_NUM_RED/256, G*FL_NUM_GREEN/256,
B*FL_NUM_BLUE/256);</tt>
<H2><a name=cursor>Cursors</H2>
The following constants define the mouse cursors that are available in
FLTK. The double-headed arrows are bitmaps
provided by FLTK on X, the others are provided by system-defined
cursors.</P>
<UL>
<LI><TT>FL_CURSOR_DEFAULT</TT> - the default cursor, usually an arrow (0)</LI>
<LI><TT>FL_CURSOR_ARROW</TT> - an arrow pointer </LI>
<LI><TT>FL_CURSOR_CROSS</TT> - crosshair </LI>
<LI><TT>FL_CURSOR_WAIT</TT> - watch or hourglass </LI>
<LI><TT>FL_CURSOR_INSERT</TT> - I-beam </LI>
<LI><TT>FL_CURSOR_HAND</TT> - hand (uparrow on MSWindows) </LI>
<LI><TT>FL_CURSOR_HELP</TT> - question mark </LI>
<LI><TT>FL_CURSOR_MOVE</TT> - 4-pointed arrow </LI>
<LI><TT>FL_CURSOR_NS</TT> - up/down arrow </LI>
<LI><TT>FL_CURSOR_WE</TT> - left/right arrow </LI>
<LI><TT>FL_CURSOR_NWSE</TT> - diagonal arrow </LI>
<LI><TT>FL_CURSOR_NESW</TT> - diagonal arrow </LI>
<LI><TT>FL_CURSOR_NONE</TT> - invisible </LI>
</UL>
<H2>FD &quot;When&quot; Conditions</H2>
<UL>
<LI><TT>FL_READ</TT> - Call the callback when there is data to be
read. </LI>
<LI><TT>FL_WRITE</TT> - Call the callback when data can be written
without blocking. </LI>
<LI><TT>FL_EXCEPT</TT> - Call the callback if an exception occurs on
the file. </LI>
</UL>
<H2><a name=damage>Damage Masks</H2>
The following damage mask bits are used by the standard FLTK widgets:
<UL>
<LI><TT>FL_DAMAGE_CHILD</TT> - A child needs to be redrawn. </LI>
<LI><TT>FL_DAMAGE_EXPOSE</TT> - The window was exposed. </LI>
<LI><TT>FL_DAMAGE_SCROLL</TT> - The <TT>Fl_Scroll</TT> widget was
scrolled. </LI>
<LI><TT>FL_DAMAGE_OVERLAY</TT> - The overlay planes need to be redrawn. </LI>
<LI><TT>FL_DAMAGE_ALL</TT> - Everything needs to be redrawn. </LI>
</UL>
</LI>
</BODY></HTML>