ZynAddSubFX: integrated FLTK 1.3.0 branch from SVN

Integrated FLTK 1.3.0 branch from SVN which brings UTF8 support and
fully integrated Xft support (SVN rev. 6791).

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
(cherry picked from commit 8affa66c61)
This commit is contained in:
Tobias Doerffel
2009-05-31 14:53:52 +02:00
parent 41efb51518
commit e0bb2cd043
354 changed files with 48435 additions and 6400 deletions

View File

@@ -1,3 +1,95 @@
CHANGES IN FLTK 1.3.0
- Fluid printing used wrong colors under Windows (STR #2195)
- Updated documentation for Fl_Input_
- Fixed fl_draw_image to obey the alpha channel, hoping that
this has no adverse effect on existing software (OS X only)
- Added OS X cursor control to Fl_Input (STR #2169)
- Fix for multiple popups, when dragging and calling fl_alert()
and friends from the callback (STR #2159)
- Avoiding crashes for recursive common dialogs (this does not
fix the issue at hand yet) (STR #1986, 2150)
- Fixed control key keycodes with modifiers on OS X
- Added menu shortcut alignment for OS X
- Fixed bad system menu hadling in OS X (STR #2153)
- Fixed File Input mouse pointer dragging (STR #2181)
- Added alternative text input awareness on OS X
- Fixed 'del' keycode on OS X (must be verified for all keyboards)
- Fixed OS X support for sending and receiving dnd data as utf8
- Added drop box to utf8 test that will show the utf8 encoding
for the first dropped character
- Restructured the unittest application
- Updated the bundled libpng to v1.2.35 (released 18 Feb. 2009)
- Fl_Preferences.H now doesn't include windows.h any more
(Windows only, STR #2173).
- Fl_Window::draw() now doesn't reset its x/y-coordinates to 0
anymore before drawing itself and its children.
- All draw() methods of widgets are now protected (STR #2142).
- The new configure option --enable-x11 (lowercase 'x') enables
Cygwin builds under Windows (with --enable-cygwin) to use X11
instead of GDI drawing (STR #2147, #2183) and is ignored otherwise.
- Added Fl_Scroll::bbox() documentation (STR #1893)
- Removed an XForms compatibility "feature" that prevented the down
array of Fl_Menu_Button from drawing (STR #2141).
- New class Fl_Widget_Tracker to simplify safe handling of widget
deletion in callbacks. This is used in Fl_Widget::do_callback()
to prevent accessing widgets after deletion in the callback.
- Fl_Help_View handles HTML2 font color specification (STR #890)
- Copyright dates are now updated to 2009 (STR #2036)
- Copy/Paste operations should now work as expected,
with utf8,16 support and fltk1.1 compatibility. (STR #2104,2121).
- Widgets now remove themselves from their parent group (if any),
when destroyed (STR #1894)
- Added flexible gap size for text buffer (STR #2046)
- Fixed static linking of image libraries (STR #1962)
- Fixed fl_set_spot() for Windows (STR #2101)
- Added sorting to Fl_Browser_ (STR #2113)
- Added utf8 support for OS X copy and paste
- Improved handling of composed keys in OS X 10.5 and up
- Fixed callback would not be called when shortcut was used with
radio and toggle buttons in default FL_RELEASE mode.
- Fixed a problem with TrackMouseEvent() (Windows only) that would
generate wrong FL_LEAVE events with subwindows. TrackMouseEvent
is now enabled by default (it was disabled for GNU compilers).
It can be disabled by defining NO_TRACK_MOUSE.
Improved test/subwindow.cxx (STR #2079)
- Fixed documentation (added missing COMCTRL32.LIB dependency)
- Fixed menu position close to screen border (STR #2057)
- Improved stability of fl_read_image (STR #2021)
- Fixed adding an idle handler during
a draw() call (STR #1950)
- Fl_Group::clip_children() is now public (STR #2017)
- Added clarification to Fl_GL_Window mode
function (STR #1945)
- Fixed Fluid textcolor output (STR #1992)
- Fixed wrong default value of Fl_Spinner in
Fluid (STR #1991)
- Fixed first modifier key event (STR #1952)
- Fl_Group and Fl_Scroll now resize themselves before
resizing their children (STR #2032)
- "fltk-config --post foo" now creates an application
bundle rather than attaching a resource fork.
- Added scroll_to(int,int) to Fl_Scroll, replacing
position(int,int) which now behaves as it should (STR #1303)
- Fixed Fl_Scroll inside Fl_Scroll (STR #265)
- Hardcoded 1.1 references in src/Makefile to 1.3 (STR #1922)
- Changed font index to 32 bit
- Changed font size to 32 bit
- Changed widget coordinates to 32 bit
- Added support for shortcuts for Fl_Input_,
Fl_Value_Input, and Fl_Text_Display derived
widgets (STR #1770)
- Initial setup (STR #1904)
- winsock dll is dynamically loaded and by default
ws2_32.dll, use of winsock1 is still possible by defining
USE_WSOCK1 at compile time.
- Cairo support: added --enable-cairo and --enable-cairoext
configure options.
- visualc(6) & vc2005 devenv's are in the ide subdirectory
- hide() and show() methods are now virtual from Fl_Widget,
was only virtual since Fl_Window derived classes before.
So now widget->hide() will work if widget is a window.
CHANGES IN FLTK 1.1.9
- Improved color contrast in secondary selection blocks
@@ -10,9 +102,10 @@ CHANGES IN FLTK 1.1.9
- Fixed MSWindows crash when selecting umlauts
in Fl_Help_View (STR #1912)
CHANGES IN FLTK 1.1.8
- Documentation fixes (STR #1454, STR #1455, STR #1456,
- Documentation fixes (STR #1454, STR #1455, STR #1456,
STR #1457, STR #1458, STR #1460, STR #1481, STR #1578,
STR #1639, STR #1645, STR #1644, STR #1792, STR #1793,
STR #1742, STR #1777, STR #1794, STR #1827, STR #1843,

View File

@@ -6,8 +6,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.0)
# The FLTK version
SET(FLTK_VERSION_MAJOR "1")
SET(FLTK_VERSION_MINOR "1")
SET(FLTK_VERSION_PATCH "9")
SET(FLTK_VERSION_MINOR "3")
SET(FLTK_VERSION_PATCH "0")
SET(FLTK_VERSION "${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}")
SET(FLTK_VERSION_FULL "${FLTK_VERSION}.${FLTK_VERSION_PATCH}")
@@ -42,7 +42,7 @@ IF(WIN32)
IF(BORLAND)
SET( FLTK_PLATFORM_DEPENDENT_LIBS import32 )
ELSE(BORLAND)
SET( FLTK_PLATFORM_DEPENDENT_LIBS wsock32 comctl32 )
SET( FLTK_PLATFORM_DEPENDENT_LIBS comctl32 )
ENDIF(BORLAND)
ENDIF(NOT CYGWIN)
ELSE(WIN32)
@@ -64,6 +64,7 @@ ENDIF(APPLE)
IF(UNIX)
FIND_PACKAGE(X11)
SET(USE_X11 1)
SET( FLTK_PLATFORM_DEPENDENT_LIBS ${X11_LIBRARIES} -lm)
SET( FLTK_PLATFORM_DEPENDENT_LIBS ${X11_LIBRARIES} -lm)
SET(USE_XFT 0)
@@ -84,7 +85,7 @@ ENDIF(APPLE AND NOT FLTK_APPLE_X11)
IF(CYGWIN)
ADD_DEFINITIONS(-DWIN32)
SET( FLTK_PLATFORM_DEPENDENT_LIBS ole32 uuid comctl32 wsock32 supc++ -lm -lgdi32)
SET( FLTK_PLATFORM_DEPENDENT_LIBS ole32 uuid comctl32 supc++ -lm -lgdi32)
ENDIF(CYGWIN)
IF(MINGW)

View File

@@ -1,4 +1,4 @@
CREDITS - Fast Light Tool Kit (FLTK) Version 1.1.5
CREDITS - Fast Light Tool Kit (FLTK) Version 1.3.0
--------------------------------------------------
This file lists the people responsible for the toolkit you
@@ -11,12 +11,13 @@ CORE DEVELOPERS
The following people do the day-to-day development of FLTK:
Fabien Costantini (fabien67@users.sf.net)
Craig P. Earls
Curtis Edwards (trilec@users.sourceforge.net)
Gustavo Hime (hime@users.sourceforge.net)
Talbot Hughes
Robert Kesterson (robertk@users.sourceforge.net)
Matthias Melcher (matthias@users.sourceforge.net)
Matthias Melcher (mm@robowerk.com)
James Dean Palmer (jamespalmer@users.sourceforge.net)
Vincent Penne (vincentp@users.sourceforge.net)
Bill Spitzak (spitzak@users.sourceforge.net)
@@ -32,12 +33,12 @@ OTHER CONTRIBUTORS
Teun Burgers
Paul Chambers
Fabien Costantini
Stephen Davies
Yuri D'Elia
Greg Ercolano
Yuri Fedorchenko
George Garvey
Duncan Gibson
Mikael Hultgren
Stuart Levy
Howard Lightstone

View File

@@ -1,9 +1,9 @@
//
// "$Id: Enumerations.H 6096 2008-04-12 04:18:58Z mike $"
// "$Id: Enumerations.H 6735 2009-04-01 22:11:57Z engelsman $"
//
// Enumerations for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,164 +25,464 @@
// http://www.fltk.org/str.php
//
/** \file
* This file contains type definitions and general enumerations.
*/
#ifndef Fl_Enumerations_H
#define Fl_Enumerations_H
# include "Fl_Export.H"
# include "fl_types.h"
/** \name Version Numbers
//
// The FLTK version number; this is changed slightly from the beta versions
// because the old "const double" definition would not allow for conditional
// compilation...
//
// FL_VERSION is a double that describes the major and minor version numbers.
// Version 1.1 is actually stored as 1.01 to allow for more than 9 minor
// releases.
//
// The FL_MAJOR_VERSION, FL_MINOR_VERSION, and FL_PATCH_VERSION constants
// give the integral values for the major, minor, and patch releases
// respectively.
//
FLTK defines some constants to help the programmer to
find out, for which FLTK version a program is compiled.
The following constants are defined:
*/
/*@{*/
/**
* The major release version of this FLTK library.
\sa FL_VERSION
*/
#define FL_MAJOR_VERSION 1
#define FL_MINOR_VERSION 1
#define FL_PATCH_VERSION 9
/**
* The minor release version for this library.
*
* FLTK remains mostly source-code compatible between minor version changes.
*/
#define FL_MINOR_VERSION 3
/**
* The patch version for this library.
*
* FLTK remains binary compatible between patches.
*/
#define FL_PATCH_VERSION 0
/**
* The FLTK version number as a \em double.
*
* This is changed slightly from the beta versions
* because the old "const double" definition would not allow for conditional
* compilation...
*
* FL_VERSION is a double that describes the major and minor version numbers.
* Version 1.1 is actually stored as 1.01 to allow for more than 9 minor
* releases.
*
* The FL_MAJOR_VERSION, FL_MINOR_VERSION, and FL_PATCH_VERSION constants
* give the integral values for the major, minor, and patch releases
* respectively.
*/
#define FL_VERSION ((double)FL_MAJOR_VERSION + \
(double)FL_MINOR_VERSION * 0.01 + \
(double)FL_PATCH_VERSION * 0.0001)
typedef unsigned char uchar;
typedef unsigned long ulong;
/*@}*/ // group: Version Numbers
/**
* Every time a user moves the mouse pointer, clicks a button,
* or presses a key, an event is generated and sent to your
* application. Events can also come from other programs like the
* window manager.
*
* Events are identified by the integer argument passed to the
* Fl_Widget::handle() virtual method. Other information about the
* most recent event is stored in static locations and acquired by
* calling the Fl::event_*() methods. This static information remains
* valid until the next event is read from the window system, so it
* is ok to look at it outside of the handle() method.
*
* \sa Fl::event_text(), Fl::event_key(), class Fl::
*/
enum Fl_Event { // events
/** No event. */
FL_NO_EVENT = 0,
/** A mouse button has gone down with the mouse pointing at this
* widget. You can find out what button by calling Fl::event_button().
* You find out the mouse position by calling Fl::event_x() and
* Fl::event_y().
*
* A widget indicates that it "wants" the mouse click by returning non-zero
* from its Fl_Widget::handle() method. It will then become the
* Fl::pushed() widget and will get FL_DRAG and the matching FL_RELEASE events.
* If Fl_Widget::handle() returns zero then FLTK will try sending the FL_PUSH
* to another widget.
*/
FL_PUSH = 1,
/** A mouse button has been released. You can find out what button by
* calling Fl::event_button().
*
* In order to receive the FL_RELEASE event, the widget must return
* non-zero when handling FL_PUSH.
*/
FL_RELEASE = 2,
/** The mouse has been moved to point at this widget. This can
* be used for highlighting feedback. If a widget wants to
* highlight or otherwise track the mouse, it indicates this by
* returning non-zero from its handle() method. It then
* becomes the Fl::belowmouse() widget and will receive
* FL_MOVE and FL_LEAVE events.
*/
FL_ENTER = 3,
/** The mouse has moved out of the widget.
* In order to receive the FL_LEAVE event, the widget must
* return non-zero when handling FL_ENTER.
*/
FL_LEAVE = 4,
/** The mouse has moved with a button held down. The current button state
* is in Fl::event_state(). The mouse position is in Fl::event_x() and
* Fl::event_y().
*
* In order to receive FL_DRAG events, the widget must return non-zero
* when handling FL_PUSH.
*/
FL_DRAG = 5,
/** This indicates an <I>attempt</I> to give a widget the keyboard focus.
*
* If a widget wants the focus, it should change itself to display the
* fact that it has the focus, and return non-zero from its handle() method.
* It then becomes the Fl::focus() widget and gets FL_KEYDOWN, FL_KEYUP,
* and FL_UNFOCUS events.
*
* The focus will change either because the window manager changed which
* window gets the focus, or because the user tried to navigate using tab,
* arrows, or other keys. You can check Fl::event_key() to figure out why
* it moved. For navigation it will be the key pressed and interaction
* with the window manager it will be zero.
*/
FL_FOCUS = 6,
/** This event is sent to the previous Fl::focus() widget when another
* widget gets the focus or the window loses focus.
*/
FL_UNFOCUS = 7,
/** A key was pressed or released. The key can be found in Fl::event_key().
* The text that the key should insert can be found with Fl::event_text()
* and its length is in Fl::event_length(). If you use the key handle()
* should return 1. If you return zero then FLTK assumes you ignored the
* key and will then attempt to send it to a parent widget. If none of
* them want it, it will change the event into a FL_SHORTCUT event.
*
* To receive FL_KEYBOARD events you must also respond to the FL_FOCUS
* and FL_UNFOCUS events.
*
* If you are writing a text-editing widget you may also want to call
* the Fl::compose() function to translate individual keystrokes into
* foreign characters.
*
* FL_KEYUP events are sent to the widget that currently has focus. This
* is not necessarily the same widget that received the corresponding
* FL_KEYDOWN event because focus may have changed between events.
*/
FL_KEYDOWN = 8,
/** Equvalent to FL_KEYDOWN.
* \see FL_KEYDOWN
*/
FL_KEYBOARD = 8,
/** Key release event.
* \see FL_KEYDOWN
*/
FL_KEYUP = 9,
/** The user clicked the close button of a window.
* This event is used internally only to trigger the callback of
* Fl_Window derived classed. The default callback closes the
* window calling Fl_Window::hide().
*/
FL_CLOSE = 10,
/** The mouse has moved without any mouse buttons held down.
* This event is sent to the Fl::belowmouse() widget.
*
* In order to receive FL_MOVE events, the widget must return
* non-zero when handling FL_ENTER.
*/
FL_MOVE = 11,
/** If the Fl::focus() widget is zero or ignores an FL_KEYBOARD
* event then FLTK tries sending this event to every widget it
* can, until one of them returns non-zero. FL_SHORTCUT is first
* sent to the Fl::belowmouse() widget, then its parents and siblings,
* and eventually to every widget in the window, trying to find an
* object that returns non-zero. FLTK tries really hard to not to ignore
* any keystrokes!
*
* You can also make "global" shortcuts by using Fl::add_handler(). A
* global shortcut will work no matter what windows are displayed or
* which one has the focus.
*/
FL_SHORTCUT = 12,
/** This widget is no longer active, due to Fl_Widget::deactivate()
* being called on it or one of its parents. Fl_Widget::active() may
* still be true after this, the widget is only active if Fl_Widget::active()
* is true on it and all its parents (use Fl_Widget::active_r() to check this).
*/
FL_DEACTIVATE = 13,
/** This widget is now active, due to Fl_Widget::activate() being
* called on it or one of its parents.
*/
FL_ACTIVATE = 14,
/** This widget is no longer visible, due to Fl_Widget::hide() being
* called on it or one of its parents, or due to a parent window being
* minimized. Fl_Widget::visible() may still be true after this, but the
* widget is visible only if visible() is true for it and all its
* parents (use Fl_Widget::visible_r() to check this).
*/
FL_HIDE = 15,
/** This widget is visible again, due to Fl_Widget::show() being called on
* it or one of its parents, or due to a parent window being restored.
* Child Fl_Windows respond to this by actually creating the window if not
* done already, so if you subclass a window, be sure to pass FL_SHOW
* to the base class Fl_Widget::handle() method!
*/
FL_SHOW = 16,
/** You should get this event some time after you call Fl::paste().
* The contents of Fl::event_text() is the text to insert and the number
* of characters is in Fl::event_length().
*/
FL_PASTE = 17,
/** The Fl::selection_owner() will get this event before the selection is
* moved to another widget. This indicates that some other widget or program
* has claimed the selection. Motif programs used this to clear the selection
* indication. Most modern programs ignore this.
*/
FL_SELECTIONCLEAR = 18,
/** The user has moved the mouse wheel. The Fl::event_dx() and Fl::event_dy()
* methods can be used to find the amount to scroll horizontally and vertically.
*/
FL_MOUSEWHEEL = 19,
/** The mouse has been moved to point at this widget. A widget that is
* interested in receiving drag'n'drop data must return 1 to receive
* FL_DND_DRAG, FL_DND_LEAVE and FL_DND_RELEASE events.
*/
FL_DND_ENTER = 20,
/** The mouse has been moved inside a widget while dragging data. A
* widget that is interested in receiving drag'n'drop data should
* indicate the possible drop position.
*/
FL_DND_DRAG = 21,
/** The mouse has moved out of the widget.
*/
FL_DND_LEAVE = 22,
/** The user has released the mouse button dropping data into the widget.
* If the widget returns 1, it will receive the data in the immediately
* following FL_PASTE event.
*/
FL_DND_RELEASE = 23
};
#define FL_KEYBOARD FL_KEYDOWN
/** \name When Conditions */
/*@{*/
/** These constants determine when a callback is performed.
*
* \sa Fl_Widget::when();
* \todo doxygen comments for values are incomplete and maybe wrong or unclear
*/
enum Fl_When { // Fl_Widget::when():
FL_WHEN_NEVER = 0,
FL_WHEN_CHANGED = 1,
FL_WHEN_RELEASE = 4,
FL_WHEN_RELEASE_ALWAYS= 6,
FL_WHEN_ENTER_KEY = 8,
FL_WHEN_ENTER_KEY_ALWAYS=10,
FL_WHEN_ENTER_KEY_CHANGED=11,
FL_WHEN_NOT_CHANGED = 2 // modifier bit to disable changed() test
FL_WHEN_NEVER = 0, ///< Never call the callback
FL_WHEN_CHANGED = 1, ///< Do the callback only when the widget value changes
FL_WHEN_NOT_CHANGED = 2, ///< Do the callback whenever the user interacts with the widget
FL_WHEN_RELEASE = 4, ///< Do the callback when the button or key is released and the value changes
FL_WHEN_RELEASE_ALWAYS= 6, ///< Do the callback when the button or key is released, even if the value doesn't change
FL_WHEN_ENTER_KEY = 8, ///< Do the callback when the user presses the ENTER key and the value changes
FL_WHEN_ENTER_KEY_ALWAYS=10, ///< Do the callback when the user presses the ENTER key, even if the value doesn't change
FL_WHEN_ENTER_KEY_CHANGED=11 ///< ?
};
// Fl::event_key() and Fl::get_key(n) (use ascii letters for all other keys):
#define FL_Button 0xfee8 // use Fl_Button+FL_*_MOUSE
#define FL_BackSpace 0xff08
#define FL_Tab 0xff09
#define FL_Enter 0xff0d
#define FL_Pause 0xff13
#define FL_Scroll_Lock 0xff14
#define FL_Escape 0xff1b
#define FL_Home 0xff50
#define FL_Left 0xff51
#define FL_Up 0xff52
#define FL_Right 0xff53
#define FL_Down 0xff54
#define FL_Page_Up 0xff55
#define FL_Page_Down 0xff56
#define FL_End 0xff57
#define FL_Print 0xff61
#define FL_Insert 0xff63
#define FL_Menu 0xff67 // the "menu/apps" key on XFree86
#define FL_Help 0xff68 // the 'help' key on Mac keyboards
#define FL_Num_Lock 0xff7f
#define FL_KP 0xff80 // use FL_KP+'x' for 'x' on numeric keypad
#define FL_KP_Enter 0xff8d // same as Fl_KP+'\r'
#define FL_KP_Last 0xffbd // use to range-check keypad
#define FL_F 0xffbd // use FL_F+n for function key n
#define FL_F_Last 0xffe0 // use to range-check function keys
#define FL_Shift_L 0xffe1
#define FL_Shift_R 0xffe2
#define FL_Control_L 0xffe3
#define FL_Control_R 0xffe4
#define FL_Caps_Lock 0xffe5
#define FL_Meta_L 0xffe7 // the left MSWindows key on XFree86
#define FL_Meta_R 0xffe8 // the right MSWindows key on XFree86
#define FL_Alt_L 0xffe9
#define FL_Alt_R 0xffea
#define FL_Delete 0xffff
/*@}*/ // group: When Conditions
// Fl::event_button():
#define FL_LEFT_MOUSE 1
#define FL_MIDDLE_MOUSE 2
#define FL_RIGHT_MOUSE 3
/** \name Mouse and Keyboard Events
// Fl::event_state():
#define FL_SHIFT 0x00010000
#define FL_CAPS_LOCK 0x00020000
#define FL_CTRL 0x00040000
#define FL_ALT 0x00080000
#define FL_NUM_LOCK 0x00100000 // most X servers do this?
#define FL_META 0x00400000 // correct for XFree86
#define FL_SCROLL_LOCK 0x00800000 // correct for XFree86
#define FL_BUTTON1 0x01000000
#define FL_BUTTON2 0x02000000
#define FL_BUTTON3 0x04000000
#define FL_BUTTONS 0x7f000000 // All possible buttons
#define FL_BUTTON(n) (0x00800000<<(n))
This and the following constants define the non-ASCII keys on the
keyboard for FL_KEYBOARD and FL_SHORTCUT events.
\todo FL_Button and FL_key... constants could be structured better
(use an enum or some doxygen grouping ?)
\sa Fl::event_key() and Fl::get_key(int) (use ascii letters for all other keys):
*/
/*@{*/
#define FL_Button 0xfee8 ///< A mouse button; use Fl_Button + n for mouse button n.
#define FL_BackSpace 0xff08 ///< The backspace key.
#define FL_Tab 0xff09 ///< The tab key.
#define FL_Enter 0xff0d ///< The enter key.
#define FL_Pause 0xff13 ///< The pause key.
#define FL_Scroll_Lock 0xff14 ///< The scroll lock key.
#define FL_Escape 0xff1b ///< The escape key.
#define FL_Home 0xff50 ///< The home key.
#define FL_Left 0xff51 ///< The left arrow key.
#define FL_Up 0xff52 ///< The up arrow key.
#define FL_Right 0xff53 ///< The right arrow key.
#define FL_Down 0xff54 ///< The down arrow key.
#define FL_Page_Up 0xff55 ///< The page-up key.
#define FL_Page_Down 0xff56 ///< The page-down key.
#define FL_End 0xff57 ///< The end key.
#define FL_Print 0xff61 ///< The print (or print-screen) key.
#define FL_Insert 0xff63 ///< The insert key.
#define FL_Menu 0xff67 ///< The menu key.
#define FL_Help 0xff68 ///< The 'help' key on Mac keyboards
#define FL_Num_Lock 0xff7f ///< The num lock key.
#define FL_KP 0xff80 ///< One of the keypad numbers; use FL_KP + n for number n.
#define FL_KP_Enter 0xff8d ///< The enter key on the keypad, same as Fl_KP+'\\r'.
#define FL_KP_Last 0xffbd ///< The last keypad key; use to range-check keypad.
#define FL_F 0xffbd ///< One of the function keys; use FL_F + n for function key n.
#define FL_F_Last 0xffe0 ///< The last function key; use to range-check function keys.
#define FL_Shift_L 0xffe1 ///< The lefthand shift key.
#define FL_Shift_R 0xffe2 ///< The righthand shift key.
#define FL_Control_L 0xffe3 ///< The lefthand control key.
#define FL_Control_R 0xffe4 ///< The righthand control key.
#define FL_Caps_Lock 0xffe5 ///< The caps lock key.
#define FL_Meta_L 0xffe7 ///< The left meta/Windows key.
#define FL_Meta_R 0xffe8 ///< The right meta/Windows key.
#define FL_Alt_L 0xffe9 ///< The left alt key.
#define FL_Alt_R 0xffea ///< The right alt key.
#define FL_Delete 0xffff ///< The delete key.
/*@}*/ // group: Mouse and Keyboard Events
/** \name Mouse Buttons
These constants define the button numbers for FL_PUSH and FL_RELEASE events.
\sa Fl::event_button()
*/
/*@{*/
#define FL_LEFT_MOUSE 1 ///< The left mouse button
#define FL_MIDDLE_MOUSE 2 ///< The middle mouse button
#define FL_RIGHT_MOUSE 3 ///< The right mouse button
/*@}*/ // group: Mouse Buttons
/** \name Event States
The following constants define bits in the Fl::event_state() value.
*/
/*@{*/ // group: Event States
#define FL_SHIFT 0x00010000 ///< One of the shift keys is down
#define FL_CAPS_LOCK 0x00020000 ///< The caps lock is on
#define FL_CTRL 0x00040000 ///< One of the ctrl keys is down
#define FL_ALT 0x00080000 ///< One of the alt keys is down
#define FL_NUM_LOCK 0x00100000 ///< The num lock is on
// most X servers do this?
#define FL_META 0x00400000 ///< One of the meta/Windows keys is down
// correct for XFree86
#define FL_SCROLL_LOCK 0x00800000 ///< The scroll lock is on
// correct for XFree86
#define FL_BUTTON1 0x01000000 ///< Mouse button 1 is pushed
#define FL_BUTTON2 0x02000000 ///< Mouse button 2 is pushed
#define FL_BUTTON3 0x04000000 ///< Mouse button 3 is pushed
#define FL_BUTTONS 0x7f000000 ///< Any mouse button is pushed
#define FL_BUTTON(n) (0x00800000<<(n)) ///< Mouse button n (n > 0) is pushed
#ifdef __APPLE__
# define FL_COMMAND FL_META
# define FL_COMMAND FL_META ///< An alias for FL_CTRL on WIN32 and X11, or FL_META on MacOS X
#else
# define FL_COMMAND FL_CTRL
# define FL_COMMAND FL_CTRL ///< An alias for FL_CTRL on WIN32 and X11, or FL_META on MacOS X
#endif // __APPLE__
enum Fl_Boxtype { // boxtypes (if you change these you must fix fl_boxtype.C):
FL_NO_BOX = 0, FL_FLAT_BOX,
/*@}*/ // group: Event States
FL_UP_BOX, FL_DOWN_BOX,
FL_UP_FRAME, FL_DOWN_FRAME,
FL_THIN_UP_BOX, FL_THIN_DOWN_BOX,
FL_THIN_UP_FRAME, FL_THIN_DOWN_FRAME,
FL_ENGRAVED_BOX, FL_EMBOSSED_BOX,
FL_ENGRAVED_FRAME, FL_EMBOSSED_FRAME,
FL_BORDER_BOX, _FL_SHADOW_BOX,
FL_BORDER_FRAME, _FL_SHADOW_FRAME,
_FL_ROUNDED_BOX, _FL_RSHADOW_BOX,
_FL_ROUNDED_FRAME, _FL_RFLAT_BOX,
_FL_ROUND_UP_BOX, _FL_ROUND_DOWN_BOX,
_FL_DIAMOND_UP_BOX, _FL_DIAMOND_DOWN_BOX,
_FL_OVAL_BOX, _FL_OSHADOW_BOX,
_FL_OVAL_FRAME, _FL_OFLAT_BOX,
_FL_PLASTIC_UP_BOX, _FL_PLASTIC_DOWN_BOX,
_FL_PLASTIC_UP_FRAME, _FL_PLASTIC_DOWN_FRAME,
_FL_PLASTIC_THIN_UP_BOX, _FL_PLASTIC_THIN_DOWN_BOX,
_FL_PLASTIC_ROUND_UP_BOX, _FL_PLASTIC_ROUND_DOWN_BOX,
_FL_GTK_UP_BOX, _FL_GTK_DOWN_BOX,
_FL_GTK_UP_FRAME, _FL_GTK_DOWN_FRAME,
_FL_GTK_THIN_UP_BOX, _FL_GTK_THIN_DOWN_BOX,
_FL_GTK_THIN_UP_FRAME, _FL_GTK_THIN_DOWN_FRAME,
_FL_GTK_ROUND_UP_BOX, _FL_GTK_ROUND_DOWN_BOX,
FL_FREE_BOXTYPE
/** \name Box Types
\brief FLTK standard box types
This enum defines the standard box types included with FLTK.
FL_NO_BOX means nothing is drawn at all, so whatever is already
on the screen remains. The FL_..._FRAME types only draw their edges,
leaving the interior unchanged. The blue color in Figure 1
is the area that is not drawn by the frame types.
\image html boxtypes.gif "Figure 1: FLTK standard box types"
\image latex boxtypes.eps "FLTK standard box types" width=10cm
\todo Description of boxtypes is incomplete.
See below for the defined enum Fl_Boxtype.
\see src/Fl_get_system_colors.cxx
*/
/*@{*/
enum Fl_Boxtype { // boxtypes (if you change these you must fix fl_boxtype.C):
FL_NO_BOX = 0, ///< nothing is drawn at all, this box is invisible
FL_FLAT_BOX, ///< a flat box
FL_UP_BOX, ///< see figure 1
FL_DOWN_BOX, ///< see figure 1
FL_UP_FRAME, ///< see figure 1
FL_DOWN_FRAME, ///< see figure 1
FL_THIN_UP_BOX, ///< see figure 1
FL_THIN_DOWN_BOX, ///< see figure 1
FL_THIN_UP_FRAME, ///< see figure 1
FL_THIN_DOWN_FRAME, ///< see figure 1
FL_ENGRAVED_BOX, ///< see figure 1
FL_EMBOSSED_BOX, ///< see figure 1
FL_ENGRAVED_FRAME, ///< see figure 1
FL_EMBOSSED_FRAME, ///< see figure 1
FL_BORDER_BOX, ///< see figure 1
_FL_SHADOW_BOX, ///< see figure 1
FL_BORDER_FRAME, ///< see figure 1
_FL_SHADOW_FRAME, ///< see figure 1
_FL_ROUNDED_BOX, ///< see figure 1
_FL_RSHADOW_BOX, ///< see figure 1
_FL_ROUNDED_FRAME, ///< see figure 1
_FL_RFLAT_BOX, ///< see figure 1
_FL_ROUND_UP_BOX, ///< see figure 1
_FL_ROUND_DOWN_BOX, ///< see figure 1
_FL_DIAMOND_UP_BOX, ///< see figure 1
_FL_DIAMOND_DOWN_BOX, ///< see figure 1
_FL_OVAL_BOX, ///< see figure 1
_FL_OSHADOW_BOX, ///< see figure 1
_FL_OVAL_FRAME, ///< see figure 1
_FL_OFLAT_BOX, ///< see figure 1
_FL_PLASTIC_UP_BOX, ///< plastic version of FL_UP_BOX
_FL_PLASTIC_DOWN_BOX, ///< plastic version of FL_DOWN_BOX
_FL_PLASTIC_UP_FRAME, ///< plastic version of FL_UP_FRAME
_FL_PLASTIC_DOWN_FRAME, ///< plastic version of FL_DOWN_FRAME
_FL_PLASTIC_THIN_UP_BOX, ///< plastic version of FL_THIN_UP_BOX
_FL_PLASTIC_THIN_DOWN_BOX, ///< plastic version of FL_THIN_DOWN_BOX
_FL_PLASTIC_ROUND_UP_BOX, ///< plastic version of FL_ROUND_UP_BOX
_FL_PLASTIC_ROUND_DOWN_BOX, ///< plastic version of FL_ROUND_DOWN_BOX
_FL_GTK_UP_BOX, ///< gtk+ version of FL_UP_BOX
_FL_GTK_DOWN_BOX, ///< gtk+ version of FL_DOWN_BOX
_FL_GTK_UP_FRAME, ///< gtk+ version of FL_UP_FRAME
_FL_GTK_DOWN_FRAME, ///< gtk+ version of FL_DOWN_RAME
_FL_GTK_THIN_UP_BOX, ///< gtk+ version of FL_THIN_UP_BOX
_FL_GTK_THIN_DOWN_BOX, ///< gtk+ version of FL_THIN_DOWN_BOX
_FL_GTK_THIN_UP_FRAME, ///< gtk+ version of FL_UP_FRAME
_FL_GTK_THIN_DOWN_FRAME, ///< gtk+ version of FL_THIN_DOWN_FRAME
_FL_GTK_ROUND_UP_BOX, ///< gtk+ version of FL_ROUND_UP_BOX
_FL_GTK_ROUND_DOWN_BOX, ///< gtk+ version of FL_ROUND_DOWN_BOX
FL_FREE_BOXTYPE ///< the first free box type for creation of new box types
};
extern FL_EXPORT Fl_Boxtype fl_define_FL_ROUND_UP_BOX();
#define FL_ROUND_UP_BOX fl_define_FL_ROUND_UP_BOX()
@@ -229,34 +529,68 @@ extern FL_EXPORT Fl_Boxtype fl_define_FL_GTK_UP_BOX();
#define FL_GTK_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+9)
// conversions of box types to other boxtypes:
/**
Get the filled version of a frame.
If no filled version of a given frame exists, the behavior of this function
is undefined and some random box or frame is returned,
*/
inline Fl_Boxtype fl_box(Fl_Boxtype b) {
return (Fl_Boxtype)((b<FL_UP_BOX||b%4>1)?b:(b-2));
}
/**
Get the "pressed" or "down" version of a box.
If no "down" version of a given box exists, the behavior of this function
is undefined and some random box or frame is returned,
*/
inline Fl_Boxtype fl_down(Fl_Boxtype b) {
return (Fl_Boxtype)((b<FL_UP_BOX)?b:(b|1));
}
/**
Get the unfilled, frame only version of a box.
If no frame version of a given box exists, the behavior of this function
is undefined and some random box or frame is returned,
*/
inline Fl_Boxtype fl_frame(Fl_Boxtype b) {
return (Fl_Boxtype)((b%4<2)?b:(b+2));
}
// back-compatability box types:
// back-compatibility box types:
#define FL_FRAME FL_ENGRAVED_FRAME
#define FL_FRAME_BOX FL_ENGRAVED_BOX
#define FL_CIRCLE_BOX FL_ROUND_DOWN_BOX
#define FL_DIAMOND_BOX FL_DIAMOND_DOWN_BOX
enum Fl_Labeltype { // labeltypes:
FL_NORMAL_LABEL = 0,
FL_NO_LABEL,
_FL_SHADOW_LABEL,
_FL_ENGRAVED_LABEL,
_FL_EMBOSSED_LABEL,
_FL_MULTI_LABEL,
_FL_ICON_LABEL,
_FL_IMAGE_LABEL,
/*@}*/ // group: Box Types
FL_FREE_LABELTYPE
/**
The labeltype() method sets the type of the label.
The following standard label types are included:
\todo The doxygen comments are incomplete, and some labeltypes
are starting with an underscore. Also, there are three
external functions undocumented (yet):
- fl_define_FL_SHADOW_LABEL()
- fl_define_FL_ENGRAVED_LABEL()
- fl_define_FL_EMBOSSED_LABEL()
*/
enum Fl_Labeltype { // labeltypes:
FL_NORMAL_LABEL = 0, ///< draws the text (0)
FL_NO_LABEL, ///< does nothing
_FL_SHADOW_LABEL, ///< draws a drop shadow under the text
_FL_ENGRAVED_LABEL, ///< draws edges as though the text is engraved
_FL_EMBOSSED_LABEL, ///< draws edges as thought the text is raised
_FL_MULTI_LABEL, ///< ?
_FL_ICON_LABEL, ///< draws the icon associated with the text
_FL_IMAGE_LABEL, ///< ?
FL_FREE_LABELTYPE ///< first free labeltype to use for creating own labeltypes
};
/**
Sets the current label type end return its corresponding Fl_Labeltype value.
@{
*/
#define FL_SYMBOL_LABEL FL_NORMAL_LABEL
extern Fl_Labeltype FL_EXPORT fl_define_FL_SHADOW_LABEL();
#define FL_SHADOW_LABEL fl_define_FL_SHADOW_LABEL()
@@ -264,63 +598,119 @@ extern Fl_Labeltype FL_EXPORT fl_define_FL_ENGRAVED_LABEL();
#define FL_ENGRAVED_LABEL fl_define_FL_ENGRAVED_LABEL()
extern Fl_Labeltype FL_EXPORT fl_define_FL_EMBOSSED_LABEL();
#define FL_EMBOSSED_LABEL fl_define_FL_EMBOSSED_LABEL()
/** @} */
enum Fl_Align { // align() values
FL_ALIGN_CENTER = 0,
FL_ALIGN_TOP = 1,
FL_ALIGN_BOTTOM = 2,
FL_ALIGN_LEFT = 4,
FL_ALIGN_RIGHT = 8,
FL_ALIGN_INSIDE = 16,
FL_ALIGN_TEXT_OVER_IMAGE = 32,
FL_ALIGN_IMAGE_OVER_TEXT = 0,
FL_ALIGN_CLIP = 64,
FL_ALIGN_WRAP = 128,
FL_ALIGN_TOP_LEFT = FL_ALIGN_TOP | FL_ALIGN_LEFT,
FL_ALIGN_TOP_RIGHT = FL_ALIGN_TOP | FL_ALIGN_RIGHT,
FL_ALIGN_BOTTOM_LEFT = FL_ALIGN_BOTTOM | FL_ALIGN_LEFT,
FL_ALIGN_BOTTOM_RIGHT = FL_ALIGN_BOTTOM | FL_ALIGN_RIGHT,
FL_ALIGN_LEFT_TOP = FL_ALIGN_TOP_LEFT,
FL_ALIGN_RIGHT_TOP = FL_ALIGN_TOP_RIGHT,
FL_ALIGN_LEFT_BOTTOM = FL_ALIGN_BOTTOM_LEFT,
FL_ALIGN_RIGHT_BOTTOM = FL_ALIGN_BOTTOM_RIGHT,
FL_ALIGN_NOWRAP = 0 // for back compatability
};
/** \name Alignment Flags */
/*@{*/
/** Flags to control the label alignment.
* This controls how the label is displayed next to or inside the widget.
* The default value is FL_ALIGN_CENTER for most widgets, which centers the label
* inside the widget.
*
* Flags can be or'd to achieve a combination of alignments.
* \see #FL_ALIGN_CENTER, etc.
*/
typedef unsigned Fl_Align;
/** Align the label horizontally in the middle. */
const Fl_Align FL_ALIGN_CENTER = (Fl_Align)0;
/** Align the label at the top of the widget. Inside labels appear below the top,
* outside labels are drawn on top of the widget. */
const Fl_Align FL_ALIGN_TOP = (Fl_Align)1;
/** Align the label at the bottom of the widget. */
const Fl_Align FL_ALIGN_BOTTOM = (Fl_Align)2;
/** Align the label at the left of the widget. Inside labels appear left-justified
* starting at the left side of the widget, outside labels are right-justified and
* drawn to the left of the widget. */
const Fl_Align FL_ALIGN_LEFT = (Fl_Align)4;
/** Align the label to the right of the widget. */
const Fl_Align FL_ALIGN_RIGHT = (Fl_Align)8;
/** Draw the label inside of the widget. */
const Fl_Align FL_ALIGN_INSIDE = (Fl_Align)16;
/** If the label contains an image, draw the text on top of the image. */
const Fl_Align FL_ALIGN_TEXT_OVER_IMAGE = (Fl_Align)32;
/** If the label contains an image, draw the text below the image. */
const Fl_Align FL_ALIGN_IMAGE_OVER_TEXT = (Fl_Align)0;
/** All parts of the label that are lager than the widget will not be drawn . */
const Fl_Align FL_ALIGN_CLIP = (Fl_Align)64;
/** Wrap text that does not fit the width of the widget. */
const Fl_Align FL_ALIGN_WRAP = (Fl_Align)128;
const Fl_Align FL_ALIGN_TOP_LEFT = FL_ALIGN_TOP | FL_ALIGN_LEFT;
const Fl_Align FL_ALIGN_TOP_RIGHT = FL_ALIGN_TOP | FL_ALIGN_RIGHT;
const Fl_Align FL_ALIGN_BOTTOM_LEFT = FL_ALIGN_BOTTOM | FL_ALIGN_LEFT;
const Fl_Align FL_ALIGN_BOTTOM_RIGHT = FL_ALIGN_BOTTOM | FL_ALIGN_RIGHT;
const Fl_Align FL_ALIGN_LEFT_TOP = FL_ALIGN_TOP_LEFT;
const Fl_Align FL_ALIGN_RIGHT_TOP = FL_ALIGN_TOP_RIGHT;
const Fl_Align FL_ALIGN_LEFT_BOTTOM = FL_ALIGN_BOTTOM_LEFT;
const Fl_Align FL_ALIGN_RIGHT_BOTTOM = FL_ALIGN_BOTTOM_RIGHT;
const Fl_Align FL_ALIGN_NOWRAP = (Fl_Align)0; // for back compatability
/*@}*/
enum Fl_Font { // standard fonts
FL_HELVETICA = 0,
FL_HELVETICA_BOLD,
FL_HELVETICA_ITALIC,
FL_HELVETICA_BOLD_ITALIC,
FL_COURIER,
FL_COURIER_BOLD,
FL_COURIER_ITALIC,
FL_COURIER_BOLD_ITALIC,
FL_TIMES,
FL_TIMES_BOLD,
FL_TIMES_ITALIC,
FL_TIMES_BOLD_ITALIC,
FL_SYMBOL,
FL_SCREEN,
FL_SCREEN_BOLD,
FL_ZAPF_DINGBATS,
/** \name Font Numbers */
/*@{*/
/** A font number is an index into the internal font table.
FL_FREE_FONT = 16, // first one to allocate
FL_BOLD = 1, // add this to helvetica, courier, or times
FL_ITALIC = 2 // add this to helvetica, courier, or times
};
The following constants define the standard FLTK fonts:
extern FL_EXPORT int FL_NORMAL_SIZE;
*/
typedef int Fl_Font;
// standard fonts
const Fl_Font FL_HELVETICA = 0; ///< Helvetica (or Arial) normal (0)
const Fl_Font FL_HELVETICA_BOLD = 1; ///< Helvetica (or Arial) bold
const Fl_Font FL_HELVETICA_ITALIC = 2; ///< Helvetica (or Arial) oblique
const Fl_Font FL_HELVETICA_BOLD_ITALIC = 3; ///< Helvetica (or Arial) bold-oblique
const Fl_Font FL_COURIER = 4; ///< Courier normal
const Fl_Font FL_COURIER_BOLD = 5; ///< Courier bold
const Fl_Font FL_COURIER_ITALIC = 6; ///< Courier italic
const Fl_Font FL_COURIER_BOLD_ITALIC = 7; ///< Courier bold-italic
const Fl_Font FL_TIMES = 8; ///< Times roman
const Fl_Font FL_TIMES_BOLD = 9; ///< Times roman bold
const Fl_Font FL_TIMES_ITALIC = 10; ///< Times roman italic
const Fl_Font FL_TIMES_BOLD_ITALIC = 11; ///< Times roman bold-italic
const Fl_Font FL_SYMBOL = 12; ///< Standard symbol font
const Fl_Font FL_SCREEN = 13; ///< Default monospaced screen font
const Fl_Font FL_SCREEN_BOLD = 14; ///< Default monospaced bold screen font
const Fl_Font FL_ZAPF_DINGBATS = 15; ///< Zapf-dingbats font
const Fl_Font FL_FREE_FONT = 16; ///< first one to allocate
const Fl_Font FL_BOLD = 1; ///< add this to helvetica, courier, or times
const Fl_Font FL_ITALIC = 2; ///< add this to helvetica, courier, or times
const Fl_Font FL_BOLD_ITALIC = 3; ///< add this to helvetica, courier, or times
/*@}*/
/** Size of a font in pixels.
* This is the approximate height of a font in pixels.
*/
typedef int Fl_Fontsize;
extern FL_EXPORT Fl_Fontsize FL_NORMAL_SIZE; ///< normal font size
/** \name Colors */
/*@{*/
/** The Fl_Color enumeration type holds a FLTK color value.
Colors are either 8-bit indexes into a virtual colormap
or 24-bit RGB color values.
Color indices occupy the lower 8 bits of the value, while
RGB colors occupy the upper 24 bits, for a byte organization of RGBI.
\todo enum Fl_Color needs some more comments for values,
see Fl/Enumerations.H
*/
enum Fl_Color { // standard colors
// These are used as default colors in widgets and altered as necessary
FL_FOREGROUND_COLOR = 0,
FL_BACKGROUND2_COLOR = 7,
FL_INACTIVE_COLOR = 8,
FL_SELECTION_COLOR = 15,
FL_FOREGROUND_COLOR = 0, ///< the default foreground color (0) used for labels and text
FL_BACKGROUND2_COLOR = 7, ///< the default background color for text, list, and valuator widgets
FL_INACTIVE_COLOR = 8, ///< the inactive foreground color
FL_SELECTION_COLOR = 15, ///< the default selection/highlight color
// boxtypes generally limit themselves to these colors so
// the whole ramp is not allocated:
FL_GRAY0 = 32, // 'A'
FL_DARK3 = 39, // 'H'
FL_DARK2 = 45, // 'N'
@@ -331,6 +721,7 @@ enum Fl_Color { // standard colors
FL_LIGHT3 = 54, // 'W'
// FLTK provides a 5x8x5 color cube that is used with colormap visuals
FL_BLACK = 56,
FL_RED = 88,
FL_GREEN = 63,
@@ -364,10 +755,12 @@ FL_EXPORT Fl_Color fl_contrast(Fl_Color fg, Fl_Color bg);
FL_EXPORT Fl_Color fl_color_average(Fl_Color c1, Fl_Color c2, float weight);
inline Fl_Color fl_lighter(Fl_Color c) { return fl_color_average(c, FL_WHITE, .67f); }
inline Fl_Color fl_darker(Fl_Color c) { return fl_color_average(c, FL_BLACK, .67f); }
/** return 24-bit color value closest to \p r, \p g, \p b. */
inline Fl_Color fl_rgb_color(uchar r, uchar g, uchar b) {
if (!r && !g && !b) return FL_BLACK;
else return (Fl_Color)(((((r << 8) | g) << 8) | b) << 8);
}
/** return 24-bit color value closest to \p grayscale */
inline Fl_Color fl_rgb_color(uchar g) {
if (!g) return FL_BLACK;
else return (Fl_Color)(((((g << 8) | g) << 8) | g) << 8);
@@ -376,6 +769,18 @@ inline Fl_Color fl_gray_ramp(int i) {return (Fl_Color)(i+FL_GRAY_RAMP);}
inline Fl_Color fl_color_cube(int r, int g, int b) {
return (Fl_Color)((b*FL_NUM_RED + r) * FL_NUM_GREEN + g + FL_COLOR_CUBE);}
//*@}*/ // group: Colors
/** \name Cursors
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.
\todo enum Fl_Cursor needs some more comments for values
(and maybe an image), see Fl/Enumerations.H
*/
enum Fl_Cursor { // standard cursors
FL_CURSOR_DEFAULT = 0,
FL_CURSOR_ARROW = 35,
@@ -452,5 +857,5 @@ enum Fl_Damage {
#endif
//
// End of "$Id: Enumerations.H 6096 2008-04-12 04:18:58Z mike $".
// End of "$Id: Enumerations.H 6735 2009-04-01 22:11:57Z engelsman $".
//

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Adjuster.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Adjuster.H 6614 2009-01-01 16:11:32Z matt $"
//
// Adjuster widget header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Adjuster widget . */
// 3-button "slider", made for Nuke
#ifndef Fl_Adjuster_H
@@ -34,6 +37,18 @@
#include "Fl_Valuator.H"
#endif
/**
The Fl_Adjuster widget was stolen from Prisms, and has proven
to be very useful for values that need a large dynamic range.
\image html adjuster1.gif
\image latex adjuster1.eps "Fl_Adjuster" width=4cm
<P>When you press a button and drag to the right the value increases.
When you drag to the left it decreases. The largest button adjusts by
100 * step(), the next by 10 * step() and that
smallest button by step(). Clicking on the buttons
increments by 10 times the amount dragging by a pixel does. Shift +
click decrements by 10 times the amount.
*/
class FL_EXPORT Fl_Adjuster : public Fl_Valuator {
int drag;
int ix;
@@ -44,12 +59,24 @@ protected:
void value_damage();
public:
Fl_Adjuster(int X,int Y,int W,int H,const char *l=0);
/**
If "soft" is turned on, the user is allowed to drag the value outside
the range. If they drag the value to one of the ends, let go, then
grab again and continue to drag, they can get to any value. Default is
one.
*/
void soft(int s) {soft_ = s;}
/**
If "soft" is turned on, the user is allowed to drag the value outside
the range. If they drag the value to one of the ends, let go, then
grab again and continue to drag, they can get to any value. Default is
one.
*/
int soft() const {return soft_;}
};
#endif
//
// End of "$Id: Fl_Adjuster.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Adjuster.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Bitmap.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Bitmap.H 6614 2009-01-01 16:11:32Z matt $"
//
// Bitmap header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Bitmap widget . */
#ifndef Fl_Bitmap_H
#define Fl_Bitmap_H
# include "Fl_Image.H"
@@ -32,19 +35,28 @@
class Fl_Widget;
struct Fl_Menu_Item;
/**
The Fl_Bitmap class supports caching and drawing of mono-color
(bitmap) images. Images are drawn using the current color.
*/
class FL_EXPORT Fl_Bitmap : public Fl_Image {
public:
/** pointer to raw bitmap data */
const uchar *array;
int alloc_array; // Non-zero if data was allocated
/** Non-zero if array points to bitmap data allocated internally */
int alloc_array;
#if defined(__APPLE__) || defined(WIN32)
void *id; // for internal use
/** for internal use */
void *id;
#else
unsigned id; // for internal use
/** for internal use */
unsigned id;
#endif // __APPLE__ || WIN32
/** The constructors create a new bitmap from the specified bitmap data */
Fl_Bitmap(const uchar *bits, int W, int H) :
Fl_Image(W,H,0), array(bits), alloc_array(0), id(0) {data((const char **)&array, 1);}
/** The constructors create a new bitmap from the specified bitmap data */
Fl_Bitmap(const char *bits, int W, int H) :
Fl_Image(W,H,0), array((const uchar *)bits), alloc_array(0), id(0) {data((const char **)&array, 1);}
virtual ~Fl_Bitmap();
@@ -60,5 +72,5 @@ class FL_EXPORT Fl_Bitmap : public Fl_Image {
#endif
//
// End of "$Id: Fl_Bitmap.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Bitmap.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Box.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Box.H 6614 2009-01-01 16:11:32Z matt $"
//
// Box header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Box widget . */
#ifndef Fl_Box_H
#define Fl_Box_H
@@ -32,13 +35,28 @@
#include "Fl_Widget.H"
#endif
/**
This widget simply draws its box, and possibly it's label. Putting it
before some other widgets and making it big enough to surround them
will let you draw a frame around them.
*/
class FL_EXPORT Fl_Box : public Fl_Widget {
protected:
void draw();
public:
Fl_Box(int X, int Y, int W, int H, const char *l=0)
/**
- The first constructor sets box() to FL_NO_BOX, which
means it is invisible. However such widgets are useful as placeholders
or Fl_Group::resizable()
values. To change the box to something visible, use box(n).
- The second form of the constructor sets the box to the specified box
type.
<P>The destructor removes the box.
*/
Fl_Box(int X, int Y, int W, int H, const char *l=0)
: Fl_Widget(X,Y,W,H,l) {}
Fl_Box(Fl_Boxtype b, int X, int Y, int W, int H, const char *l)
/** See Fl_Box::Fl_Box(int x, int y, int w, int h, const char * = 0) */
Fl_Box(Fl_Boxtype b, int X, int Y, int W, int H, const char *l)
: Fl_Widget(X,Y,W,H,l) {box(b);}
virtual int handle(int);
@@ -47,5 +65,5 @@ public:
#endif
//
// End of "$Id: Fl_Box.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Box.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Browser.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Browser.H 6726 2009-03-27 16:52:31Z greg.ercolano $"
//
// Browser header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Browser widget . */
// Forms-compatable browser. Probably useful for other
// lists of textual data. Notice that the line numbers
// start from 1, and 0 means "no line".
@@ -36,6 +39,52 @@
struct FL_BLINE;
/**
The Fl_Browser widget displays a scrolling list of text
lines, and manages all the storage for the text. This is not a text
editor or spreadsheet! But it is useful for showing a vertical list of
named objects to the user.
Each line in the browser is identified by number. <I>The numbers
start at one</I> (this is so that zero can be reserved for "no line" in
the selective browsers). <I>Unless otherwise noted, the methods do not
check to see if the passed line number is in range and legal. It must
always be greater than zero and &lt;= size().</I>
Each line contains a null-terminated string of text and a void *
data pointer. The text string is displayed, the void *
pointer can be used by the callbacks to reference the object the text
describes.
The base class does nothing when the user clicks on it. The
subclasses
Fl_Select_Browser,
Fl_Hold_Browser, and
Fl_Multi_Browser react to user clicks to select lines in
the browser and do callbacks.
The base class
Fl_Browser_ provides the scrolling and selection mechanisms of
this and all the subclasses, but the dimensions and appearance of each
item are determined by the subclass. You can use Fl_Browser_
to display information other than text, or text that is dynamically
produced from your own data structures. If you find that loading the
browser is a lot of work or is inefficient, you may want to make a
subclass of Fl_Browser_.
Some common coding patterns used for working with Fl_Browser:
\code
// How to loop through all the items in the browser
for ( int t=1; t<=browser->size(); t++ ) { // index 1 based..!
printf("item #%d, label='%s'\n", t, browser->text(t));
}
\endcode
Note: If you are <I>subclassing</I> Fl_Browser, it's more efficient
to use the protected methods item_first() and item_next(), since
Fl_Browser internally uses linked lists to manage the browser's items.
For more info, see find_item(int).
*/
class FL_EXPORT Fl_Browser : public Fl_Browser_ {
FL_BLINE *first; // the array of lines
@@ -52,81 +101,218 @@ protected:
// required routines for Fl_Browser_ subclass:
void* item_first() const ;
void* item_next(void*) const ;
void* item_prev(void*) const ;
int item_selected(void*) const ;
void item_select(void*, int);
int item_height(void*) const ;
int item_width(void*) const ;
void item_draw(void*, int, int, int, int) const ;
void* item_next(void* item) const ;
void* item_prev(void* item) const ;
void* item_last()const ;
int item_selected(void* item) const ;
void item_select(void* item, int val);
int item_height(void* item) const ;
int item_width(void* item) const ;
void item_draw(void* item, int X, int Y, int W, int H) const ;
int full_height() const ;
int incr_height() const ;
const char *item_text(void *item) const;
/** Swap the items \p a and \p b.
You must call redraw() to make any changes visible.
\param[in] a,b the items to be swapped.
\see swap(int,int), item_swap()
*/
void item_swap(void *a, void *b) { swap((FL_BLINE*)a, (FL_BLINE*)b); }
/** Return the item at specified \p line.
\param[in] line The line of the item to return. (1 based)
\returns The item, or NULL if line out of range.
\see item_at(), find_line(), lineno()
*/
void *item_at(int line) const { return (void*)find_line(line); }
FL_BLINE* find_line(int) const ;
FL_BLINE* _remove(int) ;
void insert(int, FL_BLINE*);
int lineno(void*) const ;
FL_BLINE* find_line(int line) const ;
FL_BLINE* _remove(int line) ;
void insert(int line, FL_BLINE* item);
int lineno(void *item) const ;
void swap(FL_BLINE *a, FL_BLINE *b);
public:
void remove(int);
void add(const char*, void* = 0);
void insert(int, const char*, void* = 0);
void remove(int line);
void add(const char* newtext, void* d = 0);
void insert(int line, const char* newtext, void* d = 0);
void move(int to, int from);
int load(const char* filename);
void swap(int a, int b);
void clear();
int size() const {return lines;}
/**
Returns how many lines are in the browser.
The last line number is equal to this.
Returns 0 if browser is empty.
*/
int size() const { return lines; }
void size(int W, int H) { Fl_Widget::size(W, H); }
int topline() const ;
/** For internal use only? */
enum Fl_Line_Position { TOP, BOTTOM, MIDDLE };
void lineposition(int, Fl_Line_Position);
void topline(int l) { lineposition(l, TOP); }
void bottomline(int l) { lineposition(l, BOTTOM); }
void middleline(int l) { lineposition(l, MIDDLE); }
void lineposition(int line, Fl_Line_Position pos);
/**
Scrolls the browser so the top item in the browser
is showing the specified \p line.
\param[in] line The line to be displayed at the top.
\see topline(), middleline(), bottomline(), displayed(), lineposition()
*/
void topline(int line) { lineposition(line, TOP); }
/**
Scrolls the browser so the bottom item in the browser
is showing the specified \p line.
\param[in] line The line to be displayed at the bottom.
\see topline(), middleline(), bottomline(), displayed(), lineposition()
*/
void bottomline(int line) { lineposition(line, BOTTOM); }
/**
Scrolls the browser so the middle item in the browser
is showing the specified \p line.
\param[in] line The line to be displayed in the middle.
\see topline(), middleline(), bottomline(), displayed(), lineposition()
*/
void middleline(int line) { lineposition(line, MIDDLE); }
int select(int, int=1);
int selected(int) const ;
void show(int n);
void show() {Fl_Widget::show();}
void hide(int n);
void hide() {Fl_Widget::hide();}
int visible(int n) const ;
int select(int line, int val=1);
int selected(int line) const ;
void show(int line);
/** Shows the entire Fl_Browser widget -- opposite of hide(). */
void show() { Fl_Widget::show(); }
void hide(int line);
/** Hides the entire Fl_Browser widget -- opposite of show(). */
void hide() { Fl_Widget::hide(); }
int visible(int line) const ;
int value() const ;
void value(int v) {select(v);}
const char* text(int) const ;
void text(int, const char*);
void* data(int) const ;
void data(int, void* v);
/**
Sets the browser's value(), which selects the specified \p line.
This is the same as calling select(line).
\see select(), selected(), value(), item_select(), item_selected()
*/
void value(int line) { select(line); }
const char* text(int line) const ;
void text(int line, const char* newtext);
void* data(int line) const ;
void data(int line, void* d);
Fl_Browser(int, int, int, int, const char* = 0);
Fl_Browser(int X, int Y, int W, int H, const char *L = 0);
/**
The destructor deletes all list items and destroys the browser.
*/
~Fl_Browser() { clear(); }
char format_char() const {return format_char_;}
void format_char(char c) {format_char_ = c;}
char column_char() const {return column_char_;}
void column_char(char c) {column_char_ = c;}
const int* column_widths() const {return column_widths_;}
void column_widths(const int* l) {column_widths_ = l;}
/**
Gets the current format code prefix character, which by default is '\@'.
A string of formatting codes at the start of each column are stripped off
and used to modify how the rest of the line is printed:
\li <tt>'\@.'</tt> Print rest of line, don't look for more '\@' signs
\li <tt>'\@\@'</tt> Print rest of line starting with '\@'
\li <tt>'\@l'</tt> Use a LARGE (24 point) font
\li <tt>'\@m'</tt> Use a medium large (18 point) font
\li <tt>'\@s'</tt> Use a <SMALL>small</SMALL> (11 point) font
\li <tt>'\@b'</tt> Use a <B>bold</B> font (adds FL_BOLD to font)
\li <tt>'\@i'</tt> Use an <I>italic</I> font (adds FL_ITALIC to font)
\li <tt>'\@f' or '\@t'</tt> Use a fixed-pitch
font (sets font to FL_COURIER)
\li <tt>'\@c'</tt> Center the line horizontally
\li <tt>'\@r'</tt> Right-justify the text
\li <tt>'\@B0', '\@B1', ... '\@B255'</tt> Fill the backgound with
fl_color(n)
\li <tt>'\@C0', '\@C1', ... '\@C255'</tt> Use fl_color(n) to draw the text
\li <tt>'\@F0', '\@F1', ...</tt> Use fl_font(n) to draw the text
\li <tt>'\@S1', '\@S2', ...</tt> Use point size n to draw the text
\li <tt>'\@u' or '\@_'</tt> Underline the text.
\li <tt>'\@-'</tt> draw an engraved line through the middle.
int displayed(int n) const {return Fl_Browser_::displayed(find_line(n));}
void make_visible(int n) {
if (n < 1) Fl_Browser_::display(find_line(1));
else if (n > lines) Fl_Browser_::display(find_line(lines));
else Fl_Browser_::display(find_line(n));
Notice that the '\@.' command can be used to reliably
terminate the parsing. To print a random string in a random color, use
<tt>sprintf("@C%d@.%s", color, string)</tt> and it will work even if the
string starts with a digit or has the format character in it.
*/
char format_char() const { return format_char_; }
/**
Sets the current format code prefix character to \p c.
The default prefix is '\@'. Set the prefix to 0 to disable formatting.
\see format_char() for list of '\@' codes
*/
void format_char(char c) { format_char_ = c; }
/**
Gets the current column separator character.
The default is '\\t' (tab).
\see column_char(), column_widths()
*/
char column_char() const { return column_char_; }
/**
Sets the column separator to c.
This will only have an effect if you also set column_widths().
The default is '\\t' (tab).
\see column_char(), column_widths()
*/
void column_char(char c) { column_char_ = c; }
/**
Gets the current column width array.
This array is zero-terminated and specifies the widths in pixels of
each column. The text is split at each column_char() and each part is
formatted into it's own column. After the last column any remaining
text is formatted into the space between the last column and the
right edge of the browser, even if the text contains instances of
column_char() . The default value is a one-element array of just
a zero, which means there are no columns.
Example:
\code
Fl_Browser *b = new Fl_Browser(..);
int widths[] = { 50, 50, 50, 70, 70, 40, 40, 70, 70, 50, 0 }; // widths for each column
b->column_widths(widths); // assign array to widget
b->column_char('\t'); // use tab as the column character
b->add("USER\tPID\tCPU\tMEM\tVSZ\tRSS\tTTY\tSTAT\tSTART\tTIME\tCOMMAND");
b->add("root\t2888\t0.0\t0.0\t1352\t0\ttty3\tSW\tAug15\t0:00\t@b@f/sbin/mingetty tty3");
b->add("root\t13115\t0.0\t0.0\t1352\t0\ttty2\tSW\tAug30\t0:00\t@b@f/sbin/mingetty tty2");
[..]
\endcode
\see column_char(), column_widths()
*/
const int* column_widths() const { return column_widths_; }
/**
Sets the current array to \p arr. Make sure the last entry is zero.
\see column_char(), column_widths()
*/
void column_widths(const int* arr) { column_widths_ = arr; }
/**
Returns non-zero if \p line has been scrolled to a position where it is being displayed.
Checks to see if the item's vertical position is within the top and bottom
edges of the display window. This does NOT take into account the hide()/show()
status of the widget or item.
\param[in] line The line to be checked
\returns 1 if visible, 0 if not visible.
\see topline(), middleline(), bottomline(), displayed(), lineposition()
*/
int displayed(int line) const { return Fl_Browser_::displayed(find_line(line)); }
/**
Make the item at the specified \p line visible().
Functionally similar to show(int line).
If \p line is out of range, redisplay top or bottom of list as appropriate.
\param[in] line The line to be made visible.
\see show(int), hide(int), display(), visible(), make_visible()
*/
void make_visible(int line) {
if (line < 1) Fl_Browser_::display(find_line(1));
else if (line > lines) Fl_Browser_::display(find_line(lines));
else Fl_Browser_::display(find_line(line));
}
// for back compatability only:
void replace(int a, const char* b) {text(a, b);}
void display(int, int=1);
/** For back compatibility only. */
void replace(int a, const char* b) { text(a, b); }
void display(int line, int val=1);
};
#endif
//
// End of "$Id: Fl_Browser.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Browser.H 6726 2009-03-27 16:52:31Z greg.ercolano $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Browser_.H 4879 2006-03-28 23:27:20Z matt $"
// "$Id: Fl_Browser_.H 6737 2009-04-02 06:44:34Z greg.ercolano $"
//
// Common browser header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,10 +25,8 @@
// http://www.fltk.org/str.php
//
// This is the base class for browsers. To be useful it must
// be subclassed and several virtual functions defined. The
// Forms-compatable browser and the file chooser's browser are
// subclassed off of this.
/* \file
Fl_Browser_ widget . */
// Yes, I know this should be a template...
@@ -39,12 +37,33 @@
#include "Fl_Group.H"
#endif
#include "Fl_Scrollbar.H"
#include <FL/Fl.H> // Fl::scrollbar_size()
#define FL_NORMAL_BROWSER 0
#define FL_SELECT_BROWSER 1
#define FL_HOLD_BROWSER 2
#define FL_MULTI_BROWSER 3
#define FL_NORMAL_BROWSER 0 /**< type() of Fl_Browser */
#define FL_SELECT_BROWSER 1 /**< type() of FL_Select_Browser */
#define FL_HOLD_BROWSER 2 /**< type() of Fl_Hold_Browser */
#define FL_MULTI_BROWSER 3 /**< type() of Fl_Multi_Browser */
#define FL_SORT_ASCENDING 0 /**< sort browser items in ascending alphabetic order. */
#define FL_SORT_DESCENDING 1 /**< sort in descending order */
/**
This is the base class for browsers. To be useful it must be
subclassed and several virtual functions defined. The Forms-compatible
browser and the file chooser's browser are subclassed off of this.
This has been designed so that the subclass has complete control
over the storage of the data, although because next() and
prev() functions are used to index, it works best as a linked list
or as a large block of characters in which the line breaks must be
searched for.
A great deal of work has been done so that the "height" of a data
object does not need to be determined until it is drawn. This is
useful if actually figuring out the size of an object requires
accessing image data or doing stat() on a file or doing some
other slow operation.
*/
class FL_EXPORT Fl_Browser_ : public Fl_Group {
int position_; // where user wants it scrolled to
int real_position_; // the current vertical scrolling position
@@ -53,102 +72,307 @@ class FL_EXPORT Fl_Browser_ : public Fl_Group {
int offset_; // how far down top_ item the real_position is
int max_width; // widest object seen so far
uchar has_scrollbar_; // which scrollbars are enabled
uchar textfont_, textsize_;
Fl_Font textfont_;
Fl_Fontsize textsize_;
unsigned textcolor_;
void* top_; // which item scrolling position is in
void* selection_; // which is selected (except for FL_MULTI_BROWSER)
void *redraw1,*redraw2; // minimal update pointers
void* max_width_item; // which item has max_width_
static int scrollbar_width_;
int scrollbar_size_; // size of scrollbar trough
void update_top();
protected:
// All of the following must be supplied by the subclass:
/**
This method must be provided by the subclass
to return the first item in the list.
\see item_first(), item_next(), item_last(), item_prev()
*/
virtual void *item_first() const = 0;
virtual void *item_next(void *) const = 0;
virtual void *item_prev(void *) const = 0;
virtual int item_height(void *) const = 0;
virtual int item_width(void *) const = 0;
virtual int item_quick_height(void *) const ;
virtual void item_draw(void *,int,int,int,int) const = 0;
/**
This method must be provided by the subclass
to return the item in the list after \p item.
\see item_first(), item_next(), item_last(), item_prev()
*/
virtual void *item_next(void *item) const = 0;
/**
This method must be provided by the subclass
to return the item in the list before \p item.
\see item_first(), item_next(), item_last(), item_prev()
*/
virtual void *item_prev(void *item) const = 0;
/**
This method must be provided by the subclass
to return the last item in the list.
\see item_first(), item_next(), item_last(), item_prev()
*/
virtual void *item_last() const { return 0L; }
/**
This method must be provided by the subclass to return
the height of \p item in pixels.
Allow for two additional pixels for the list selection box.
\param[in] item The item whose height is returned.
\returns The height of the specified \p item in pixels.
\see item_height(), item_width(), item_quick_height()
*/
virtual int item_height(void *item) const = 0;
/**
This method must be provided by the subclass to return the width of the
\p item in pixels. Allow for two additional pixels for the list
selection box.
\param[in] item The item whose width is returned.
\returns The width of the item in pixels.
*/
virtual int item_width(void *item) const = 0;
virtual int item_quick_height(void *item) const ;
/**
This method must be provided by the subclass to draw the \p item
in the area indicated by \p X, \p Y, \p W, \p H.
*/
virtual void item_draw(void *item,int X,int Y,int W,int H) const = 0;
/**
This optional method returns a string (label) that may be used for sorting.
\param[in] item The item whose label text is returned.
\returns The item's text label. (Can be NULL if blank)
*/
virtual const char *item_text(void *item) const { return 0L; }
/**
This optional method should be provided by the subclass
to efficiently swap browser items \p a and \p b, such as for sorting.
\param[in] a,b The two items to be swapped.
*/
virtual void item_swap(void *a,void *b) { }
/**
This method must be provided by the subclass
to return the item for the specified \p index.
\param[in] index The \p index of the item to be returned
\returns The item at the specified \p index.
*/
virtual void *item_at(int index) const { return 0L; }
// you don't have to provide these but it may help speed it up:
virtual int full_width() const ; // current width of all items
virtual int full_height() const ; // current height of all items
virtual int incr_height() const ; // average height of an item
// These only need to be done by subclass if you want a multi-browser:
virtual void item_select(void *,int=1);
virtual int item_selected(void *) const ;
virtual void item_select(void *item,int val=1);
virtual int item_selected(void *item) const ;
// things the subclass may want to call:
void *top() const {return top_;}
void *selection() const {return selection_;}
/**
Returns the item that appears at the top of the list.
*/
void *top() const { return top_; }
/**
Returns the item currently selected, or NULL if there is no selection.
For multiple selection browsers this call returns the currently focused item,
even if it is not selected. To find all selected items, call
Fl_Multi_Browser::selected() for every item in question.
*/
void *selection() const { return selection_; }
void new_list(); // completely clobber all data, as though list replaced
void deleting(void *a); // get rid of any pointers to a
void deleting(void *item); // get rid of any pointers to item
void replacing(void *a,void *b); // change a pointers to b
void swapping(void *a,void *b); // exchange pointers a and b
void inserting(void *a,void *b); // insert b near a
int displayed(void *) const ; // true if this line is visible
void redraw_line(void *); // minimal update, no change in size
void redraw_lines() {damage(FL_DAMAGE_SCROLL);} // redraw all of them
void bbox(int&,int&,int&,int&) const;
int displayed(void *item) const ; // true if this item is visible
void redraw_line(void *item); // minimal update, no change in size
/**
This method will cause the entire list to be redrawn.
\see redraw_lines(), redraw_line()
*/
void redraw_lines() { damage(FL_DAMAGE_SCROLL); } // redraw all of them
void bbox(int &X,int &Y,int &W,int &H) const;
int leftedge() const; // x position after scrollbar & border
void *find_item(int my); // item under mouse
void draw(int,int,int,int);
int handle(int,int,int,int,int);
void *find_item(int ypos); // item under mouse
void draw();
Fl_Browser_(int,int,int,int,const char * = 0);
Fl_Browser_(int X,int Y,int W,int H,const char *L=0);
public:
Fl_Scrollbar scrollbar; // Vertical scrollbar
Fl_Scrollbar hscrollbar; // Horizontal scrollbar
/**
Vertical scrollbar. Public, so that it can be accessed directly.
*/
Fl_Scrollbar scrollbar;
/**
Horizontal scrollbar. Public, so that it can be accessed directly.
*/
Fl_Scrollbar hscrollbar;
int handle(int);
void resize(int,int,int,int);
int handle(int event);
void resize(int X,int Y,int W,int H);
int select(void *,int=1,int docallbacks=0);
int select_only(void *,int docallbacks=0);
int select(void *item,int val=1,int docallbacks=0);
int select_only(void *item,int docallbacks=0);
int deselect(int docallbacks=0);
int position() const {return position_;}
int hposition() const {return hposition_;}
void position(int); // scroll to here
/**
Gets the vertical scroll position of the list as a pixel position \p pos.
The position returned is how many pixels of the list are scrolled off the top edge
of the screen. Example: A position of '3' indicates the top 3 pixels of
the list are scrolled off the top edge of the screen.
\see position(), hposition()
*/
int position() const { return position_; }
void position(int pos); // scroll to here
/**
Gets the horizontal scroll position of the list as a pixel position \p pos.
The position returned is how many pixels of the list are scrolled off the left edge
of the screen. Example: A position of '18' indicates the left 18 pixels of
the list are scrolled off the left edge of the screen.
\see position(), hposition()
*/
int hposition() const { return hposition_; }
void hposition(int); // pan to here
void display(void*); // scroll so this item is shown
void display(void *item); // scroll so this item is shown
uchar has_scrollbar() const {return has_scrollbar_;}
void has_scrollbar(uchar i) {has_scrollbar_ = i;}
/**
Values for has_scrollbar().
*/
/** Anonymous enum bit flags for has_scrollbar().
- bit 0: horizontal
- bit 1: vertical
- bit 2: 'always' (to be combined with bits 0 and 1)
- bit 3-31: reserved for future use
*/
enum { // values for has_scrollbar()
HORIZONTAL = 1,
VERTICAL = 2,
BOTH = 3,
ALWAYS_ON = 4,
HORIZONTAL_ALWAYS = 5,
VERTICAL_ALWAYS = 6,
BOTH_ALWAYS = 7
HORIZONTAL = 1, ///< Only show horizontal scrollbar.
VERTICAL = 2, ///< Only show vertical scrollbar.
BOTH = 3, ///< Show both scrollbars. (default)
ALWAYS_ON = 4, ///< Specified scrollbar(s) should 'always' be shown (to be used with HORIZONTAL/VERTICAL)
HORIZONTAL_ALWAYS = 5, ///< Horizontal scrollbar always on.
VERTICAL_ALWAYS = 6, ///< Vertical scrollbar always on.
BOTH_ALWAYS = 7 ///< Both scrollbars always on.
};
/**
Returns the current scrollbar mode, see Fl_Browser_::has_scrollbar(uchar)
*/
uchar has_scrollbar() const { return has_scrollbar_; }
/**
Sets whether the widget should have scrollbars or not (default Fl_Browser_::BOTH).
By default you can scroll in both directions, and the scrollbars
disappear if the data will fit in the widget.
has_scrollbar() changes this based on the value of \p mode:
- 0 - No scrollbars.
Fl_Font textfont() const {return (Fl_Font)textfont_;}
void textfont(uchar s) {textfont_ = s;}
uchar textsize() const {return textsize_;}
void textsize(uchar s) {textsize_ = s;}
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
void textcolor(unsigned n) {textcolor_ = n;}
- Fl_Browser_::HORIZONTAL - Only a horizontal scrollbar.
static void scrollbar_width(int b) {scrollbar_width_ = b;}
static int scrollbar_width() {return scrollbar_width_;}
- Fl_Browser_::VERTICAL - Only a vertical scrollbar.
// for back compatability:
void scrollbar_right() {scrollbar.align(FL_ALIGN_RIGHT);}
void scrollbar_left() {scrollbar.align(FL_ALIGN_LEFT);}
- Fl_Browser_::BOTH - The default is both scrollbars.
- Fl_Browser_::HORIZONTAL_ALWAYS - Horizontal scrollbar always on,
vertical always off.
- Fl_Browser_::VERTICAL_ALWAYS - Vertical scrollbar always on,
horizontal always off.
- Fl_Browser_::BOTH_ALWAYS - Both always on.
*/
void has_scrollbar(uchar mode) { has_scrollbar_ = mode; }
/**
Gets the default text font for the lines in the browser.
\see textfont(), textsize(), textcolor()
*/
Fl_Font textfont() const { return textfont_; }
/**
Sets the default text font for the lines in the browser to \p font.
*/
void textfont(Fl_Font font) { textfont_ = font; }
/**
Gets the default text size (in pixels) for the lines in the browser.
*/
Fl_Fontsize textsize() const { return textsize_; }
/**
Sets the default text size (in pixels) for the lines in the browser to \p size.
*/
void textsize(Fl_Fontsize size) { textsize_ = size; }
/**
Gets the default text color for the lines in the browser.
*/
Fl_Color textcolor() const { return (Fl_Color)textcolor_; }
/**
Sets the default text color for the lines in the browser to color \p col.
*/
void textcolor(unsigned col) { textcolor_ = col; }
/**
Gets the current size of the scrollbars' troughs, in pixels.
If this value is zero (default), this widget will use the
Fl::scrollbar_size() value as the scrollbar's width.
\returns Scrollbar size in pixels, or 0 if the global Fl::scrollsize() is being used.
\see Fl::scrollbar_size(int)
*/
int scrollbar_size() const {
return(scrollbar_size_);
}
/**
Sets the pixel size of the scrollbars' troughs to the \p size, in pixels.
Normally you should not need this method, and should use
Fl::scrollbar_size(int) instead to manage the size of ALL
your widgets' scrollbars. This ensures your application
has a consistent UI, is the default behavior, and is normally
what you want.
Only use THIS method if you really need to override the global
scrollbar size. The need for this should be rare.
Setting \p size to the special value of 0 causes the widget to
track the global Fl::scrollbar_size(), which is the default.
\param[in] size Sets the scrollbar size in pixels.\n
If 0 (default), scrollbar size tracks the global Fl::scrollbar_size()
\see Fl::scrollbar_size()
*/
void scrollbar_size(int size) {
scrollbar_size_ = size;
}
/**
This method has been deprecated, existing for backwards compatibility only.
Use scrollbar_size() instead.
This method always returns the global value Fl::scrollbar_size().
\returns Always returns the global value Fl::scrollbar_size().
\todo This method should eventually be removed in 1.4+
*/
int scrollbar_width() const {
return(Fl::scrollbar_size());
}
/**
This method has been deprecated, existing for backwards compatibility only.
Use scrollbar_size(int) instead.
This method sets the global Fl::scrollbar_size(), and forces this
instance of the widget to use it.
\todo This method should eventually be removed in 1.4+
*/
void scrollbar_width(int width) {
Fl::scrollbar_size(width);
scrollbar_size_ = 0;
}
/**
Moves the vertical scrollbar to the righthand side of the list.
For back compatibility.
*/
void scrollbar_right() { scrollbar.align(FL_ALIGN_RIGHT); }
/**
Moves the vertical scrollbar to the lefthand side of the list.
For back compatibility.
*/
void scrollbar_left() { scrollbar.align(FL_ALIGN_LEFT); }
void sort(int flags=0);
};
#endif
//
// End of "$Id: Fl_Browser_.H 4879 2006-03-28 23:27:20Z matt $".
// End of "$Id: Fl_Browser_.H 6737 2009-04-02 06:44:34Z greg.ercolano $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Button.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Button.H 6614 2009-01-01 16:11:32Z matt $"
//
// Button header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Button widget . */
#ifndef Fl_Button_H
#define Fl_Button_H
@@ -33,13 +36,51 @@
#endif
// values for type()
#define FL_NORMAL_BUTTON 0
#define FL_TOGGLE_BUTTON 1
#define FL_RADIO_BUTTON (FL_RESERVED_TYPE+2)
#define FL_HIDDEN_BUTTON 3 // for Forms compatability
#define FL_NORMAL_BUTTON 0 /**< value() will be set to 1 during the press of the button and
reverts back to 0 when the button is released */
#define FL_TOGGLE_BUTTON 1 ///< value() toggles between 0 and 1 at every click of the button
#define FL_RADIO_BUTTON (FL_RESERVED_TYPE+2) /**< is set to 1 at button press, and all other
buttons in the same group with <tt>type() == FL_RADIO_BUTTON</tt>
are set to zero.*/
#define FL_HIDDEN_BUTTON 3 ///< for Forms compatibility
#ifndef FL_DOXYGEN
extern FL_EXPORT int fl_old_shortcut(const char*);
#endif
/**
\class Fl_Button
\brief Buttons generate callbacks when they are clicked by the user.
You control exactly when and how by changing the values for type() and
when(). Buttons can also generate callbacks in response to \c FL_SHORTCUT
events. The button can either have an explicit shortcut(int s) value or a
letter shortcut can be indicated in the label() with an '\&' character
before it. For the label shortcut it does not matter if \e Alt is held
down, but if you have an input field in the same window, the user will have
to hold down the \e Alt key so that the input field does not eat the event
first as an \c FL_KEYBOARD event.
\todo Refactor the doxygen comments for Fl_Button type() documentation.
For an Fl_Button object, the type() call returns one of:
\li \c FL_NORMAL_BUTTON (0): value() remains unchanged after button press.
\li \c FL_TOGGLE_BUTTON: value() is inverted after button press.
\li \c FL_RADIO_BUTTON: value() is set to 1 after button press, and all other
buttons in the current group with <tt>type() == FL_RADIO_BUTTON</tt>
are set to zero.
\todo Refactor the doxygen comments for Fl_Button when() documentation.
For an Fl_Button object, the following when() values are useful, the default
being \c FL_WHEN_RELEASE:
\li \c 0: The callback is not done, instead changed() is turned on.
\li \c FL_WHEN_RELEASE: The callback is done after the user successfully
clicks the button, or when a shortcut is typed.
\li \c FL_WHEN_CHANGED: The callback is done each time the value() changes
(when the user pushes and releases the button, and as the mouse is
dragged around in and out of the button).
*/
class FL_EXPORT Fl_Button : public Fl_Widget {
int shortcut_;
@@ -54,25 +95,82 @@ protected:
public:
virtual int handle(int);
Fl_Button(int,int,int,int,const char * = 0);
int value(int);
Fl_Button(int X, int Y, int W, int H, const char *L = 0);
int value(int v);
/**
Returns the current value of the button (0 or 1).
*/
char value() const {return value_;}
/**
Same as \c value(1).
\see value(int v)
*/
int set() {return value(1);}
/**
Same as \c value(0).
\see value(int v)
*/
int clear() {return value(0);}
void setonly(); // this should only be called on FL_RADIO_BUTTONs
/**
Returns the current shortcut key for the button.
\retval int
*/
int shortcut() const {return shortcut_;}
/**
Sets the shortcut key to \c s.
Setting this overrides the use of '\&' in the label().
The value is a bitwise OR of a key and a set of shift flags, for example:
<tt>FL_ALT | 'a'</tt>, or
<tt>FL_ALT | (FL_F + 10)</tt>, or just
<tt>'a'</tt>.
A value of 0 disables the shortcut.
The key can be any value returned by Fl::event_key(), but will usually be
an ASCII letter. Use a lower-case letter unless you require the shift key
to be held down.
The shift flags can be any set of values accepted by Fl::event_state().
If the bit is on, that shift key must be pushed. Meta, Alt, Ctrl, and
Shift must be off if they are not in the shift flags (zero for the other
bits indicates a "don't care" setting).
\param[in] s bitwise OR of key and shift flags
*/
void shortcut(int s) {shortcut_ = s;}
/**
Returns the current down box type, which is drawn when value() is non-zero.
\retval Fl_Boxtype
*/
Fl_Boxtype down_box() const {return (Fl_Boxtype)down_box_;}
/**
Sets the down box type. The default value of 0 causes FLTK to figure out
the correct matching down version of box().
\param[in] b down box type
*/
void down_box(Fl_Boxtype b) {down_box_ = b;}
// back compatability:
/// (for backwards compatibility)
void shortcut(const char *s) {shortcut(fl_old_shortcut(s));}
/// (for backwards compatibility)
Fl_Color down_color() const {return selection_color();}
/// (for backwards compatibility)
void down_color(unsigned c) {selection_color(c);}
};
#endif
//
// End of "$Id: Fl_Button.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Button.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Chart.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Chart.H 6614 2009-01-01 16:11:32Z matt $"
//
// Forms chart header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Chart widget . */
#ifndef Fl_Chart_H
#define Fl_Chart_H
@@ -33,25 +36,48 @@
#endif
// values for type()
#define FL_BAR_CHART 0
#define FL_HORBAR_CHART 1
#define FL_LINE_CHART 2
#define FL_FILL_CHART 3
#define FL_SPIKE_CHART 4
#define FL_PIE_CHART 5
#define FL_SPECIALPIE_CHART 6
#define FL_BAR_CHART 0 /**< type() for Bar Chart variant */
#define FL_HORBAR_CHART 1 /**< type() for Horizontal Bar Chart variant */
#define FL_LINE_CHART 2 /**< type() for Line Chart variant */
#define FL_FILL_CHART 3 /**< type() for Fill Line Chart variant */
#define FL_SPIKE_CHART 4 /**< type() for Spike Chart variant */
#define FL_PIE_CHART 5 /**< type() for Pie Chart variant */
#define FL_SPECIALPIE_CHART 6 /**< type() for Special Pie Chart variant */
#define FL_FILLED_CHART FL_FILL_CHART // compatibility
#define FL_FILLED_CHART FL_FILL_CHART /**< for compatibility */
#define FL_CHART_MAX 128
#define FL_CHART_LABEL_MAX 18
#define FL_CHART_MAX 128 /**< max entries per chart */
#define FL_CHART_LABEL_MAX 18 /**< max label length for entry */
/** For internal use only */
struct FL_CHART_ENTRY {
float val;
unsigned col;
char str[FL_CHART_LABEL_MAX+1];
float val; /**< For internal use only. */
unsigned col; /**< For internal use only. */
char str[FL_CHART_LABEL_MAX+1]; /**< For internal use only. */
};
/**
\class Fl_Chart
\brief Fl_Chart displays simple charts.
It is provided for Forms compatibility.
\image html charts.gif
\image latex charts.eps "Fl_Chart" width=10cm
\todo Refactor Fl_Chart::type() information.
The type of an Fl_Chart object can be set using type(uchar t) to:
\li \c FL_BAR_CHART: Each sample value is drawn as a vertical bar.
\li \c FL_FILLED_CHART: The chart is filled from the bottom of the graph
to the sample values.
\li \c FL_HORBAR_CHART: Each sample value is drawn as a horizontal bar.
\li \c FL_LINE_CHART: The chart is drawn as a polyline with vertices at
each sample value.
\li \c FL_PIE_CHART: A pie chart is drawn with each sample value being
drawn as a proportionate slice in the circle.
\li \c FL_SPECIALPIE_CHART: Like \c FL_PIE_CHART, but the first slice is
separated from the pie.
\li \c FL_SPIKE_CHART: Each sample value is drawn as a vertical line.
*/
class FL_EXPORT Fl_Chart : public Fl_Widget {
int numb;
int maxnumb;
@@ -59,35 +85,76 @@ class FL_EXPORT Fl_Chart : public Fl_Widget {
FL_CHART_ENTRY *entries;
double min,max;
uchar autosize_;
uchar textfont_,textsize_;
Fl_Font textfont_;
Fl_Fontsize textsize_;
unsigned textcolor_;
protected:
void draw();
public:
Fl_Chart(int,int,int,int,const char * = 0);
Fl_Chart(int X, int Y, int W, int H, const char *L = 0);
~Fl_Chart();
void clear();
void add(double, const char * =0, unsigned=0);
void insert(int, double, const char * =0, unsigned=0);
void replace(int, double, const char * =0, unsigned=0);
void add(double val, const char *str = 0, unsigned col = 0);
void insert(int ind, double val, const char *str = 0, unsigned col = 0);
void replace(int ind, double val, const char *str = 0, unsigned col = 0);
/**
Gets the lower and upper bounds of the chart values.
\param[out] a, b are set to lower, upper
*/
void bounds(double *a,double *b) const {*a = min; *b = max;}
void bounds(double a,double b);
/**
Returns the number of data values in the chart.
*/
int size() const {return numb;}
void size(int W, int H) { Fl_Widget::size(W, H); }
/**
Gets the maximum number of data values for a chart.
*/
int maxsize() const {return maxnumb;}
void maxsize(int);
Fl_Font textfont() const {return (Fl_Font)textfont_;}
void textfont(uchar s) {textfont_ = s;}
uchar textsize() const {return textsize_;}
void textsize(uchar s) {textsize_ = s;}
void maxsize(int m);
/** Gets the chart's text font */
Fl_Font textfont() const {return textfont_;}
/** Sets the chart's text font to \p s. */
void textfont(Fl_Font s) {textfont_ = s;}
/** Gets the chart's text size */
Fl_Fontsize textsize() const {return textsize_;}
/** gets the chart's text size to \p s. */
void textsize(Fl_Fontsize s) {textsize_ = s;}
/** Gets the chart's text color */
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
/** gets the chart's text color to \p n. */
void textcolor(unsigned n) {textcolor_ = n;}
/**
Get whether the chart will automatically adjust the bounds of the chart.
\returns non-zero if auto-sizing is enabled and zero if disabled.
*/
uchar autosize() const {return autosize_;}
/**
Set whether the chart will automatically adjust the bounds of the chart.
\param[in] n non-zero to enable automatic resizing, zero to disable.
*/
void autosize(uchar n) {autosize_ = n;}
};
#endif
//
// End of "$Id: Fl_Chart.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Chart.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Check_Browser.H 5979 2007-11-19 15:46:24Z matt $"
// "$Id: Fl_Check_Browser.H 6614 2009-01-01 16:11:32Z matt $"
//
// Fl_Check_Browser header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,12 +25,19 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Check_Browser widget . */
#ifndef Fl_Check_Browser_H
#define Fl_Check_Browser_H
#include "Fl.H"
#include "Fl_Browser_.H"
/**
The Fl_Check_Browser widget displays a scrolling list of text
lines that may be selected and/or checked by the user.
*/
class FL_EXPORT Fl_Check_Browser : public Fl_Browser_ {
/* required routines for Fl_Browser_ subclass: */
@@ -47,13 +54,16 @@ class FL_EXPORT Fl_Check_Browser : public Fl_Browser_ {
public: // IRIX 5.3 C++ compiler doesn't support private structures...
#ifndef FL_DOXYGEN
/** For internal use only. */
struct cb_item {
cb_item *next;
cb_item *prev;
char checked;
char selected;
char *text;
cb_item *next; /**< For internal use only. */
cb_item *prev; /**< For internal use only. */
char checked; /**< For internal use only. */
char selected; /**< For internal use only. */
char *text; /**< For internal use only. */
};
#endif // !FL_DOXYGEN
private:
@@ -69,6 +79,7 @@ class FL_EXPORT Fl_Check_Browser : public Fl_Browser_ {
public:
Fl_Check_Browser(int x, int y, int w, int h, const char *l = 0);
/** The destructor deletes all list items and destroys the browser. */
~Fl_Check_Browser() { clear(); }
int add(char *s); // add an (unchecked) item
int add(char *s, int b); // add an item and set checked
@@ -76,14 +87,22 @@ class FL_EXPORT Fl_Check_Browser : public Fl_Browser_ {
int remove(int item); // delete an item. Returns nitems()
// inline const char * methods to avoid breaking binary compatibility...
/** See int Fl_Check_Browser::add(char *s) */
int add(const char *s) { return add((char *)s); }
/** See int Fl_Check_Browser::add(char *s) */
int add(const char *s, int b) { return add((char *)s, b); }
void clear(); // delete all items
/**
Returns how many lines are in the browser. The last line number is equal to
this.
*/
int nitems() const { return nitems_; }
/** Returns how many items are currently checked. */
int nchecked() const { return nchecked_; }
int checked(int item) const;
void checked(int item, int b);
/** Equivalent to Fl_Check_Browser::checked(item, 1). */
void set_checked(int item) { checked(item, 1); }
void check_all();
void check_none();
@@ -98,6 +117,6 @@ class FL_EXPORT Fl_Check_Browser : public Fl_Browser_ {
#endif // Fl_Check_Browser_H
//
// End of "$Id: Fl_Check_Browser.H 5979 2007-11-19 15:46:24Z matt $".
// End of "$Id: Fl_Check_Browser.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Check_Button.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Check_Button.H 6614 2009-01-01 16:11:32Z matt $"
//
// Check button header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,18 +25,36 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Check_Button widget . */
#ifndef Fl_Check_Button_H
#define Fl_Check_Button_H
#include "Fl_Light_Button.H"
/**
\class Fl_Check_Button
\brief A button with an "checkmark" to show its status.
\image html Fl_Check_Button.gif
\image latex Fl_Check_Button.eps "Fl_Check_Button" width=4cm
Buttons generate callbacks when they are clicked by the user. You control
exactly when and how by changing the values for type() and when().
The Fl_Check_Button subclass displays its "ON" state by showing a "checkmark"
rather than drawing itself pushed in.
\todo Refactor Fl_Check_Button doxygen comments (add color() info etc?)
\todo Generate Fl_Check_Button.gif with visible checkmark.
*/
class FL_EXPORT Fl_Check_Button : public Fl_Light_Button {
public:
Fl_Check_Button(int x,int y,int w,int h,const char *l = 0);
Fl_Check_Button(int X, int Y, int W, int H, const char *L = 0);
};
#endif
//
// End of "$Id: Fl_Check_Button.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Check_Button.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Choice.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Choice.H 6614 2009-01-01 16:11:32Z matt $"
//
// Choice header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,24 +25,84 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Choice widget . */
#ifndef Fl_Choice_H
#define Fl_Choice_H
#include "Fl_Menu_.H"
/**
\class Fl_Choice
\brief A button that is used to pop up a menu.
This is a button that, when pushed, pops up a menu (or hierarchy of menus)
defined by an array of Fl_Menu_Item objects.
Motif calls this an OptionButton.
The only difference between this and a Fl_Menu_Button is that the name of
the most recent chosen menu item is displayed inside the box, while the
label is displayed outside the box. However, since the use of this is most
often to control a single variable rather than do individual callbacks,
some of the Fl_Menu_Button methods are redescribed here in those terms.
When the user picks an item off the menu the value() is set to that item
and then the item's callback is done with the menu_button as the
\c Fl_Widget* argument. If the item does not have a callback the
menu_button's callback is done instead.
All three mouse buttons pop up the menu. The Forms behavior of the first
two buttons to increment/decrement the choice is not implemented. This
could be added with a subclass, however.
The menu will also pop up in response to shortcuts indicated by putting
a '\&' character in the label(). See Fl_Button::shortcut(int s) for a
description of this.
Typing the shortcut() of any of the items will do exactly the same as when
you pick the item with the mouse. The '\&' character in item names are
only looked at when the menu is popped up, however.
\image html choice.gif
\image latex choice.eps "Fl_Choice" width=4cm
\todo Refactor the doxygen comments for Fl_Choice changed() documentation.
\li <tt>int Fl_Widget::changed() const</tt>
This value is true the user picks a different value. <em>It is turned
off by value() and just before doing a callback (the callback can turn
it back on if desired).</em>
\li <tt>void Fl_Widget::set_changed()</tt>
This method sets the changed() flag.
\li <tt>void Fl_Widget::clear_changed()</tt>
This method clears the changed() flag.
\li <tt>Fl_Boxtype Fl_Choice::down_box() const</tt>
Gets the current down box, which is used when the menu is popped up.
The default down box type is \c FL_DOWN_BOX.
\li <tt>void Fl_Choice::down_box(Fl_Boxtype b)</tt>
Sets the current down box type to \p b.
*/
class FL_EXPORT Fl_Choice : public Fl_Menu_ {
protected:
void draw();
public:
int handle(int);
Fl_Choice(int,int,int,int,const char * = 0);
int value(const Fl_Menu_Item*);
int value(int i);
Fl_Choice(int X, int Y, int W, int H, const char *L = 0);
/**
Gets the index of the last item chosen by the user.
The index is zero initially.
*/
int value() const {return Fl_Menu_::value();}
int value(int v);
int value(const Fl_Menu_Item* v);
};
#endif
//
// End of "$Id: Fl_Choice.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Choice.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Clock.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Clock.H 6754 2009-04-12 11:32:22Z AlbrechtS $"
//
// Clock header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Clock, Fl_Clock_Output widgets . */
#ifndef Fl_Clock_H
#define Fl_Clock_H
@@ -33,43 +36,102 @@
#endif
// values for type:
#define FL_SQUARE_CLOCK 0
#define FL_ROUND_CLOCK 1
#define FL_ANALOG_CLOCK FL_SQUARE_CLOCK
#define FL_DIGITAL_CLOCK FL_SQUARE_CLOCK // nyi
#define FL_SQUARE_CLOCK 0 /**< type() of Square Clock variant */
#define FL_ROUND_CLOCK 1 /**< type() of Round Clock variant */
#define FL_ANALOG_CLOCK FL_SQUARE_CLOCK /**< An analog clock is square */
#define FL_DIGITAL_CLOCK FL_SQUARE_CLOCK /**< Not yet implemented */
// a Fl_Clock_Output can be used to display a program-supplied time:
// fabien: Please keep the horizontal formatting of both images in class desc,
// don't loose vert. space for nothing!
/**
\class Fl_Clock_Output
\brief This widget can be used to display a program-supplied time.
The time shown on the clock is not updated. To display the current time,
use Fl_Clock instead.
\htmlonly <BR> <table align=CENTER border=1 cellpadding=5 >
<caption align=bottom>type() FL_SQUARE_CLOCK and FL_ROUND_CLOCK </caption> <TR><TD> \endhtmlonly
\image html clock.gif
\htmlonly </TD> <TD> \endhtmlonly
\image html round_clock.gif
\htmlonly </TD> </TR> </table> \endhtmlonly
\image latex clock.eps "FL_SQUARE_CLOCK type" width=4cm
\image latex round_clock.eps "FL_ROUND_CLOCK type" width=4cm
*/
class FL_EXPORT Fl_Clock_Output : public Fl_Widget {
int hour_, minute_, second_;
ulong value_;
void drawhands(Fl_Color,Fl_Color); // part of draw
protected:
void draw(int, int, int, int);
void draw();
void draw(int X, int Y, int W, int H);
public:
Fl_Clock_Output(int x,int y,int w,int h, const char *l = 0);
Fl_Clock_Output(int X, int Y, int W, int H, const char *L = 0);
void value(ulong v); // set to this Unix time
void value(int,int,int); // set hour, minute, second
void value(int H, int m, int s);
/**
Returns the displayed time.
Returns the time in seconds since the UNIX epoch (January 1, 1970).
\see value(ulong)
*/
ulong value() const {return value_;}
/**
Returns the displayed hour (0 to 23).
\see value(), minute(), second()
*/
int hour() const {return hour_;}
/**
Returns the displayed minute (0 to 59).
\see value(), hour(), second()
*/
int minute() const {return minute_;}
/**
Returns the displayed second (0 to 60, 60=leap second).
\see value(), hour(), minute()
*/
int second() const {return second_;}
};
// a Fl_Clock displays the current time always by using a timeout:
/**
\class Fl_Clock
\brief This widget provides a round analog clock display.
Fl_Clock is provided for Forms compatibility.
It installs a 1-second timeout callback using Fl::add_timeout().
You can choose the rounded or square type of the the clock with type(), see below.
\htmlonly <BR> <table align=CENTER border=1 cellpadding=5 >
<caption align=bottom>type() FL_SQUARE_CLOCK and FL_ROUND_CLOCK </caption> <TR><TD> \endhtmlonly
\image html clock.gif
\htmlonly </TD> <TD> \endhtmlonly
\image html round_clock.gif
\htmlonly </TD> </TR> </table> \endhtmlonly
\image latex clock.eps "FL_SQUARE_CLOCK type" width=4cm
\image latex round_clock.eps "FL_ROUND_CLOCK type" width=4cm
*/
class FL_EXPORT Fl_Clock : public Fl_Clock_Output {
public:
int handle(int);
void update();
Fl_Clock(int x,int y,int w,int h, const char *l = 0);
Fl_Clock(uchar t,int x,int y,int w,int h, const char *l);
Fl_Clock(int X, int Y, int W, int H, const char *L = 0);
Fl_Clock(uchar t, int X, int Y, int W, int H, const char *L);
~Fl_Clock();
};
#endif
//
// End of "$Id: Fl_Clock.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Clock.H 6754 2009-04-12 11:32:22Z AlbrechtS $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Color_Chooser.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Color_Chooser.H 6614 2009-01-01 16:11:32Z matt $"
//
// Color chooser header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/** \file
Fl_Color_Chooser widget . */
// The color chooser object and the color chooser popup. The popup
// is just a window containing a single color chooser and some boxes
// to indicate the current and cancelled color.
@@ -38,6 +41,9 @@
#include <FL/Fl_Choice.H>
#include <FL/Fl_Value_Input.H>
#ifndef FL_DOXYGEN
/** For internal use only */
class FL_EXPORT Flcc_HueBox : public Fl_Widget {
int px, py;
protected:
@@ -49,6 +55,7 @@ public:
px = py = 0;}
};
/** For internal use only */
class FL_EXPORT Flcc_ValueBox : public Fl_Widget {
int py;
protected:
@@ -60,12 +67,52 @@ public:
py = 0;}
};
/** For internal use only */
class FL_EXPORT Flcc_Value_Input : public Fl_Value_Input {
public:
int format(char*);
Flcc_Value_Input(int X, int Y, int W, int H) : Fl_Value_Input(X,Y,W,H) {}
};
#endif // !FL_DOXYGEN
/** \addtogroup group_comdlg
@{ */
/**
\class Fl_Color_Chooser
\brief The Fl_Color_Chooser widget provides a standard RGB color chooser.
\image html fl_color_chooser.jpg
\image latex fl_color_chooser.eps "fl_color_chooser()" width=5cm
You can place any number of the widgets into a panel of your own design.
The diagram shows the widget as part of a color chooser dialog created by
the fl_color_chooser() function. The Fl_Color_Chooser widget contains the
hue box, value slider, and rgb input fields from the above diagram (it
does not have the color chips or the Cancel or OK buttons).
The callback is done every time the user changes the rgb value. It is not
done if they move the hue control in a way that produces the \e same rgb
value, such as when saturation or value is zero.
The fl_color_chooser() function pops up a window to let the user pick an
arbitrary RGB color. They can pick the hue and saturation in the "hue box"
on the left (hold down CTRL to just change the saturation), and the
brightness using the vertical slider. Or they can type the 8-bit numbers
into the RGB Fl_Value_Input fields, or drag the mouse across them to adjust
them. The pull-down menu lets the user set the input fields to show RGB,
HSV, or 8-bit RGB (0 to 255).
fl_color_chooser() returns non-zero if the user picks ok, and updates the
RGB values. If the user picks cancel or closes the window this returns
zero and leaves RGB unchanged.
If you use the color chooser on an 8-bit screen, it will allocate all the
available colors, leaving you no space to exactly represent the color the
user picks! You can however use fl_rectf() to fill a region with a simulated
color using dithering.
*/
/** @} */
class FL_EXPORT Fl_Color_Chooser : public Fl_Group {
Flcc_HueBox huebox;
Flcc_ValueBox valuebox;
@@ -80,18 +127,56 @@ class FL_EXPORT Fl_Color_Chooser : public Fl_Group {
static void rgb_cb(Fl_Widget*, void*);
static void mode_cb(Fl_Widget*, void*);
public:
/** Returns which Fl_Color_Chooser variant is currently active */
int mode() {return choice.value();}
/**
Returns the current hue.
0 <= hue < 6. Zero is red, one is yellow, two is green, etc.
<em>This value is convenient for the internal calculations - some other
systems consider hue to run from zero to one, or from 0 to 360.</em>
*/
double hue() const {return hue_;}
/**
Returns the saturation.
0 <= saturation <= 1.
*/
double saturation() const {return saturation_;}
/**
Returns the value/brightness.
0 <= value <= 1.
*/
double value() const {return value_;}
/**
Returns the current red value.
0 <= r <= 1.
*/
double r() const {return r_;}
/**
Returns the current green value.
0 <= g <= 1.
*/
double g() const {return g_;}
/**
Returns the current blue value.
0 <= b <= 1.
*/
double b() const {return b_;}
int hsv(double,double,double);
int rgb(double,double,double);
static void hsv2rgb(double, double, double,double&,double&,double&);
static void rgb2hsv(double, double, double,double&,double&,double&);
Fl_Color_Chooser(int,int,int,int,const char* = 0);
int hsv(double H, double S, double V);
int rgb(double R, double G, double B);
static void hsv2rgb(double H, double S, double V, double& R, double& G, double& B);
static void rgb2hsv(double R, double G, double B, double& H, double& S, double& V);
Fl_Color_Chooser(int X, int Y, int W, int H, const char *L = 0);
};
FL_EXPORT int fl_color_chooser(const char* name, double& r, double& g, double& b);
@@ -100,5 +185,5 @@ FL_EXPORT int fl_color_chooser(const char* name, uchar& r, uchar& g, uchar& b);
#endif
//
// End of "$Id: Fl_Color_Chooser.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Color_Chooser.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Counter.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Counter.H 6716 2009-03-24 01:40:44Z fabien $"
//
// Counter header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Counter widget . */
// A numerical value with up/down step buttons. From Forms.
#ifndef Fl_Counter_H
@@ -35,12 +38,26 @@
#endif
// values for type():
#define FL_NORMAL_COUNTER 0
#define FL_SIMPLE_COUNTER 1
#define FL_NORMAL_COUNTER 0 /**< type() for counter with fast buttons */
#define FL_SIMPLE_COUNTER 1 /**< type() for counter without fast buttons */
/**
Controls a single floating point value with button (or keyboard) arrows.
Double arrows buttons achieve larger steps than simple arrows.
\see Fl_Spinner for value input with vertical step arrows.
<P align=center>\image html counter.gif</P>
\image latex counter.eps "Fl_Counter" width=4cm
\todo Refactor the doxygen comments for Fl_Counter type() documentation.
The type of an Fl_Counter object can be set using type(uchar t) to:
\li \c FL_NORMAL_COUNTER: Displays a counter with 4 arrow buttons.
\li \c FL_SIMPLE_COUNTER: Displays a counter with only 2 arrow buttons.
*/
class FL_EXPORT Fl_Counter : public Fl_Valuator {
uchar textfont_, textsize_;
Fl_Font textfont_;
Fl_Fontsize textsize_;
unsigned textcolor_;
double lstep_;
uchar mouseobj;
@@ -55,16 +72,47 @@ protected:
public:
int handle(int);
Fl_Counter(int,int,int,int,const char * = 0);
Fl_Counter(int X, int Y, int W, int H, const char* L = 0);
~Fl_Counter();
/**
Sets the increment for the large step buttons.
The default value is 1.0.
\param[in] a large step increment.
*/
void lstep(double a) {lstep_ = a;}
/**
Sets the increments for the normal and large step buttons.
\param[in] a, b normal and large step increments.
*/
void step(double a,double b) {Fl_Valuator::step(a); lstep_ = b;}
/**
Sets the increment for the normal step buttons.
\param[in] a normal step increment.
*/
void step(double a) {Fl_Valuator::step(a);}
Fl_Font textfont() const {return (Fl_Font)textfont_;}
void textfont(uchar s) {textfont_ = s;}
uchar textsize() const {return textsize_;}
void textsize(uchar s) {textsize_ = s;}
/**
Returns the increment for normal step buttons.
*/
double step() {return Fl_Valuator::step();}
/** Gets the text font */
Fl_Font textfont() const {return textfont_;}
/** Sets the text font to \p s */
void textfont(Fl_Font s) {textfont_ = s;}
/** Gets the font size */
Fl_Fontsize textsize() const {return textsize_;}
/** Sets the font size to \p s */
void textsize(Fl_Fontsize s) {textsize_ = s;}
/** Gets the font color */
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
/** Sets the font color to \p s */
void textcolor(unsigned s) {textcolor_ = s;}
};
@@ -72,5 +120,5 @@ public:
#endif
//
// End of "$Id: Fl_Counter.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Counter.H 6716 2009-03-24 01:40:44Z fabien $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Dial.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Dial.H 6614 2009-01-01 16:11:32Z matt $"
//
// Dial header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Dial widget . */
#ifndef Fl_Dial_H
#define Fl_Dial_H
@@ -33,10 +36,23 @@
#endif
// values for type():
#define FL_NORMAL_DIAL 0
#define FL_LINE_DIAL 1
#define FL_FILL_DIAL 2
#define FL_NORMAL_DIAL 0 /**< type() for dial variant with dot */
#define FL_LINE_DIAL 1 /**< type() for dial variant with line */
#define FL_FILL_DIAL 2 /**< type() for dial variant with filled arc */
/**
The Fl_Dial widget provides a circular dial to control a
single floating point value.
<P ALIGN=CENTER>\image html dial.gif
\image latex dial.eps "Fl_Dial" width=4cm
Use type() to set the type of the dial to:
<UL>
<LI>FL_NORMAL_DIAL - Draws a normal dial with a knob. </LI>
<LI>FL_LINE_DIAL - Draws a dial with a line. </LI>
<LI>FL_FILL_DIAL - Draws a dial with a filled arc. </LI>
</UL>
*/
class FL_EXPORT Fl_Dial : public Fl_Valuator {
short a1,a2;
@@ -44,18 +60,32 @@ class FL_EXPORT Fl_Dial : public Fl_Valuator {
protected:
// these allow subclasses to put the dial in a smaller area:
void draw(int, int, int, int);
int handle(int, int, int, int, int);
void draw(int X, int Y, int W, int H);
int handle(int event, int X, int Y, int W, int H);
void draw();
public:
int handle(int);
/**
Creates a new Fl_Dial widget using the given position, size,
and label string. The default type is FL_NORMAL_DIAL.
*/
Fl_Dial(int x,int y,int w,int h, const char *l = 0);
/**
Sets Or gets the angles used for the minimum and maximum values. The default
values are 45 and 315 (0 degrees is straight down and the angles
progress clockwise). Normally angle1 is less than angle2, but if you
reverse them the dial moves counter-clockwise.
*/
short angle1() const {return a1;}
/** See short angle1() const */
void angle1(short a) {a1 = a;}
/** See short angle1() const */
short angle2() const {return a2;}
/** See short angle1() const */
void angle2(short a) {a2 = a;}
/** See short angle1() const */
void angles(short a, short b) {a1 = a; a2 = b;}
};
@@ -63,5 +93,5 @@ public:
#endif
//
// End of "$Id: Fl_Dial.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Dial.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Double_Window.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Double_Window.H 6614 2009-01-01 16:11:32Z matt $"
//
// Double-buffered window header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,15 +25,35 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Double_Window widget . */
#ifndef Fl_Double_Window_H
#define Fl_Double_Window_H
#include "Fl_Window.H"
/**
The Fl_Double_Window provides a double-buffered window.
If possible this will use the X double buffering extension (Xdbe). If
not, it will draw the window data into an off-screen pixmap, and then
copy it to the on-screen window.
<P>It is highly recommended that you put the following code before the
first show() of <I>any</I> window in your program: </P>
\code
Fl::visual(FL_DOUBLE|FL_INDEX)
\endcode
This makes sure you can use Xdbe on servers where double buffering
does not exist for every visual.
*/
class FL_EXPORT Fl_Double_Window : public Fl_Window {
protected:
void flush(int eraseoverlay);
char force_doublebuffering_; // force db, even if the OS already buffers windows (overlays need that on MacOS and Windows2000)
/**
Force double buffering, even if the OS already buffers windows
(overlays need that on MacOS and Windows2000)
*/
char force_doublebuffering_;
public:
void show();
void show(int a, char **b) {Fl_Window::show(a,b);}
@@ -41,8 +61,15 @@ public:
void resize(int,int,int,int);
void hide();
~Fl_Double_Window();
/**
Creates a new Fl_Double_Window widget using the given
position, size, and label (title) string.
*/
Fl_Double_Window(int W, int H, const char *l = 0)
: Fl_Window(W,H,l), force_doublebuffering_(0) { type(FL_DOUBLE_WINDOW); }
/**
See Fl_Double_Window::Fl_Double_Window(int w, int h, const char *label = 0)
*/
Fl_Double_Window(int X, int Y, int W, int H, const char *l = 0)
: Fl_Window(X,Y,W,H,l), force_doublebuffering_(0) { type(FL_DOUBLE_WINDOW); }
};
@@ -50,5 +77,5 @@ public:
#endif
//
// End of "$Id: Fl_Double_Window.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Double_Window.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
/*
* "$Id: Fl_Export.H 4288 2005-04-16 00:13:17Z mike $"
* "$Id: Fl_Export.H 6614 2009-01-01 16:11:32Z matt $"
*
* WIN32 DLL export definitions for the Fast Light Tool Kit (FLTK).
* WIN32 DLL export .
*
* Copyright 1998-2005 by Bill Spitzak and others.
* Copyright 1998-2009 by Bill Spitzak and others.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -45,5 +45,5 @@
#endif /* !Fl_Export_H */
/*
* End of "$Id: Fl_Export.H 4288 2005-04-16 00:13:17Z mike $".
* End of "$Id: Fl_Export.H 6614 2009-01-01 16:11:32Z matt $".
*/

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_File_Browser.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_File_Browser.H 6614 2009-01-01 16:11:32Z matt $"
//
// FileBrowser definitions.
//
// Copyright 1999-2005 by Michael Sweet.
// Copyright 1999-2009 by Michael Sweet.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_File_Browser widget . */
//
// Include necessary header files...
//
@@ -41,6 +44,7 @@
// Fl_File_Browser class...
//
/** The Fl_File_Browser widget displays a list of filenames, optionally with file-specific icons. */
class FL_EXPORT Fl_File_Browser : public Fl_Browser
{
int filetype_;
@@ -57,25 +61,60 @@ class FL_EXPORT Fl_File_Browser : public Fl_Browser
public:
enum { FILES, DIRECTORIES };
/**
The constructor creates the Fl_File_Browser widget at the specified position and size.
The destructor destroys the widget and frees all memory that has been allocated.
*/
Fl_File_Browser(int, int, int, int, const char * = 0);
/** Sets or gets the size of the icons. The default size is 20 pixels. */
uchar iconsize() const { return (iconsize_); };
/** Sets or gets the size of the icons. The default size is 20 pixels. */
void iconsize(uchar s) { iconsize_ = s; redraw(); };
/**
Sets or gets the filename filter. The pattern matching uses
the fl_filename_match()
function in FLTK.
*/
void filter(const char *pattern);
/**
Sets or gets the filename filter. The pattern matching uses
the fl_filename_match()
function in FLTK.
*/
const char *filter() const { return (pattern_); };
/**
Loads the specified directory into the browser. If icons have been
loaded then the correct icon is associated with each file in the list.
<P>The sort argument specifies a sort function to be used with
fl_filename_list().
*/
int load(const char *directory, Fl_File_Sort_F *sort = fl_numericsort);
uchar textsize() const { return (Fl_Browser::textsize()); };
void textsize(uchar s) { Fl_Browser::textsize(s); iconsize_ = (uchar)(3 * s / 2); };
Fl_Fontsize textsize() const { return Fl_Browser::textsize(); };
void textsize(Fl_Fontsize s) { Fl_Browser::textsize(s); iconsize_ = (uchar)(3 * s / 2); };
/**
Sets or gets the file browser type, FILES or
DIRECTORIES. When set to FILES, both
files and directories are shown. Otherwise only directories are
shown.
*/
int filetype() const { return (filetype_); };
/**
Sets or gets the file browser type, FILES or
DIRECTORIES. When set to FILES, both
files and directories are shown. Otherwise only directories are
shown.
*/
void filetype(int t) { filetype_ = t; };
};
#endif // !_Fl_File_Browser_H_
//
// End of "$Id: Fl_File_Browser.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_File_Browser.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_File_Chooser.H 5644 2007-01-28 19:41:56Z mike $"
// "$Id: Fl_File_Chooser.H 6678 2009-03-13 23:36:09Z AlbrechtS $"
//
// Fl_File_Chooser dialog for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,7 +25,7 @@
// http://www.fltk.org/str.php
//
// generated by Fast Light User Interface Designer (fluid) version 1.0108
// generated by Fast Light User Interface Designer (fluid) version 1.0300
#ifndef Fl_File_Chooser_H
#define Fl_File_Chooser_H
@@ -150,10 +150,10 @@ public:
int shown();
void textcolor(Fl_Color c);
Fl_Color textcolor();
void textfont(uchar f);
uchar textfont();
void textsize(uchar s);
uchar textsize();
void textfont(Fl_Font f);
Fl_Font textfont();
void textsize(Fl_Fontsize s);
Fl_Fontsize textsize();
void type(int t);
int type();
void * user_data() const;
@@ -161,20 +161,67 @@ public:
const char *value(int f = 1);
void value(const char *filename);
int visible();
/**
[standard text may be customized at run-time]
*/
static const char *add_favorites_label;
/**
[standard text may be customized at run-time]
*/
static const char *all_files_label;
/**
[standard text may be customized at run-time]
*/
static const char *custom_filter_label;
/**
[standard text may be customized at run-time]
*/
static const char *existing_file_label;
/**
[standard text may be customized at run-time]
*/
static const char *favorites_label;
/**
[standard text may be customized at run-time]
*/
static const char *filename_label;
/**
[standard text may be customized at run-time]
*/
static const char *filesystems_label;
/**
[standard text may be customized at run-time]
*/
static const char *manage_favorites_label;
/**
[standard text may be customized at run-time]
*/
static const char *new_directory_label;
/**
[standard text may be customized at run-time]
*/
static const char *new_directory_tooltip;
/**
[standard text may be customized at run-time]
*/
static const char *preview_label;
/**
[standard text may be customized at run-time]
*/
static const char *save_label;
/**
[standard text may be customized at run-time]
*/
static const char *show_label;
/**
the sort function that is used when loading
the contents of a directory.
*/
static Fl_File_Sort_F *sort;
private:
Fl_Widget* ext_group;
public:
Fl_Widget* add_extra(Fl_Widget* gr);
};
FL_EXPORT char *fl_dir_chooser(const char *message,const char *fname,int relative=0);
FL_EXPORT char *fl_file_chooser(const char *message,const char *pat,const char *fname,int relative=0);
@@ -183,5 +230,5 @@ FL_EXPORT void fl_file_chooser_ok_label(const char*l);
#endif
//
// End of "$Id: Fl_File_Chooser.H 5644 2007-01-28 19:41:56Z mike $".
// End of "$Id: Fl_File_Chooser.H 6678 2009-03-13 23:36:09Z AlbrechtS $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_File_Icon.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_File_Icon.H 6614 2009-01-01 16:11:32Z matt $"
//
// Fl_File_Icon definitions.
//
// Copyright 1999-2005 by Michael Sweet.
// Copyright 1999-2009 by Michael Sweet.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_File_Icon widget . */
//
// Include necessary header files...
//
@@ -39,13 +42,17 @@
// Special color value for the icon color.
//
# define FL_ICON_COLOR (Fl_Color)0xffffffff
# define FL_ICON_COLOR (Fl_Color)0xffffffff /**< icon color [background?]*/
//
// Fl_File_Icon class...
//
/**
The Fl_File_Icon class manages icon images that can be used
as labels in other widgets and as icons in the FileBrowser widget.
*/
class FL_EXPORT Fl_File_Icon //// Icon data
{
static Fl_File_Icon *first_; // Pointer to first icon/filetype
@@ -83,27 +90,73 @@ class FL_EXPORT Fl_File_Icon //// Icon data
~Fl_File_Icon();
short *add(short d);
/**
Adds a color value to the icon array, returning a pointer to it.
\param[in] c color value
*/
short *add_color(Fl_Color c)
{ short *d = add((short)COLOR); add((short)(c >> 16)); add((short)c); return (d); }
/**
Adds a vertex value to the icon array, returning a pointer to it.
The integer version accepts coordinates from 0 to 10000.
The origin (0.0) is in the lower-lefthand corner of the icon.
\param[in] x, y vertex coordinates
*/
short *add_vertex(int x, int y)
{ short *d = add((short)VERTEX); add((short)x); add((short)y); return (d); }
/**
Adds a vertex value to the icon array, returning a pointer to it.
The floating point version goes from 0.0 to 1.0.
The origin (0.0) is in the lower-lefthand corner of the icon.
\param[in] x, y vertex coordinates
*/
short *add_vertex(float x, float y)
{ short *d = add((short)VERTEX); add((short)(x * 10000.0));
add((short)(y * 10000.0)); return (d); }
/** Clears all icon data from the icon.*/
void clear() { num_data_ = 0; }
void draw(int x, int y, int w, int h, Fl_Color ic, int active = 1);
void label(Fl_Widget *w);
static void labeltype(const Fl_Label *o, int x, int y, int w, int h, Fl_Align a);
void load(const char *f);
int load_fti(const char *fti);
int load_image(const char *i);
/** Returns next file icon object. See Fl_File_Icon::first() */
Fl_File_Icon *next() { return (next_); }
/** Returns the filename matching pattern for the icon.*/
const char *pattern() { return (pattern_); }
/** Returns the number of words of data used by the icon.*/
int size() { return (num_data_); }
/**
Returns the filetype associated with the icon, which can be one of the
following:
\li Fl_File_Icon::ANY, any kind of file.
\li Fl_File_Icon::PLAIN, plain files.
\li Fl_File_Icon::FIFO, named pipes.
\li Fl_File_Icon::DEVICE, character and block devices.
\li Fl_File_Icon::LINK, symbolic links.
\li Fl_File_Icon::DIRECTORY, directories.
*/
int type() { return (type_); }
/** Returns the data array for the icon.*/
short *value() { return (data_); }
static Fl_File_Icon *find(const char *filename, int filetype = ANY);
/** Returns a pointer to the first icon in the list.*/
static Fl_File_Icon *first() { return (first_); }
static void load_system_icons(void);
};
@@ -111,5 +164,5 @@ class FL_EXPORT Fl_File_Icon //// Icon data
#endif // !_Fl_Fl_File_Icon_H_
//
// End of "$Id: Fl_File_Icon.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_File_Icon.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_File_Input.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_File_Input.H 6716 2009-03-24 01:40:44Z fabien $"
//
// File_Input header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
// Original version Copyright 1998 by Curtis Edwards.
//
// This library is free software; you can redistribute it and/or
@@ -26,12 +26,31 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_File_Input widget . */
#ifndef Fl_File_Input_H
# define Fl_File_Input_H
# include <FL/Fl_Input.H>
/**
\class Fl_File_Input
\brief This widget displays a pathname in a text input field.
A navigation bar located above the input field allows the user to
navigate upward in the directory tree.
You may want to handle FL_WHEN_CHANGED events for tracking text changes
and also FL_WHEN_RELEASE for button release when changing to parent dir.
FL_WHEN_RELEASE callback won't be called if the directory clicked
is the same that the current one.
<P align=CENTER> \image html Fl_File_Input.gif </P>
\image latex Fl_File_Input.eps "Fl_File_Input" width=6cm
\note As all Fl_Input derived objects, Fl_File_Input may call its callback
when loosing focus (see FL_UNFOCUS) to update its state like its cursor shape.
One resulting side effect is that you should call clear_changed() early in your callback
to avoid reentrant calls if you plan to show another window or dialog box in the callback.
*/
class FL_EXPORT Fl_File_Input : public Fl_Input
{
Fl_Color errorcolor_;
@@ -46,17 +65,34 @@ class FL_EXPORT Fl_File_Input : public Fl_Input
public:
Fl_File_Input(int,int,int,int,const char *t=0);
Fl_File_Input(int X, int Y, int W, int H, const char *L=0);
virtual int handle(int);
virtual int handle(int event);
protected:
virtual void draw();
public:
/** Gets the box type used for the navigation bar. */
Fl_Boxtype down_box() const { return (Fl_Boxtype)down_box_; }
/** Sets the box type to use for the navigation bar. */
void down_box(Fl_Boxtype b) { down_box_ = b; }
/**
Gets the current error color.
\todo Better docs for Fl_File_Input::errorcolor() - is it even used?
*/
Fl_Color errorcolor() const { return errorcolor_; }
/** Sets the current error color to \p c */
void errorcolor(Fl_Color c) { errorcolor_ = c; }
int value(const char*);
int value(const char*, int);
int value(const char *str);
int value(const char *str, int len);
/**
Returns the current value, which is a pointer to an internal buffer
and is valid only until the next event is handled.
*/
const char *value() { return Fl_Input_::value(); }
};
@@ -64,5 +100,5 @@ public:
//
// End of "$Id: Fl_File_Input.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_File_Input.H 6716 2009-03-24 01:40:44Z fabien $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Fill_Dial.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Fill_Dial.H 6614 2009-01-01 16:11:32Z matt $"
//
// Filled dial header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,13 +25,18 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Fill_Dial widget . */
#ifndef Fl_Fill_Dial_H
#define Fl_Fill_Dial_H
#include "Fl_Dial.H"
/** Draws a dial with a filled arc */
class Fl_Fill_Dial : public Fl_Dial {
public:
/** Creates a filled dial, also setting its type to FL_FILL_DIAL. */
Fl_Fill_Dial(int x,int y,int w,int h, const char *l = 0)
: Fl_Dial(x,y,w,h,l) {type(FL_FILL_DIAL);}
};
@@ -39,5 +44,5 @@ public:
#endif
//
// End of "$Id: Fl_Fill_Dial.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Fill_Dial.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Fill_Slider.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Fill_Slider.H 6614 2009-01-01 16:11:32Z matt $"
//
// Filled slider header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,13 +25,17 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Fill_Slider widget . */
#ifndef Fl_Fill_Slider_H
#define Fl_Fill_Slider_H
#include "Fl_Slider.H"
/** Widget that draws a filled horizontal slider, useful as a progress or value meter*/
class Fl_Fill_Slider : public Fl_Slider {
public:
/** Creates the slider from its position,size and optional title. */
Fl_Fill_Slider(int x,int y,int w,int h,const char *l=0)
: Fl_Slider(x,y,w,h,l) {type(FL_VERT_FILL_SLIDER);}
};
@@ -39,5 +43,5 @@ public:
#endif
//
// End of "$Id: Fl_Fill_Slider.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Fill_Slider.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Float_Input.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Float_Input.H 6614 2009-01-01 16:11:32Z matt $"
//
// Floating point input header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,19 +25,33 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Float_Input widget . */
#ifndef Fl_Float_Input_H
#define Fl_Float_Input_H
#include "Fl_Input.H"
/**
The Fl_Float_Input class is a subclass of Fl_Input
that only allows the user to type floating point numbers (sign,
digits, decimal point, more digits, 'E' or 'e', sign, digits).
*/
class Fl_Float_Input : public Fl_Input {
public:
Fl_Float_Input(int X,int Y,int W,int H,const char *l = 0)
: Fl_Input(X,Y,W,H,l) {type(FL_FLOAT_INPUT);}
/**
Creates a new Fl_Float_Input widget using the given position,
size, and label string. The default boxtype is FL_DOWN_BOX.
<P> Inherited destructor destroys the widget and any value associated with it
*/
Fl_Float_Input(int X,int Y,int W,int H,const char *l = 0)
: Fl_Input(X,Y,W,H,l) {type(FL_FLOAT_INPUT);}
};
#endif
//
// End of "$Id: Fl_Float_Input.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Float_Input.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_FormsBitmap.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_FormsBitmap.H 6614 2009-01-01 16:11:32Z matt $"
//
// Forms bitmap header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,11 +25,17 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_FormsBitmap widget . */
#ifndef Fl_FormsBitmap_H
#define Fl_FormsBitmap_H
#include "Fl_Bitmap.H"
/**
Forms compatibility Bitmap Image Widget
*/
class FL_EXPORT Fl_FormsBitmap : public Fl_Widget {
Fl_Bitmap *b;
protected:
@@ -37,12 +43,14 @@ protected:
public:
Fl_FormsBitmap(Fl_Boxtype, int, int, int, int, const char * = 0);
void set(int W, int H, const uchar *bits);
/** Sets a new bitmap. */
void bitmap(Fl_Bitmap *B) {b = B;}
/** Gets a the current associated Fl_Bitmap objects. */
Fl_Bitmap *bitmap() const {return b;}
};
#endif
//
// End of "$Id: Fl_FormsBitmap.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_FormsBitmap.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_FormsPixmap.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_FormsPixmap.H 6614 2009-01-01 16:11:32Z matt $"
//
// Forms pixmap header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,24 +25,39 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_FormsPixmap widget . */
#ifndef Fl_FormsPixmap_H
#define Fl_FormsPixmap_H
#include "Fl_Pixmap.H"
/**
\class Fl_FormsPixmap
\brief Forms pixmap drawing routines
*/
class FL_EXPORT Fl_FormsPixmap : public Fl_Widget {
Fl_Pixmap *b;
protected:
void draw();
public:
Fl_FormsPixmap(Fl_Boxtype, int, int, int, int, const char * = 0);
Fl_FormsPixmap(Fl_Boxtype t, int X, int Y, int W, int H, const char *L= 0);
void set(/*const*/char * const * bits);
/**
Set the internal pixmap pointer to an existing pixmap.
\param[in] B existing pixmap
*/
void Pixmap(Fl_Pixmap *B) {b = B;}
/** Get the internal pixmap pointer. */
Fl_Pixmap *Pixmap() const {return b;}
};
#endif
//
// End of "$Id: Fl_FormsPixmap.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_FormsPixmap.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Free.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Free.H 6614 2009-01-01 16:11:32Z matt $"
//
// Forms free header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Free widget . */
#ifndef Fl_Free_H
#define Fl_Free_H
@@ -32,35 +35,55 @@
#include "Fl_Widget.H"
#endif
#define FL_NORMAL_FREE 1
#define FL_SLEEPING_FREE 2
#define FL_INPUT_FREE 3
#define FL_CONTINUOUS_FREE 4
#define FL_ALL_FREE 5
#define FL_NORMAL_FREE 1 /**< normal event handling */
#define FL_SLEEPING_FREE 2 /**< deactivate event handling */
#define FL_INPUT_FREE 3 /**< accepts FL_FOCUS events */
#define FL_CONTINUOUS_FREE 4 /**< repeated timeout handling */
#define FL_ALL_FREE 5 /**< FL_INPUT_FREE and FL_CONTINOUS_FREE */
/** appropriate signature for handle function */
typedef int (*FL_HANDLEPTR)(Fl_Widget *, int , float, float, char);
/**
Emulation of the Forms "free" widget.
This emulation allows the free demo to run, and appears to be useful for
porting programs written in Forms which use the free widget or make
subclasses of the Forms widgets.
There are five types of free, which determine when the handle function
is called:
\li \c FL_NORMAL_FREE normal event handling.
\li \c FL_SLEEPING_FREE deactivates event handling (widget is inactive).
\li \c FL_INPUT_FREE accepts FL_FOCUS events.
\li \c FL_CONTINUOUS_FREE sets a timeout callback 100 times a second and
provides an FL_STEP event. This has obvious
detrimental effects on machine performance.
\li \c FL_ALL_FREE same as FL_INPUT_FREE and FL_CONTINUOUS_FREE.
*/
class FL_EXPORT Fl_Free : public Fl_Widget {
FL_HANDLEPTR hfunc;
static void step(void *);
protected:
void draw();
public:
int handle(int);
Fl_Free(uchar t,int x,int y,int w,int h,const char *l,FL_HANDLEPTR hdl);
~Fl_Free();
int handle(int e);
Fl_Free(uchar t,int X,int Y,int W,int H,const char *L,FL_HANDLEPTR hdl);
~Fl_Free();
};
// old event names for compatability:
#define FL_MOUSE FL_DRAG
#define FL_DRAW 100 // NOT USED
#define FL_STEP 101
#define FL_FREEMEM 102 // NOT USED
#define FL_FREEZE 103 // NOT USED
#define FL_THAW 104 // NOT USED
// old event names for compatibility:
#define FL_MOUSE FL_DRAG /**< for backward compatibility */
#define FL_DRAW 100 /**< for backward compatibility [UNUSED]*/
#define FL_STEP 101 /**< for backward compatibility */
#define FL_FREEMEM 102 /**< for backward compatibility [UNUSED]*/
#define FL_FREEZE 103 /**< for backward compatibility [UNUSED]*/
#define FL_THAW 104 /**< for backward compatibility [UNUSED]*/
#endif
//
// End of "$Id: Fl_Free.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Free.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Group.H 5993 2007-12-15 16:42:00Z mike $"
// "$Id: Fl_Group.H 6716 2009-03-24 01:40:44Z fabien $"
//
// Group header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Group, Fl_End classes . */
#ifndef Fl_Group_H
#define Fl_Group_H
@@ -32,13 +35,20 @@
#include "Fl_Widget.H"
#endif
/**
The Fl_Group class is the FLTK container widget. It maintains
an array of child widgets. These children can themselves be any widget
including Fl_Group. The most important subclass of Fl_Group
is Fl_Window, however groups can also be used to control radio buttons
or to enforce resize behavior.
*/
class FL_EXPORT Fl_Group : public Fl_Widget {
Fl_Widget** array_;
Fl_Widget* savedfocus_;
Fl_Widget* resizable_;
int children_;
short *sizes_; // remembered initial sizes of children
int *sizes_; // remembered initial sizes of children
int navigation(int);
static Fl_Group *current_;
@@ -50,15 +60,12 @@ class FL_EXPORT Fl_Group : public Fl_Widget {
protected:
enum { CLIP_CHILDREN = 2048 };
void clip_children(int c) { if (c) set_flag(CLIP_CHILDREN); else clear_flag(CLIP_CHILDREN); }
int clip_children() { return (flags() & CLIP_CHILDREN) != 0; }
void draw();
void draw_child(Fl_Widget&) const;
void draw_child(Fl_Widget& widget) const;
void draw_children();
void draw_outside_label(const Fl_Widget&) const ;
void update_child(Fl_Widget&) const;
short* sizes();
void draw_outside_label(const Fl_Widget& widget) const ;
void update_child(Fl_Widget& widget) const;
int *sizes();
public:
@@ -68,44 +75,154 @@ public:
static Fl_Group *current();
static void current(Fl_Group *g);
/**
Returns how many child widgets the group has.
*/
int children() const {return children_;}
/**
Returns array()[n]. <i>No range checking is done!</i>
*/
Fl_Widget* child(int n) const {return array()[n];}
int find(const Fl_Widget*) const;
/**
See int Fl_Group::find(const Fl_Widget *w) const
*/
int find(const Fl_Widget& o) const {return find(&o);}
Fl_Widget* const* array() const;
void resize(int,int,int,int);
/**
Creates a new Fl_Group widget using the given position, size,
and label string. The default boxtype is FL_NO_BOX.
*/
Fl_Group(int,int,int,int, const char * = 0);
virtual ~Fl_Group();
void add(Fl_Widget&);
/**
See void Fl_Group::add(Fl_Widget &w)
*/
void add(Fl_Widget* o) {add(*o);}
void insert(Fl_Widget&, int i);
/**
This does insert(w, find(before)). This will append the
widget if \p before is not in the group.
*/
void insert(Fl_Widget& o, Fl_Widget* before) {insert(o,find(before));}
void remove(Fl_Widget&);
/**
Removes the widget \p o from the group.
\sa void remove(Fl_Widget&)
*/
void remove(Fl_Widget* o) {remove(*o);}
void clear();
/**
See void Fl_Group::resizable(Fl_Widget *box)
*/
void resizable(Fl_Widget& o) {resizable_ = &o;}
/**
The resizable widget defines the resizing box for the group. When the
group is resized it calculates a new size and position for all of its
children. Widgets that are horizontally or vertically inside the
dimensions of the box are scaled to the new size. Widgets outside the
box are moved.
In these examples the gray area is the resizable:
\image html resizebox1.gif
\image html resizebox2.gif
\image latex resizebox1.eps "before resize" width=4cm
\image latex resizebox2.eps "after resize" width=4cm
The resizable may be set to the group itself, in which case all the
contents are resized. This is the default value for Fl_Group,
although NULL is the default for Fl_Window and Fl_Pack.
If the resizable is NULL then all widgets remain a fixed size
and distance from the top-left corner.
It is possible to achieve any type of resize behavior by using an
invisible Fl_Box as the resizable and/or by using a hierarchy
of child Fl_Group's.
*/
void resizable(Fl_Widget* o) {resizable_ = o;}
/**
See void Fl_Group::resizable(Fl_Widget *box)
*/
Fl_Widget* resizable() const {return resizable_;}
/**
Adds a widget to the group and makes it the resizable widget.
*/
void add_resizable(Fl_Widget& o) {resizable_ = &o; add(o);}
void init_sizes();
// back compatability function:
void focus(Fl_Widget* o) {o->take_focus();}
/**
Controls whether the group widget clips the drawing of
child widgets to its bounding box.
Set \p c to 1 if you want to clip the child widgets to the
bounding box.
The default is to not clip (0) the drawing of child widgets.
*/
void clip_children(int c) { if (c) set_flag(CLIP_CHILDREN); else clear_flag(CLIP_CHILDREN); }
/**
Returns the current clipping mode.
\return true, if clipping is enabled, false otherwise.
\see void Fl_Group::clip_children(int c)
*/
int clip_children() { return (flags() & CLIP_CHILDREN) != 0; }
// back compatibility functions:
/**
\deprecated This is for backwards compatibility only. You should use
\e W->%take_focus() instead.
\sa Fl_Widget::take_focus();
*/
void focus(Fl_Widget* W) {W->take_focus();}
/** This is for forms compatibility only */
Fl_Widget* & _ddfdesign_kludge() {return resizable_;}
/** This is for forms compatibility only */
void forms_end();
};
// dummy class used to end child groups in constructors for complex
// subclasses of Fl_Group:
/**
This is a dummy class that allows you to end a Fl_Group in a constructor list of a
class:
\code
class MyClass {
Fl_Group group;
Fl_Button button_in_group;
Fl_End end;
Fl_Button button_outside_group;
MyClass();
};
MyClass::MyClass() :
group(10,10,100,100),
button_in_group(20,20,60,30),
end(),
button_outside_group(10,120,60,30)
{}
\endcode
*/
class FL_EXPORT Fl_End {
public:
/** All it does is calling Fl_Group::current()->end() */
Fl_End() {Fl_Group::current()->end();}
};
#endif
//
// End of "$Id: Fl_Group.H 5993 2007-12-15 16:42:00Z mike $".
// End of "$Id: Fl_Group.H 6716 2009-03-24 01:40:44Z fabien $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Help_Dialog.H 5643 2007-01-28 19:36:51Z mike $"
// "$Id: Fl_Help_Dialog.H 6614 2009-01-01 16:11:32Z matt $"
//
// Fl_Help_Dialog dialog for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Help_Dialog widget . */
// generated by Fast Light User Interface Designer (fluid) version 1.0108
#ifndef Fl_Help_Dialog_H
@@ -74,8 +77,8 @@ public:
void resize(int xx, int yy, int ww, int hh);
void show();
void show(int argc, char **argv);
void textsize(uchar s);
uchar textsize();
void textsize(Fl_Fontsize s);
Fl_Fontsize textsize();
void topline(const char *n);
void topline(int n);
void value(const char *f);
@@ -88,5 +91,5 @@ public:
#endif
//
// End of "$Id: Fl_Help_Dialog.H 5643 2007-01-28 19:36:51Z mike $".
// End of "$Id: Fl_Help_Dialog.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,10 +1,10 @@
//
// "$Id: Fl_Help_View.H 5991 2007-12-15 16:08:23Z mike $"
// "$Id: Fl_Help_View.H 6743 2009-04-07 17:33:22Z AlbrechtS $"
//
// Help Viewer widget definitions.
//
// Copyright 1997-2005 by Easy Software Products.
// Image support donated by Matthias Melcher, Copyright 2000.
// Copyright 1997-2009 by Easy Software Products.
// Image support by Matthias Melcher, Copyright 2000-2009.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -26,6 +26,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Help_View widget . */
#ifndef Fl_Help_View_H
# define Fl_Help_View_H
@@ -69,69 +72,118 @@ struct Fl_Help_Block
//
// Fl_Help_Link structure...
//
/** Definition of a link for the html viewer. */
struct Fl_Help_Link
{
char filename[192], // Reference filename
name[32]; // Link target (blank if none)
int x, // X offset of link text
y, // Y offset of link text
w, // Width of link text
h; // Height of link text
char filename[192], ///< Reference filename
name[32]; ///< Link target (blank if none)
int x, ///< X offset of link text
y, ///< Y offset of link text
w, ///< Width of link text
h; ///< Height of link text
};
//
// Fl_Help_Target structure...
//
/*
* Fl_Help_View font stack opaque implementation
*/
/** Fl_Help_View font stack element definition. */
struct Fl_Help_Font_Style {
Fl_Font f; ///< Font
Fl_Fontsize s; ///< Font Size
Fl_Color c; ///< Font Color
void get(Fl_Font &afont, Fl_Fontsize &asize, Fl_Color &acolor) {afont=f; asize=s; acolor=c;} ///< Gets current font attributes
void set(Fl_Font afont, Fl_Fontsize asize, Fl_Color acolor) {f=afont; s=asize; c=acolor;} ///< Sets current font attributes
Fl_Help_Font_Style(Fl_Font afont, Fl_Fontsize asize, Fl_Color acolor) {set(afont, asize, acolor);}
Fl_Help_Font_Style(){} // For in table use
};
/** Fl_Help_View font stack definition. */
const size_t MAX_FL_HELP_FS_ELTS = 100;
struct Fl_Help_Font_Stack {
/** font stack construction, initialize attributes. */
Fl_Help_Font_Stack() {
nfonts_ = 0;
}
void init(Fl_Font f, Fl_Fontsize s, Fl_Color c) {
nfonts_ = 0;
elts_[nfonts_].set(f, s, c);
fl_font(f, s);
fl_color(c);
}
/** Gets the top (current) element on the stack. */
void top(Fl_Font &f, Fl_Fontsize &s, Fl_Color &c) { elts_[nfonts_].get(f, s, c); }
/** Pushes the font style triplet on the stack, also calls fl_font() & fl_color() adequately */
void push(Fl_Font f, Fl_Fontsize s, Fl_Color c) {
if (nfonts_ < MAX_FL_HELP_FS_ELTS-1) nfonts_ ++;
elts_[nfonts_].set(f, s, c);
fl_font(f, s); fl_color(c);
}
/** Pops from the stack the font style triplet and calls fl_font() & fl_color() adequately */
void pop(Fl_Font &f, Fl_Fontsize &s, Fl_Color &c) {
if (nfonts_ > 0) nfonts_ --;
top(f, s, c);
fl_font(f, s); fl_color(c);
}
/** Gets the current count of font style elements in the stack. */
size_t count() const {return nfonts_;} // Gets the current number of fonts in the stack
protected:
size_t nfonts_; ///< current number of fonts in stack
Fl_Help_Font_Style elts_[100]; ///< font elements
};
/** Fl_Help_Target structure */
struct Fl_Help_Target
{
char name[32]; // Target name
int y; // Y offset of target
char name[32]; ///< Target name
int y; ///< Y offset of target
};
//
// Fl_Help_View class...
//
class FL_EXPORT Fl_Help_View : public Fl_Group //// Help viewer widget
/**
The Fl_Help_View widget displays HTML text. Most HTML 2.0
elements are supported, as well as a primitive implementation of tables.
GIF, JPEG, and PNG images are displayed inline.
*/
class FL_EXPORT Fl_Help_View : public Fl_Group // Help viewer widget
{
enum { RIGHT = -1, CENTER, LEFT }; // Alignments
enum { RIGHT = -1, CENTER, LEFT }; ///< Alignments
char title_[1024]; // Title string
Fl_Color defcolor_, // Default text color
bgcolor_, // Background color
textcolor_, // Text color
linkcolor_; // Link color
uchar textfont_, // Default font for text
textsize_; // Default font size
const char *value_; // HTML text value
char title_[1024]; ///< Title string
Fl_Color defcolor_, ///< Default text color
bgcolor_, ///< Background color
textcolor_, ///< Text color
linkcolor_; ///< Link color
Fl_Font textfont_; ///< Default font for text
Fl_Fontsize textsize_; ///< Default font size
const char *value_; ///< HTML text value
Fl_Help_Font_Stack fstack_; ///< font stack management
int nblocks_, ///< Number of blocks/paragraphs
ablocks_; ///< Allocated blocks
Fl_Help_Block *blocks_; ///< Blocks
int nblocks_, // Number of blocks/paragraphs
ablocks_; // Allocated blocks
Fl_Help_Block *blocks_; // Blocks
Fl_Help_Func *link_; ///< Link transform function
int nfonts_; // Number of fonts in stack
uchar fonts_[100][2]; // Font stack
int nlinks_, ///< Number of links
alinks_; ///< Allocated links
Fl_Help_Link *links_; ///< Links
Fl_Help_Func *link_; // Link transform function
int ntargets_, ///< Number of targets
atargets_; ///< Allocated targets
Fl_Help_Target *targets_; ///< Targets
int nlinks_, // Number of links
alinks_; // Allocated links
Fl_Help_Link *links_; // Links
int ntargets_, // Number of targets
atargets_; // Allocated targets
Fl_Help_Target *targets_; // Targets
char directory_[1024]; // Directory for current file
char filename_[1024]; // Current filename
int topline_, // Top line in document
leftline_, // Lefthand position
size_, // Total document length
hsize_; // Maximum document width
Fl_Scrollbar scrollbar_, // Vertical scrollbar for document
hscrollbar_; // Horizontal scrollbar
char directory_[1024]; ///< Directory for current file
char filename_[1024]; ///< Current filename
int topline_, ///< Top line in document
leftline_, ///< Lefthand position
size_, ///< Total document length
hsize_, ///< Maximum document width
scrollbar_size_; ///< Size for both scrollbars
Fl_Scrollbar scrollbar_, ///< Vertical scrollbar for document
hscrollbar_; ///< Horizontal scrollbar
static int selection_first;
static int selection_last;
@@ -148,6 +200,12 @@ class FL_EXPORT Fl_Help_View : public Fl_Group //// Help viewer widget
static Fl_Color hv_selection_color;
static Fl_Color hv_selection_text_color;
void initfont(Fl_Font &f, Fl_Fontsize &s, Fl_Color &c) { f = textfont_; s = textsize_; c = textcolor_; fstack_.init(f, s, c); }
void pushfont(Fl_Font f, Fl_Fontsize s) {fstack_.push(f, s, textcolor_);}
void pushfont(Fl_Font f, Fl_Fontsize s, Fl_Color c) {fstack_.push(f, s, c);}
void popfont(Fl_Font &f, Fl_Fontsize &s, Fl_Color &c) {fstack_.pop(f, s, c);}
Fl_Help_Block *add_block(const char *s, int xx, int yy, int ww, int hh, uchar border = 0);
void add_link(const char *n, int xx, int yy, int ww, int hh);
void add_target(const char *n, int yy);
@@ -164,16 +222,6 @@ class FL_EXPORT Fl_Help_View : public Fl_Group //// Help viewer widget
int get_length(const char *l);
int handle(int);
void initfont(uchar &f, uchar &s) { nfonts_ = 0;
fl_font(f = fonts_[0][0] = textfont_,
s = fonts_[0][1] = textsize_); }
void pushfont(uchar f, uchar s) { if (nfonts_ < 99) nfonts_ ++;
fl_font(fonts_[nfonts_][0] = f,
fonts_[nfonts_][1] = s); }
void popfont(uchar &f, uchar &s) { if (nfonts_ > 0) nfonts_ --;
fl_font(f = fonts_[nfonts_][0],
s = fonts_[nfonts_][1]); }
void hv_draw(const char *t, int x, int y);
char begin_selection();
char extend_selection();
@@ -186,36 +234,105 @@ public:
Fl_Help_View(int xx, int yy, int ww, int hh, const char *l = 0);
~Fl_Help_View();
/** Returns the current directory for the text in the buffer. */
const char *directory() const { if (directory_[0]) return (directory_);
else return ((const char *)0); }
/** Returns the current filename for the text in the buffer. */
const char *filename() const { if (filename_[0]) return (filename_);
else return ((const char *)0); }
int find(const char *s, int p = 0);
/**
This method assigns a callback function to use when a link is
followed or a file is loaded (via Fl_Help_View::load()) that
requires a different file or path.
The callback function receives a pointer to the Fl_Help_View
widget and the URI or full pathname for the file in question.
It must return a pathname that can be opened as a local file or NULL:
\code
const char *fn(Fl_Widget *w, const char *uri);
\endcode
The link function can be used to retrieve remote or virtual
documents, returning a temporary file that contains the actual
data. If the link function returns NULL, the value of
the Fl_Help_View widget will remain unchanged.
If the link callback cannot handle the URI scheme, it should
return the uri value unchanged or set the value() of the widget
before returning NULL.
*/
void link(Fl_Help_Func *fn) { link_ = fn; }
int load(const char *f);
void resize(int,int,int,int);
/** Gets the size of the help view. */
int size() const { return (size_); }
void size(int W, int H) { Fl_Widget::size(W, H); }
/** Sets the default text color. */
void textcolor(Fl_Color c) { if (textcolor_ == defcolor_) textcolor_ = c; defcolor_ = c; }
/** Returns the current default text color. */
Fl_Color textcolor() const { return (defcolor_); }
void textfont(uchar f) { textfont_ = f; format(); }
uchar textfont() const { return (textfont_); }
void textsize(uchar s) { textsize_ = s; format(); }
uchar textsize() const { return (textsize_); }
/** Sets the default text font. */
void textfont(Fl_Font f) { textfont_ = f; format(); }
/** Returns the current default text font. */
Fl_Font textfont() const { return (textfont_); }
/** Sets the default text size. */
void textsize(Fl_Fontsize s) { textsize_ = s; format(); }
/** Gets the default text size. */
Fl_Fontsize textsize() const { return (textsize_); }
/** Returns the current document title, or NULL if there is no title. */
const char *title() { return (title_); }
void topline(const char *n);
void topline(int);
/** Returns the current top line in pixels. */
int topline() const { return (topline_); }
void leftline(int);
/** Gets the left position in pixels. */
int leftline() const { return (leftline_); }
void value(const char *v);
void value(const char *val);
/** Returns the current buffer contents. */
const char *value() const { return (value_); }
void clear_selection();
void select_all();
/**
Gets the current size of the scrollbars' troughs, in pixels.
If this value is zero (default), this widget will use the
Fl::scrollbar_size() value as the scrollbar's width.
\returns Scrollbar size in pixels, or 0 if the global Fl::scrollbar_size() is being used.
\see Fl::scrollbar_size(int)
*/
int scrollbar_size() const {
return(scrollbar_size_);
}
/**
Sets the pixel size of the scrollbars' troughs to the \p size, in pixels.
Normally you should not need this method, and should use
Fl::scrollbar_size(int) instead to manage the size of ALL
your widgets' scrollbars. This ensures your application
has a consistent UI, is the default behavior, and is normally
what you want.
Only use THIS method if you really need to override the global
scrollbar size. The need for this should be rare.
Setting \p size to the special value of 0 causes the widget to
track the global Fl::scrollbar_size(), which is the default.
\param[in] size Sets the scrollbar size in pixels.\n
If 0 (default), scrollbar size tracks the global Fl::scrollbar_size()
\see Fl::scrollbar_size()
*/
void scrollbar_size(int size) {
scrollbar_size_ = size;
}
};
#endif // !Fl_Help_View_H
//
// End of "$Id: Fl_Help_View.H 5991 2007-12-15 16:08:23Z mike $".
// End of "$Id: Fl_Help_View.H 6743 2009-04-07 17:33:22Z AlbrechtS $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Hold_Browser.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Hold_Browser.H 6614 2009-01-01 16:11:32Z matt $"
//
// Hold browser header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,19 +25,37 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Hold_Browser widget . */
#ifndef Fl_Hold_Browser_H
#define Fl_Hold_Browser_H
#include "Fl_Browser.H"
/**
The Fl_Hold_Browser is a subclass of Fl_Browser
which lets the user select a single item, or no items by clicking on
the empty space. As long as the mouse button is held down the item
pointed to by it is highlighted, and this highlighting remains on when
the mouse button is released. Normally the callback is done when the
user releases the mouse, but you can change this with when().
<P>See Fl_Browser for methods to add and remove lines from the browser.
*/
class Fl_Hold_Browser : public Fl_Browser {
public:
Fl_Hold_Browser(int X,int Y,int W,int H,const char *l=0)
/**
Creates a new Fl_Hold_Browser widget using the given
position, size, and label string. The default boxtype is FL_DOWN_BOX.
The constructor specializes Fl_Browser() by setting the type to FL_HOLD_BROWSER.
The destructor destroys the widget and frees all memory that has been allocated.
*/
Fl_Hold_Browser(int X,int Y,int W,int H,const char *l=0)
: Fl_Browser(X,Y,W,H,l) {type(FL_HOLD_BROWSER);}
};
#endif
//
// End of "$Id: Fl_Hold_Browser.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Hold_Browser.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Hor_Fill_Slider.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Hor_Fill_Slider.H 6614 2009-01-01 16:11:32Z matt $"
//
// Horizontal fill slider header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -24,6 +24,10 @@
//
// http://www.fltk.org/str.php
//
/* \file
Fl_Hor_Fill_Slider widget . */
#ifndef Fl_Hor_Fill_Slider_H
#define Fl_Hor_Fill_Slider_H
@@ -38,5 +42,5 @@ public:
#endif
//
// End of "$Id: Fl_Hor_Fill_Slider.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Hor_Fill_Slider.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Hor_Nice_Slider.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Hor_Nice_Slider.H 6614 2009-01-01 16:11:32Z matt $"
//
// Horizontal "nice" slider header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Hor_Nice_Slider widget . */
#ifndef Fl_Hor_Nice_Slider_H
#define Fl_Hor_Nice_Slider_H
@@ -39,5 +42,5 @@ public:
#endif
//
// End of "$Id: Fl_Hor_Nice_Slider.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Hor_Nice_Slider.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Hor_Slider.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Hor_Slider.H 6614 2009-01-01 16:11:32Z matt $"
//
// Horizontal slider header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Hor_Slider widget . */
#ifndef Fl_Hor_Slider_H
#define Fl_Hor_Slider_H
@@ -39,5 +42,5 @@ public:
#endif
//
// End of "$Id: Fl_Hor_Slider.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Hor_Slider.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Hor_Value_Slider.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Hor_Value_Slider.H 6614 2009-01-01 16:11:32Z matt $"
//
// Horizontal value slider header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Hor_Value_Slider widget . */
#ifndef Fl_Hor_Value_Slider_H
#define Fl_Hor_Value_Slider_H
@@ -39,5 +42,5 @@ public:
#endif
//
// End of "$Id: Fl_Hor_Value_Slider.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Hor_Value_Slider.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Image.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Image.H 6614 2009-01-01 16:11:32Z matt $"
//
// Image header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Image, Fl_RGB_Image classes . */
#ifndef Fl_Image_H
# define Fl_Image_H
@@ -34,6 +37,17 @@ class Fl_Widget;
struct Fl_Menu_Item;
struct Fl_Label;
/**
Fl_Image is the base class used for caching and
drawing all kinds of images in FLTK. This class keeps track of
common image data such as the pixels, colormap, width, height,
and depth. Virtual methods are used to provide type-specific
image handling.</P>
<P>Since the Fl_Image class does not support image
drawing by itself, calling the draw() method results in
a box with an X in it being drawn instead.
*/
class FL_EXPORT Fl_Image {
int w_, h_, d_, ld_, count_;
const char * const *data_;
@@ -44,10 +58,34 @@ class FL_EXPORT Fl_Image {
protected:
/**
The first form of the w() method returns the current
image width in pixels.</P>
<P>The second form is a protected method that sets the current
image width.
*/
void w(int W) {w_ = W;}
/**
The first form of the h() method returns the current
image height in pixels.</P>
<P>The second form is a protected method that sets the current
image height.
*/
void h(int H) {h_ = H;}
/**
The first form of the d() method returns the current
image depth. The return value will be 0 for bitmaps, 1 for
pixmaps, and 1 to 4 for color images.</P>
<P>The second form is a protected method that sets the current
image depth.
*/
void d(int D) {d_ = D;}
/** See int ld() */
void ld(int LD) {ld_ = LD;}
/** See const char * const *data() */
void data(const char * const *p, int c) {data_ = p; count_ = c;}
void draw_empty(int X, int Y);
@@ -56,27 +94,99 @@ class FL_EXPORT Fl_Image {
public:
/** See void Fl_Image::w(int) */
int w() const {return w_;}
/** See void Fl_Image::h(int) */
int h() const {return h_;}
/**
The first form of the d() method returns the current
image depth. The return value will be 0 for bitmaps, 1 for
pixmaps, and 1 to 4 for color images.</P>
<P>The second form is a protected method that sets the current
image depth.
*/
int d() const {return d_;}
/**
The first form of the ld() method returns the current
line data size in bytes. Line data is extra data that is included
after each line of color image data and is normally not present.</P>
<P>The second form is a protected method that sets the current
line data size in bytes.
*/
int ld() const {return ld_;}
/**
The count() method returns the number of data values
associated with the image. The value will be 0 for images with
no associated data, 1 for bitmap and color images, and greater
than 2 for pixmap images.
*/
int count() const {return count_;}
/**
The first form of the data() method returns a
pointer to the current image data array. Use the
count() method to find the size of the data array.</P>
<P>The second form is a protected method that sets the current
array pointer and count of pointers in the array.
*/
const char * const *data() const {return data_;}
/**
The constructor creates an empty image with the specified
width, height, and depth. The width and height are in pixels.
The depth is 0 for bitmaps, 1 for pixmap (colormap) images, and
1 to 4 for color images.
*/
Fl_Image(int W, int H, int D) {w_ = W; h_ = H; d_ = D; ld_ = 0; count_ = 0; data_ = 0;}
virtual ~Fl_Image();
virtual Fl_Image *copy(int W, int H);
/**
The copy() method creates a copy of the specified
image. If the width and height are provided, the image is
resized to the specified size. The image should be deleted (or in
the case of Fl_Shared_Image, released) when you are done
with it.
*/
Fl_Image *copy() { return copy(w(), h()); }
virtual void color_average(Fl_Color c, float i);
/**
The inactive() method calls
color_average(FL_BACKGROUND_COLOR, 0.33f) to produce
an image that appears grayed out. <I>This method does not
alter the original image data.</I>
*/
void inactive() { color_average(FL_GRAY, .33f); }
virtual void desaturate();
virtual void label(Fl_Widget*w);
virtual void label(Fl_Menu_Item*m);
virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0);
void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);}
/**
The draw() methods draw the image. This form specifies
a bounding box for the image, with the origin
(upper-lefthand corner) of the image offset by the cx
and cy arguments.
*/
virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0); // platform dependent
/**
The draw() methods draw the image. This form
specifies the upper-lefthand corner of the image
*/
void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);} // platform dependent
virtual void uncache();
};
/**
The Fl_RGB_Image class supports caching and drawing
of full-color images with 1 to 4 channels of color information.
Images with an even number of channels are assumed to contain
alpha information, which is used to blend the image with the
contents of the screen.</P>
<P>Fl_RGB_Image is defined in
&lt;FL/Fl_Image.H&gt;, however for compatibility reasons
&lt;FL/Fl_RGB_Image.H&gt; should be included.
*/
class FL_EXPORT Fl_RGB_Image : public Fl_Image {
public:
@@ -90,7 +200,7 @@ class FL_EXPORT Fl_RGB_Image : public Fl_Image {
unsigned id; // for internal use
unsigned mask; // for internal use (mask bitmap)
#endif // __APPLE__ || WIN32
/** The constructor creates a new image from the specified data. */
Fl_RGB_Image(const uchar *bits, int W, int H, int D=3, int LD=0) :
Fl_Image(W,H,D), array(bits), alloc_array(0), id(0), mask(0) {data((const char **)&array, 1); ld(LD);}
virtual ~Fl_RGB_Image();
@@ -108,5 +218,5 @@ class FL_EXPORT Fl_RGB_Image : public Fl_Image {
#endif // !Fl_Image_H
//
// End of "$Id: Fl_Image.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Image.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Input.H 5300 2006-08-14 07:06:45Z matt $"
// "$Id: Fl_Input.H 6699 2009-03-18 22:58:12Z engelsman $"
//
// Input header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,17 +25,232 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Input widget . */
#ifndef Fl_Input_H
#define Fl_Input_H
#include "Fl_Input_.H"
/**
This is the FLTK text input widget. It displays a single line
of text and lets the user edit it. Normally it is drawn with an
inset box and a white background. The text may contain any
characters (even 0), and will correctly display anything, using
^X notation for unprintable control characters and \\nnn notation
for unprintable characters with the high bit set. It assumes the
font can draw any characters in the ISO-8859-1 character set.</P>
<CENTER><TABLE border=1 WIDTH=90% summary="Fl_Input keyboard and mouse bindings.">
<TR><TD WIDTH=200><B>Mouse button 1</B></TD><TD>Moves the cursor to
this point. Drag selects characters. Double click selects words.
Triple click selects all text. Shift+click extends the selection.
When you select text it is automatically copied to the clipboard.
</TD></TR>
<TR><TD><B>Mouse button 2</B></TD><TD>Insert the clipboard at
the point clicked. You can also select a region and replace it with the
clipboard by selecting the region with mouse button 2.
</TD></TR>
<TR><TD><B>Mouse button 3</B></TD><TD>Currently acts like button 1.</TD></TR>
<TR><TD><B>Backspace</B></TD><TD>Deletes one character to the left, or
deletes the selected region.</TD></TR>
<TR><TD><B>Enter</B></TD><TD>May cause the callback, see when().</TD></TR>
<TR><TD><B>^A or Home</B></TD><TD>Go to start of line.</TD></TR>
<TR><TD><B>^B or Left</B></TD><TD>Move left</TD></TR>
<TR><TD><B>^C</B></TD><TD>Copy the selection to the clipboard</TD></TR>
<TR><TD><B>^D or Delete</B></TD><TD>Deletes one character to the right
or deletes the selected region.</TD></TR>
<TR><TD><B>^E or End</B></TD><TD>Go to the end of line.</TD></TR>
<TR><TD><B>^F or Right</B></TD><TD>Move right</TD></TR>
<TR><TD><B>^K</B></TD><TD>Delete to the end of line (next \\n character)
or deletes a single \\n character. These deletions are all concatenated
into the clipboard.</TD></TR>
<TR><TD><B>^N or Down</B></TD><TD>Move down (for Fl_Multiline_Input
only, otherwise it moves to the next input field).</TD></TR>
<TR><TD><B>^P or Up</B></TD><TD>Move up (for Fl_Multiline_Input only,
otherwise it moves to the previous input field).</TD></TR>
<TR><TD><B>^U</B></TD><TD>Delete everything.</TD></TR>
<TR><TD><B>^V or ^Y</B></TD><TD>Paste the clipboard</TD></TR>
<TR><TD><B>^X or ^W</B></TD><TD>Copy the region to the clipboard and
delete it.</TD></TR>
<TR><TD><B>^Z or ^_</B></TD><TD>Undo. This is a single-level undo
mechanism, but all adjacent deletions and insertions are concatenated
into a single "undo". Often this will undo a lot more than you
expected.</TD></TR>
<TR><TD><B>Shift+move</B></TD><TD>Move the cursor but also extend the
selection.</TD></TR>
<TR><TD><B>RightCtrl or
<BR>Compose</B></TD><TD>
\anchor Fl_Input_Compose_Character
Start a compose-character
sequence. The next one or two keys typed define the character to
insert (see table that follows.)
<p>For instance, to type "<22>" type [compose][a]['] or [compose]['][a].
<P>The character "nbsp" (non-breaking space) is typed by using
[compose][space].
<P>The single-character sequences may be followed by a space if
necessary to remove ambiguity. For instance, if you really want to
type "<22>~" rather than "<22>" you must type [compose][a][space][~].
<p>The same key may be used to "quote" control characters into the
text. If you need a ^Q character you can get one by typing
[compose][Control+Q].
<p>X may have a key on the keyboard
defined as XK_Multi_key. If so this key may be used as well
as the right-hand control key. You can set this up with the program
xmodmap.
<p>If your keyboard is set to support a foreign language you should
also be able to type "dead key" prefix characters. On X you will
actually be able to see what dead key you typed, and if you then move
the cursor without completing the sequence the accent will remain
inserted.</TD></TR>
</TABLE></CENTER>
<!-- NEW PAGE -->
<center><table border=1 summary="Character Composition Table">
<caption align="top">Character Composition Table</caption>
<tr>
<th>Keys</th><th>Char</th>
<th>Keys</th><th>Char</th>
<th>Keys</th><th>Char</th>
<th>Keys</th><th>Char</th>
<th>Keys</th><th>Char</th>
<th>Keys</th><th>Char</th>
</tr><tr>
<td align=center>sp</td><td align=center><small>nbsp</small></td>
<td align=center>*</td><td align=center><3E></td>
<td align=center>` A</td><td align=center><3E></td>
<td align=center>D -</td><td align=center><3E></td>
<td align=center>` a</td><td align=center><3E></td>
<td align=center>d -</td><td align=center><3E></td>
</tr><tr>
<td align=center>!</td><td align=center><3E></td>
<td align=center>+ -</td><td align=center><3E></td>
<td align=center>' A</td><td align=center><3E></td>
<td align=center>~ N</td><td align=center><3E></td>
<td align=center>' a</td><td align=center><3E></td>
<td align=center>~ n</td><td align=center><3E></td>
</tr><tr>
<td align=center>%</td><td align=center><3E></td>
<td align=center>2</td><td align=center><3E></td>
<td align=center>A ^</td><td align=center><3E></td>
<td align=center>` O</td><td align=center><3E></td>
<td align=center>^ a</td><td align=center><3E></td>
<td align=center>` o</td><td align=center><3E></td>
</tr><tr>
<td align=center>#</td><td align=center><3E></td>
<td align=center>3</td><td align=center><3E></td>
<td align=center>~ A</td><td align=center><3E></td>
<td align=center>' O</td><td align=center><3E></td>
<td align=center>~ a</td><td align=center><3E></td>
<td align=center>' o</td><td align=center><3E></td>
</tr><tr>
<td align=center>$</td><td align=center><3E></td>
<td align=center>'</td><td align=center><3E></td>
<td align=center>: A</td><td align=center><3E></td>
<td align=center>^ O</td><td align=center><3E></td>
<td align=center>: a</td><td align=center><3E></td>
<td align=center>^ o</td><td align=center><3E></td>
</tr><tr>
<td align=center>y =</td><td align=center><3E></td>
<td align=center>u</td><td align=center><3E></td>
<td align=center>* A</td><td align=center><3E></td>
<td align=center>~ O</td><td align=center><3E></td>
<td align=center>* a</td><td align=center><3E></td>
<td align=center>~ o</td><td align=center><3E></td>
</tr><tr>
<td align=center>|</td><td align=center><3E></td>
<td align=center>p</td><td align=center><3E></td>
<td align=center>A E</td><td align=center><3E></td>
<td align=center>: O</td><td align=center><3E></td>
<td align=center>a e</td><td align=center><3E></td>
<td align=center>: o</td><td align=center><3E></td>
</tr><tr>
<td align=center>&</td><td align=center><3E></td>
<td align=center>.</td><td align=center><3E></td>
<td align=center>, C</td><td align=center><3E></td>
<td align=center>x</td><td align=center><3E></td>
<td align=center>, c</td><td align=center><3E></td>
<td align=center>- :</td><td align=center><3E></td>
</tr><tr>
<td align=center>:</td><td align=center><3E></td>
<td align=center>,</td><td align=center><3E></td>
<td align=center>E `</td><td align=center><3E></td>
<td align=center>O /</td><td align=center><3E></td>
<td align=center>` e</td><td align=center><3E></td>
<td align=center>o /</td><td align=center><3E></td>
</tr><tr>
<td align=center>c</td><td align=center><3E></td>
<td align=center>1</td><td align=center><3E></td>
<td align=center>' E</td><td align=center><3E></td>
<td align=center>` U</td><td align=center><3E></td>
<td align=center>' e</td><td align=center><3E></td>
<td align=center>` u</td><td align=center><3E></td>
</tr><tr>
<td align=center>a</td><td align=center><3E></td>
<td align=center>o</td><td align=center><3E></td>
<td align=center>^ E</td><td align=center><3E></td>
<td align=center>' U</td><td align=center><3E></td>
<td align=center>^ e</td><td align=center><3E></td>
<td align=center>' u</td><td align=center><3E></td>
</tr><tr>
<td align=center>&lt; &lt;</td><td align=center><3E></td>
<td align=center>&gt; &gt;</td><td align=center><3E></td>
<td align=center>: E</td><td align=center><3E></td>
<td align=center>^ U</td><td align=center><3E></td>
<td align=center>: e</td><td align=center><3E></td>
<td align=center>^ u</td><td align=center><3E></td>
</tr><tr>
<td align=center>~</td><td align=center><3E></td>
<td align=center>1 4</td><td align=center><3E></td>
<td align=center>` I</td><td align=center><3E></td>
<td align=center>: U</td><td align=center><3E></td>
<td align=center>` i</td><td align=center><3E></td>
<td align=center>: u</td><td align=center><3E></td>
</tr><tr>
<td align=center>-</td><td align=center><3E></td>
<td align=center>1 2</td><td align=center><3E></td>
<td align=center>' I</td><td align=center><3E></td>
<td align=center>' Y</td><td align=center><3E></td>
<td align=center>' i</td><td align=center><3E></td>
<td align=center>' y</td><td align=center><3E></td>
</tr><tr>
<td align=center>r</td><td align=center><3E></td>
<td align=center>3 4</td><td align=center><3E></td>
<td align=center>^ I</td><td align=center><3E></td>
<td align=center>T H</td><td align=center><3E></td>
<td align=center>^ i</td><td align=center><3E></td>
<td align=center>t h</td><td align=center><3E></td>
</tr><tr>
<td align=center>_</td><td align=center><3E></td>
<td align=center>?</td><td align=center><3E></td>
<td align=center>: I</td><td align=center><3E></td>
<td align=center>s s</td><td align=center><3E></td>
<td align=center>: i</td><td align=center><3E></td>
<td align=center>: y</td><td align=center><3E></td>
</tr>
</table></center>
*/
class FL_EXPORT Fl_Input : public Fl_Input_ {
int handle_key();
int shift_position(int p);
int shift_up_down_position(int p);
public:
void handle_mouse(int keepmark=0);
protected:
void draw();
public:
int handle(int);
Fl_Input(int,int,int,int,const char * = 0);
};
@@ -43,5 +258,5 @@ public:
#endif
//
// End of "$Id: Fl_Input.H 5300 2006-08-14 07:06:45Z matt $".
// End of "$Id: Fl_Input.H 6699 2009-03-18 22:58:12Z engelsman $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Input_.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Input_.H 6777 2009-04-23 15:32:19Z matt $"
//
// Input base class header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Input_ widget . */
#ifndef Fl_Input__H
#define Fl_Input__H
@@ -46,100 +49,406 @@
#define FL_MULTILINE_INPUT_WRAP (FL_MULTILINE_INPUT | FL_INPUT_WRAP)
#define FL_MULTILINE_OUTPUT_WRAP (FL_MULTILINE_INPUT | FL_INPUT_READONLY | FL_INPUT_WRAP)
/**
This class provides a low-overhead text input field.
This is a virtual base class below Fl_Input. It has all
the same interfaces, but lacks the handle() and
draw() method. You may want to subclass it if you are
one of those people who likes to change how the editing keys
work. It may also be useful for adding scrollbars
to the input field.
This can act like any of the subclasses of Fl_Input, by
setting type() to one of the following values:
\code
#define FL_NORMAL_INPUT 0
#define FL_FLOAT_INPUT 1
#define FL_INT_INPUT 2
#define FL_MULTILINE_INPUT 4
#define FL_SECRET_INPUT 5
#define FL_INPUT_TYPE 7
#define FL_INPUT_READONLY 8
#define FL_NORMAL_OUTPUT (FL_NORMAL_INPUT | FL_INPUT_READONLY)
#define FL_MULTILINE_OUTPUT (FL_MULTILINE_INPUT | FL_INPUT_READONLY)
#define FL_INPUT_WRAP 16
#define FL_MULTILINE_INPUT_WRAP (FL_MULTILINE_INPUT | FL_INPUT_WRAP)
#define FL_MULTILINE_OUTPUT_WRAP (FL_MULTILINE_INPUT | FL_INPUT_READONLY | FL_INPUT_WRAP)
\endcode
All variables that represent an index into a text buffer are byte-oriented,
not character oriented. Since utf8 characters can be up to six bytes long,
simply incrementing such an index will not reliably advance to the next character
in the text buffer.
Indices and pointers into the text buffer shoudl always point at an 7 bit ASCII
character or the beginning of a utf8 character sequence. Behavior for false
utf8 sequences and pointers into the middle of a seqeunce are undefined.
\see Fl_Text_Display, Fl_Text_Editor for more powerful text handling widgets
\internal
When porting this widget from ASCII to UTF8, previously legal pointers into
the text of this widget can become illegal by pointing into the middle of
a UTF8 seuence. This is not a big problem for Fl_Input_ because all code
in this module is quite tolerant. It could be problematic though when deriving
from this class because no feedback for illegal pointers is given. Additionaly,
a careless "copy" call can put partial UTF8 sequnces into the clipboard.
None of these issues should be desasterous. Nevertheless, we should
discuss how FLTK should handle false UTF8 suequences and pointers.
*/
class FL_EXPORT Fl_Input_ : public Fl_Widget {
/** \internal Storage for the text field. */
const char* value_;
/** \internal Buffer memory for expanded text. \see expand() */
char* buffer;
/** \internal Size of text in bytes in the \p value_ field. */
int size_;
/** \internal \todo Please document me! */
int bufsize;
/** \internal Positin of the cursor in the document */
int position_;
/** \internal Position of the other and of the selected text. If \p position_ equals
\p mark_, no text is selected */
int mark_;
/** \internal Offset to text origin within wdget bounds */
int xscroll_, yscroll_;
/** \internal Minimal update pointer. Display requirs redraw from here to the end
of the buffer. */
int mu_p;
/** \internal Maximum size of buffer. \todo Is this really needed? */
int maximum_size_;
/** \internal Shorcut key that will get this widget the focus. */
int shortcut_;
/** \internal This is set if no text but only the cursor needs updating. */
uchar erase_cursor_only;
uchar textfont_;
uchar textsize_;
/** \internal The font used for the entire text. */
Fl_Font textfont_;
/** \internal Height of the font used for the entire text. */
Fl_Fontsize textsize_;
/** \internal color of the entire text */
unsigned textcolor_;
/** \internal color of the text cursor */
unsigned cursor_color_;
/** \internal Horizontal cursor position in pixels while movin up or down. */
static double up_down_pos;
/** \internal Flag to remeber last cursor move. */
static int was_up_down;
/* Convert a given text segment into the text that will be rendered on screen. */
const char* expand(const char*, char*) const;
/* Calculates the width in pixels of part of a text buffer. */
double expandpos(const char*, const char*, const char*, int*) const;
/* Mark a range of characters for update. */
void minimal_update(int, int);
/* Mark a range of characters for update. */
void minimal_update(int p);
/* Copy the value from a possibly static entry into the internal buffer. */
void put_in_buffer(int newsize);
/* Set the current font and font size. */
void setfont() const;
protected:
/* Finds the start of a word. */
int word_start(int i) const;
/* Finds the end of a word. */
int word_end(int i) const;
/* Finds the start of a line. */
int line_start(int i) const;
/* Finds the end of a line. */
int line_end(int i) const;
/* Draw the text in the passed bounding box. */
void drawtext(int, int, int, int);
/* Move the cursor to the column given by up_down_pos. */
int up_down_position(int, int keepmark=0);
/* Handle mouse clicks and mose moves. */
void handle_mouse(int, int, int, int, int keepmark=0);
/* Handle all kinds of text field related events. */
int handletext(int e, int, int, int, int);
/* Check the when() field and do a callback if indicated. */
void maybe_do_callback();
/** \internal Horizontal offset of text to left edge of widget. */
int xscroll() const {return xscroll_;}
/** \internal Vertical offset of text to top edge of widget. */
int yscroll() const {return yscroll_;}
/* Return the number of lines displayed on a single page. */
int linesPerPage();
public:
/* Change the size of the widget. */
void resize(int, int, int, int);
/* Creator */
Fl_Input_(int, int, int, int, const char* = 0);
/* Destructor */
~Fl_Input_();
/* Changes the widget text. */
int value(const char*);
/* Changes the widget text. */
int value(const char*, int);
/* Changes the widget text. */
int static_value(const char*);
/* Changes the widget text. */
int static_value(const char*, int);
/**
Returns the text displayed in the widget.
This function returns the current value, which is a pointer
to the internal buffer and is valid only until the next event is
handled.
\return pointer to an internal buffer - do not free() this
\see Fl_Input_::value(const char*)
*/
const char* value() const {return value_;}
char index(int i) const {return value_[i];}
/* Returns the character at index \p i. */
Fl_Char index(int i) const;
/**
Returns the number of bytes in value().
This may be greater than <tt>strlen(value())</tt> if there are
\c nul characters in the text.
\return number of bytes in the text
*/
int size() const {return size_;}
/** Sets the width and height of this widget.
\param [in] W, H new width and height
\see Fl_Widget::size(int, int) */
void size(int W, int H) { Fl_Widget::size(W, H); }
/** Gets the maximum length of the input field.
\todo It is not clear if this function is actually required */
int maximum_size() const {return maximum_size_;}
/** Sets the maximum length of the input field.
\todo It is not clear if this function is actually required */
void maximum_size(int m) {maximum_size_ = m;}
/** Gets the position of the text cursor.
\return the cursor position as an index
\see position(int, int)
*/
int position() const {return position_;}
/** Gets the current selection mark.
\return index into the text */
int mark() const {return mark_;}
/* Sets the index for the cursor and mark. */
int position(int p, int m);
/** Set the cursor position and mark.
position(n) is the same as <tt>position(n, n)</tt>.
\param p new index for cursor and mark
\return 0 if no positions changed
\see position(int, int), position(), mark(int)
*/
int position(int p) {return position(p, p);}
/** Sets the current selection mark.
mark(n) is the same as <tt>position(position(),n)</tt>.
\param m new index of the mark
\return 0 if the mark did not change
\see position(), position(int, int) */
int mark(int m) {return position(position(), m);}
/* Deletes text from b to e and inserts the new string text. */
int replace(int, int, const char*, int=0);
/**
Deletes the current selection.
This function deletes the currently selected text
\e without storing it in the clipboard. To use the clipboard,
you may call copy() first or copy_cuts() after
this call.
\return 0 if no data was copied
*/
int cut() {return replace(position(), mark(), 0);}
/**
Deletes the next \p n bytes rounded to characters before or after the cursor.
This function deletes the currently selected text
\e without storing it in the clipboard. To use the clipboard,
you may call copy() first or copy_cuts() after
this call.
\param n number of bytes rounded to full characters and clamped to the buffer.
A negative number will cut characters to the left of the cursor.
\return 0 if no data was copied
*/
int cut(int n) {return replace(position(), position()+n, 0);}
/**
Deletes all characters between index \p a and \p b.
This function deletes the currently selected text
\e without storing it in the clipboard. To use the clipboard,
you may call copy() first or copy_cuts() after
this call.
\param a, b range of bytes rounded to full characters and clamped to the buffer
\return 0 if no data was copied
*/
int cut(int a, int b) {return replace(a, b, 0);}
/**
Inserts text at the cursor position.
This function inserts the string in \p t at the cursor
position() and moves the new position and mark to
the end of the inserted text.
\param [in] t text that will be inserted
\param [in] l length of text, or 0 if the string is terminated by \c nul.
\return 0 if no text was inserted
*/
int insert(const char* t, int l=0){return replace(position_, mark_, t, l);}
/* Put the current selection into the clipboard. */
int copy(int clipboard);
/* Undo previous changes to the text buffer. */
int undo();
/* Copy the yank buffer to the clipboard. */
int copy_cuts();
Fl_Font textfont() const {return (Fl_Font)textfont_;}
void textfont(uchar s) {textfont_ = s;}
uchar textsize() const {return textsize_;}
void textsize(uchar s) {textsize_ = s;}
/** Return the shortcut key associtaed with this widget.
\return shortcut keystroke
\see Fl_Button::shortcut() */
int shortcut() const {return shortcut_;}
/**
Sets the shortcut key associtaed with this widget.
Pressing the shortcut key gives text editing focus to this widget.
\param [in] s new shortcut keystroke
\see Fl_Button::shortcut()
*/
void shortcut(int s) {shortcut_ = s;}
/** Gets the font of the text in the input field.
\return the current Fl_Font index */
Fl_Font textfont() const {return textfont_;}
/** Sets the font of the text in the input field.
The text font defaults to \c FL_HELVETICA.
\param [in] s the new text font */
void textfont(Fl_Font s) {textfont_ = s;}
/** Gets the size of the text in the input field.
\return the text height in pixels */
Fl_Fontsize textsize() const {return textsize_;}
/** Sets the size of the text in the input field.
The text height defaults to \c FL_NORMAL_SIZE.
\param [in] s the new font height in pixel units */
void textsize(Fl_Fontsize s) {textsize_ = s;}
/** Gets the color of the text in the input field.
\return the text color
\see textcolor(unsigned) */
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
/** Sets the color of the text in the input field.
The text color defaults to \c FL_FOREGROUND_COLOR.
\param [in] n new text color
\see textcolor() */
void textcolor(unsigned n) {textcolor_ = n;}
/** Gets the color of the cursor.
\return the current cursor color */
Fl_Color cursor_color() const {return (Fl_Color)cursor_color_;}
/** Sets the color of the cursor.
The default color for the cursor is \c FL_BLACK.
\param [in] n the new cursor color */
void cursor_color(unsigned n) {cursor_color_ = n;}
/** Gets the input field type.
\return the current input type */
int input_type() const {return type() & FL_INPUT_TYPE; }
/** Sets the input field type.
A redraw() is required to reformat the input field.
\param [in] t new input type */
void input_type(int t) { type((uchar)(t | readonly())); }
/** Gets the read-only state of the input field.
\return non-zero if this widget is read-only */
int readonly() const { return type() & FL_INPUT_READONLY; }
/** Sets the read-only state of the input field.
\param [in] b if \p b is 0, the text in this widget can be edited by the user */
void readonly(int b) { if (b) type((uchar)(type() | FL_INPUT_READONLY));
else type((uchar)(type() & ~FL_INPUT_READONLY)); }
/**
Gets the word wrapping state of the input field.
Word wrap is only functional with multi-line input fields.
*/
int wrap() const { return type() & FL_INPUT_WRAP; }
/**
Sets the word wrapping state of the input field.
Word wrap is only functional with multi-line input fields.
*/
void wrap(int b) { if (b) type((uchar)(type() | FL_INPUT_WRAP));
else type((uchar)(type() & ~FL_INPUT_WRAP)); }
};
#endif
//
// End of "$Id: Fl_Input_.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Input_.H 6777 2009-04-23 15:32:19Z matt $".
//

View File

@@ -1,5 +1,5 @@
//
// "$Id$"
// "$Id: Fl_Input_Choice.H 6614 2009-01-01 16:11:32Z matt $"
//
// An input/chooser widget.
// ______________ ____
@@ -7,7 +7,7 @@
// | input area || \/ |
// |______________||____|
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
// Copyright 2004 by Greg Ercolano.
//
// This library is free software; you can redistribute it and/or
@@ -30,6 +30,11 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Input_Choice widget . */
#ifndef Fl_Input_Choice_H
#define Fl_Input_Choice_H
@@ -40,6 +45,17 @@
#include <FL/fl_draw.H>
#include <string.h>
/**
A combination of the input widget and a menu button.
The user can either type into the input area, or use the
menu button chooser on the right, which loads the input area
with predefined text. Normally it is drawn with an inset box
and a white background.
<P>
The application can directly access both the input and menu
widgets directly, using the menubutton()
and input() accessor methods.
*/
class Fl_Input_Choice : public Fl_Group {
// Private class to handle slightly 'special' behavior of menu button
class InputMenuButton : public Fl_Menu_Button {
@@ -112,6 +128,11 @@ class Fl_Input_Choice : public Fl_Group {
inline int menu_h() { return(h() - Fl::box_dh(box())); }
public:
/**
Creates a new Fl_Input_Choice widget using the given position, size,
and label string.
<P> Inherited destructor Destroys the widget and any value associated with it.
*/
Fl_Input_Choice (int x,int y,int w,int h,const char*l=0) : Fl_Group(x,y,w,h,l) {
Fl_Group::box(FL_DOWN_BOX);
align(FL_ALIGN_LEFT); // default like Fl_Input
@@ -126,12 +147,10 @@ public:
menu_->box(FL_FLAT_BOX); // cosmetic
end();
}
void add(const char *s) {
menu_->add(s);
}
int changed() const {
return inp_->changed() | Fl_Widget::changed();
}
/** Adds an item to the menu.*/
void add(const char *s) { menu_->add(s); }
int changed() const { return inp_->changed() | Fl_Widget::changed();}
void clear_changed() {
inp_->clear_changed();
Fl_Widget::clear_changed();
@@ -140,60 +159,58 @@ public:
inp_->set_changed();
// no need to call Fl_Widget::set_changed()
}
void clear() {
menu_->clear();
}
Fl_Boxtype down_box() const {
return (menu_->down_box());
}
void down_box(Fl_Boxtype b) {
menu_->down_box(b);
}
const Fl_Menu_Item *menu() {
return (menu_->menu());
}
void menu(const Fl_Menu_Item *m) {
menu_->menu(m);
}
/** Removes all items from the menu. */
void clear() { menu_->clear(); }
/** Gets the box type of the menu button */
Fl_Boxtype down_box() const { return (menu_->down_box()); }
/** Sets the box type of the menu button */
void down_box(Fl_Boxtype b) { menu_->down_box(b); }
/** Gets the Fl_Menu_Item array used for the menu. */
const Fl_Menu_Item *menu() { return (menu_->menu()); }
/** Sets the Fl_Menu_Item array used for the menu. */
void menu(const Fl_Menu_Item *m) { menu_->menu(m); }
void resize(int X, int Y, int W, int H) {
Fl_Group::resize(X,Y,W,H);
inp_->resize(inp_x(), inp_y(), inp_w(), inp_h());
menu_->resize(menu_x(), menu_y(), menu_w(), menu_h());
}
Fl_Color textcolor() const {
return (inp_->textcolor());
}
void textcolor(Fl_Color c) {
inp_->textcolor(c);
}
uchar textfont() const {
return (inp_->textfont());
}
void textfont(uchar f) {
inp_->textfont(f);
}
uchar textsize() const {
return (inp_->textsize());
}
void textsize(uchar s) {
inp_->textsize(s);
}
const char* value() const {
return (inp_->value());
}
void value(const char *val) {
inp_->value(val);
}
/** Gets the encapsulated input text color attributes */
Fl_Color textcolor() const { return (inp_->textcolor());}
/** Sets the encapsulated input text color attributes */
void textcolor(Fl_Color c) { inp_->textcolor(c);}
/** Gets the encapsulated input text font attributes */
Fl_Font textfont() const { return (inp_->textfont());}
/** Sets the encapsulated input text font attributes */
void textfont(Fl_Font f) { inp_->textfont(f);}
/** Gets the encapsulated input size attributes */
Fl_Fontsize textsize() const { return (inp_->textsize()); }
/** Sets the encapsulated input size attributes */
void textsize(Fl_Fontsize s) { inp_->textsize(s); }
/** See void Fl_Input_Choice::value(const char *s) */
const char* value() const { return (inp_->value()); }
/**
Sets or returns the input widget's current contents. The
second form sets the contents using the index into the menu
which you can set as an integer. Setting the value effectively
'chooses' this menu item, and sets it as the new input text,
deleting the previous text.
*/
void value(const char *val) { inp_->value(val); }
/** See void Fl_Input_Choice::value(const char *s) */
void value(int val) {
menu_->value(val);
inp_->value(menu_->text(val));
}
/** Returns a reference to the internal Fl_Menu_Button widget. */
Fl_Menu_Button *menubutton() { return menu_; }
/**
Returns a reference to the internal Fl_Input widget.</p>
*/
Fl_Input *input() { return inp_; }
};
#endif // !Fl_Input_Choice_H
//
// End of "$Id$".
// End of "$Id: Fl_Input_Choice.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Int_Input.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Int_Input.H 6614 2009-01-01 16:11:32Z matt $"
//
// Integer input header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,19 +25,31 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Int_Input widget . */
#ifndef Fl_Int_Input_H
#define Fl_Int_Input_H
#include "Fl_Input.H"
/**
The Fl_Int_Input class is a subclass of Fl_Input
that only allows the user to type decimal digits (or hex numbers of the form 0xaef).
*/
class Fl_Int_Input : public Fl_Input {
public:
Fl_Int_Input(int X,int Y,int W,int H,const char *l = 0)
: Fl_Input(X,Y,W,H,l) {type(FL_INT_INPUT);}
/**
Creates a new Fl_Int_Input widget using the given position,
size, and label string. The default boxtype is FL_DOWN_BOX.
<P>Inherited destructor Destroys the widget and any value associated with it.
*/
Fl_Int_Input(int X,int Y,int W,int H,const char *l = 0)
: Fl_Input(X,Y,W,H,l) {type(FL_INT_INPUT);}
};
#endif
//
// End of "$Id: Fl_Int_Input.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Int_Input.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Light_Button.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Light_Button.H 6614 2009-01-01 16:11:32Z matt $"
//
// Lighted button header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,11 +25,25 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Light_Button widget . */
#ifndef Fl_Light_Button_H
#define Fl_Light_Button_H
#include "Fl_Button.H"
/**
<P>This subclass displays the "on" state by turning on a light,
rather than drawing pushed in. The shape of the "light"
is initially set to FL_DOWN_BOX. The color of the light when
on is controlled with selection_color(), which defaults to FL_YELLOW.
Buttons generate callbacks when they are clicked by the user. You
control exactly when and how by changing the values for type() and when().
<P ALIGN=CENTER>\image html Fl_Light_Button.gif</P>
\image latex Fl_Light_Button.eps "Fl_Light_Button" width=4cm
*/
class FL_EXPORT Fl_Light_Button : public Fl_Button {
protected:
virtual void draw();
@@ -41,5 +55,5 @@ public:
#endif
//
// End of "$Id: Fl_Light_Button.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Light_Button.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Line_Dial.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Line_Dial.H 6614 2009-01-01 16:11:32Z matt $"
//
// Line dial header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Line_Dial widget . */
#ifndef Fl_Line_Dial_H
#define Fl_Line_Dial_H
@@ -39,5 +42,5 @@ public:
#endif
//
// End of "$Id: Fl_Line_Dial.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Line_Dial.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Menu.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Menu.H 6614 2009-01-01 16:11:32Z matt $"
//
// Old menu header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,9 +25,9 @@
// http://www.fltk.org/str.php
//
// this include file is for back compatability only
// this include file is for back compatibility only
#include "Fl_Menu_Item.H"
//
// End of "$Id: Fl_Menu.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Menu.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Menu_.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Menu_.H 6614 2009-01-01 16:11:32Z matt $"
//
// Menu base class header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Menu_ widget . */
#ifndef Fl_Menu__H
#define Fl_Menu__H
@@ -33,6 +36,15 @@
#endif
#include "Fl_Menu_Item.H"
/**
Base class of all widgets that have a menu in FLTK.
Currently FLTK provides you with
Fl_Menu_Button, Fl_Menu_Bar, and Fl_Choice.
<P>The class contains a pointer to an array of structures of type Fl_Menu_Item. The
array may either be supplied directly by the user program, or it may
be "private": a dynamically allocated array managed by the Fl_Menu_.
*/
class FL_EXPORT Fl_Menu_ : public Fl_Widget {
Fl_Menu_Item *menu_;
@@ -42,8 +54,8 @@ protected:
uchar alloc;
uchar down_box_;
uchar textfont_;
uchar textsize_;
Fl_Font textfont_;
Fl_Fontsize textsize_;
unsigned textcolor_;
public:
@@ -57,46 +69,78 @@ public:
const Fl_Menu_Item* test_shortcut() {return picked(menu()->test_shortcut());}
void global();
/**
Returns a pointer to the array of Fl_Menu_Items. This will either be
the value passed to menu(value) or the private copy.
*/
const Fl_Menu_Item *menu() const {return menu_;}
void menu(const Fl_Menu_Item *m);
void copy(const Fl_Menu_Item *m, void* user_data = 0);
int add(const char*, int shortcut, Fl_Callback*, void* = 0, int = 0);
int add(const char* a, const char* b, Fl_Callback* c,
void* d = 0, int e = 0) {return add(a,fl_old_shortcut(b),c,d,e);}
/** See int Fl_Menu_::add(const char* label, int shortcut, Fl_Callback*, void *user_data=0, int flags=0)*/
int add(const char* a, const char* b, Fl_Callback* c, void* d = 0, int e = 0) {
return add(a,fl_old_shortcut(b),c,d,e);}
int add(const char *);
int size() const ;
void size(int W, int H) { Fl_Widget::size(W, H); }
void clear();
int add(const char *);
void replace(int,const char *);
void remove(int);
/** Changes the shortcut of item i to n. */
void shortcut(int i, int s) {menu_[i].shortcut(s);}
/** Sets the flags of item i. For a list of the flags, see Fl_Menu_Item. */
void mode(int i,int fl) {menu_[i].flags = fl;}
/** Gets the flags of item i. For a list of the flags, see Fl_Menu_Item. */
int mode(int i) const {return menu_[i].flags;}
/** Returns a pointer to the last menu item that was picked. */
const Fl_Menu_Item *mvalue() const {return value_;}
/** Returns the index into menu() of the last item chosen by the user. It is zero initially. */
int value() const {return value_ ? (int)(value_-menu_) : -1;}
int value(const Fl_Menu_Item*);
/**
The value is the index into menu() of the last item chosen by
the user. It is zero initially. You can set it as an integer, or set
it with a pointer to a menu item. The set routines return non-zero if
the new value is different than the old one.
*/
int value(int i) {return value(menu_+i);}
/** Returns the title of the last item chosen, or of item i. */
const char *text() const {return value_ ? value_->text : 0;}
/** Returns the title of the last item chosen, or of item i. */
const char *text(int i) const {return menu_[i].text;}
Fl_Font textfont() const {return (Fl_Font)textfont_;}
void textfont(uchar c) {textfont_=c;}
uchar textsize() const {return textsize_;}
void textsize(uchar c) {textsize_=c;}
/** Gets the current font of menu item labels. */
Fl_Font textfont() const {return textfont_;}
/** Sets the current font of menu item labels. */
void textfont(Fl_Font c) {textfont_=c;}
/** Gets the font size of menu item labels. */
Fl_Fontsize textsize() const {return textsize_;}
/** Sets the font size of menu item labels. */
void textsize(Fl_Fontsize c) {textsize_=c;}
/** Get the current color of menu item labels. */
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
/** Sets the current color of menu item labels. */
void textcolor(unsigned c) {textcolor_=c;}
/**
This box type is used to surround the currently-selected items in the
menus. If this is FL_NO_BOX then it acts like
FL_THIN_UP_BOX and selection_color() acts like
FL_WHITE, for back compatibility.
*/
Fl_Boxtype down_box() const {return (Fl_Boxtype)down_box_;}
/** See Fl_Boxtype Fl_Menu_::down_box() const */
void down_box(Fl_Boxtype b) {down_box_ = b;}
// back compatability:
/** For back compatibility, same as selection_color() */
Fl_Color down_color() const {return selection_color();}
/** For back compatibility, same as selection_color() */
void down_color(unsigned c) {selection_color(c);}
};
#endif
//
// End of "$Id: Fl_Menu_.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Menu_.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Menu_Bar.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Menu_Bar.H 6614 2009-01-01 16:11:32Z matt $"
//
// Menu bar header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,16 +25,59 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Menu_Bar widget . */
#ifndef Fl_Menu_Bar_H
#define Fl_Menu_Bar_H
#include "Fl_Menu_.H"
/**
This widget provides a standard menubar interface. Usually you will
put this widget along the top edge of your window. The height of the
widget should be 30 for the menu titles to draw correctly with the
default font.
<P>The items on the bar and the menus they bring up are defined by a
single Fl_Menu_Item
array. Because a Fl_Menu_Item array defines a hierarchy, the
top level menu defines the items in the menubar, while the submenus
define the pull-down menus. Sub-sub menus and lower pop up to the right
of the submenus. </P>
<P ALIGN=CENTER>\image html menubar.gif</P>
\image latex menubar.eps " menubar" width=12cm
<P>If there is an item in the top menu that is not a title of a
submenu, then it acts like a "button" in the menubar. Clicking on it
will pick it. </P>
<P>When the user picks an item off the menu, the item's callback is
done with the menubar as the Fl_Widget* argument. If the item
does not have a callback the menubar's callback is done instead. </P>
<P>Submenus will also pop up in response to shortcuts indicated by
putting a '&' character in the name field of the menu item. If you put a
'&' character in a top-level "button" then the shortcut picks it. The
'&' character in submenus is ignored until the menu is popped up. </P>
<P>Typing the shortcut() of any of the menu items will cause
callbacks exactly the same as when you pick the item with the mouse.
*/
class FL_EXPORT Fl_Menu_Bar : public Fl_Menu_ {
protected:
void draw();
public:
int handle(int);
/**
Creates a new Fl_Menu_Bar widget using the given position,
size, and label string. The default boxtype is FL_UP_BOX.
<P>The constructor sets menu() to NULL. See
Fl_Menu_ for the methods to set or change the menu. </P>
<P>labelsize(), labelfont(), and labelcolor()
are used to control how the menubar items are drawn. They are
initialized from the Fl_Menu static variables, but you can
change them if desired. </P>
<P>label() is ignored unless you change align() to
put it outside the menubar.
<P>The destructor removes the Fl_Menu_Bar widget and all of its
menu items.
*/
Fl_Menu_Bar(int X, int Y, int W, int H,const char *l=0)
: Fl_Menu_(X,Y,W,H,l) {}
};
@@ -42,5 +85,5 @@ public:
#endif
//
// End of "$Id: Fl_Menu_Bar.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Menu_Bar.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Menu_Button.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Menu_Button.H 6614 2009-01-01 16:11:32Z matt $"
//
// Menu button header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,11 +25,35 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Menu_Button widget . */
#ifndef Fl_Menu_Button_H
#define Fl_Menu_Button_H
#include "Fl_Menu_.H"
/**
This is a button that when pushed pops up a menu (or hierarchy of
menus) defined by an array of
Fl_Menu_Item objects.
<P ALIGN=CENTER>\image html menu_button.gif</P>
\image latex menu_button.eps " menu_button" width=5cm
<P>Normally any mouse button will pop up a menu and it is lined up
below the button as shown in the picture. However an Fl_Menu_Button
may also control a pop-up menu. This is done by setting the type()
, see below. </P>
<P>The menu will also pop up in response to shortcuts indicated by
putting a '&' character in the label(). </P>
<P>Typing the shortcut() of any of the menu items will cause
callbacks exactly the same as when you pick the item with the mouse.
The '&' character in menu item names are only looked at when the menu is
popped up, however. </P>
<P>When the user picks an item off the menu, the item's callback is
done with the menu_button as the Fl_Widget* argument. If the
item does not have a callback the menu_button's callback is done
instead.
*/
class FL_EXPORT Fl_Menu_Button : public Fl_Menu_ {
protected:
void draw();
@@ -44,5 +68,5 @@ public:
#endif
//
// End of "$Id: Fl_Menu_Button.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Menu_Button.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Menu_Item.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Menu_Item.H 6614 2009-01-01 16:11:32Z matt $"
//
// Menu item header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -51,64 +51,285 @@ extern FL_EXPORT int fl_old_shortcut(const char*);
class Fl_Menu_;
/**
The Fl_Menu_Item structure defines a single menu item that
is used by the Fl_Menu_ class.
\code
struct Fl_Menu_Item {
const char* text; // label()
ulong shortcut_;
Fl_Callback* callback_;
void* user_data_;
int flags;
uchar labeltype_;
uchar labelfont_;
uchar labelsize_;
uchar labelcolor_;
};
enum { // values for flags:
FL_MENU_INACTIVE = 1,
FL_MENU_TOGGLE = 2,
FL_MENU_VALUE = 4,
FL_MENU_RADIO = 8,
FL_MENU_INVISIBLE = 0x10,
FL_SUBMENU_POINTER = 0x20,
FL_SUBMENU = 0x40,
FL_MENU_DIVIDER = 0x80,
FL_MENU_HORIZONTAL = 0x100
};
\endcode
Typically menu items are statically defined; for example:
\code
Fl_Menu_Item popup[] = {
{"&alpha", FL_ALT+'a', the_cb, (void*)1},
{"&beta", FL_ALT+'b', the_cb, (void*)2},
{"gamma", FL_ALT+'c', the_cb, (void*)3, FL_MENU_DIVIDER},
{"&strange", 0, strange_cb},
{"&charm", 0, charm_cb},
{"&truth", 0, truth_cb},
{"b&eauty", 0, beauty_cb},
{"sub&menu", 0, 0, 0, FL_SUBMENU},
{"one"},
{"two"},
{"three"},
{0},
{"inactive", FL_ALT+'i', 0, 0, FL_MENU_INACTIVE|FL_MENU_DIVIDER},
{"invisible",FL_ALT+'i', 0, 0, FL_MENU_INVISIBLE},
{"check", FL_ALT+'i', 0, 0, FL_MENU_TOGGLE|FL_MENU_VALUE},
{"box", FL_ALT+'i', 0, 0, FL_MENU_TOGGLE},
{0}};
\endcode
produces:
\image html menu.gif
\image latex menu.eps "menu" width=10cm
A submenu title is identified by the bit FL_SUBMENU in the
flags field, and ends with a label() that is NULL.
You can nest menus to any depth. A pointer to the first item in the
submenu can be treated as an Fl_Menu array itself. It is also
possible to make separate submenu arrays with FL_SUBMENU_POINTER flags.
You should use the method functions to access structure members and
not access them directly to avoid compatibility problems with future
releases of FLTK.
*/
struct FL_EXPORT Fl_Menu_Item {
const char *text; // label()
int shortcut_;
Fl_Callback *callback_;
void *user_data_;
int flags;
uchar labeltype_;
uchar labelfont_;
uchar labelsize_;
unsigned labelcolor_;
const char *text; ///< menu item text, returned by label()
int shortcut_; ///< menu item shortcut
Fl_Callback *callback_; ///< menu item callback
void *user_data_; ///< menu item user_data for 3rd party apps
int flags; ///< menu item flags like FL_MENU_TOGGLE, FL_MENU_RADIO
uchar labeltype_; ///< how the menu item text looks like
Fl_Font labelfont_; ///< which font for this menu item text
Fl_Fontsize labelsize_; ///< size of menu item text
unsigned labelcolor_; ///< menu item text color
// advance N items, skipping submenus:
const Fl_Menu_Item *next(int=1) const;
/**
Advances a pointer by n items through a menu array, skipping
the contents of submenus and invisible items. There are two calls so
that you can advance through const and non-const data.
*/
Fl_Menu_Item *next(int i=1) {
return (Fl_Menu_Item*)(((const Fl_Menu_Item*)this)->next(i));}
/** Returns the first menu item, same as next(0). */
const Fl_Menu_Item *first() const { return next(0); }
/** Returns the first menu item, same as next(0). */
Fl_Menu_Item *first() { return next(0); }
// methods on menu items:
/**
Returns the title of the item.
A NULL here indicates the end of the menu (or of a submenu).
A '&' in the item will print an underscore under the next letter,
and if the menu is popped up that letter will be a "shortcut" to pick
that item. To get a real '&' put two in a row.
*/
const char* label() const {return text;}
/** See const char* Fl_Menu_Item::label() const */
void label(const char* a) {text=a;}
/** See const char* Fl_Menu_Item::label() const */
void label(Fl_Labeltype a,const char* b) {labeltype_ = a; text = b;}
/**
A labeltype identifies a routine that draws the label of the
widget. This can be used for special effects such as emboss, or to use
the label() pointer as another form of data such as a bitmap.
The value FL_NORMAL_LABEL prints the label as text.
*/
Fl_Labeltype labeltype() const {return (Fl_Labeltype)labeltype_;}
/**
A labeltype identifies a routine that draws the label of the
widget. This can be used for special effects such as emboss, or to use
the label() pointer as another form of data such as a bitmap.
The value FL_NORMAL_LABEL prints the label as text.
*/
void labeltype(Fl_Labeltype a) {labeltype_ = a;}
/**
This color is passed to the labeltype routine, and is typically the
color of the label text. This defaults to FL_BLACK. If this
color is not black fltk will <I>not</I> use overlay bitplanes to draw
the menu - this is so that images put in the menu draw correctly.
*/
Fl_Color labelcolor() const {return (Fl_Color)labelcolor_;}
/** See Fl_Color Fl_Menu_Item::labelcolor() const */
void labelcolor(unsigned a) {labelcolor_ = a;}
Fl_Font labelfont() const {return (Fl_Font)labelfont_;}
void labelfont(uchar a) {labelfont_ = a;}
uchar labelsize() const {return labelsize_;}
void labelsize(uchar a) {labelsize_ = a;}
/**
Fonts are identified by small 8-bit indexes into a table. See the
enumeration list for predefined fonts. The default value is a
Helvetica font. The function Fl::set_font() can define new fonts.
*/
Fl_Font labelfont() const {return labelfont_;}
/**
Fonts are identified by small 8-bit indexes into a table. See the
enumeration list for predefined fonts. The default value is a
Helvetica font. The function Fl::set_font() can define new fonts.
*/
void labelfont(Fl_Font a) {labelfont_ = a;}
/** Gets the label font pixel size/height.*/
Fl_Fontsize labelsize() const {return labelsize_;}
/** Sets the label font pixel size/height.*/
void labelsize(Fl_Fontsize a) {labelsize_ = a;}
/**
Each item has space for a callback function and an argument for that
function. Due to back compatibility, the Fl_Menu_Item itself
is not passed to the callback, instead you have to get it by calling
((Fl_Menu_*)w)->mvalue() where w is the widget argument.
*/
Fl_Callback_p callback() const {return callback_;}
/** See Fl_Callback_p Fl_MenuItem::callback() const */
void callback(Fl_Callback* c, void* p) {callback_=c; user_data_=p;}
/** See Fl_Callback_p Fl_MenuItem::callback() const */
void callback(Fl_Callback* c) {callback_=c;}
/** See Fl_Callback_p Fl_MenuItem::callback() const */
void callback(Fl_Callback0*c) {callback_=(Fl_Callback*)c;}
/** See Fl_Callback_p Fl_MenuItem::callback() const */
void callback(Fl_Callback1*c, long p=0) {callback_=(Fl_Callback*)c; user_data_=(void*)p;}
/**
Get or set the user_data argument that is sent to the
callback function.
*/
void* user_data() const {return user_data_;}
/**
Get or set the user_data argument that is sent to the
callback function.
*/
void user_data(void* v) {user_data_ = v;}
/**
For convenience you can also define the callback as taking a long
argument. This is implemented by casting this to a Fl_Callback
and casting the long to a void* and may not be
portable to some machines.
*/
long argument() const {return (long)user_data_;}
/**
For convenience you can also define the callback as taking a long
argument. This is implemented by casting this to a Fl_Callback
and casting the long to a void* and may not be
portable to some machines.
*/
void argument(long v) {user_data_ = (void*)v;}
/** Gets what key combination shortcut will trigger the menu item. */
int shortcut() const {return shortcut_;}
/**
Sets exactly what key combination will trigger the menu item. The
value is a logical 'or' of a key and a set of shift flags, for instance
FL_ALT+'a' or FL_ALT+FL_F+10 or just 'a'. A value of
zero disables the shortcut.
The key can be any value returned by Fl::event_key(), but will usually
be an ASCII letter. Use a lower-case letter unless you require the shift
key to be held down.
The shift flags can be any set of values accepted by Fl::event_state().
If the bit is on that shift key must be pushed. Meta, Alt, Ctrl,
and Shift must be off if they are not in the shift flags (zero for the
other bits indicates a "don't care" setting).
*/
void shortcut(int s) {shortcut_ = s;}
/**
Returns true if either FL_SUBMENU or FL_SUBMENU_POINTER
is on in the flags. FL_SUBMENU indicates an embedded submenu
that goes from the next item through the next one with a NULL
label(). FL_SUBMENU_POINTER indicates that user_data()
is a pointer to another menu array.
*/
int submenu() const {return flags&(FL_SUBMENU|FL_SUBMENU_POINTER);}
/**
Returns true if a checkbox will be drawn next to this item. This is
true if FL_MENU_TOGGLE or FL_MENU_RADIO is set in the flags.
*/
int checkbox() const {return flags&FL_MENU_TOGGLE;}
/**
Returns true if this item is a radio item. When a radio button is
selected all "adjacent" radio buttons are turned off. A set of radio
items is delimited by an item that has radio() false, or by an
item with FL_MENU_DIVIDER turned on.
*/
int radio() const {return flags&FL_MENU_RADIO;}
/** Returns the current value of the check or radio item. */
int value() const {return flags&FL_MENU_VALUE;}
/**
Turns the check or radio item "on" for the menu item. Note that this
does not turn off any adjacent radio items like set_only() does.
*/
void set() {flags |= FL_MENU_VALUE;}
/** Turns the check or radio item "off" for the menu item. */
void clear() {flags &= ~FL_MENU_VALUE;}
void setonly();
/** Gets the visibility of an item. */
int visible() const {return !(flags&FL_MENU_INVISIBLE);}
/** Makes an item visible in the menu. */
void show() {flags &= ~FL_MENU_INVISIBLE;}
/** Hides an item in the menu. */
void hide() {flags |= FL_MENU_INVISIBLE;}
/** Gets whether or not the item can be picked. */
int active() const {return !(flags&FL_MENU_INACTIVE);}
/** Allows a menu item to be picked. */
void activate() {flags &= ~FL_MENU_INACTIVE;}
/**
Prevents a menu item from being picked. Note that this will also cause
the menu item to appear grayed-out.
*/
void deactivate() {flags |= FL_MENU_INACTIVE;}
int activevisible() const {return !(flags&0x11);}
/** Returns non 0 if FL_INACTIVE and FL_INVISIBLE are cleared, 0 otherwise. */
int activevisible() const {return !(flags & (FL_MENU_INACTIVE|FL_MENU_INVISIBLE));}
// compatibility for FLUID so it can set the image of a menu item...
/** compatibility api for FLUID, same as a->label(this) */
void image(Fl_Image* a) {a->label(this);}
/** compatibility api for FLUID, same as a.label(this) */
void image(Fl_Image& a) {a.label(this);}
// used by menubar:
@@ -130,24 +351,54 @@ struct FL_EXPORT Fl_Menu_Item {
const Fl_Menu_Item* test_shortcut() const;
const Fl_Menu_Item* find_shortcut(int *ip=0) const;
/**
Calls the Fl_Menu_Item item's callback, and provides the
Fl_Widget argument (and optionally overrides the user_data()
argument). You must first check that callback() is non-zero
before calling this.
*/
void do_callback(Fl_Widget* o) const {callback_(o, user_data_);}
/**
Calls the Fl_Menu_Item item's callback, and provides the
Fl_Widget argument (and optionally overrides the user_data()
argument). You must first check that callback() is non-zero
before calling this.
*/
void do_callback(Fl_Widget* o,void* arg) const {callback_(o, arg);}
/**
Calls the Fl_Menu_Item item's callback, and provides the
Fl_Widget argument (and optionally overrides the user_data()
argument). You must first check that callback() is non-zero
before calling this.
*/
void do_callback(Fl_Widget* o,long arg) const {callback_(o, (void*)arg);}
// back-compatability, do not use:
// back-compatibility, do not use:
/** back compatibility only \deprecated. */
int checked() const {return flags&FL_MENU_VALUE;}
/** back compatibility only \deprecated. */
void check() {flags |= FL_MENU_VALUE;}
/** back compatibility only \deprecated. */
void uncheck() {flags &= ~FL_MENU_VALUE;}
int add(const char*, int shortcut, Fl_Callback*, void* =0, int = 0);
/** See int add(const char*, int shortcut, Fl_Callback*, void*, int) */
int add(const char*a, const char* b, Fl_Callback* c,
void* d = 0, int e = 0) {
return add(a,fl_old_shortcut(b),c,d,e);}
int size() const ;
};
typedef Fl_Menu_Item Fl_Menu; // back compatability
typedef Fl_Menu_Item Fl_Menu; // back compatibility
enum { // back-compatability enum:
enum { // back-compatibility enum:
FL_PUP_NONE = 0,
FL_PUP_GREY = FL_MENU_INACTIVE,
FL_PUP_GRAY = FL_MENU_INACTIVE,
@@ -163,5 +414,5 @@ enum { // back-compatability enum:
#endif
//
// End of "$Id: Fl_Menu_Item.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Menu_Item.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Menu_Window.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Menu_Window.H 6614 2009-01-01 16:11:32Z matt $"
//
// Menu window header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,11 +25,20 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Menu_Window widget . */
#ifndef Fl_Menu_Window_H
#define Fl_Menu_Window_H
#include "Fl_Single_Window.H"
/**
The Fl_Menu_Window widget is a window type used for menus. By
default the window is drawn in the hardware overlay planes if they are
available so that the menu don't force the rest of the window to
redraw.
*/
class FL_EXPORT Fl_Menu_Window : public Fl_Single_Window {
enum {NO_OVERLAY = 128};
public:
@@ -37,12 +46,18 @@ public:
void erase();
void flush();
void hide();
/** Tells if hardware overlay mode is set */
int overlay() {return !(flags()&NO_OVERLAY);}
/** Tells FLTK to use hardware overlay planes if they are available. */
void set_overlay() {clear_flag(NO_OVERLAY);}
/** Tells FLTK to use normal drawing planes instead of overlay planes.
This is usually necessary if your menu contains multi-color pixmaps. */
void clear_overlay() {set_flag(NO_OVERLAY);}
~Fl_Menu_Window();
/** Creates a new Fl_Menu_Window widget using the given size, and label string. */
Fl_Menu_Window(int W, int H, const char *l = 0)
: Fl_Single_Window(W,H,l) { image(0); }
/** Creates a new Fl_Menu_Window widget using the given position, size, and label string. */
Fl_Menu_Window(int X, int Y, int W, int H, const char *l = 0)
: Fl_Single_Window(X,Y,W,H,l) { image(0); }
};
@@ -50,5 +65,5 @@ public:
#endif
//
// End of "$Id: Fl_Menu_Window.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Menu_Window.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Multi_Browser.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Multi_Browser.H 6614 2009-01-01 16:11:32Z matt $"
//
// Multi browser header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,13 +25,32 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Multi_Browser widget . */
#ifndef Fl_Multi_Browser_H
#define Fl_Multi_Browser_H
#include "Fl_Browser.H"
/**
The Fl_Multi_Browser class is a subclass of Fl_Browser
which lets the user select any set of the lines. The user interface
is Macintosh style: clicking an item turns off all the others and
selects that one, dragging selects all the items the mouse moves over,
and shift + click toggles the items. This is different then how forms
did it. Normally the callback is done when the user releases the
mouse, but you can change this with when().
<P>See Fl_Browser for methods to add and remove lines from the browser.
*/
class Fl_Multi_Browser : public Fl_Browser {
public:
/**
Creates a new Fl_Multi_Browser widget using the given
position, size, and label string. The default boxtype is FL_DOWN_BOX.
The constructor specializes Fl_Browser() by setting the type to FL_MULTI_BROWSER.
The destructor destroys the widget and frees all memory that has been allocated.
*/
Fl_Multi_Browser(int X,int Y,int W,int H,const char *L=0)
: Fl_Browser(X,Y,W,H,L) {type(FL_MULTI_BROWSER);}
};
@@ -39,5 +58,5 @@ public:
#endif
//
// End of "$Id: Fl_Multi_Browser.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Multi_Browser.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Multi_Label.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Multi_Label.H 6614 2009-01-01 16:11:32Z matt $"
//
// Multi-label header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -43,5 +43,5 @@ struct FL_EXPORT Fl_Multi_Label {
#endif
//
// End of "$Id: Fl_Multi_Label.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Multi_Label.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Multiline_Input.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Multiline_Input.H 6614 2009-01-01 16:11:32Z matt $"
//
// Multiline input header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,19 +25,38 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Multiline_Input widget . */
#ifndef Fl_Multiline_Input_H
#define Fl_Multiline_Input_H
#include "Fl_Input.H"
/**
This input field displays '\n' characters as new lines rather than ^J,
and accepts the Return, Tab, and up and down arrow keys. This is for
editing multiline text.
<P>This is far from the nirvana of text editors, and is probably only
good for small bits of text, 10 lines at most. I think FLTK can be
used to write a powerful text editor, but it is not going to be a
built-in feature. Powerful text editors in a toolkit are a big source
of bloat.
*/
class Fl_Multiline_Input : public Fl_Input {
public:
Fl_Multiline_Input(int X,int Y,int W,int H,const char *l = 0)
: Fl_Input(X,Y,W,H,l) {type(FL_MULTILINE_INPUT);}
/**
Creates a new Fl_Multiline_Input widget using the given
position, size, and label string. The default boxtype is FL_DOWN_BOX.
<P>Inherited destructor destroys the widget and any value associated with it.
*/
Fl_Multiline_Input(int X,int Y,int W,int H,const char *l = 0)
: Fl_Input(X,Y,W,H,l) {type(FL_MULTILINE_INPUT);}
};
#endif
//
// End of "$Id: Fl_Multiline_Input.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Multiline_Input.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Multiline_Output.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Multiline_Output.H 6614 2009-01-01 16:11:32Z matt $"
//
// Multi line output header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,19 +25,32 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Multiline_Output widget . */
#ifndef Fl_Multiline_Output_H
#define Fl_Multiline_Output_H
#include "Fl_Output.H"
/**
This widget is a subclass of Fl_Output that displays multiple
lines of text. It also displays tab characters as whitespace to the
next column.
*/
class Fl_Multiline_Output : public Fl_Output {
public:
Fl_Multiline_Output(int X,int Y,int W,int H,const char *l = 0)
: Fl_Output(X,Y,W,H,l) {type(FL_MULTILINE_OUTPUT);}
/**
Creates a new Fl_Multiline_Output widget using the given
position, size, and label string. The default boxtype is FL_DOWN_BOX
<P> Inherited destructor destroys the widget and any value associated with it.
*/
Fl_Multiline_Output(int X,int Y,int W,int H,const char *l = 0)
: Fl_Output(X,Y,W,H,l) {type(FL_MULTILINE_OUTPUT);}
};
#endif
//
// End of "$Id: Fl_Multiline_Output.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Multiline_Output.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Nice_Slider.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Nice_Slider.H 6614 2009-01-01 16:11:32Z matt $"
//
// "Nice" slider header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -24,6 +24,10 @@
//
// http://www.fltk.org/str.php
//
/* \file
Fl_Nice_Slider widget . */
#ifndef Fl_Nice_Slider_H
#define Fl_Nice_Slider_H
@@ -38,5 +42,5 @@ public:
#endif
//
// End of "$Id: Fl_Nice_Slider.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Nice_Slider.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Object.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Object.H 6614 2009-01-01 16:11:32Z matt $"
//
// Old Fl_Object header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,12 +25,12 @@
// http://www.fltk.org/str.php
//
// This file is provided for back compatability only. Please use Fl_Widget
// This file is provided for back compatibility only. Please use Fl_Widget
#ifndef Fl_Object
#define Fl_Object Fl_Widget
#endif
#include "Fl_Widget.H"
//
// End of "$Id: Fl_Object.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Object.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Output.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Output.H 6614 2009-01-01 16:11:32Z matt $"
//
// Output header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,19 +25,43 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Output widget . */
#ifndef Fl_Output_H
#define Fl_Output_H
#include "Fl_Input.H"
/**
This widget displays a piece of text. When you set the value()
, Fl_Output does a strcpy() to it's own storage,
which is useful for program-generated values. The user may select
portions of the text using the mouse and paste the contents into other
fields or programs.
<P align=CENTER>\image html text.gif</P>
\image latex text.eps "Fl_Output" width=8cm
<P>There is a single subclass,
Fl_Multiline_Output, which allows you to display multiple lines of
text. </P>
<P>The text may contain any characters except \\0, and will correctly
display anything, using ^X notation for unprintable control characters
and \\nnn notation for unprintable characters with the high bit set. It
assumes the font can draw any characters in the ISO-Latin1 character
set.
*/
class Fl_Output : public Fl_Input {
public:
Fl_Output(int X,int Y,int W,int H, const char *l = 0)
/**
Creates a new Fl_Output widget using the given position,
size, and label string. The default boxtype is FL_DOWN_BOX.
<P>Inherited destrucor destroys the widget and any value associated with it.
*/
Fl_Output(int X,int Y,int W,int H, const char *l = 0)
: Fl_Input(X, Y, W, H, l) {type(FL_NORMAL_OUTPUT);}
};
#endif
//
// End of "$Id: Fl_Output.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Output.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Overlay_Window.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Overlay_Window.H 6614 2009-01-01 16:11:32Z matt $"
//
// Overlay window header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,11 +25,25 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Overlay_Window class . */
#ifndef Fl_Overlay_Window_H
#define Fl_Overlay_Window_H
#include "Fl_Double_Window.H"
/**
This window provides double buffering and also the ability to draw the
"overlay" which is another picture placed on top of the main image. The
overlay is designed to be a rapidly-changing but simple graphic such as
a mouse selection box. Fl_Overlay_Window uses the overlay
planes provided by your graphics hardware if they are available.
<P>If no hardware support is found the overlay is simulated by drawing
directly into the on-screen copy of the double-buffered window, and
"erased" by copying the backbuffer over it again. This means the
overlay will blink if you change the image in the window.
*/
class FL_EXPORT Fl_Overlay_Window : public Fl_Double_Window {
friend class _Fl_Overlay;
virtual void draw_overlay() = 0;
@@ -42,9 +56,18 @@ public:
~Fl_Overlay_Window();
int can_do_overlay();
void redraw_overlay();
/**
Creates a new Fl_Overlay_Window widget using the given
position, size, and label (title) string. If the
positions (x,y) are not given, then the window manager
will choose them.
*/
Fl_Overlay_Window(int W, int H, const char *l=0)
: Fl_Double_Window(W,H,l) {overlay_ = 0; force_doublebuffering_=1; image(0); }
Fl_Overlay_Window(int X, int Y, int W, int H, const char *l=0)
/**
See Fl_Overlay_Window::Fl_Overlay_Window(int W, int H, const char *l=0)
*/
Fl_Overlay_Window(int X, int Y, int W, int H, const char *l=0)
: Fl_Double_Window(X,Y,W,H,l) {overlay_ = 0; force_doublebuffering_=1; image(0); }
void show(int a, char **b) {Fl_Double_Window::show(a,b);}
};
@@ -52,5 +75,5 @@ public:
#endif
//
// End of "$Id: Fl_Overlay_Window.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Overlay_Window.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Pack.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Pack.H 6664 2009-02-18 09:27:54Z AlbrechtS $"
//
// Pack header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,27 +25,60 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Pack widget . */
#ifndef Fl_Pack_H
#define Fl_Pack_H
#include <FL/Fl_Group.H>
/**
This widget was designed to add the functionality of compressing and
aligning widgets.
<P>If type() is Fl_Pack::HORIZONTAL all the children are
resized to the height of the Fl_Pack, and are moved next to
each other horizontally. If type() is not Fl_Pack::HORIZONTAL
then the children are resized to the width and are stacked below each
other. Then the Fl_Pack resizes itself to surround the child
widgets.
<P>This widget is needed for the Fl_Tabs.
In addition you may want to put the Fl_Pack inside an
Fl_Scroll.
<P>The resizable for Fl_Pack is set to NULL by default.</p>
<P>See also: Fl_Group::resizable()
*/
class FL_EXPORT Fl_Pack : public Fl_Group {
int spacing_;
public:
enum { // values for type(int)
VERTICAL = 0,
HORIZONTAL = 1
};
protected:
void draw();
public:
Fl_Pack(int x,int y,int w ,int h,const char *l = 0);
/**
Gets the number of extra pixels of blank space that are added
between the children.
*/
int spacing() const {return spacing_;}
/**
Sets the number of extra pixels of blank space that are added
between the children.
*/
void spacing(int i) {spacing_ = i;}
/** Same as Fl_Group::type() */
uchar horizontal() const {return type();}
};
#endif
//
// End of "$Id: Fl_Pack.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Pack.H 6664 2009-02-18 09:27:54Z AlbrechtS $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Pixmap.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Pixmap.H 6614 2009-01-01 16:11:32Z matt $"
//
// Pixmap header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Pixmap widget . */
#ifndef Fl_Pixmap_H
#define Fl_Pixmap_H
# include "Fl_Image.H"
@@ -37,6 +40,10 @@ struct Fl_Menu_Item;
# define explicit
# endif // __sgi && !_COMPILER_VERSION
/**
The Fl_Pixmap class supports caching and drawing of colormap
(pixmap) images, including transparency.
*/
class FL_EXPORT Fl_Pixmap : public Fl_Image {
void copy_data();
void delete_data();
@@ -57,9 +64,13 @@ class FL_EXPORT Fl_Pixmap : public Fl_Image {
unsigned mask; // for internal use (mask bitmap)
#endif // __APPLE__ || WIN32
/** The constructors create a new pixmap from the specified XPM data. */
explicit Fl_Pixmap(char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();}
/** The constructors create a new pixmap from the specified XPM data. */
explicit Fl_Pixmap(uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();}
/** The constructors create a new pixmap from the specified XPM data. */
explicit Fl_Pixmap(const char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();}
/** The constructors create a new pixmap from the specified XPM data. */
explicit Fl_Pixmap(const uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();}
virtual ~Fl_Pixmap();
virtual Fl_Image *copy(int W, int H);
@@ -76,5 +87,5 @@ class FL_EXPORT Fl_Pixmap : public Fl_Image {
#endif
//
// End of "$Id: Fl_Pixmap.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Pixmap.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Positioner.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Positioner.H 6614 2009-01-01 16:11:32Z matt $"
//
// Positioner header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Positioner widget . */
#ifndef Fl_Positioner_H
#define Fl_Positioner_H
@@ -32,6 +35,14 @@
#include "Fl_Widget.H"
#endif
/**
This class is provided for Forms compatibility. It provides 2D input.
It would be useful if this could be put atop another widget so that the
crosshairs are on top, but this is not implemented. The color of the
crosshairs is selection_color().
<P ALIGN=CENTER>\image html positioner.gif </P>
\image latex positioner.eps " Fl_Positioner" width=4cm
*/
class FL_EXPORT Fl_Positioner : public Fl_Widget {
double xmin, ymin;
@@ -49,29 +60,44 @@ protected:
public:
int handle(int);
/**
Creates a new Fl_Positioner widget using the given position,
size, and label string. The default boxtype is FL_NO_BOX.
*/
Fl_Positioner(int x,int y,int w,int h, const char *l=0);
/** Gets the X axis coordinate.*/
double xvalue() const {return xvalue_;}
/** Gets the Y axis coordinate.*/
double yvalue() const {return yvalue_;}
int xvalue(double);
int yvalue(double);
int value(double,double);
void xbounds(double, double);
/** Gets the X axis minimum */
double xminimum() const {return xmin;}
/** Same as xbounds(a, xmaximum()) */
void xminimum(double a) {xbounds(a,xmax);}
/** Gets the X axis maximum */
double xmaximum() const {return xmax;}
/** Same as xbounds(xminimum(), a) */
void xmaximum(double a) {xbounds(xmin,a);}
void ybounds(double, double);
/** Gets the Y axis minimum */
double yminimum() const {return ymin;}
void yminimum(double a) {ybounds(a,ymax);}
/** Same as ybounds(a, ymaximum()) */
void yminimum(double a) {ybounds(a, ymax);}
/** Gets the Y axis maximum */
double ymaximum() const {return ymax;}
void ymaximum(double a) {ybounds(ymin,a);}
/** Same as ybounds(ymininimum(), a) */
void ymaximum(double a) {ybounds(ymin, a);}
/** Sets the stepping value for the X axis.*/
void xstep(double a) {xstep_ = a;}
/** Sets the stepping value for the Y axis.*/
void ystep(double a) {ystep_ = a;}
};
#endif
//
// End of "$Id: Fl_Positioner.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Positioner.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Preferences.H 5330 2006-08-18 07:29:09Z matt $"
// "$Id: Fl_Preferences.H 6770 2009-04-18 18:52:59Z matt $"
//
// Preferences definitions for the Fast Light Tool Kit (FLTK).
// Preferences .
//
// Copyright 2002-2005 by Matthias Melcher.
// Copyright 2002-2009 by Matthias Melcher.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,42 +25,75 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Preferences class . */
#ifndef Fl_Preferences_H
# define Fl_Preferences_H
# ifdef WIN32
# include <windows.h>
# endif // WIN32
# include <stdio.h>
# include "Fl_Export.H"
/**
* Preferences are a data tree containing a root, branches and leafs
\brief Fl_Preferences provides methods to store user
settings between application starts.
It is similar to the
Registry on WIN32 and Preferences on MacOS, and provides a
simple configuration mechanism for UNIX.
Fl_Preferences uses a hierarchy to store data. It
bundles similar data into groups and manages entries into those
groups as name/value pairs.
Preferences are stored in text files that can be edited
manually. The file format is easy to read and relatively
forgiving. Preferences files are the same on all platforms. User
comments in preference files are preserved. Filenames are unique
for each application by using a vendor/application naming
scheme. The user must provide default values for all entries to
ensure proper operation should preferences be corrupted or not
yet exist.
Entries can be of any length. However, the size of each
preferences file should be kept under 100k for performance
reasons. One application can have multiple preferences files.
Extensive binary data however should be stored in separate
files: see getUserdataPath().
\note Starting with FLTK 1.3, preference databases are expected to
be in utf8 encoding. Previous databases were stored in the
current chracter set or code page which renders them incompatible
for text entries using international characters.
*/
class FL_EXPORT Fl_Preferences
{
public:
enum Root { SYSTEM=0, USER };
// enum Type { win32, macos, fltk };
/**
Define the scope of the preferences.
*/
enum Root {
SYSTEM=0, ///< Preferences are used system-wide
USER ///< Preferences apply only to the current user
};
Fl_Preferences( Root root, const char *vendor, const char *application );
Fl_Preferences( const char *path, const char *vendor, const char *application );
Fl_Preferences( Fl_Preferences&, const char *group );
Fl_Preferences( Fl_Preferences &parent, const char *group );
Fl_Preferences( Fl_Preferences*, const char *group );
~Fl_Preferences();
int groups();
const char *group( int );
char groupExists( const char *group );
const char *group( int num_group );
char groupExists( const char *key );
char deleteGroup( const char *group );
int entries();
const char *entry( int );
char entryExists( const char *entry );
const char *entry( int index );
char entryExists( const char *key );
char deleteEntry( const char *entry );
char set( const char *entry, int value );
@@ -70,14 +103,15 @@ public:
char set( const char *entry, double value, int precision );
char set( const char *entry, const char *value );
char set( const char *entry, const void *value, int size );
char get( const char *entry, int &value, int defaultValue );
char get( const char *entry, int &value, int defaultValue );
char get( const char *entry, float &value, float defaultValue );
char get( const char *entry, double &value, double defaultValue );
char get( const char *entry, char *&value, const char *defaultValue );
char get( const char *entry, char *value, const char *defaultValue, int maxSize );
char get( const char *entry, void *&value, const void *defaultValue, int defaultSize );
char get( const char *entry, void *value, const void *defaultValue, int defaultSize, int maxSize );
int size( const char *entry );
char getUserdataPath( char *path, int pathlen );
@@ -87,15 +121,35 @@ public:
// char export( const char *filename, Type fileFormat );
// char import( const char *filename );
/**
'Name' provides a simple method to create numerical or more complex
procedural names for entries and groups on the fly.
Example: prefs.set(Fl_Preferences::Name("File%d",i),file[i]);.
See test/preferences.cxx as a sample for writing arrays into preferences.<p>
'Name' is actually implemented as a class inside Fl_Preferences. It casts
into const char* and gets automatically destroyed after the enclosing call
ends.
*/
class FL_EXPORT Name {
char *data_;
public:
Name( unsigned int n );
Name( const char *format, ... );
/**
Return the Name as a "C" string.
\internal
*/
operator const char *() { return data_; }
~Name();
};
/** \internal An entry associates a preference name to its corresponding value */
struct Entry
{
char *name, *value;
@@ -167,5 +221,5 @@ private:
#endif // !Fl_Preferences_H
//
// End of "$Id: Fl_Preferences.H 5330 2006-08-18 07:29:09Z matt $".
// End of "$Id: Fl_Preferences.H 6770 2009-04-18 18:52:59Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Progress.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Progress.H 6614 2009-01-01 16:11:32Z matt $"
//
// Progress bar widget definitions.
//
// Copyright 2000-2005 by Michael Sweet.
// Copyright 2000-2009 by Michael Sweet.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Progress widget . */
#ifndef _Fl_Progress_H_
# define _Fl_Progress_H_
@@ -38,7 +41,9 @@
//
// Progress class...
//
/**
Displays a progress bar for the user.
*/
class FL_EXPORT Fl_Progress : public Fl_Widget
{
float value_,
@@ -53,18 +58,24 @@ class FL_EXPORT Fl_Progress : public Fl_Widget
Fl_Progress(int x, int y, int w, int h, const char *l = 0);
/** Sets the maximum value in the progress widget. */
void maximum(float v) { maximum_ = v; redraw(); }
/** Gets the maximum value in the progress widget. */
float maximum() const { return (maximum_); }
/** Sets the minimum value in the progress widget. */
void minimum(float v) { minimum_ = v; redraw(); }
/** Gets the minimum value in the progress widget. */
float minimum() const { return (minimum_); }
/** Sets the current value in the progress widget. */
void value(float v) { value_ = v; redraw(); }
/** Gets the current value in the progress widget. */
float value() const { return (value_); }
};
#endif // !_Fl_Progress_H_
//
// End of "$Id: Fl_Progress.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Progress.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Radio_Button.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Radio_Button.H 6614 2009-01-01 16:11:32Z matt $"
//
// Radio button header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Radio_Button widget . */
#ifndef Fl_Radio_Button_H
#define Fl_Radio_Button_H
@@ -39,5 +42,5 @@ public:
#endif
//
// End of "$Id: Fl_Radio_Button.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Radio_Button.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Radio_Light_Button.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Radio_Light_Button.H 6614 2009-01-01 16:11:32Z matt $"
//
// Radio light button header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -24,6 +24,10 @@
//
// http://www.fltk.org/str.php
//
/* \file
Fl_Radio_Light_Button widget . */
#ifndef Fl_Radio_Light_Button_H
#define Fl_Radio_Light_Button_H
@@ -38,5 +42,5 @@ public:
#endif
//
// End of "$Id: Fl_Radio_Light_Button.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Radio_Light_Button.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Radio_Round_Button.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Radio_Round_Button.H 6614 2009-01-01 16:11:32Z matt $"
//
// Radio round button header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Radio_Round_Button widget . */
#ifndef Fl_Radio_Round_Button_H
#define Fl_Radio_Round_Button_H
@@ -39,5 +42,5 @@ public:
#endif
//
// End of "$Id: Fl_Radio_Round_Button.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Radio_Round_Button.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Repeat_Button.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Repeat_Button.H 6614 2009-01-01 16:11:32Z matt $"
//
// Repeat button header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,15 +25,29 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Repeat_Button widget . */
#ifndef Fl_Repeat_Button_H
#define Fl_Repeat_Button_H
#include "Fl.H"
#include "Fl_Button.H"
/**
The Fl_Repeat_Button is a subclass of Fl_Button that
generates a callback when it is pressed and then repeatedly generates
callbacks as long as it is held down. The speed of the repeat is fixed
and depends on the implementation.
*/
class FL_EXPORT Fl_Repeat_Button : public Fl_Button {
static void repeat_callback(void *);
public:
int handle(int);
/**
Creates a new Fl_Repeat_Button widget using the given
position, size, and label string. The default boxtype is FL_UP_BOX.
Deletes the button.
*/
Fl_Repeat_Button(int X,int Y,int W,int H,const char *l=0)
: Fl_Button(X,Y,W,H,l) {}
void deactivate() {
@@ -45,5 +59,5 @@ public:
#endif
//
// End of "$Id: Fl_Repeat_Button.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Repeat_Button.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Return_Button.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Return_Button.H 6614 2009-01-01 16:11:32Z matt $"
//
// Return button header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,15 +25,30 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Return_Button widget . */
#ifndef Fl_Return_Button_H
#define Fl_Return_Button_H
#include "Fl_Button.H"
/**
The Fl_Return_Button is a subclass of Fl_Button that
generates a callback when it is pressed or when the user presses the
Enter key. A carriage-return symbol is drawn next to the button label.
<P ALIGN=CENTER>\image html Fl_Return_Button.gif
\image latex Fl_Return_Button.eps "Fl_Return_Button" width=4cm
*/
class FL_EXPORT Fl_Return_Button : public Fl_Button {
protected:
void draw();
public:
int handle(int);
/**
Creates a new Fl_Return_Button widget using the given
position, size, and label string. The default boxtype is FL_UP_BOX.
<P> The inherited destructor deletes the button.
*/
Fl_Return_Button(int X, int Y, int W, int H,const char *l=0)
: Fl_Button(X,Y,W,H,l) {}
};
@@ -41,5 +56,5 @@ public:
#endif
//
// End of "$Id: Fl_Return_Button.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Return_Button.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Roller.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Roller.H 6614 2009-01-01 16:11:32Z matt $"
//
// Roller header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Roller widget . */
#ifndef Fl_Roller_H
#define Fl_Roller_H
@@ -32,6 +35,12 @@
#include "Fl_Valuator.H"
#endif
/**
The Fl_Roller widget is a "dolly" control commonly used to
move 3D objects.
<P ALIGN=CENTER>\image html Fl_Roller.gif
\image latex Fl_Roller.eps "Fl_Roller" width=4cm
*/
class FL_EXPORT Fl_Roller : public Fl_Valuator {
protected:
void draw();
@@ -43,5 +52,5 @@ public:
#endif
//
// End of "$Id: Fl_Roller.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Roller.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Round_Button.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Round_Button.H 6614 2009-01-01 16:11:32Z matt $"
//
// Round button header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,11 +25,26 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Round_Button widget . */
#ifndef Fl_Round_Button_H
#define Fl_Round_Button_H
#include "Fl_Light_Button.H"
/**
Buttons generate callbacks when they are clicked by the user. You
control exactly when and how by changing the values for type()
and when().
<P ALIGN=CENTER>\image html Fl_Round_Button.gif</P>
\image latex Fl_Round_Button.eps " Fl_Round_Button" width=4cm
<P>The Fl_Round_Button subclass display the "on" state by
turning on a light, rather than drawing pushed in. The shape of the
"light" is initially set to FL_ROUND_DOWN_BOX. The color of the light
when on is controlled with selection_color(), which defaults to
FL_RED.
*/
class FL_EXPORT Fl_Round_Button : public Fl_Light_Button {
public:
Fl_Round_Button(int x,int y,int w,int h,const char *l = 0);
@@ -38,5 +53,5 @@ public:
#endif
//
// End of "$Id: Fl_Round_Button.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Round_Button.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Round_Clock.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Round_Clock.H 6614 2009-01-01 16:11:32Z matt $"
//
// Round clock header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,13 +25,18 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Round_Clock widget . */
#ifndef Fl_Round_Clock_H
#define Fl_Round_Clock_H
#include "Fl_Clock.H"
/** A clock widget of type FL_ROUND_CLOCK. Has no box. */
class Fl_Round_Clock : public Fl_Clock {
public:
/** Creates the clock widget, setting his type and box. */
Fl_Round_Clock(int x,int y,int w,int h, const char *l = 0)
: Fl_Clock(x,y,w,h,l) {type(FL_ROUND_CLOCK); box(FL_NO_BOX);}
};
@@ -39,5 +44,5 @@ public:
#endif
//
// End of "$Id: Fl_Round_Clock.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Round_Clock.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Scroll.H 5618 2007-01-18 19:23:24Z matt $"
// "$Id: Fl_Scroll.H 6614 2009-01-01 16:11:32Z matt $"
//
// Scroll header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,12 +25,71 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Scroll widget . */
#ifndef Fl_Scroll_H
#define Fl_Scroll_H
#include "Fl_Group.H"
#include "Fl_Scrollbar.H"
/**
This container widget lets you maneuver around a set of widgets much
larger than your window. If the child widgets are larger than the size
of this object then scrollbars will appear so that you can scroll over
to them:
<P ALIGN=CENTER>\image html Fl_Scroll.gif </P>
\image latex Fl_Scroll.eps "Fl_Scroll" width=4cm
<P>If all of the child widgets are packed together into a solid
rectangle then you want to set box() to FL_NO_BOX or
one of the _FRAME types. This will result in the best output.
However, if the child widgets are a sparse arrangment you must set
box() to a real _BOX type. This can result in some
blinking during redrawing, but that can be solved by using a
Fl_Double_Window. </P>
By default you can scroll in both directions, and the scrollbars
disappear if the data will fit in the area of the scroll.
<P>Use Fl_Scroll::type() to change this as follows :
<UL>
<LI>0 - No scrollbars </LI>
<LI>Fl_Scroll::HORIZONTAL - Only a horizontal scrollbar. </LI>
<LI>Fl_Scroll::VERTICAL - Only a vertical scrollbar. </LI>
<LI>Fl_Scroll::BOTH - The default is both scrollbars. </LI>
<LI>Fl_Scroll::HORIZONTAL_ALWAYS - Horizontal scrollbar always on, vertical always off. </LI>
<LI>Fl_Scroll::VERTICAL_ALWAYS - Vertical scrollbar always on, horizontal always off. </LI>
<LI>Fl_Scroll::BOTH_ALWAYS - Both always on. </LI>
</UL>
<P> Use <B> scrollbar.align(int) ( see void Fl_Widget::align(Fl_Align) ) :</B>
to change what side the scrollbars are drawn on.<BR>If the
FL_ALIGN_LEFT bit is on, the vertical scrollbar is on the left.
If the FL_ALIGN_TOP bit is on, the horizontal scrollbar is on
the top. Note that only the alignment flags in scrollbar are
considered. The flags in hscrollbar however are ignored.
<P>This widget can also be used to pan around a single child widget
"canvas". This child widget should be of your own class, with a
draw() method that draws the contents. The scrolling is done by
changing the x() and y() of the widget, so this child
must use the x() and y() to position it's drawing.
To speed up drawing it should test fl_push_clip().
<P>Another very useful child is a single
Fl_Pack, which is itself a group that packs it's children
together and changes size to surround them. Filling the Fl_Pack
with Fl_Tabs groups (and then putting
normal widgets inside those) gives you a very powerful scrolling list
of individually-openable panels. </P>
<P>Fluid lets you create these, but you can only lay out objects that
fit inside the Fl_Scroll without scrolling. Be sure to leave
space for the scrollbars, as Fluid won't show these either. </P>
<P><I>You cannot use Fl_Window as a child of this since the
clipping is not conveyed to it when drawn, and it will draw over the
scrollbars and neighboring objects.</I>
*/
class FL_EXPORT Fl_Scroll : public Fl_Group {
int xposition_, yposition_;
@@ -66,14 +125,16 @@ public:
BOTH_ALWAYS = 7
};
/** Gets the current horizontal scrolling position. */
int xposition() const {return xposition_;}
/** Gets the current vertical scrolling position. */
int yposition() const {return yposition_;}
void position(int, int);
void scroll_to(int, int);
void clear();
};
#endif
//
// End of "$Id: Fl_Scroll.H 5618 2007-01-18 19:23:24Z matt $".
// End of "$Id: Fl_Scroll.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Scrollbar.H 6042 2008-02-25 13:00:53Z matt $"
// "$Id: Fl_Scrollbar.H 6683 2009-03-14 11:46:43Z engelsman $"
//
// Scroll bar header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,11 +25,30 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Scrollbar widget . */
#ifndef Fl_Scrollbar_H
#define Fl_Scrollbar_H
#include "Fl_Slider.H"
/**
The Fl_Scrollbar widget displays a slider with arrow buttons at
the ends of the scrollbar. Clicking on the arrows move up/left and
down/right by linesize(). Scrollbars also accept FL_SHORTCUT events:
the arrows move by linesize(), and vertical scrollbars take Page
Up/Down (they move by the page size minus linesize()) and Home/End
(they jump to the top or bottom).
Scrollbars have step(1) preset (they always return integers). If
desired you can set the step() to non-integer values. You will then
have to use casts to get at the floating-point versions of value()
from Fl_Slider.
\image html scrollbar.gif
\image latex scrollbar.eps "Fl_Scrollbar" width=4cm
*/
class FL_EXPORT Fl_Scrollbar : public Fl_Slider {
int linesize_;
@@ -41,15 +60,55 @@ protected:
public:
Fl_Scrollbar(int x,int y,int w,int h, const char *l = 0);
Fl_Scrollbar(int X,int Y,int W,int H, const char *L = 0);
~Fl_Scrollbar();
int handle(int);
int value() {return int(Fl_Slider::value());}
int value(int p, int s, int top, int total) {
return scrollvalue(p, s, top, total);
/**
Gets the integer value (position) of the slider in the scrollbar.
You can get the floating point value with Fl_Slider::value().
\see Fl_Scrollbar::value(int p)
\see Fl_Scrollbar::value(int pos, int size, int first, int total)
*/
int value() const {return int(Fl_Slider::value());}
/**
Sets the value (position) of the slider in the scrollbar.
\see Fl_Scrollbar::value()
\see Fl_Scrollbar::value(int pos, int size, int first, int total)
*/
int value(int p) {return int(Fl_Slider::value((double)p));}
/**
Sets the position, size and range of the slider in the scrollbar.
\param[in] pos position, first line displayed
\param[in] size window size, number of lines displayed
\param[in] first number of first line
\param[in] total total number of lines
You should call this every time your window changes size, your data
changes size, or your scroll position changes (even if in response
to a callback from this scrollbar).
All necessary calls to redraw() are done.
Calls Fl_Slider::scrollvalue(int pos, int size, int first, int total).
*/
int value(int pos, int size, int first, int total) {
return scrollvalue(pos, size, first, total);
}
/**
Get the size of step, in lines, that the arror keys move.
*/
int linesize() const {return linesize_;}
/**
This number controls how big the steps are that the arrow keys do.
In addition page up/down move by the size last sent to value()
minus one linesize(). The default is 16.
*/
void linesize(int i) {linesize_ = i;}
};
@@ -57,5 +116,5 @@ public:
#endif
//
// End of "$Id: Fl_Scrollbar.H 6042 2008-02-25 13:00:53Z matt $".
// End of "$Id: Fl_Scrollbar.H 6683 2009-03-14 11:46:43Z engelsman $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Secret_Input.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Secret_Input.H 6614 2009-01-01 16:11:32Z matt $"
//
// Secret input header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,19 +25,32 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Secret_Input widget . */
#ifndef Fl_Secret_Input_H
#define Fl_Secret_Input_H
#include "Fl_Input.H"
/**
The Fl_Secret_Input class is a subclass of Fl_Input
that displays its input as a string of asterisks. This subclass is
usually used to receive passwords and other "secret" information.
*/
class Fl_Secret_Input : public Fl_Input {
public:
Fl_Secret_Input(int X,int Y,int W,int H,const char *l = 0)
: Fl_Input(X,Y,W,H,l) {type(FL_SECRET_INPUT);}
/**
Creates a new Fl_Secret_Input widget using the given
position, size, and label string. The default boxtype is FL_DOWN_BOX.
<P>Inherited destructor destroys the widget and any value associated with it.
*/
Fl_Secret_Input(int X,int Y,int W,int H,const char *l = 0)
: Fl_Input(X,Y,W,H,l) {type(FL_SECRET_INPUT);}
};
#endif
//
// End of "$Id: Fl_Secret_Input.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Secret_Input.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Select_Browser.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Select_Browser.H 6614 2009-01-01 16:11:32Z matt $"
//
// Select browser header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,19 +25,36 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Select_Browser widget . */
#ifndef Fl_Select_Browser_H
#define Fl_Select_Browser_H
#include "Fl_Browser.H"
/**
The class is a subclass of Fl_Browser
which lets the user select a single item, or no items by clicking on
the empty space. As long as the mouse button is held down on an
unselected item it is highlighted. Normally the callback is done when the
user presses the mouse, but you can change this with when().
<P>See Fl_Browser for methods to add and remove lines from the browser.
*/
class Fl_Select_Browser : public Fl_Browser {
public:
Fl_Select_Browser(int X,int Y,int W,int H,const char *l=0)
/**
Creates a new Fl_Select_Browser widget using the given
position, size, and label string. The default boxtype is FL_DOWN_BOX.
The constructor specializes Fl_Browser() by setting the type to FL_SELECT_BROWSER.
The destructor destroys the widget and frees all memory that has been allocated.
*/
Fl_Select_Browser(int X,int Y,int W,int H,const char *l=0)
: Fl_Browser(X,Y,W,H,l) {type(FL_SELECT_BROWSER);}
};
#endif
//
// End of "$Id: Fl_Select_Browser.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Select_Browser.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Shared_Image.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Shared_Image.H 6614 2009-01-01 16:11:32Z matt $"
//
// Shared image header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Shared_Image class . */
#ifndef Fl_Shared_Image_H
# define Fl_Shared_Image_H
@@ -36,6 +39,13 @@ typedef Fl_Image *(*Fl_Shared_Handler)(const char *name, uchar *header,
int headerlen);
// Shared images class.
/**
This class supports caching, loading,
and drawing of image files. Most applications will also want to
link against the fltk_images library and call the
fl_register_images()
function to support standard image formats such as BMP, GIF, JPEG, and PNG.
*/
class FL_EXPORT Fl_Shared_Image : public Fl_Image {
protected:
@@ -62,8 +72,9 @@ class FL_EXPORT Fl_Shared_Image : public Fl_Image {
void update();
public:
/** Returns the filename of the shared image */
const char *name() { return name_; }
/** Returns the number of references of this shared image. When reference is below 1, the image is deleted. */
int refcount() { return refcount_; }
void release();
void reload();
@@ -95,5 +106,5 @@ FL_EXPORT extern void fl_register_images();
#endif // !Fl_Shared_Image_H
//
// End of "$Id: Fl_Shared_Image.H 4288 2005-04-16 00:13:17Z mike $"
// End of "$Id: Fl_Shared_Image.H 6614 2009-01-01 16:11:32Z matt $"
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Simple_Counter.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Simple_Counter.H 6614 2009-01-01 16:11:32Z matt $"
//
// Simple counter header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,11 +25,18 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Simple_Counter widget . */
#ifndef Fl_Simple_Counter_H
#define Fl_Simple_Counter_H
#include "Fl_Counter.H"
/**
This widget creates a counter with only 2 arrow buttons
<P align=center>\image html counter.gif</P>
\image latex counter.eps "Fl_Simple_Counter" width=4cm
*/
class Fl_Simple_Counter : public Fl_Counter {
public:
Fl_Simple_Counter(int x,int y,int w,int h, const char *l = 0)
@@ -39,5 +46,5 @@ public:
#endif
//
// End of "$Id: Fl_Simple_Counter.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Simple_Counter.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Single_Window.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Single_Window.H 6614 2009-01-01 16:11:32Z matt $"
//
// Single-buffered window header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,18 +25,36 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Single_Window class . */
#ifndef Fl_Single_Window_H
#define Fl_Single_Window_H
#include "Fl_Window.H"
/**
This is the same as Fl_Window. However, it is possible that
some implementations will provide double-buffered windows by default.
This subcan be used to force single-buffering. This may be
useful for modifying existing programs that use incremental update, or
for some types of image data, such as a movie flipbook.
*/
class FL_EXPORT Fl_Single_Window : public Fl_Window {
public:
void show();
void show(int a, char **b) {Fl_Window::show(a,b);}
void flush();
/**
Creates a new Fl_Single_Window widget using the given
size, and label (title) string.
*/
Fl_Single_Window(int W, int H, const char *l=0)
: Fl_Window(W,H,l) {}
/**
Creates a new Fl_Single_Window widget using the given
position, size, and label (title) string.
*/
Fl_Single_Window(int X, int Y, int W, int H, const char *l=0)
: Fl_Window(X,Y,W,H,l) {}
int make_current();
@@ -45,5 +63,5 @@ public:
#endif
//
// End of "$Id: Fl_Single_Window.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Single_Window.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Slider.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Slider.H 6683 2009-03-14 11:46:43Z engelsman $"
//
// Slider header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Slider widget . */
#ifndef Fl_Slider_H
#define Fl_Slider_H
@@ -40,6 +43,30 @@
#define FL_VERT_NICE_SLIDER 4
#define FL_HOR_NICE_SLIDER 5
/**
The Fl_Slider widget contains a sliding knob inside a box. It if
often used as a scrollbar. Moving the box all the way to the
top/left sets it to the minimum(), and to the bottom/right to the
maximum(). The minimum() may be greater than the maximum() to
reverse the slider direction.
Use void Fl_Widget::type(int) to set how the slider is drawn,
which can be one of the following:
\li FL_VERTICAL - Draws a vertical slider (this is the default).
\li FL_HORIZONTAL - Draws a horizontal slider.
\li FL_VERT_FILL_SLIDER - Draws a filled vertical slider,
useful as a progress or value meter.
\li FL_HOR_FILL_SLIDER - Draws a filled horizontal slider,
useful as a progress or value meter.
\li FL_VERT_NICE_SLIDER - Draws a vertical slider with a nice
looking control knob.
\li FL_HOR_NICE_SLIDER - Draws a horizontal slider with a
nice looking control knob.
\image html slider.gif
\image latex slider.eps "Fl_Slider" width=4cm
*/
class FL_EXPORT Fl_Slider : public Fl_Valuator {
float slider_size_;
@@ -52,24 +79,42 @@ protected:
// these allow subclasses to put the slider in a smaller area:
void draw(int, int, int, int);
int handle(int, int, int, int, int);
void draw();
public:
void draw();
int handle(int);
Fl_Slider(int x,int y,int w,int h, const char *l = 0);
Fl_Slider(uchar t,int x,int y,int w,int h, const char *l);
Fl_Slider(int X,int Y,int W,int H, const char *L = 0);
Fl_Slider(uchar t,int X,int Y,int W,int H, const char *L);
int scrollvalue(int windowtop,int windowsize,int first,int totalsize);
int scrollvalue(int pos,int size,int first,int total);
void bounds(double a, double b);
/**
Get the dimensions of the moving piece of slider.
*/
float slider_size() const {return slider_size_;}
/**
Set the dimensions of the moving piece of slider. This is
the fraction of the size of the entire widget. If you set this
to 1 then the slider cannot move. The default value is .08.
For the "fill" sliders this is the size of the area around the
end that causes a drag effect rather than causing the slider to
jump to the mouse.
*/
void slider_size(double v);
/** Gets the slider box type. */
Fl_Boxtype slider() const {return (Fl_Boxtype)slider_;}
/** Sets the slider box type. */
void slider(Fl_Boxtype c) {slider_ = c;}
};
#endif
//
// End of "$Id: Fl_Slider.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Slider.H 6683 2009-03-14 11:46:43Z engelsman $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id$"
// "$Id: Fl_Spinner.H 6614 2009-01-01 16:11:32Z matt $"
//
// Spinner widget for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2006 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Spinner widget . */
#ifndef Fl_Spinner_H
# define Fl_Spinner_H
@@ -40,10 +43,11 @@
# include <stdlib.h>
//
// Fl_Spinner widget class...
//
/**
This widget is a combination of the input
widget and repeat buttons. The user can either type into the
input area or use the buttons to change the value.
*/
class Fl_Spinner : public Fl_Group
{
double value_; // Current value
@@ -114,6 +118,11 @@ class Fl_Spinner : public Fl_Group
public:
/**
Creates a new Fl_Spinner widget using the given position, size,
and label string.
<P>Inherited destructor Destroys the widget and any value associated with it.
*/
Fl_Spinner(int X, int Y, int W, int H, const char *L = 0)
: Fl_Group(X, Y, W, H, L),
input_(X, Y, W - H / 2 - 2, H),
@@ -140,7 +149,9 @@ class Fl_Spinner : public Fl_Group
down_button_.callback((Fl_Callback *)sb_cb, this);
}
/** Sets or returns the format string for the value. */
const char *format() { return (format_); }
/** Sets or returns the format string for the value. */
void format(const char *f) { format_ = f; update(); }
int handle(int event) {
@@ -163,13 +174,19 @@ class Fl_Spinner : public Fl_Group
return Fl_Group::handle(event);
}
// Speling mistaks retained for source compatibility...
/** Speling mistakes retained for source compatibility \deprecated */
double maxinum() const { return (maximum_); }
/** Gets the maximum value of the widget. */
double maximum() const { return (maximum_); }
/** Sets the maximum value of the widget. */
void maximum(double m) { maximum_ = m; }
/** Speling mistakes retained for source compatibility \deprecated */
double mininum() const { return (minimum_); }
/** Gets the minimum value of the widget. */
double minimum() const { return (minimum_); }
/** Sets the minimum value of the widget. */
void minimum(double m) { minimum_ = m; }
/** Sets the minimum and maximum values for the widget. */
void range(double a, double b) { minimum_ = a; maximum_ = b; }
void resize(int X, int Y, int W, int H) {
Fl_Group::resize(X,Y,W,H);
@@ -179,32 +196,51 @@ class Fl_Spinner : public Fl_Group
down_button_.resize(X + W - H / 2 - 2, Y + H - H / 2,
H / 2 + 2, H / 2);
}
/**
Sets or returns the amount to change the value when the user clicks a button.
Before setting step to a non-integer value, the spinner
type() should be changed to floating point.
*/
double step() const { return (step_); }
/** See double Fl_Spinner::step() const */
void step(double s) {
step_ = s;
if (step_ != (int)step_) input_.type(FL_FLOAT_INPUT);
else input_.type(FL_INT_INPUT);
update();
}
/** Gets the color of the text in the input field. */
Fl_Color textcolor() const {
return (input_.textcolor());
}
/** Sets the color of the text in the input field. */
void textcolor(Fl_Color c) {
input_.textcolor(c);
}
uchar textfont() const {
/** Gets the font of the text in the input field. */
Fl_Font textfont() const {
return (input_.textfont());
}
void textfont(uchar f) {
/** Sets the font of the text in the input field. */
void textfont(Fl_Font f) {
input_.textfont(f);
}
uchar textsize() const {
/** Gets the size of the text in the input field. */
Fl_Fontsize textsize() const {
return (input_.textsize());
}
void textsize(uchar s) {
/** Sets the size of the text in the input field. */
void textsize(Fl_Fontsize s) {
input_.textsize(s);
}
/** Sets or Gets the numeric representation in the input field.
Valid values are FL_INT_INPUT and FL_FLOAT_INPUT.
The first form also changes the format() template.
Setting a new spinner type via a superclass pointer will not work.
\note type is not a virtual function.
*/
uchar type() const { return (input_.type()); }
/** See uchar Fl_Spinner::type() const */
void type(uchar v) {
if (v==FL_FLOAT_INPUT) {
format("%.*f");
@@ -213,12 +249,18 @@ class Fl_Spinner : public Fl_Group
}
input_.type(v);
}
/** Gets the current value of the widget. */
double value() const { return (value_); }
/**
Sets the current value of the widget.
Before setting value to a non-integer value, the spinner
type() should be changed to floating point.
*/
void value(double v) { value_ = v; update(); }
};
#endif // !Fl_Spinner_H
//
// End of "$Id$".
// End of "$Id: Fl_Spinner.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Sys_Menu_Bar.H 4546 2005-08-29 20:05:38Z matt $"
// "$Id: Fl_Sys_Menu_Bar.H 6614 2009-01-01 16:11:32Z matt $"
//
// MacOS system menu bar header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -52,5 +52,5 @@ typedef Fl_Menu_Bar Fl_Sys_Menu_Bar;
#endif
//
// End of "$Id: Fl_Sys_Menu_Bar.H 4546 2005-08-29 20:05:38Z matt $".
// End of "$Id: Fl_Sys_Menu_Bar.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Tabs.H 5326 2006-08-17 13:43:07Z matt $"
// "$Id: Fl_Tabs.H 6614 2009-01-01 16:11:32Z matt $"
//
// Tab header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,11 +25,40 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Tabs widget . */
#ifndef Fl_Tabs_H
#define Fl_Tabs_H
#include "Fl_Group.H"
/**
The Fl_Tabs widget is the "file card tabs"
interface that allows you to put lots and lots of buttons and
switches in a panel, as popularized by many toolkits.
\image html tabs.gif
\image latex tabs.eps "Fl_Tabs" width=8cm
Clicking the tab makes a child visible() by calling
show() on it, and all other children are made invisible
by calling hide() on them. Usually the children are Fl_Group widgets
containing several widgets themselves.
Each child makes a card, and its label() is printed
on the card tab, including the label font and style. The
selection color of that child is used to color the tab, while
the color of the child determines the background color of the pane.
The size of the tabs is controlled by the bounding box of the
children (there should be some space between the children and
the edge of the Fl_Tabs), and the tabs may be placed
"inverted" on the bottom - this is determined by which
gap is larger. It is easiest to lay this out in fluid, using the
fluid browser to select each child group and resize them until
the tabs look the way you want them to.
*/
class FL_EXPORT Fl_Tabs : public Fl_Group {
Fl_Widget *value_;
Fl_Widget *push_;
@@ -53,5 +82,5 @@ public:
#endif
//
// End of "$Id: Fl_Tabs.H 5326 2006-08-17 13:43:07Z matt $".
// End of "$Id: Fl_Tabs.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Text_Buffer.H 6010 2008-01-04 20:31:52Z matt $"
// "$Id: Fl_Text_Buffer.H 6618 2009-01-01 21:54:10Z matt $"
//
// Header file for Fl_Text_Buffer class.
//
// Copyright 2001-2005 by Bill Spitzak and others.
// Copyright 2001-2009 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
// the LGPL for the FLTK library granted by Mark Edel.
//
@@ -27,6 +27,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Text_Buffer, Fl_Text_Selection widget . */
#ifndef FL_TEXT_BUFFER_H
#define FL_TEXT_BUFFER_H
@@ -36,6 +39,11 @@
#include "Fl_Export.H"
/** \class Fl_Text_Selection
This is an internal class for Fl_Text_Buffer to manage text selections.
\todo members must be documented
*/
class FL_EXPORT Fl_Text_Selection {
friend class Fl_Text_Buffer;
@@ -48,6 +56,10 @@ class FL_EXPORT Fl_Text_Selection {
int end() { return mEnd; }
int rect_start() { return mRectStart; }
int rect_end() { return mRectEnd; }
/**
Returns a non-zero number if any text has been selected, or 0
if no text is selected.
*/
char selected() { return mSelected; }
void selected(char b) { mSelected = b; }
int includes(int pos, int lineStartPos, int dispIndex);
@@ -69,11 +81,26 @@ typedef void (*Fl_Text_Modify_Cb)(int pos, int nInserted, int nDeleted,
void* cbArg);
typedef void (*Fl_Text_Predelete_Cb)(int pos, int nDeleted, void* cbArg);
/**
The Fl_Text_Buffer class is used by the Fl_Text_Display
and Fl_Text_Editor to manage complex text data and is based upon the
excellent NEdit text editor engine - see http://www.nedit.org/.
*/
/**
The Fl_Text_Buffer class is used by the
Fl_Text_Display
and
Fl_Text_Editor
to manage complex text data and is based upon the
excellent NEdit text editor engine - see
http://www.nedit.org/.
*/
class FL_EXPORT Fl_Text_Buffer {
public:
Fl_Text_Buffer(int requestedSize = 0);
Fl_Text_Buffer(int requestedSize = 0, int preferredGapSize = 1024);
~Fl_Text_Buffer();
/** Returns the number of characters in the buffer. */
int length() { return mLength; }
char* text();
void text(const char* text);
@@ -81,6 +108,7 @@ class FL_EXPORT Fl_Text_Buffer {
char character(int pos);
char* text_in_rectangle(int start, int end, int rectStart, int rectEnd);
void insert(int pos, const char* text);
/** Appends the text string to the end of the buffer. */
void append(const char* t) { insert(length(), t); }
void remove(int start, int end);
void replace(int start, int end, const char *text);
@@ -88,11 +116,19 @@ class FL_EXPORT Fl_Text_Buffer {
int undo(int *cp=0);
void canUndo(char flag=1);
int insertfile(const char *file, int pos, int buflen = 128*1024);
/**
Appends the named file to the end of the buffer. Returns 0 on
success, non-zero on error (strerror() contains reason). 1 indicates
open for read failed (no data loaded). 2 indicates error occurred
while reading data (data was partially loaded).
*/
int appendfile(const char *file, int buflen = 128*1024)
{ return insertfile(file, length(), buflen); }
/** Loads a text file into the buffer */
int loadfile(const char *file, int buflen = 128*1024)
{ select(0, length()); remove_selection(); return appendfile(file, buflen); }
int outputfile(const char *file, int start, int end, int buflen = 128*1024);
/** Saves a text file from the current buffer */
int savefile(const char *file, int buflen = 128*1024)
{ return outputfile(file, 0, length(), buflen); }
@@ -108,9 +144,11 @@ class FL_EXPORT Fl_Text_Buffer {
void remove_rectangular(int start, int end, int rectStart, int rectEnd);
void clear_rectangular(int start, int end, int rectStart, int rectEnd);
/** Gets the tab width. */
int tab_distance() { return mTabDist; }
void tab_distance(int tabDist);
void select(int start, int end);
/** Returns a non 0 value if text has been selected, 0 otherwise */
int selected() { return mPrimary.selected(); }
void unselect();
void select_rectangular(int start, int end, int rectStart, int rectEnd);
@@ -123,7 +161,10 @@ class FL_EXPORT Fl_Text_Buffer {
void remove_selection();
void replace_selection(const char* text);
void secondary_select(int start, int end);
/** Returns a non 0 value if text has been selected in the secondary
text selection, 0 otherwise */
int secondary_selected() { return mSecondary.selected(); }
/** Clears any selection in the secondary text selection object. */
void secondary_unselect();
void secondary_select_rectangular(int start, int end, int rectStart,
@@ -137,6 +178,10 @@ class FL_EXPORT Fl_Text_Buffer {
void remove_secondary_selection();
void replace_secondary_selection(const char* text);
void highlight(int start, int end);
/**
Returns the highlighted text. When you are done with the
text, free it using the free() function.
*/
int highlight() { return mHighlight.selected(); }
void unhighlight();
void highlight_rectangular(int start, int end, int rectStart, int rectEnd);
@@ -149,12 +194,21 @@ class FL_EXPORT Fl_Text_Buffer {
void add_modify_callback(Fl_Text_Modify_Cb bufModifiedCB, void* cbArg);
void remove_modify_callback(Fl_Text_Modify_Cb bufModifiedCB, void* cbArg);
/**
Calls all modify callbacks that have been registered using
the add_modify_callback()
method.
*/
void call_modify_callbacks() { call_modify_callbacks(0, 0, 0, 0, 0); }
void add_predelete_callback(Fl_Text_Predelete_Cb bufPredelCB, void* cbArg);
void remove_predelete_callback(Fl_Text_Predelete_Cb predelCB, void* cbArg);
void call_predelete_callbacks() { call_predelete_callbacks(0, 0); }
/**
Calls the stored pre-delete callback procedure(s) for this buffer to update
the changed area(s) on the screen and any other listeners.
*/
void call_predelete_callbacks() { call_predelete_callbacks(0, 0); }
char* line_text(int pos);
int line_start(int pos);
@@ -185,9 +239,13 @@ class FL_EXPORT Fl_Text_Buffer {
int substitute_null_characters(char* string, int length);
void unsubstitute_null_characters(char* string);
/** Returns the current nul substitution character. */
char null_substitution_character() { return mNullSubsChar; }
/** Returns the primary selection. */
Fl_Text_Selection* primary_selection() { return &mPrimary; }
/** Returns the secondary selection. */
Fl_Text_Selection* secondary_selection() { return &mSecondary; }
/** Returns the current highlight selection. */
Fl_Text_Selection* highlight_selection() { return &mHighlight; }
protected:
@@ -223,41 +281,44 @@ class FL_EXPORT Fl_Text_Buffer {
void update_selections(int pos, int nDeleted, int nInserted);
Fl_Text_Selection mPrimary; /* highlighted areas */
Fl_Text_Selection mSecondary;
Fl_Text_Selection mHighlight;
int mLength; /* length of the text in the buffer (the length
Fl_Text_Selection mPrimary; /**< highlighted areas */
Fl_Text_Selection mSecondary; /**< highlighted areas */
Fl_Text_Selection mHighlight; /**< highlighted areas */
int mLength; /**< length of the text in the buffer (the length
of the buffer itself must be calculated:
gapEnd - gapStart + length) */
char* mBuf; /* allocated memory where the text is stored */
int mGapStart; /* points to the first character of the gap */
int mGapEnd; /* points to the first char after the gap */
char* mBuf; /**< allocated memory where the text is stored */
int mGapStart; /**< points to the first character of the gap */
int mGapEnd; /**< points to the first char after the gap */
// The hardware tab distance used by all displays for this buffer,
// and used in computing offsets for rectangular selection operations.
int mTabDist; /* equiv. number of characters in a tab */
int mUseTabs; /* True if buffer routines are allowed to use
int mTabDist; /**< equiv. number of characters in a tab */
int mUseTabs; /**< True if buffer routines are allowed to use
tabs for padding in rectangular operations */
int mNModifyProcs; /* number of modify-redisplay procs attached */
Fl_Text_Modify_Cb* /* procedures to call when buffer is */
mNodifyProcs; /* modified to redisplay contents */
void** mCbArgs; /* caller arguments for modifyProcs above */
int mNPredeleteProcs; /* number of pre-delete procs attached */
Fl_Text_Predelete_Cb* /* procedure to call before text is deleted */
mPredeleteProcs; /* from the buffer; at most one is supported. */
void **mPredeleteCbArgs; /* caller argument for pre-delete proc above */
int mCursorPosHint; /* hint for reasonable cursor position after
int mNModifyProcs; /**< number of modify-redisplay procs attached */
Fl_Text_Modify_Cb* /**< procedures to call when buffer is */
mNodifyProcs; /**< modified to redisplay contents */
void** mCbArgs; /**< caller arguments for modifyProcs above */
int mNPredeleteProcs; /**< number of pre-delete procs attached */
Fl_Text_Predelete_Cb* /**< procedure to call before text is deleted */
mPredeleteProcs; /**< from the buffer; at most one is supported. */
void **mPredeleteCbArgs; /**< caller argument for pre-delete proc above */
int mCursorPosHint; /**< hint for reasonable cursor position after
a buffer modification operation */
char mNullSubsChar; /* NEdit is based on C null-terminated strings,
char mNullSubsChar; /**< NEdit is based on C null-terminated strings,
so ascii-nul characters must be substituted
with something else. This is the else, but
of course, things get quite messy when you
use it */
char mCanUndo; /* if this buffer is used for attributes, it must
char mCanUndo; /**< if this buffer is used for attributes, it must
not do any undo calls */
int mPreferredGapSize; /**< the default allocation for the text gap is 1024
bytes and should only be increased if frequent
and large changes in buffer size are expected */
};
#endif
//
// End of "$Id: Fl_Text_Buffer.H 6010 2008-01-04 20:31:52Z matt $".
// End of "$Id: Fl_Text_Buffer.H 6618 2009-01-01 21:54:10Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Text_Display.H 4502 2005-08-10 23:11:51Z matt $"
// "$Id: Fl_Text_Display.H 6614 2009-01-01 16:11:32Z matt $"
//
// Header file for Fl_Text_Display class.
//
// Copyright 2001-2005 by Bill Spitzak and others.
// Copyright 2001-2009 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
// the LGPL for the FLTK library granted by Mark Edel.
//
@@ -27,6 +27,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Text_Display widget . */
#ifndef FL_TEXT_DISPLAY_H
#define FL_TEXT_DISPLAY_H
@@ -36,8 +39,16 @@
#include "Fl_Scrollbar.H"
#include "Fl_Text_Buffer.H"
/**
This is the FLTK text display widget. It allows the user to
view multiple lines of text and supports highlighting and
scrolling. The buffer that is displayed in the widget is managed
by the Fl_Text_Buffer
class.
*/
class FL_EXPORT Fl_Text_Display: public Fl_Group {
public:
/** text display cursor shapes enumeration */
enum {
NORMAL_CURSOR, CARET_CURSOR, DIM_CURSOR,
BLOCK_CURSOR, HEAVY_CURSOR
@@ -47,9 +58,10 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
CURSOR_POS, CHARACTER_POS
};
// drag types- they match Fl::event_clicks() so that single clicking to
// start a collection selects by character, double clicking selects by
// word and triple clicking selects by line.
/** drag types- they match Fl::event_clicks() so that single clicking to
start a collection selects by character, double clicking selects by
word and triple clicking selects by line.
*/
enum {
DRAG_CHAR = 0, DRAG_WORD = 1, DRAG_LINE = 2
};
@@ -57,13 +69,14 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
typedef void (*Unfinished_Style_Cb)(int, void *);
// style attributes - currently not implemented!
/** style attributes - currently not implemented! */
enum {
ATTR_NONE = 0,
ATTR_UNDERLINE = 1,
ATTR_HIDDEN = 2
};
/** This structure associates the color,font,size of a string to draw
with an attribute mask matching attr */
struct Style_Table_Entry {
Fl_Color color;
Fl_Font font;
@@ -76,13 +89,22 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
virtual int handle(int e);
void buffer(Fl_Text_Buffer* buf);
/**
Sets or gets the current text buffer associated with the text widget.
Multiple text widgets can be associated with the same text buffer.
*/
void buffer(Fl_Text_Buffer& buf) { buffer(&buf); }
/**
Gets the current text buffer associated with the text widget.
Multiple text widgets can be associated with the same text buffer.
*/
Fl_Text_Buffer* buffer() { return mBuffer; }
void redisplay_range(int start, int end);
void scroll(int topLineNum, int horizOffset);
void insert(const char* text);
void overstrike(const char* text);
void insert_position(int newPos);
/** Gets the position of the text insertion cursor for text display */
int insert_position() { return mCursorPos; }
int in_selection(int x, int y);
void show_insert_position();
@@ -98,15 +120,24 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
void next_word(void);
void previous_word(void);
void show_cursor(int b = 1);
/** Hides the text cursor */
void hide_cursor() { show_cursor(0); }
void cursor_style(int style);
/** Sets or gets the text cursor color. */
Fl_Color cursor_color() const {return mCursor_color;}
/** Sets or gets the text cursor color. */
void cursor_color(Fl_Color n) {mCursor_color = n;}
/** Sets or gets the width/height of the scrollbars. */
int scrollbar_width() { return scrollbar_width_; }
Fl_Align scrollbar_align() { return scrollbar_align_; }
/** Sets or gets the width/height of the scrollbars. */
void scrollbar_width(int W) { scrollbar_width_ = W; }
/** Gets the scrollbar alignment type */
Fl_Align scrollbar_align() { return scrollbar_align_; }
/** Sets the scrollbar alignment type */
void scrollbar_align(Fl_Align a) { scrollbar_align_ = a; }
/** Moves the insert position to the beginning of the current word. */
int word_start(int pos) { return buffer()->word_start(pos); }
/** Moves the insert position to the end of the current word. */
int word_end(int pos) { return buffer()->word_end(pos); }
@@ -118,12 +149,24 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
int position_style(int lineStartPos, int lineLen, int lineIndex,
int dispIndex);
/** \todo FIXME : get set methods pointing on shortcut_
have no effects as shortcut_ is unused in this class and derived! */
int shortcut() const {return shortcut_;}
/** \todo FIXME : get set methods pointing on shortcut_
have no effects as shortcut_ is unused in this class and derived! */
void shortcut(int s) {shortcut_ = s;}
Fl_Font textfont() const {return (Fl_Font)textfont_;}
void textfont(uchar s) {textfont_ = s;}
uchar textsize() const {return textsize_;}
void textsize(uchar s) {textsize_ = s;}
/** Gets the default font used when drawing text in the widget. */
Fl_Font textfont() const {return textfont_;}
/** Sets the default font used when drawing text in the widget. */
void textfont(Fl_Font s) {textfont_ = s;}
/** Gets the default size of text in the widget. */
Fl_Fontsize textsize() const {return textsize_;}
/** Sets the default size of text in the widget. */
void textsize(Fl_Fontsize s) {textsize_ = s;}
/** Gets the default color of text in the widget. */
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
/** Sets the default color of text in the widget. */
void textcolor(unsigned n) {textcolor_ = n;}
int wrapped_column(int row, int column);
@@ -212,7 +255,7 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
int wrap_uses_character(int lineEndPos);
int range_touches_selection(Fl_Text_Selection *sel, int rangeStart,
int rangeEnd);
#ifndef FL_DOXYGEN
int damage_range1_start, damage_range1_end;
int damage_range2_start, damage_range2_end;
int mCursorPos;
@@ -280,8 +323,10 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
int display_insert_position_hint;
struct { int x, y, w, h; } text_area;
uchar textfont_;
uchar textsize_;
int shortcut_;
Fl_Font textfont_;
Fl_Fontsize textsize_;
unsigned textcolor_;
// The following are not presently used from the original NEdit code,
@@ -289,10 +334,11 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
// can implement line numbers without breaking binary compatibility.
int mLineNumLeft, mLineNumWidth;
/* Line number margin and width */
#endif
};
#endif
//
// End of "$Id: Fl_Text_Display.H 4502 2005-08-10 23:11:51Z matt $".
// End of "$Id: Fl_Text_Display.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Text_Editor.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Text_Editor.H 6614 2009-01-01 16:11:32Z matt $"
//
// Header file for Fl_Text_Editor class.
//
// Copyright 2001-2005 by Bill Spitzak and others.
// Copyright 2001-2009 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
// the LGPL for the FLTK library granted by Mark Edel.
//
@@ -27,6 +27,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Text_Editor widget . */
#ifndef FL_TEXT_EDITOR_H
#define FL_TEXT_EDITOR_H
@@ -36,35 +39,59 @@
// key will match in any state
#define FL_TEXT_EDITOR_ANY_STATE (-1L)
/**
This is the FLTK text editor widget. It allows the user to
edit multiple lines of text and supports highlighting and
scrolling. The buffer that is displayed in the widget is managed
by the Fl_Text_Buffer
class.
*/
class FL_EXPORT Fl_Text_Editor : public Fl_Text_Display {
public:
/** Key function binding callback type */
typedef int (*Key_Func)(int key, Fl_Text_Editor* editor);
/** Simple linked list associating a key/state to a function */
struct Key_Binding {
int key;
int state;
Key_Func function;
Key_Binding* next;
int key; ///< the key pressed
int state; ///< the state of key modifiers
Key_Func function; ///< associated function
Key_Binding* next; ///< next key binding in the list
};
Fl_Text_Editor(int X, int Y, int W, int H, const char* l = 0);
~Fl_Text_Editor() { remove_all_key_bindings(); }
virtual int handle(int e);
/**
Sets the current insert mode; if non-zero, new text
is inserted before the current cursor position. Otherwise, new
text replaces text at the current cursor position.
*/
void insert_mode(int b) { insert_mode_ = b; }
/**
Gets the current insert mode; if non-zero, new text
is inserted before the current cursor position. Otherwise, new
text replaces text at the current cursor position.
*/
int insert_mode() { return insert_mode_; }
void add_key_binding(int key, int state, Key_Func f, Key_Binding** list);
/** Adds a key of state "state" with the function "function" */
void add_key_binding(int key, int state, Key_Func f)
{ add_key_binding(key, state, f, &key_bindings); }
void remove_key_binding(int key, int state, Key_Binding** list);
/** Removes the key binding associated with the key "key" of state "state". */
void remove_key_binding(int key, int state)
{ remove_key_binding(key, state, &key_bindings); }
void remove_all_key_bindings(Key_Binding** list);
/** Removes all of the key bindings associated with the text editor or list. */
void remove_all_key_bindings() { remove_all_key_bindings(&key_bindings); }
void add_default_key_bindings(Key_Binding** list);
Key_Func bound_key_function(int key, int state, Key_Binding* list);
/** Returns the function associated with a key binding. */
Key_Func bound_key_function(int key, int state)
{ return bound_key_function(key, state, key_bindings); }
/** Sets the default key function for unassigned keys. */
void default_key_function(Key_Func f) { default_key_function_ = f; }
// functions for the built in default bindings
@@ -96,15 +123,17 @@ class FL_EXPORT Fl_Text_Editor : public Fl_Text_Display {
int handle_key();
void maybe_do_callback();
#ifndef FL_DOXYGEN
int insert_mode_;
Key_Binding* key_bindings;
static Key_Binding* global_key_bindings;
Key_Func default_key_function_;
#endif
};
#endif
//
// End of "$Id: Fl_Text_Editor.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Text_Editor.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Tile.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Tile.H 6614 2009-01-01 16:11:32Z matt $"
//
// Tile header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,14 +25,71 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Tile widget . */
#ifndef Fl_Tile_H
#define Fl_Tile_H
#include "Fl_Group.H"
/**
The Fl_Tile class lets you resize the children by dragging
the border between them:
<P ALIGN=CENTER>\image html Fl_Tile.gif </P>
\image latex Fl_Tile.eps "Fl_Tile" width=4cm
<P>For the tiling to work correctly, the children of an
Fl_Tile must cover the entire area of the widget, but not
overlap. This means that all children must touch each
other at their edges, and no gaps can't be left inside the
Fl_Tile.
<P>Fl_Tile does not normailly draw any graphics of its own.
The "borders" which can be seen in the snapshot above
are actually part of the children. Their boxtypes have been set
to FL_DOWN_BOX creating the impression of
"ridges" where the boxes touch. What you see are
actually two adjacent FL_DOWN_BOX's drawn next to each
other. All neighboring widgets share the same edge - the widget's
thick borders make it appear as though the widgets aren't actually
touching, but they are. If the edges of adjacent widgets do not
touch, then it will be impossible to drag the corresponding
edges.</P>
<P>Fl_Tile allows objects to be resized to zero dimensions.
To prevent this you can use the resizable() to limit where
corners can be dragged to.</P>
<P>Even though objects can be resized to zero sizes, they must
initially have non-zero sizes so the Fl_Tile can figure out
their layout. If desired, call position() after creating the
children but before displaying the window to set the borders where you
want.
<P>Note on resizable(Fl_Widget &w) :
The "resizable" child widget (which should be invisible) limits where the
border can be dragged to. If you don't set it, it will be possible to
drag the borders right to the edge, and thus resize objects on the edge
to zero width or height. The resizable() widget is not
resized by dragging any borders. See also void Fl_Group::resizable(Fl_Widget &w)
*/
class FL_EXPORT Fl_Tile : public Fl_Group {
public:
int handle(int);
/**
Creates a new Fl_Tile widget using the given position, size,
and label string. The default boxtype is FL_NO_BOX.
<P>The destructor <I>also deletes all the children</I>. This allows a
whole tree to be deleted at once, without having to keep a pointer to
all the children in the user code. A kludge has been done so the
Fl_Tile and all of it's children can be automatic (local)
variables, but you must declare the Fl_Tile <I>first</I>, so
that it is destroyed last.
*/
Fl_Tile(int X,int Y,int W,int H,const char*l=0) : Fl_Group(X,Y,W,H,l) {}
void resize(int, int, int, int);
void position(int, int, int, int);
@@ -41,5 +98,5 @@ public:
#endif
//
// End of "$Id: Fl_Tile.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Tile.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Tiled_Image.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Tiled_Image.H 6614 2009-01-01 16:11:32Z matt $"
//
// Tiled image header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,13 +25,23 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Tiled_Image widget . */
#ifndef Fl_Tiled_Image_H
# define Fl_Tiled_Image_H
# include "Fl_Image.H"
// Tiled image class.
/**
This class supports tiling of images
over a specified area. The source (tile) image is <B>not</B>
copied unless you call the color_average(),
desaturate(),
or inactive()
methods.
*/
class FL_EXPORT Fl_Tiled_Image : public Fl_Image {
protected:
@@ -49,11 +59,12 @@ class FL_EXPORT Fl_Tiled_Image : public Fl_Image {
virtual void desaturate();
virtual void draw(int X, int Y, int W, int H, int cx, int cy);
void draw(int X, int Y) { draw(X, Y, w(), h(), 0, 0); }
/** Gets The image that is shared */
Fl_Image *image() { return image_; }
};
#endif // !Fl_Tiled_Image_H
//
// End of "$Id: Fl_Tiled_Image.H 4288 2005-04-16 00:13:17Z mike $"
// End of "$Id: Fl_Tiled_Image.H 6614 2009-01-01 16:11:32Z matt $"
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Timer.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Timer.H 6614 2009-01-01 16:11:32Z matt $"
//
// Timer header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Timer widget . */
#ifndef Fl_Timer_H
#define Fl_Timer_H
@@ -37,6 +40,13 @@
#define FL_VALUE_TIMER 1
#define FL_HIDDEN_TIMER 2
/**
This is provided only to emulate the Forms Timer widget. It works by
making a timeout callback every 1/5 second. This is wasteful and
inaccurate if you just want something to happen a fixed time in the
future. You should directly call
Fl::add_timeout() instead.
*/
class FL_EXPORT Fl_Timer : public Fl_Widget {
static void stepcb(void *);
void step();
@@ -50,9 +60,21 @@ public:
Fl_Timer(uchar t,int x,int y,int w,int h, const char *l);
~Fl_Timer();
void value(double);
/** See void Fl_Timer::value(double) */
double value() const {return delay>0.0?delay:0.0;}
/**
Gets or sets the direction of the timer. If the direction is zero
then the timer will count up, otherwise it will count down from the
initial value().
*/
char direction() const {return direction_;}
/**
Gets or sets the direction of the timer. If the direction is zero
then the timer will count up, otherwise it will count down from the
initial value().
*/
void direction(char d) {direction_ = d;}
/** Gets or sets whether the timer is suspended. */
char suspended() const {return !on;}
void suspended(char d);
};
@@ -60,6 +82,6 @@ public:
#endif
//
// End of "$Id: Fl_Timer.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Timer.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Toggle_Button.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Toggle_Button.H 6614 2009-01-01 16:11:32Z matt $"
//
// Toggle button header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,13 +25,30 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Toggle_Button widget . */
#ifndef Fl_Toggle_Button_H
#define Fl_Toggle_Button_H
#include "Fl_Button.H"
/**
The toggle button is a push button that needs to be clicked once
to toggle on, and one more time to toggle off.
The Fl_Toggle_Button subclass displays the "on" state by
drawing a pushed-in button.</P>
<P>Buttons generate callbacks when they are clicked by the user. You
control exactly when and how by changing the values for type()
and when().
*/
class Fl_Toggle_Button : public Fl_Button {
public:
/**
Creates a new Fl_Toggle_Button widget using the given
position, size, and label string.
<P>The inherited destructor deletes the toggle button.
*/
Fl_Toggle_Button(int X,int Y,int W,int H,const char *l=0)
: Fl_Button(X,Y,W,H,l) {type(FL_TOGGLE_BUTTON);}
};
@@ -39,5 +56,5 @@ public:
#endif
//
// End of "$Id: Fl_Toggle_Button.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Toggle_Button.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Toggle_Light_Button.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Toggle_Light_Button.H 6614 2009-01-01 16:11:32Z matt $"
//
// Toggle light button header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,7 +25,7 @@
// http://www.fltk.org/str.php
//
// provided for back-compatability only
// provided for back-compatibility only
#ifndef Fl_Toggle_Light_Button
#include "Fl_Light_Button.H"
@@ -33,5 +33,5 @@
#endif
//
// End of "$Id: Fl_Toggle_Light_Button.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Toggle_Light_Button.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Toggle_Round_Button.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Toggle_Round_Button.H 6614 2009-01-01 16:11:32Z matt $"
//
// Toggle round button header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,7 +25,7 @@
// http://www.fltk.org/str.php
//
// provided for back-compatability only
// provided for back-compatibility only
#ifndef Fl_Toggle_Round_Button
#include "Fl_Round_Button.H"
@@ -33,5 +33,5 @@
#endif
//
// End of "$Id: Fl_Toggle_Round_Button.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Toggle_Round_Button.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Tooltip.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Tooltip.H 6614 2009-01-01 16:11:32Z matt $"
//
// Tooltip header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,53 +25,85 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Tooltip widget . */
#ifndef Fl_Tooltip_H
#define Fl_Tooltip_H
#include <FL/Fl.H>
#include <FL/Fl_Widget.H>
/**
The Fl_Tooltip class provides tooltip support for
all FLTK widgets. It contains only static methods.
*/
class FL_EXPORT Fl_Tooltip {
public:
/** Gets the tooltip delay. The default delay is 1.0 seconds. */
static float delay() { return delay_; }
/** Sets the tooltip delay. The default delay is 1.0 seconds. */
static void delay(float f) { delay_ = f; }
/**
Gets the tooltip hover delay, the delay between tooltips.
The default delay is 0.2 seconds.
*/
static float hoverdelay() { return hoverdelay_; }
/**
Sets the tooltip hover delay, the delay between tooltips.
The default delay is 0.2 seconds.
*/
static void hoverdelay(float f) { hoverdelay_ = f; }
/** Returns non-zero if tooltips are enabled. */
static int enabled() { return enabled_; }
/** Enables tooltips on all widgets (or disables if <i>b</i> is false). */
static void enable(int b = 1) { enabled_ = b;}
/** Same as enable(0), disables tooltips on all widgets. */
static void disable() { enabled_ = 0; }
static void (*enter)(Fl_Widget* w);
static void enter_area(Fl_Widget* w, int X, int Y, int W, int H, const char* tip);
static void (*exit)(Fl_Widget *w);
/** Gets the current widget target */
static Fl_Widget* current() {return widget_;}
static void current(Fl_Widget*);
static int font() { return font_; }
static int size() { return size_; }
static void font(int i) { font_ = i; }
static void size(int s) { size_ = s; }
static void color(unsigned c) { color_ = c; }
/** Gets the typeface for the tooltip text. */
static Fl_Font font() { return font_; }
/** Sets the typeface for the tooltip text. */
static void font(Fl_Font i) { font_ = i; }
/** Gets the size of the tooltip text. */
static Fl_Fontsize size() { return size_; }
/** Sets the size of the tooltip text. */
static void size(Fl_Fontsize s) { size_ = s; }
/** Gets the background color for tooltips. The default background color is a pale yellow. */
static Fl_Color color() { return (Fl_Color)color_; }
static void textcolor(unsigned c) { textcolor_ = c; }
/** Sets the background color for tooltips. The default background color is a pale yellow. */
static void color(unsigned c) { color_ = c; }
/** Gets the color of the text in the tooltip. The default is black. */
static Fl_Color textcolor() { return (Fl_Color)textcolor_; }
/** Sets the color of the text in the tooltip. The default is black. */
static void textcolor(unsigned c) { textcolor_ = c; }
// These should not be public, but Fl_Widget::tooltip() needs them...
// fabien: made it private with only a friend function access
private:
friend void Fl_Widget::tooltip(const char *);
static void enter_(Fl_Widget* w);
static void exit_(Fl_Widget *w);
private:
static float delay_;
static float hoverdelay_;
static float delay_; //!< delay before a tooltip is shown
static float hoverdelay_; //!< delay between tooltips
static int enabled_;
static unsigned color_;
static unsigned textcolor_;
static int font_;
static int size_;
static Fl_Widget* widget_;
static Fl_Font font_;
static Fl_Fontsize size_;
static Fl_Widget* widget_; //!< Keeps track of the current target widget
};
#endif
//
// End of "$Id: Fl_Tooltip.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Tooltip.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Valuator.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Valuator.H 6614 2009-01-01 16:11:32Z matt $"
//
// Valuator header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Valuator widget . */
#ifndef Fl_Valuator_H
#define Fl_Valuator_H
@@ -33,9 +36,22 @@
#endif
// shared type() values for classes that work in both directions:
#define FL_VERTICAL 0
#define FL_HORIZONTAL 1
#define FL_VERTICAL 0 ///< The valuator can work vertically
#define FL_HORIZONTAL 1 ///< The valuator can work horizontally
/**
The Fl_Valuator class controls a single floating-point value
and provides a consistent interface to set the value, range, and step,
and insures that callbacks are done the same for every object.
<P>There are probably more of these classes in FLTK than any others:
<P ALIGN=CENTER>\image html valuators.gif</P>
\image latex valuators.eps "Valuators derived from Fl_Valuators" width=10cm
<P>In the above diagram each box surrounds an actual subclass. These
are further differentiated by setting the type() of the widget t
o the symbolic value labeling the widget.
The ones labelled "0" are the default versions with a type(0).
For consistency the symbol FL_VERTICAL is defined as zero.
*/
class FL_EXPORT Fl_Valuator : public Fl_Widget {
double value_;
@@ -44,32 +60,74 @@ class FL_EXPORT Fl_Valuator : public Fl_Widget {
double A; int B; // rounds to multiples of A/B, or no rounding if A is zero
protected:
int horizontal() const {return type()&1;}
/** Tells if the valuator is an FL_HORIZONTAL one */
int horizontal() const {return type()& FL_HORIZONTAL;}
Fl_Valuator(int X, int Y, int W, int H, const char* L);
/** Gets the previous floating point value before an event changed it */
double previous_value() const {return previous_value_;}
/** Stores the current value in the previous value */
void handle_push() {previous_value_ = value_;}
double softclamp(double);
void handle_drag(double newvalue);
void handle_release(); // use drag() value
virtual void value_damage(); // cause damage() due to value() changing
/** Sets the current floating point value. */
void set_value(double v) {value_ = v;}
public:
void bounds(double a, double b) {min=a; max=b;}
double minimum() const {return min;}
void minimum(double a) {min = a;}
double maximum() const {return max;}
void maximum(double a) {max = a;}
/** Sets the minimum (a) and maximum (b) values for the valuator widget. */
void bounds(double a, double b) {min=a; max=b;}
/** Gets the minimum value for the valuator. */
double minimum() const {return min;}
/** Sets the minimum value for the valuator. */
void minimum(double a) {min = a;}
/** Gets the maximum value for the valuator. */
double maximum() const {return max;}
/** Sets the maximum value for the valuator. */
void maximum(double a) {max = a;}
/**
Sets the minimum and maximum values for the valuator. When
the user manipulates the widget, the value is limited to this
range. This clamping is done <I>after</I> rounding to the step
value (this makes a difference if the range is not a multiple of
the step).
<P>The minimum may be greater than the maximum. This has the
effect of "reversing" the object so the larger values
are in the opposite direction. This also switches which end of
the filled sliders is filled.</P>
<P>Some widgets consider this a "soft" range. This
means they will stop at the range, but if the user releases and
grabs the control again and tries to move it further, it is
allowed.</P>
<P>The range may affect the display. You must redraw()
the widget after changing the range.
*/
void range(double a, double b) {min = a; max = b;}
/** See double Fl_Valuator::step() const */
void step(int a) {A = a; B = 1;}
/** See double Fl_Valuator::step() const */
void step(double a, int b) {A = a; B = b;}
void step(double s);
/**
Gets or sets the step value. As the user moves the mouse the
value is rounded to the nearest multiple of the step value. This
is done <I>before</I> clamping it to the range. For most widgets
the default step is zero.
<P>For precision the step is stored as the ratio of two
integers, A/B. You can set these integers directly. Currently
setting a floating point value sets the nearest A/1 or 1/B value
possible.
*/
double step() const {return A/B;}
void precision(int);
/** Gets the floating point(double) value. See int value(double) */
double value() const {return value_;}
int value(double);
@@ -82,5 +140,5 @@ public:
#endif
//
// End of "$Id: Fl_Valuator.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Valuator.H 6614 2009-01-01 16:11:32Z matt $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Value_Input.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Value_Input.H 6664 2009-02-18 09:27:54Z AlbrechtS $"
//
// Value input header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,14 +25,47 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Value_Input widget . */
#ifndef Fl_Value_Input_H
#define Fl_Value_Input_H
#include "Fl_Valuator.H"
#include "Fl_Input.H"
/**
The Fl_Value_Input widget displays a numeric value.
The user can click in the text field and edit it - there is in
fact a hidden Fl_Input widget with
type(FL_FLOAT_INPUT) or type(FL_INT_INPUT) in
there - and when they hit return or tab the value updates to
what they typed and the callback is done.
<P>If step() is non-zero and integral, then the range of numbers
is limited to integers instead of floating point numbers. As
well as displaying the value as an integer, typed input is also
limited to integer values, even if the hidden Fl_Input widget
is of type(FL_FLOAT_INPUT).</P>
<P>If step() is non-zero, the user can also drag the
mouse across the object and thus slide the value. The left
button moves one step() per pixel, the middle by 10
* step(), and the right button by 100 * step(). It
is therefore impossible to select text by dragging across it,
although clicking can still move the insertion cursor.</P>
<P>If step() is non-zero and integral, then the range
of numbers are limited to integers instead of floating point
values.
<P ALIGN="CENTER">\image html Fl_Value_Input.gif
\image latex Fl_Value_Input.eps "Fl_Value_Input" width=8cm
*/
class FL_EXPORT Fl_Value_Input : public Fl_Valuator {
public:
/* This is the encapsulated Fl_input attribute to which
this class delegates the value font, color and shortcut */
Fl_Input input;
private:
char soft_;
@@ -40,20 +73,57 @@ private:
virtual void value_damage(); // cause damage() due to value() changing
public:
int handle(int);
protected:
void draw();
public:
void resize(int,int,int,int);
Fl_Value_Input(int x,int y,int w,int h,const char *l=0);
~Fl_Value_Input();
/** See void Fl_Value_Input::soft(char s) */
void soft(char s) {soft_ = s;}
/**
If "soft" is turned on, the user is allowed to drag
the value outside the range. If they drag the value to one of
the ends, let go, then grab again and continue to drag, they can
get to any value. The default is true.
*/
char soft() const {return soft_;}
/**
The first form returns the current shortcut key for the Input.
<P>The second form sets the shortcut key to key. Setting this
overrides the use of '&' in the label(). The value is a bitwise
OR of a key and a set of shift flags, for example FL_ALT | 'a'
, FL_ALT | (FL_F + 10), or just 'a'. A value
of 0 disables the shortcut. </P>
<P>The key can be any value returned by
Fl::event_key(), but will usually be an ASCII letter. Use
a lower-case letter unless you require the shift key to be held down. </P>
<P>The shift flags can be any set of values accepted by
Fl::event_state(). If the bit is on that shift key must
be pushed. Meta, Alt, Ctrl, and Shift must be off if they are not in
the shift flags (zero for the other bits indicates a "don't care"
setting).
*/
int shortcut() const {return input.shortcut();}
/** See int Fl_Value_Input::shortcut() const */
void shortcut(int s) {input.shortcut(s);}
/** Gets the typeface of the text in the value box. */
Fl_Font textfont() const {return input.textfont();}
void textfont(uchar s) {input.textfont(s);}
uchar textsize() const {return input.textsize();}
void textsize(uchar s) {input.textsize(s);}
/** Sets the typeface of the text in the value box. */
void textfont(Fl_Font s) {input.textfont(s);}
/** Gets the size of the text in the value box. */
Fl_Fontsize textsize() const {return input.textsize();}
/** Sets the size of the text in the value box. */
void textsize(Fl_Fontsize s) {input.textsize(s);}
/** Gets the color of the text in the value box. */
Fl_Color textcolor() const {return input.textcolor();}
/** Sets the color of the text in the value box.*/
void textcolor(unsigned n) {input.textcolor(n);}
/** Gets the color of the text cursor. The text cursor is black by default. */
Fl_Color cursor_color() const {return input.cursor_color();}
/** Sets the color of the text cursor. The text cursor is black by default. */
void cursor_color(unsigned n) {input.cursor_color(n);}
};
@@ -61,5 +131,5 @@ public:
#endif
//
// End of "$Id: Fl_Value_Input.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Value_Input.H 6664 2009-02-18 09:27:54Z AlbrechtS $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Value_Output.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Value_Output.H 6664 2009-02-18 09:27:54Z AlbrechtS $"
//
// Value output header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Value_Output widget . */
#ifndef Fl_Value_Output_H
#define Fl_Value_Output_H
@@ -32,27 +35,61 @@
#include "Fl_Valuator.H"
#endif
/**
The Fl_Value_Output widget displays a floating point value.
If step() is not zero, the user can adjust the value by
dragging the mouse left and right. The left button moves one step()
per pixel, the middle by 10 * step(), and the right button by
100 * step().
<P>This is much lighter-weight than
Fl_Value_Input because it contains no text editing code or
character buffer. </P>
<P ALIGN=CENTER>\image html Fl_Value_Output.gif
\image latex Fl_Value_Output.eps "Fl_Value_Output" width=8cm
*/
class FL_EXPORT Fl_Value_Output : public Fl_Valuator {
uchar textfont_, textsize_, soft_;
Fl_Font textfont_;
Fl_Fontsize textsize_;
uchar soft_;
unsigned textcolor_;
protected:
void draw();
public:
int handle(int);
void draw();
Fl_Value_Output(int x,int y,int w,int h,const char *l=0);
/**
If "soft" is turned on, the user is allowed to drag the value outside
the range. If they drag the value to one of the ends, let go, then
grab again and continue to drag, they can get to any value. Default is
one.
*/
void soft(uchar s) {soft_ = s;}
/**
If "soft" is turned on, the user is allowed to drag the value outside
the range. If they drag the value to one of the ends, let go, then
grab again and continue to drag, they can get to any value. Default is
one.
*/
uchar soft() const {return soft_;}
Fl_Font textfont() const {return (Fl_Font)textfont_;}
void textfont(uchar s) {textfont_ = s;}
uchar textsize() const {return textsize_;}
void textsize(uchar s) {textsize_ = s;}
/** Gets the typeface of the text in the value box. */
Fl_Font textfont() const {return textfont_;}
/** Sets the typeface of the text in the value box. */
void textfont(Fl_Font s) {textfont_ = s;}
/** Gets the size of the text in the value box. */
Fl_Fontsize textsize() const {return textsize_;}
void textsize(Fl_Fontsize s) {textsize_ = s;}
/** Sets the color of the text in the value box. */
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
/** Gets the color of the text in the value box. */
void textcolor(unsigned s) {textcolor_ = s;}
};
#endif
//
// End of "$Id: Fl_Value_Output.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Value_Output.H 6664 2009-02-18 09:27:54Z AlbrechtS $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Value_Slider.H 4288 2005-04-16 00:13:17Z mike $"
// "$Id: Fl_Value_Slider.H 6664 2009-02-18 09:27:54Z AlbrechtS $"
//
// Value slider header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,28 +25,45 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Value_Slider widget . */
#ifndef Fl_Value_Slider_H
#define Fl_Value_Slider_H
#include "Fl_Slider.H"
/**
The Fl_Value_Slider widget is a Fl_Slider widget
with a box displaying the current value.
<P ALIGN=CENTER>\image html value_slider.gif
\image latex value_slider.eps "Fl_Value_Slider" width=4cm
*/
class FL_EXPORT Fl_Value_Slider : public Fl_Slider {
uchar textfont_, textsize_;
Fl_Font textfont_;
Fl_Fontsize textsize_;
unsigned textcolor_;
public:
protected:
void draw();
public:
int handle(int);
Fl_Value_Slider(int x,int y,int w,int h, const char *l = 0);
Fl_Font textfont() const {return (Fl_Font)textfont_;}
void textfont(uchar s) {textfont_ = s;}
uchar textsize() const {return textsize_;}
void textsize(uchar s) {textsize_ = s;}
/** Gets the typeface of the text in the value box. */
Fl_Font textfont() const {return textfont_;}
/** Sets the typeface of the text in the value box. */
void textfont(Fl_Font s) {textfont_ = s;}
/** Gets the size of the text in the value box. */
Fl_Fontsize textsize() const {return textsize_;}
/** Sets the size of the text in the value box. */
void textsize(Fl_Fontsize s) {textsize_ = s;}
/** Gets the color of the text in the value box. */
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
/** Sets the color of the text in the value box. */
void textcolor(unsigned s) {textcolor_ = s;}
};
#endif
//
// End of "$Id: Fl_Value_Slider.H 4288 2005-04-16 00:13:17Z mike $".
// End of "$Id: Fl_Value_Slider.H 6664 2009-02-18 09:27:54Z AlbrechtS $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Widget.H 5982 2007-11-19 16:21:48Z matt $"
// "$Id: Fl_Widget.H 6753 2009-04-12 09:40:59Z AlbrechtS $"
//
// Widget header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Widget, Fl_Label classes . */
#ifndef Fl_Widget_H
#define Fl_Widget_H
@@ -35,30 +38,63 @@ class Fl_Window;
class Fl_Group;
class Fl_Image;
/** Default callback type definition for all fltk widgets (by far the most used) */
typedef void (Fl_Callback )(Fl_Widget*, void*);
/** Default callback type pointer definition for all fltk widgets */
typedef Fl_Callback* Fl_Callback_p; // needed for BORLAND
/** One parameter callback type definition passing only the widget */
typedef void (Fl_Callback0)(Fl_Widget*);
/** Callback type definition passing the widget and a long data value */
typedef void (Fl_Callback1)(Fl_Widget*, long);
/** This struct stores all information for a text or mixed graphics label.
\todo For FLTK 1.3, the Fl_Label type will become a widget by itself. That way
we will be avoiding a lot of code duplication by handling labels in
a similar fashion to widgets containing text. We also provide an easy
interface for very complex labels, containing html or vector graphics.
*/
struct FL_EXPORT Fl_Label {
/** label text */
const char* value;
/** optional image for an active label */
Fl_Image* image;
/** optional image for a deactivated label */
Fl_Image* deimage;
/** type of label. \see Fl_Labeltype */
uchar type;
uchar font;
uchar size;
/** label font used in text */
Fl_Font font;
/** size of label font */
Fl_Fontsize size;
/** text color */
unsigned color;
/** Draws the label aligned to the given box */
void draw(int,int,int,int, Fl_Align) const ;
void measure(int&, int&) const ;
void measure(int &w, int &h) const ;
};
/** Fl_Widget is the base class for all widgets in FLTK.
You can't create one of these because the constructor is not public.
However you can subclass it.
All "property" accessing methods, such as color(), parent(), or argument()
are implemented as trivial inline functions and thus are as fast and small
as accessing fields in a structure. Unless otherwise noted, the property
setting methods such as color(n) or label(s) are also trivial inline
functions, even if they change the widget's appearance. It is up to the
user code to call redraw() after these.
*/
class FL_EXPORT Fl_Widget {
friend class Fl_Group;
Fl_Group* parent_;
Fl_Callback* callback_;
void* user_data_;
short x_,y_,w_,h_;
int x_,y_,w_,h_;
Fl_Label label_;
int flags_;
unsigned color_;
@@ -66,156 +102,826 @@ class FL_EXPORT Fl_Widget {
uchar type_;
uchar damage_;
uchar box_;
uchar align_;
Fl_Align align_:8;
uchar when_;
const char *tooltip_;
// unimplemented copy ctor and assignment operator
/** unimplemented copy ctor */
Fl_Widget(const Fl_Widget &);
/** unimplemented assignment operator */
Fl_Widget& operator=(const Fl_Widget &);
protected:
Fl_Widget(int,int,int,int,const char* =0);
/** Creates a widget at the given position and size.
void x(int v) {x_ = (short)v;}
void y(int v) {y_ = (short)v;}
void w(int v) {w_ = (short)v;}
void h(int v) {h_ = (short)v;}
The Fl_Widget is a protected constructor, but all derived widgets have a
matching public constructor. It takes a value for x(), y(), w(), h(), and
an optional value for label().
\param[in] x, y the position of the widget relative to the enclosing window
\param[in] w, h size of the widget in pixels
\param[in] label optional text for the widget label
*/
Fl_Widget(int x, int y, int w, int h, Fl_CString label=0L);
/** Internal use only. Use position(int,int), size(int,int) or resize(int,int,int,int) instead. */
void x(int v) {x_ = v;}
/** Internal use only. Use position(int,int), size(int,int) or resize(int,int,int,int) instead. */
void y(int v) {y_ = v;}
/** Internal use only. Use position(int,int), size(int,int) or resize(int,int,int,int) instead. */
void w(int v) {w_ = v;}
/** Internal use only. Use position(int,int), size(int,int) or resize(int,int,int,int) instead. */
void h(int v) {h_ = v;}
/** Gets the widget flags mask */
int flags() const {return flags_;}
/** Sets a flag in the flags mask */
void set_flag(int c) {flags_ |= c;}
/** Clears a flag in the flags mask */
void clear_flag(int c) {flags_ &= ~c;}
enum {INACTIVE=1, INVISIBLE=2, OUTPUT=4, SHORTCUT_LABEL=64,
CHANGED=128, VISIBLE_FOCUS=512, COPIED_LABEL = 1024};
/** flags possible values enumeration.
See activate(), output(), visible(), changed(), set_visible_focus()
*/
enum {
INACTIVE=1, ///< the widget can't receive focus, and is disabled but potentially visible
INVISIBLE=2, ///< the widget is not drawn but can receive events
OUTPUT=4, ///< for output only
SHORTCUT_LABEL=64, ///< the label contains a shortcut we need to draw
CHANGED=128, ///< the widget value changed
VISIBLE_FOCUS=512, ///< accepts keyboard focus navigation if the widget can have the focus
COPIED_LABEL=1024 ///< the widget label is internally copied, its destruction is handled by the widget
};
void draw_box() const;
void draw_box(Fl_Boxtype, Fl_Color) const;
void draw_box(Fl_Boxtype, int,int,int,int, Fl_Color) const;
void draw_box(Fl_Boxtype t, Fl_Color c) const;
void draw_box(Fl_Boxtype t, int x,int y,int w,int h, Fl_Color c) const;
/** draws a focus rectangle around the widget */
void draw_focus() {draw_focus(box(),x(),y(),w(),h());}
void draw_focus(Fl_Boxtype, int,int,int,int) const;
void draw_focus(Fl_Boxtype t, int x,int y,int w,int h) const;
void draw_label() const;
void draw_label(int, int, int, int) const;
public:
/** Destroys the widget.
Destroying single widgets is not very common. You almost always want to
destroy the parent group instead, which will destroy all of the child widgets
and groups in that group.
\since FLTK 1.3, the widget's destructor removes the widget from its parent
group, if it is member of a group.
*/
virtual ~Fl_Widget();
virtual void draw() = 0;
virtual int handle(int);
Fl_Group* parent() const {return parent_;}
void parent(Fl_Group* p) {parent_ = p;} // for hacks only, Fl_Group::add()
/** Draws the widget.
Never call this function directly. FLTK will schedule redrawing whenever
needed. If your widget must be redrawn as soon as possible, call redraw()
instead.
Override this function to draw your own widgets.
If you ever need to call another widget's draw method <I>from within your
own draw() method</I>, e.g. for an embedded scrollbar, you can do it
(because draw() is virtual) like this:
\code
Fl_Widget *s = &scroll; // scroll is an embedded Fl_Scrollbar
s->draw(); // calls Fl_Scrollbar::draw()
\endcode
*/
virtual void draw() = 0;
/** Handles the specified event.
You normally don't call this method directly, but instead let FLTK do
it when the user interacts with the widget.
When implemented in a widget, this function must return 0 if the
widget does not use the event or 1 otherwise.
Most of the time, you want to call the inherited handle() method in
your overridden method so that you don't short-circuit events that you
don't handle. In this last case you should return the callee retval.
\param[in] event the kind of event received
\retval 0 if the event was not used or understood
\retval 1 if the event was used and can be deleted
\see Fl_Event
*/
virtual int handle(int event);
/** Returns a pointer to the parent widget.
Usually this is a Fl_Group or Fl_Window.
\retval NULL if the widget has no parent
\see Fl_Group::add(Fl_Widget*)
*/
Fl_Group* parent() const {return parent_;}
/** Internal use only - "for hacks only".
It is \em \b STRONGLY recommended not to use this method, because it
short-circuits Fl_Group's normal widget adding and removing methods,
if the widget is already a child widget of another Fl_Group.
Use Fl_Group::add(Fl_Widget*) and/or Fl_Group::remove(Fl_Widget*) instead.
*/
void parent(Fl_Group* p) {parent_ = p;} // for hacks only, use Fl_Group::add()
/** Gets the widget type.
Returns the widget type value, which is used for Forms compatibility
and to simulate RTTI.
\todo Explain "simulate RTTI" (currently only used to decide if a widget
is a window, i.e. type()>=FL_WINDOW ?). Is type() really used in a way
that ensures "Forms compatibility" ?
*/
uchar type() const {return type_;}
/** Sets the widget type.
This is used for Forms compatibility.
*/
void type(uchar t) {type_ = t;}
/** Gets the widget position in its window.
\return the x position relative to the window
*/
int x() const {return x_;}
/** Gets the widget position in its window.
\return the y position relative to the window
*/
int y() const {return y_;}
/** Gets the widget width.
\return the width of the widget in pixels.
*/
int w() const {return w_;}
/** Gets the widget height.
\return the height of the widget in pixels.
*/
int h() const {return h_;}
virtual void resize(int,int,int,int);
/** Changes the size or position of the widget.
This is a virtual function so that the widget may implement its
own handling of resizing. The default version does \e not
call the redraw() method, but instead relies on the parent widget
to do so because the parent may know a faster way to update the
display, such as scrolling from the old position.
Some window managers under X11 call resize() a lot more often
than needed. Please verify that the position or size of a widget
did actually change before doing any extensive calculations.
position(X, Y) is a shortcut for resize(X, Y, w(), h()),
and size(W, H) is a shortcut for resize(x(), y(), W, H).
\param[in] x, y new position relative to the parent window
\param[in] w, h new size
\see position(int,int), size(int,int)
*/
virtual void resize(int x, int y, int w, int h);
/** Internal use only. */
int damage_resize(int,int,int,int);
/** Repositions the window or widget.
position(X, Y) is a shortcut for resize(X, Y, w(), h()).
\param[in] X, Y new position relative to the parent window
\see resize(int,int,int,int), size(int,int)
*/
void position(int X,int Y) {resize(X,Y,w_,h_);}
/** Changes the size of the widget.
size(W, H) is a shortcut for resize(x(), y(), W, H).
\param[in] W, H new size
\see position(int,int), resize(int,int,int,int)
*/
void size(int W,int H) {resize(x_,y_,W,H);}
Fl_Align align() const {return (Fl_Align)align_;}
void align(uchar a) {align_ = a;}
/** Gets the label alignment.
\return label alignment
\see label(), align(Fl_Align), Fl_Align
\todo This function should not take uchar as an argument.
Apart from the fact that uchar is too short with only 8 bits,
it does not provide type safety (in which case we don't need
to declare Fl_Align an enum to begin with).
*NOTE* The current (FLTK 1.3) implementation (Dec 2008) is such that
Fl_Align is (typedef'd to be) "unsigned" (int), but Fl_Widget's
"align_" member variable is a bit field of 8 bits only !
*/
Fl_Align align() const {return align_;}
/** Sets the label alignment.
This controls how the label is displayed next to or inside the widget.
The default value is FL_ALIGN_CENTER, which centers the label inside
the widget.
\param[in] alignment new label alignment
\see align(), Fl_Align
*/
void align(Fl_Align alignment) {align_ = alignment;}
/** Gets the box type of the widget.
\return the current box type
\see box(Fl_Boxtype), Fl_Boxtype
*/
Fl_Boxtype box() const {return (Fl_Boxtype)box_;}
void box(Fl_Boxtype a) {box_ = a;}
/** Sets the box type for the widget.
This identifies a routine that draws the background of the widget.
See Fl_Boxtype for the available types. The default depends on the
widget, but is usually FL_NO_BOX or FL_UP_BOX.
\param[in] new_box the new box type
\see box(), Fl_Boxtype
*/
void box(Fl_Boxtype new_box) {box_ = new_box;}
/** Gets the background color of the widget.
\return current background color
\see color(unsigned), color(unsigned, unsigned)
*/
Fl_Color color() const {return (Fl_Color)color_;}
void color(unsigned a) {color_ = a;}
/** Sets the background color of the widget.
The color is passed to the box routine. The color is either an index into
an internal table of RGB colors or an RGB color value generated using
fl_rgb_color().
The default for most widgets is FL_BACKGROUND_COLOR. Use Fl::set_color()
to redefine colors in the color map.
\param[in] bg background color
\see color(), color(unsigned, unsigned), selection_color(unsigned)
*/
void color(unsigned bg) {color_ = bg;}
/** Gets the selection color.
\return the current selection color
\see selection_color(unsigned), color(unsigned, unsigned)
*/
Fl_Color selection_color() const {return (Fl_Color)color2_;}
/** Sets the selection color.
The selection color is defined for Forms compatibility and is usually
used to color the widget when it is selected, although some widgets
use this color for other purposes. You can set both colors at once
with color(unsigned bg, unsigned sel).
\param[in] a the new selection color
\see selection_color(), color(unsigned, unsigned)
*/
void selection_color(unsigned a) {color2_ = a;}
void color(unsigned a, unsigned b) {color_=a; color2_=b;}
/** Sets the background and selection color of the widget.
The two color form sets both the background and selection colors.
\param[in] bg background color
\param[in] sel selection color
\see color(unsigned), selection_color(unsigned)
*/
void color(unsigned bg, unsigned sel) {color_=bg; color2_=sel;}
/** Gets the current label text.
\return a pointer to the current label text
\see label(Fl_CString), copy_label(Fl_CString)
*/
const char* label() const {return label_.value;}
void label(const char* a);
void copy_label(const char* a);
void label(Fl_Labeltype a,const char* b) {label_.type = a; label_.value = b;}
/** Sets the current label pointer.
The label is shown somewhere on or next to the widget. The passed pointer
is stored unchanged in the widget (the string is \em not copied), so if
you need to set the label to a formatted value, make sure the buffer is
static, global, or allocated. The copy_label() method can be used
to make a copy of the label string automatically.
\param[in] text pointer to new label text
\see copy_label()
*/
void label(const char* text);
/** Sets the current label.
Unlike label(), this method allocates a copy of the label
string instead of using the original string pointer.
The internal copy will automatically be freed whenever you assign
a new label or when the widget is destroyed.
\param[in] new_label the new label text
\see label()
*/
void copy_label(Fl_CString new_label);
/** Shortcut to set the label text and type in one call.
\see label(FL_CString), labeltype(Fl_Labeltype)
*/
void label(Fl_Labeltype a, const char* b) {label_.type = a; label_.value = b;}
/** Gets the label type.
\return the current label type.
\see Fl_Labeltype
*/
Fl_Labeltype labeltype() const {return (Fl_Labeltype)label_.type;}
/** Sets the label type.
The label type identifies the function that draws the label of the widget.
This is generally used for special effects such as embossing or for using
the label() pointer as another form of data such as an icon. The value
FL_NORMAL_LABEL prints the label as plain text.
\param[in] a new label type
\see Fl_Labeltype
*/
void labeltype(Fl_Labeltype a) {label_.type = a;}
/** Gets the label color.
The default color is FL_FOREGROUND_COLOR.
\return the current label color
*/
Fl_Color labelcolor() const {return (Fl_Color)label_.color;}
void labelcolor(unsigned a) {label_.color=a;}
Fl_Font labelfont() const {return (Fl_Font)label_.font;}
void labelfont(uchar a) {label_.font=a;}
uchar labelsize() const {return label_.size;}
void labelsize(uchar a) {label_.size=a;}
/** Sets the label color.
The default color is FL_FOREGROUND_COLOR.
\param[in] c the new label color
*/
void labelcolor(unsigned c) {label_.color=c;}
/** Gets the font to use.
Fonts are identified by indexes into a table. The default value
uses a Helvetica typeface (Arial for Microsoft&reg; Windows&reg;).
The function Fl::set_font() can define new typefaces.
\return current font used by the label
\see Fl_Font
*/
Fl_Font labelfont() const {return label_.font;}
/** Sets the font to use.
Fonts are identified by indexes into a table. The default value
uses a Helvetica typeface (Arial for Microsoft&reg; Windows&reg;).
The function Fl::set_font() can define new typefaces.
\param[in] f the new font for the label
\see Fl_Font
*/
void labelfont(Fl_Font f) {label_.font=f;}
/** Gets the font size in pixels.
The default size is 14 pixels.
\return the current font size
*/
Fl_Fontsize labelsize() const {return label_.size;}
/** Sets the font size in pixels.
\param[in] pix the new font size
\see Fl_Fontsize labelsize()
*/
void labelsize(Fl_Fontsize pix) {label_.size=pix;}
/** Gets the image that is used as part of the widget label.
This image is used when drawing the widget in the active state.
\return the current image
*/
Fl_Image* image() {return label_.image;}
void image(Fl_Image* a) {label_.image=a;}
void image(Fl_Image& a) {label_.image=&a;}
/** Sets the image to use as part of the widget label.
This image is used when drawing the widget in the active state.
\param[in] img the new image for the label
*/
void image(Fl_Image* img) {label_.image=img;}
/** Sets the image to use as part of the widget label.
This image is used when drawing the widget in the active state.
\param[in] img the new image for the label
*/
void image(Fl_Image& img) {label_.image=&img;}
/** Gets the image that is used as part of the widget label.
This image is used when drawing the widget in the inactive state.
\return the current image for the deactivated widget
*/
Fl_Image* deimage() {return label_.deimage;}
void deimage(Fl_Image* a) {label_.deimage=a;}
void deimage(Fl_Image& a) {label_.deimage=&a;}
/** Sets the image to use as part of the widget label.
This image is used when drawing the widget in the inactive state.
\param[in] img the new image for the deactivated widget
*/
void deimage(Fl_Image* img) {label_.deimage=img;}
/** Sets the image to use as part of the widget label.
This image is used when drawing the widget in the inactive state.
\param[in] img the new image for the deactivated widget
*/
void deimage(Fl_Image& img) {label_.deimage=&img;}
/** Gets the current tooltip text.
\return a pointer to the tooltip text or NULL
*/
const char *tooltip() const {return tooltip_;}
/** Sets the current tooltip text.
Sets a string of text to display in a popup tooltip window when the user
hovers the mouse over the widget. The string is <I>not</I> copied, so
make sure any formatted string is stored in a static, global,
or allocated buffer.
If no tooltip is set, the tooltip of the parent is inherited. Setting a
tooltip for a group and setting no tooltip for a child will show the
group's tooltip instead. To avoid this behavior, you can set the child's
tooltip to an empty string ("").
\param[in] t new tooltip
*/
void tooltip(const char *t);
/** Gets the current callback function for the widget.
Each widget has a single callback.
\return current callback
*/
Fl_Callback_p callback() const {return callback_;}
void callback(Fl_Callback* c, void* p) {callback_=c; user_data_=p;}
void callback(Fl_Callback* c) {callback_=c;}
void callback(Fl_Callback0*c) {callback_=(Fl_Callback*)c;}
void callback(Fl_Callback1*c, long p=0) {callback_=(Fl_Callback*)c; user_data_=(void*)p;}
/** Sets the current callback function for the widget.
Each widget has a single callback.
\param[in] cb new callback
\param[in] p user data
*/
void callback(Fl_Callback* cb, void* p) {callback_=cb; user_data_=p;}
/** Sets the current callback function for the widget.
Each widget has a single callback.
\param[in] cb new callback
*/
void callback(Fl_Callback* cb) {callback_=cb;}
/** Sets the current callback function for the widget.
Each widget has a single callback.
\param[in] cb new callback
*/
void callback(Fl_Callback0*cb) {callback_=(Fl_Callback*)cb;}
/** Sets the current callback function for the widget.
Each widget has a single callback.
\param[in] cb new callback
\param[in] p user data
*/
void callback(Fl_Callback1*cb, long p=0) {callback_=(Fl_Callback*)cb; user_data_=(void*)p;}
/** Gets the user data for this widget.
Gets the current user data (void *) argument that is passed to the callback function.
\return user data as a pointer
*/
void* user_data() const {return user_data_;}
/** Sets the user data for this widget.
Sets the new user data (void *) argument that is passed to the callback function.
\param[in] v new user data
*/
void user_data(void* v) {user_data_ = v;}
/** Gets the current user data (long) argument that is passed to the callback function.
*/
long argument() const {return (long)user_data_;}
/** Sets the current user data (long) argument that is passed to the callback function.
\todo The user data value must be implemented using a \em union to avoid
64 bit machine incompatibilities.
*/
void argument(long v) {user_data_ = (void*)v;}
/** Returns the conditions under which the callback is called.
You can set the flags with when(uchar), the default value is
FL_WHEN_RELEASE.
\return set of flags
\see when(uchar)
*/
Fl_When when() const {return (Fl_When)when_;}
/** Sets the flags used to decide when a callback is called.
This controls when callbacks are done. The following values are useful,
the default value is FL_WHEN_RELEASE:
\li 0: The callback is not done, but changed() is turned on.
\li FL_WHEN_CHANGED: The callback is done each time the text is
changed by the user.
\li FL_WHEN_RELEASE: The callback will be done when this widget loses
the focus, including when the window is unmapped. This is a useful
value for text fields in a panel where doing the callback on every
change is wasteful. However the callback will also happen if the
mouse is moved out of the window, which means it should not do
anything visible (like pop up an error message).
You might do better setting this to zero, and scanning all the
items for changed() when the OK button on a panel is pressed.
\li FL_WHEN_ENTER_KEY: If the user types the Enter key, the entire
text is selected, and the callback is done if the text has changed.
Normally the Enter key will navigate to the next field (or insert
a newline for a Fl_Multiline_Input) - this changes the behavior.
\li FL_WHEN_ENTER_KEY|FL_WHEN_NOT_CHANGED: The Enter key will do the
callback even if the text has not changed. Useful for command fields.
Fl_Widget::when() is a set of bitflags used by subclasses of
Fl_Widget to decide when to do the callback.
If the value is zero then the callback is never done. Other values
are described in the individual widgets. This field is in the base
class so that you can scan a panel and do_callback() on all the ones
that don't do their own callbacks in response to an "OK" button.
\param[in] i set of flags
*/
void when(uchar i) {when_ = i;}
/** Returns whether a widget is visible.
\retval 0 if the widget is not drawn and hence invisible.
\see show(), hide(), visible_r()
*/
int visible() const {return !(flags_&INVISIBLE);}
/** Returns whether a widget and all its parents are visible.
\retval 0 if the widget or any of its parents are invisible.
\see show(), hide(), visible()
*/
int visible_r() const;
void show();
void hide();
/** Makes a widget visible.
An invisible widget never gets redrawn and does not get events.
The visible() method returns true if the widget is set to be
visible. The visible_r() method returns true if the widget and
all of its parents are visible. A widget is only visible if
visible() is true on it <I>and all of its parents</I>.
Changing it will send FL_SHOW or FL_HIDE events to
the widget. <I>Do not change it if the parent is not visible, as this
will send false FL_SHOW or FL_HIDE events to the widget</I>.
redraw() is called if necessary on this or the parent.
\see hide(), visible(), visible_r()
*/
virtual void show();
/** Makes a widget invisible.
\see show(), visible(), visible_r()
*/
virtual void hide();
/** Makes the widget visible.
You must still redraw the parent widget to see a change in the
window. Normally you want to use the show() method instead.
*/
void set_visible() {flags_ &= ~INVISIBLE;}
/** Hides the widget.
You must still redraw the parent to see a change in the window.
Normally you want to use the hide() method instead.
*/
void clear_visible() {flags_ |= INVISIBLE;}
/** Returns whether the widget is active.
\retval 0 if the widget is inactive
\see active_r(), activate(), deactivate()
*/
int active() const {return !(flags_&INACTIVE);}
/** Returns whether the widget and all of its parents are active.
\retval 0 if this or any of the parent widgets are inactive
\see active(), activate(), deactivate()
*/
int active_r() const;
/** Activates the widget.
Changing this value will send FL_ACTIVATE to the widget if
active_r() is true.
\see active(), active_r(), deactivate()
*/
void activate();
/** Deactivates the widget.
Inactive widgets will be drawn "grayed out", e.g. with less contrast
than the active widget. Inactive widgets will not receive any keyboard
or mouse button events. Other events (including FL_ENTER, FL_MOVE,
FL_LEAVE, FL_SHORTCUT, and others) will still be sent. A widget is
only active if active() is true on it <I>and all of its parents</I>.
Changing this value will send FL_DEACTIVATE to the widget if
active_r() is true.
Currently you cannot deactivate Fl_Window widgets.
\see activate(), active(), active_r()
*/
void deactivate();
/** Returns if a widget is used for output only.
output() means the same as !active() except it does not change how the
widget is drawn. The widget will not receive any events. This is useful
for making scrollbars or buttons that work as displays rather than input
devices.
\retval 0 if the widget is used for input and output
\see set_output(), clear_output()
*/
int output() const {return (flags_&OUTPUT);}
/** Sets a widget to output only.
\see output(), clear_output()
*/
void set_output() {flags_ |= OUTPUT;}
/** Sets a widget to accept input.
\see set_output(), output()
*/
void clear_output() {flags_ &= ~OUTPUT;}
/** Returns if the widget is able to take events.
This is the same as (active() && !output()
&& visible()) but is faster.
\retval 0 if the widget takes no events
*/
int takesevents() const {return !(flags_&(INACTIVE|INVISIBLE|OUTPUT));}
/**
Checks if the widget value changed since the last callback.
"Changed" is a flag that is turned on when the user changes the value
stored in the widget. This is only used by subclasses of Fl_Widget that
store values, but is in the base class so it is easier to scan all the
widgets in a panel and do_callback() on the changed ones in response
to an "OK" button.
Most widgets turn this flag off when they do the callback, and when
the program sets the stored value.
\retval 0 if the value did not change
\see set_changed(), clear_changed()
*/
int changed() const {return flags_&CHANGED;}
/** Marks the value of the widget as changed.
\see changed(), clear_changed()
*/
void set_changed() {flags_ |= CHANGED;}
/** Marks the value of the widget as unchanged.
\see changed(), set_changed()
*/
void clear_changed() {flags_ &= ~CHANGED;}
/** Gives the widget the keyboard focus.
Tries to make this widget be the Fl::focus() widget, by first sending
it an FL_FOCUS event, and if it returns non-zero, setting
Fl::focus() to this widget. You should use this method to
assign the focus to a widget.
\return true if the widget accepted the focus.
*/
int take_focus();
/** Enables keyboard focus navigation with this widget.
Note, however, that this will not necessarily mean that the widget
will accept focus, but for widgets that can accept focus, this method
enables it if it has been disabled.
\see visible_focus(), clear_visible_focus(), visible_focus(int)
*/
void set_visible_focus() { flags_ |= VISIBLE_FOCUS; }
/** Disables keyboard focus navigation with this widget.
Normally, all widgets participate in keyboard focus navigation.
\see set_visible_focus(), visible_focus(), visible_focus(int)
*/
void clear_visible_focus() { flags_ &= ~VISIBLE_FOCUS; }
/** Modifies keyboard focus navigation.
\param[in] v set or clear visible focus
\see set_visible_focus(), clear_visible_focus(), visible_focus()
*/
void visible_focus(int v) { if (v) set_visible_focus(); else clear_visible_focus(); }
/** Checks whether this widget has a visible focus.
\retval 0 if this widget has no visible focus.
\see visible_focus(int), set_visible_focus(), clear_visible_focus()
*/
int visible_focus() { return flags_ & VISIBLE_FOCUS; }
static void default_callback(Fl_Widget*, void*);
void do_callback() {callback_(this,user_data_); if (callback_ != default_callback) clear_changed();}
void do_callback(Fl_Widget* o,void* arg=0) {callback_(o,arg); if (callback_ != default_callback) clear_changed();}
void do_callback(Fl_Widget* o,long arg) {callback_(o,(void*)arg); if (callback_ != default_callback) clear_changed();}
/** Sets the default callback for all widgets.
Sets the default callback, which puts a pointer to the widget on the queue
returned by Fl::readqueue(). You may want to call this from your own callback.
\param[in] cb the new callback
\param[in] d user data associated with that callback
\see callback(), do_callback(), Fl::readqueue()
*/
static void default_callback(Fl_Widget *cb, void *d);
/** Calls the widget callback.
Causes a widget to invoke its callback function with default arguments.
\see callback()
*/
void do_callback() {do_callback(this,user_data_);}
/** Calls the widget callback.
Causes a widget to invoke its callback function with arbitrary arguments.
\param[in] o call the callback with \p o as the widget argument
\param[in] arg call the callback with \p arg as the user data argument
\see callback()
*/
void do_callback(Fl_Widget* o,long arg) {do_callback(o,(void*)arg);}
// Causes a widget to invoke its callback function with arbitrary arguments.
// Documentation and implementation in Fl_Widget.cxx
void do_callback(Fl_Widget* o,void* arg=0);
/** Internal use only. */
int test_shortcut();
/** Internal use only. */
static char label_shortcut(const char *t);
/** Internal use only. */
static int test_shortcut(const char*);
int contains(const Fl_Widget*) const ;
int inside(const Fl_Widget* o) const {return o ? o->contains(this) : 0;}
/** Checks if w is a child of this widget.
\param[in] w potential child widget
\return Returns 1 if \p w is a child of this widget, or is
equal to this widget. Returns 0 if \p w is NULL.
*/
int contains(const Fl_Widget *w) const ;
/** Checks if this widget is a child of w.
Returns 1 if this widget is a child of \p w, or is
equal to \p w. Returns 0 if \p w is NULL.
\param[in] w the possible parent widget.
\see contains()
*/
int inside(const Fl_Widget* w) const {return w ? w->contains(this) : 0;}
/** Schedules the drawing of the widget.
Marks the widget as needing its draw() routine called.
*/
void redraw();
void redraw_label();
uchar damage() const {return damage_;}
void clear_damage(uchar c = 0) {damage_ = c;}
void damage(uchar c);
void damage(uchar c,int,int,int,int);
void draw_label(int, int, int, int, Fl_Align) const;
void measure_label(int& xx, int& yy) {label_.measure(xx,yy);}
/** Schedules the drawing of the label.
Marks the widget or the parent as needing a redraw for the label area
of a widget.
*/
void redraw_label();
/** Returns non-zero if draw() needs to be called.
The damage value is actually a bit field that the widget
subclass can use to figure out what parts to draw.
\return a bitmap of flags describing the kind of damage to the widget
\see damage(uchar), clear_damage(uchar)
*/
uchar damage() const {return damage_;}
/** Clears the damage flags.
Damage flags are cleared when parts of the widget drawing is repaired.
\param[in] c bitmask of flags to clear
\see damage(uchar), damage()
*/
void clear_damage(uchar c = 0) {damage_ = c;}
/** Sets the damage bits for the widget.
Setting damage bits will schedule the widget for the next redraw.
\param[in] c bitmask of flags to set
\see damage(), clear_damage(uchar)
*/
void damage(uchar c);
/** Sets the damage bits for an area inside the widget.
Setting damage bits will schedule the widget for the next redraw.
\param[in] c bitmask of flags to set
\param[in] x, y, w, h size of damaged area
\see damage(), clear_damage(uchar)
*/
void damage(uchar c, int x, int y, int w, int h);
void draw_label(int, int, int, int, Fl_Align) const;
/** Sets width ww and height hh accordingly with the label size.
Labels with images will return w() and h() of the image.
*/
void measure_label(int& ww, int& hh) {label_.measure(ww, hh);}
/** Returns a pointer to the primary Fl_Window widget.
\retval NULL if no window is associated with this widget.
\note for an Fl_Window widget, this returns its <I>parent</I> window
(if any), not <I>this</I> window.
*/
Fl_Window* window() const ;
// back compatability only:
/** For back compatibility only.
\deprecated Use selection_color() instead.
*/
Fl_Color color2() const {return (Fl_Color)color2_;}
/** For back compatibility only.
\deprecated Use selection_color(unsigned) instead.
*/
void color2(unsigned a) {color2_ = a;}
};
// reserved type numbers (necessary for my cheapo RTTI) start here.
// grep the header files for "RESERVED_TYPE" to find the next available
// number.
/**
Reserved type numbers (necessary for my cheapo RTTI) start here.
Grep the header files for "RESERVED_TYPE" to find the next available
number.
*/
#define FL_RESERVED_TYPE 100
#endif
//
// End of "$Id: Fl_Widget.H 5982 2007-11-19 16:21:48Z matt $".
// End of "$Id: Fl_Widget.H 6753 2009-04-12 09:40:59Z AlbrechtS $".
//

View File

@@ -1,9 +1,9 @@
//
// "$Id: Fl_Window.H 4421 2005-07-15 09:34:53Z matt $"
// "$Id: Fl_Window.H 6614 2009-01-01 16:11:32Z matt $"
//
// Window header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2005 by Bill Spitzak and others.
// Copyright 1998-2009 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -25,16 +25,34 @@
// http://www.fltk.org/str.php
//
/* \file
Fl_Window widget . */
#ifndef Fl_Window_H
#define Fl_Window_H
#include "Fl_Group.H"
#define FL_WINDOW 0xF0 // all subclasses have type() >= this
#define FL_DOUBLE_WINDOW 0xF1
#define FL_WINDOW 0xF0 ///< window type id all subclasses have type() >= this
#define FL_DOUBLE_WINDOW 0xF1 ///< double window type id
class Fl_X;
/**
This widget produces an actual window. This can either be a main
window, with a border and title and all the window management controls,
or a "subwindow" inside a window. This is controlled by whether or not
the window has a parent().
<P>Once you create a window, you usually add children Fl_Widget
's to it by using window-&gt;add(child) for each new widget. See Fl_Group for more information
on how to add and remove children. </P>
<P>There are several subclasses of Fl_Window that provide
double-buffering, overlay, menu, and OpenGL support. </P>
<P>The window's callback is done if the user tries to close a window
using the window manager and
Fl::modal() is zero or equal to the window. Fl_Window
has a default callback that calls Fl_Window::hide().
*/
class FL_EXPORT Fl_Window : public Fl_Group {
friend class Fl_X;
@@ -44,8 +62,9 @@ class FL_EXPORT Fl_Window : public Fl_Group {
const char* xclass_;
const void* icon_;
// size_range stuff:
short minw, minh, maxw, maxh;
uchar dw, dh, aspect, size_range_set;
int minw, minh, maxw, maxh;
int dw, dh, aspect;
uchar size_range_set;
// cursor stuff
Fl_Cursor cursor_default;
Fl_Color cursor_fg, cursor_bg;
@@ -66,63 +85,282 @@ class FL_EXPORT Fl_Window : public Fl_Group {
protected:
/** Stores the last window that was made current. See current() const */
static Fl_Window *current_;
virtual void draw();
/** Forces the window to be drawn, this window is also made current and calls draw(). */
virtual void flush();
public:
Fl_Window(int,int,int,int, const char* = 0);
Fl_Window(int,int, const char* = 0);
virtual ~Fl_Window();
/**
Creates a window from the given size and title.
If Fl_Group::current() is not NULL, the window is created as a
subwindow of the parent window.</p>
<p>The first form of the constructor creates a top-level window
and asks the window manager to position the window. The second
form of the constructor either creates a subwindow or a
top-level window at the specified location (x,y) , subject to window
manager configuration. If you do not specify the position of the
window, the window manager will pick a place to show the window
or allow the user to pick a location. Use position(x,y)
or hotspot() before calling show() to request a
position on the screen. See Fl_Window::resize()
for some more details on positioning windows.</p>
<p>Top-level windows initially have visible() set to 0
and parent() set to NULL. Subwindows initially
have visible() set to 1 and parent() set to
the parent window pointer.</p>
<P>Fl_Widget::box() defaults to FL_FLAT_BOX. If you
plan to completely fill the window with children widgets you should
change this to FL_NO_BOX. If you turn the window border off
you may want to change this to FL_UP_BOX.
*/
Fl_Window(int w, int h, const char* title= 0);
/** Creates a window from the given position, size and title.
See Fl_Window::Fl_Window(int w, int h, const char *title = 0)
*/
Fl_Window(int x, int y, int w, int h, const char* title = 0);
/**
The destructor <I>also deletes all the children</I>. This allows a
whole tree to be deleted at once, without having to keep a pointer to
all the children in the user code. A kludge has been done so the
Fl_Window and all of it's children can be automatic (local)
variables, but you must declare the Fl_Window <I>first</I> so
that it is destroyed last.
*/
virtual ~Fl_Window();
virtual int handle(int);
/**
Changes the size and position of the window. If shown() is
true, these changes are communicated to the window server (which may
refuse that size and cause a further resize). If shown() is
false, the size and position are used when show() is called.
See Fl_Group for the effect
of resizing on the child widgets.
<P>You can also call the Fl_Widget methods size(x,y)
and position(w,h), which are inline wrappers for this virtual
function. </P>
<P>A top-level window can not force, but merely suggest a position and
size to the operating system. The window manager may not be willing or
able to display a window at the desired position or with the given
dimensions. It is up to the application developer to verify window
parameters after the resize request.
*/
virtual void resize(int,int,int,int);
/**
Gets or sets whether or not the window manager border is around the
window. The default value is true. border(n) can be used to
turn the border on and off, and returns non-zero if the value has been
changed. <I>Under most X window managers this does not work after
show() has been called, although SGI's 4DWM does work.</I>
*/
void border(int b);
/**
Fast inline function to turn the border
off. It only works before show() is called.
*/
void clear_border() {set_flag(FL_NOBORDER);}
/** See int Fl_Window::border(int) */
int border() const {return !(flags() & FL_NOBORDER);}
/** Activate the flags FL_NOBORDER|FL_OVERRIDE */
void set_override() {set_flag(FL_NOBORDER|FL_OVERRIDE);}
/** Returns non zero if FL_OVERRIDE flag is set, 0 otherwise. */
int override() const { return flags()&FL_OVERRIDE; }
/**
A "modal" window, when shown(), will prevent any events from
being delivered to other windows in the same program, and will also
remain on top of the other windows (if the X window manager supports
the "transient for" property). Several modal windows may be shown at
once, in which case only the last one shown gets events. You can See
which window (if any) is modal by calling
Fl::modal().
*/
void set_modal() {set_flag(FL_MODAL);}
/** Returns true if this window is modal. */
int modal() const {return flags() & FL_MODAL;}
/**
A "non-modal" window (terminology borrowed from Microsoft Windows)
acts like a modal() one in that it remains on top, but it has
no effect on event delivery. There are <I>three</I> states for a
window: modal, non-modal, and normal.
*/
void set_non_modal() {set_flag(FL_NON_MODAL);}
/** Returns true if this window is modal or non-modal. */
int non_modal() const {return flags() & (FL_NON_MODAL|FL_MODAL);}
/**
Position the window so that the mouse is pointing at the
given position, or at the center of the given widget, which may be the
window itself. If the optional offscreen parameter is
non-zero, then the window is allowed to extend off the screen (this
does not work with some X window managers). \see position()
*/
void hotspot(int x, int y, int offscreen = 0);
/** See void Fl_Window::hotspot(int x, int y, int offscreen = 0) */
void hotspot(const Fl_Widget*, int offscreen = 0);
/** See void Fl_Window::hotspot(int x, int y, int offscreen = 0) */
void hotspot(const Fl_Widget& p, int offscreen = 0) {hotspot(&p,offscreen);}
/**
Undoes the effect of a previous resize() or show()
so that the next time show() is called the window manager is
free to position the window.
*/
void free_position() {clear_flag(FL_FORCE_POSITION);}
/**
Set the allowable range the user can resize this window to. This only
works for top-level windows.
<UL>
<LI>minw and minh are the smallest the window can
be. Either value must be greater than 0.</LI>
<LI>maxw and maxh are the largest the window can be.
If either is <I>equal</I> to the minimum then you cannot resize in
that direction. If either is zero then FLTK picks a maximum size in
that direction such that the window will fill the screen. </LI>
<LI>dw and dh are size increments. The window will
be constrained to widths of minw + N * dw, where N
is any non-negative integer. If these are less or equal to 1 they
are ignored. (this is ignored on WIN32)</LI>
<LI>aspect is a flag that indicates that the window should
preserve it's aspect ratio. This only works if both the maximum and
minimum have the same aspect ratio. (ignored on WIN32 and by many X
window managers)</LI>
</UL>
If this function is not called, FLTK tries to figure out the range
from the setting of resizable():
<UL>
<LI>If resizable() is NULL (this is the default)
then the window cannot be resized and the resize border and max-size
control will not be displayed for the window. </LI>
<LI>If either dimension of resizable() is less than 100,
then that is considered the minimum size. Otherwise the
resizable() has a minimum size of 100. </LI>
<LI>If either dimension of resizable() is zero, then that is
also the maximum size (so the window cannot resize in that direction). </LI>
</UL>
It is undefined what happens if the current size does not fit in the
constraints passed to size_range().
*/
void size_range(int a, int b, int c=0, int d=0, int e=0, int f=0, int g=0) {
minw=(short)a; minh=(short)b; maxw=(short)c; maxh=(short)d; dw=(uchar)e; dh=(uchar)f; aspect=(uchar)g; size_range_();}
minw=a; minh=b; maxw=c; maxh=d; dw=e; dh=f; aspect=g; size_range_();}
/** See void Fl_Window::label(const char*) */
const char* label() const {return Fl_Widget::label();}
/** See void Fl_Window::iconlabel(const char*) */
const char* iconlabel() const {return iconlabel_;}
/** Sets the window title bar label. */
void label(const char*);
/** Sets the icon label. */
void iconlabel(const char*);
void label(const char* label, const char* iconlabel);
/** Gets or sets the icon label. */
void label(const char* label, const char* iconlabel); // platform dependent
void copy_label(const char* a);
/** See void Fl_Window::xclass(const char*) */
const char* xclass() const {return xclass_;}
/**
A string used to tell the system what type of window this is. Mostly
this identifies the picture to draw in the icon. <I>Under X, this is
turned into a XA_WM_CLASS pair by truncating at the first
non-alphanumeric character and capitalizing the first character, and
the second one if the first is 'x'. Thus "foo" turns into "foo, Foo",
and "xprog.1" turns into "xprog, XProg".</I> This only works if called <I>
before</I> calling show().
<P>Under Microsoft Windows this string is used as the name of the
WNDCLASS structure, though it is not clear if this can have any
visible effect. The passed pointer is stored unchanged. The string
is not copied.
*/
void xclass(const char* c) {xclass_ = c;}
/** Gets the current icon window target dependent data */
const void* icon() const {return icon_;}
/** Sets the current icon window target dependent data */
void icon(const void * ic) {icon_ = ic;}
/**
Returns non-zero if show() has been called (but not hide()
). You can tell if a window is iconified with (w-&gt;shown()
&!w-&gt;visible()).
*/
int shown() {return i != 0;}
/**
Put the window on the screen. Usually this has the side effect of
opening the display. The second form is used for top-level
windows and allow standard arguments to be parsed from the
command-line.
<P>If the window is already shown then it is restored and raised to the
top. This is really convenient because your program can call show()
at any time, even if the window is already up. It also means that
show() serves the purpose of raise() in other toolkits.
*/
virtual void show();
/**
Remove the window from the screen. If the window is already hidden or
has not been shown then this does nothing and is harmless.
*/
virtual void hide();
/**
See virtual void Fl_Window::show()
*/
void show(int, char**);
/**
Makes the window completely fill the screen, without any window
manager border visible. You must use fullscreen_off() to undo
this. This may not work with all window managers.
*/
void fullscreen();
/**
Turns off any side effects of fullscreen() and does
resize(x,y,w,h).
*/
void fullscreen_off(int,int,int,int);
/**
Iconifies the window. If you call this when shown() is false
it will show() it as an icon. If the window is already
iconified this does nothing.
<P>Call show() to restore the window. </P>
<P>When a window is iconified/restored (either by these calls or by the
user) the handle() method is called with FL_HIDE and
FL_SHOW events and visible() is turned on and off. </P>
<P>There is no way to control what is drawn in the icon except with the
string passed to Fl_Window::xclass(). You should not rely on
window managers displaying the icons.
*/
void iconize();
int x_root() const ;
int y_root() const ;
static Fl_Window *current();
static Fl_Window *current();
/**
Sets things up so that the drawing functions in &lt;FL/fl_draw.H&gt; will go into this
window. This is useful for incremental update of windows, such as in an
idle callback, which will make your program behave much better if it
draws a slow graphic. <B>Danger: incremental update is very hard to
debug and maintain!</B>
<P>This method only works for the Fl_Window and
Fl_Gl_Window derived classes.
*/
void make_current();
// for back-compatability only:
void cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE);
// for back-compatibility only:
/**
Changes the cursor for this window. This always calls the system, if
you are changing the cursor a lot you may want to keep track of how
you set it in a static varaible and call this only if the new cursor
is different.
<P>The type Fl_Cursor is an enumeration defined in &lt;Enumerations.H&gt;.
(Under X you can get any XC_cursor value by passing
Fl_Cursor((XC_foo/2)+1)). The colors only work on X, they are
not implemented on WIN32.
<P> For back compatibility only.
*/
void cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE); // platform dependent
void default_cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE);
static void default_callback(Fl_Window*, void* v);
@@ -131,5 +369,5 @@ public:
#endif
//
// End of "$Id: Fl_Window.H 4421 2005-07-15 09:34:53Z matt $".
// End of "$Id: Fl_Window.H 6614 2009-01-01 16:11:32Z matt $".
//

Some files were not shown because too many files have changed in this diff Show More