| @@ -0,0 +1,2 @@ | |||
| The initial FLTK 1.3 is based on the final 1.1.8. | |||
| @@ -0,0 +1,49 @@ | |||
| # | |||
| # FLTKConfig.cmake - FLTK CMake configuration file for external projects. | |||
| # | |||
| # This file is configured by FLTK and used by the UseFLTK.cmake module | |||
| # to load FLTK's settings for an external project. | |||
| set(FLTK_FOUND TRUE) | |||
| set(FLTK_VERSION @FLTK_VERSION_FULL@) | |||
| set(FLTK_FLUID_EXECUTABLE "@FLTK_FLUID_PATH@") | |||
| if(NOT "@EXE_LINKER_FLAGS@" STREQUAL "") | |||
| set(FLTK_EXE_LINKER_FLAGS "@EXE_LINKER_FLAGS@") | |||
| endif(NOT "@EXE_LINKER_FLAGS@" STREQUAL "") | |||
| set(FLTK_USE_FILE "@PREFIX_CONFIG@/UseFLTK.cmake") | |||
| set(FLTK_DIR "@PREFIX_CONFIG@") | |||
| set(FLTK_BIN_DIR "@PREFIX_BIN@") | |||
| set(FLTK_LIB_DIR "@PREFIX_LIB@") | |||
| set(FLTK_INCLUDE_DIR "@PREFIX_INCLUDE@") | |||
| set(FLTK_DATA_DIR "@PREFIX_DATA@") | |||
| set(FLTK_DOC_DIR "@PREFIX_DOC@") | |||
| set(FLTK_SHARED_LIBS_FOUND @OPTION_BUILD_SHARED_LIBS@) | |||
| set(FLTK_CAIRO_FOUND @FLTK_CAIRO_FOUND@) | |||
| set(FLTK_GL_FOUND @FLTK_GL_FOUND@) | |||
| set(FLTK_THREADS_FOUND @FLTK_THREADS_FOUND@) | |||
| set(FLTK_PTHREADS_FOUND @FLTK_PTHREADS_FOUND@) | |||
| set(FLTK_BUILTIN_JPEG_FOUND @FLTK_BUILTIN_JPEG_FOUND@) | |||
| set(FLTK_BUILTIN_ZLIB_FOUND @FLTK_BUILTIN_ZLIB_FOUND@) | |||
| set(FLTK_BUILTIN_PNG_FOUND @FLTK_BUILTIN_PNG_FOUND@) | |||
| set(FLTK_XINERAMA_FOUND @FLTK_XINERAMA_FOUND@) | |||
| set(FLTK_XFT_FOUND @FLTK_XFT_FOUND@) | |||
| set(FLTK_XDBE_FOUND @FLTK_XDBE_FOUND@) | |||
| set(FLTK_CAIRO_FOUND @FLTK_CAIRO_FOUND@) | |||
| set(FLTK_GL_FOUND @FLTK_GL_FOUND@) | |||
| set(FLTK_THREADS_FOUND @FLTK_THREADS_FOUND@) | |||
| set(FLTK_PTHREADS_FOUND @FLTK_PTHREADS_FOUND@) | |||
| set(FLTK_BUILTIN_JPEG_FOUND @FLTK_BUILTIN_JPEG_FOUND@) | |||
| set(FLTK_BUILTIN_ZLIB_FOUND @FLTK_BUILTIN_ZLIB_FOUND@) | |||
| set(FLTK_BUILTIN_PNG_FOUND @FLTK_BUILTIN_PNG_FOUND@) | |||
| set(FLTK_XINERAMA_FOUND @FLTK_XINERAMA_FOUND@) | |||
| set(FLTK_XFT_FOUND @FLTK_XFT_FOUND@) | |||
| set(FLTK_XDBE_FOUND @FLTK_XDBE_FOUND@) | |||
| include("@PREFIX_CONFIG@/FLTKLibraries.cmake") | |||
| @@ -0,0 +1,8 @@ | |||
| # | |||
| # automatically generated - do not edit | |||
| include_directories("@PREFIX_INCLUDE@") | |||
| if(FLTK_EXE_LINKER_FLAGS) | |||
| list(APPEND CMAKE_EXE_LINKER_FLAGS "${FLTK_EXE_LINKER_FLAGS}") | |||
| endif(FLTK_EXE_LINKER_FLAGS) | |||
| @@ -0,0 +1,19 @@ | |||
| if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") | |||
| message(FATAL_ERROR | |||
| "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") | |||
| endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") | |||
| file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) | |||
| string(REGEX REPLACE "\n" ";" files "${files}") | |||
| foreach(file ${files}) | |||
| message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") | |||
| exec_program("@CMAKE_COMMAND@" | |||
| ARGS "-E remove -f \"$ENV{DESTDIR}${file}\"" | |||
| OUTPUT_VARIABLE rm_out | |||
| RETURN_VALUE rm_retval | |||
| ) | |||
| if(NOT "${rm_retval}" STREQUAL 0) | |||
| message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") | |||
| endif(NOT "${rm_retval}" STREQUAL 0) | |||
| endforeach(file) | |||
| @@ -0,0 +1,17 @@ | |||
| # On unix create backward compatibility symlinks | |||
| if(NOT EXISTS @PREFIX_INCLUDE@/Fl) | |||
| EXECUTE_PROCESS(COMMAND ln -s FL Fl | |||
| WORKING_DIRECTORY @PREFIX_INCLUDE@ | |||
| ) | |||
| endif(NOT EXISTS @PREFIX_INCLUDE@/Fl) | |||
| file(GLOB FLTK_HEADER_FILES @PREFIX_INCLUDE@/FL/*.H) | |||
| foreach(file ${FLTK_HEADER_FILES}) | |||
| GET_FILENAME_COMPONENT(nameWE ${file} NAME_WE) | |||
| if(NOT EXISTS @PREFIX_INCLUDE@/FL/${nameWE}.h) | |||
| EXECUTE_PROCESS(COMMAND ln -s ${nameWE}.H ${nameWE}.h | |||
| WORKING_DIRECTORY @PREFIX_INCLUDE@/FL | |||
| ) | |||
| endif() | |||
| endforeach(file) | |||
| @@ -0,0 +1,10 @@ | |||
| #include <dirent.h> | |||
| int func (const char *d, dirent ***list, void *sort) { | |||
| int n = scandir(d, list, 0, (int(*)(const dirent **, const dirent **))sort); | |||
| } | |||
| int main() { | |||
| return 0; | |||
| } | |||
| @@ -0,0 +1,691 @@ | |||
| # | |||
| # "$Id: CMakeLists.txt 8198 2011-01-06 10:24:58Z manolo $" | |||
| # | |||
| # Main CMakeLists.txt to build the FLTK project using CMake (www.cmake.org) | |||
| # Written by Andy Cedilnik and Julien Jomier | |||
| # | |||
| # Copyright 1998-2010 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 | |||
| # License as published by the Free Software Foundation; either | |||
| # version 2 of the License, or (at your option) any later version. | |||
| # | |||
| # This library is distributed in the hope that it will be useful, | |||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| # Library General Public License for more details. | |||
| # | |||
| # You should have received a copy of the GNU Library General Public | |||
| # License along with this library; if not, write to the Free Software | |||
| # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| # USA. | |||
| # | |||
| # Please report all bugs and problems on the following page: | |||
| # | |||
| # http:#www.fltk.org/str.php | |||
| # | |||
| ####################################################################### | |||
| # basic setup | |||
| ####################################################################### | |||
| project(FLTK) | |||
| cmake_minimum_required(VERSION 2.6) | |||
| # The FLTK version | |||
| set(FLTK_VERSION_MAJOR "1") | |||
| 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}") | |||
| set(EXECUTABLE_OUTPUT_PATH ${FLTK_BINARY_DIR}/bin) | |||
| set(LIBRARY_OUTPUT_PATH ${FLTK_BINARY_DIR}/lib) | |||
| set(ARCHIVE_OUTPUT_PATH ${FLTK_BINARY_DIR}/lib) | |||
| # Search for modules in the FLTK source dir first | |||
| set(CMAKE_MODULE_PATH "${FLTK_SOURCE_DIR}/CMake") | |||
| include_directories(${FLTK_BINARY_DIR} ${FLTK_SOURCE_DIR}) | |||
| ####################################################################### | |||
| # platform dependent information | |||
| ####################################################################### | |||
| include(TestBigEndian) | |||
| TEST_BIG_ENDIAN(WORDS_BIGENDIAN) | |||
| if(APPLE) | |||
| set(__APPLE_QUARTZ__ 1) | |||
| set(HAVE_STRTOLL 1) | |||
| set(HAVE_STRCASECMP 1) | |||
| set(HAVE_DIRENT_H 1) | |||
| set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Cocoa") | |||
| endif(APPLE) | |||
| if(WIN32) | |||
| if(MSVC) | |||
| add_definitions(-DWIN32_LEAN_AND_MEAN) | |||
| add_definitions(-D_CRT_SECURE_NO_WARNINGS) | |||
| endif(MSVC) | |||
| if(CMAKE_C_COMPILER_ID STREQUAL GNU) | |||
| set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-subsystem,windows") | |||
| endif(CMAKE_C_COMPILER_ID STREQUAL GNU) | |||
| if(MINGW AND EXISTS /mingw) | |||
| list(APPEND CMAKE_PREFIX_PATH /mingw) | |||
| endif(MINGW AND EXISTS /mingw) | |||
| endif(WIN32) | |||
| ####################################################################### | |||
| # size of ints | |||
| include(CheckTypeSize) | |||
| CHECK_TYPE_SIZE(short SIZEOF_SHORT) | |||
| CHECK_TYPE_SIZE(int SIZEOF_INT) | |||
| CHECK_TYPE_SIZE(long SIZEOF_LONG) | |||
| CHECK_TYPE_SIZE("long long" HAVE_LONG_LONG) | |||
| if(${SIZEOF_SHORT} MATCHES "^2$") | |||
| set(U16 "unsigned short") | |||
| endif(${SIZEOF_SHORT} MATCHES "^2$") | |||
| if(${SIZEOF_INT} MATCHES "^4$") | |||
| set(U32 "unsigned") | |||
| else() | |||
| if(${SIZEOF_LONG} MATCHES "^4$") | |||
| set(U32 "unsigned long") | |||
| endif(${SIZEOF_LONG} MATCHES "^4$") | |||
| endif(${SIZEOF_INT} MATCHES "^4$") | |||
| if(${SIZEOF_INT} MATCHES "^8$") | |||
| set(U64 "unsigned") | |||
| else() | |||
| if(${SIZEOF_LONG} MATCHES "^8$") | |||
| set(U64 "unsigned long") | |||
| endif(${SIZEOF_LONG} MATCHES "^8$") | |||
| endif(${SIZEOF_INT} MATCHES "^8$") | |||
| ####################################################################### | |||
| # check for headers, libraries and functions | |||
| ####################################################################### | |||
| # headers | |||
| find_file(HAVE_ALSA_ASOUNDLIB_H alsa/asoundlib.h) | |||
| find_file(HAVE_DIRENT_H dirent.h) | |||
| find_file(HAVE_DLFCN_H dlfcn.h) | |||
| find_file(HAVE_FREETYPE_H freetype.h PATH_SUFFIXES freetype2) | |||
| find_file(HAVE_GL_GL_H GL/gl.h) | |||
| find_file(HAVE_GL_GLU_H GL/glu.h) | |||
| find_file(HAVE_LIBPNG_PNG_H libpng/png.h) | |||
| find_file(HAVE_LOCALE_H locale.h) | |||
| find_file(HAVE_NDIR_H ndir.h) | |||
| find_file(HAVE_OPENGL_GLU_H OpenGL/glu.h) | |||
| find_file(HAVE_PNG_H png.h) | |||
| find_file(HAVE_PTHREAD_H pthread.h) | |||
| find_file(HAVE_STDIO_H stdio.h) | |||
| find_file(HAVE_STRINGS_H strings.h) | |||
| find_file(HAVE_SYS_DIR_H sys/dir.h) | |||
| find_file(HAVE_SYS_NDIR_H sys/ndir.h) | |||
| find_file(HAVE_SYS_SELECT_H sys/select.h) | |||
| find_file(HAVE_SYS_STDTYPES_H sys/stdtypes.h) | |||
| find_path(HAVE_XDBE_H Xdbe.h PATH_SUFFIXES X11/extensions extensions) | |||
| mark_as_advanced(HAVE_ALSA_ASOUNDLIB_H HAVE_DIRENT_H HAVE_DLFCN_H) | |||
| mark_as_advanced(HAVE_FREETYPE_H HAVE_GL_GL_H HAVE_GL_GLU_H) | |||
| mark_as_advanced(HAVE_LIBPNG_PNG_H HAVE_LOCALE_H HAVE_NDIR_H) | |||
| mark_as_advanced(HAVE_OPENGL_GLU_H HAVE_PNG_H HAVE_PTHREAD_H) | |||
| mark_as_advanced(HAVE_STDIO_H HAVE_STRINGS_H HAVE_SYS_DIR_H) | |||
| mark_as_advanced(HAVE_SYS_NDIR_H HAVE_SYS_SELECT_H) | |||
| mark_as_advanced(HAVE_SYS_STDTYPES_H HAVE_XDBE_H) | |||
| # where to find freetype headers | |||
| find_path(FREETYPE_PATH freetype/config/ftheader.h PATH_SUFFIXES freetype2) | |||
| if(FREETYPE_PATH) | |||
| include_directories(${FREETYPE_PATH}) | |||
| endif(FREETYPE_PATH) | |||
| mark_as_advanced(FREETYPE_PATH) | |||
| ####################################################################### | |||
| # libraries | |||
| find_library(LIB_CAIRO cairo) | |||
| find_library(LIB_fontconfig fontconfig) | |||
| find_library(LIB_freetype freetype) | |||
| find_library(LIB_GL GL) | |||
| find_library(LIB_MesaGL MesaGL) | |||
| find_library(LIB_jpeg jpeg) | |||
| find_library(LIB_png png) | |||
| find_library(LIB_zlib z) | |||
| mark_as_advanced(LIB_CAIRO LIB_fontconfig LIB_freetype) | |||
| mark_as_advanced(LIB_GL LIB_MesaGL) | |||
| mark_as_advanced(LIB_jpeg LIB_png LIB_zlib) | |||
| ####################################################################### | |||
| # functions | |||
| include(CheckFunctionExists) | |||
| if(HAVE_DLFCN_H) | |||
| set(CMAKE_REQUIRED_LIBRARIES dl) | |||
| endif(HAVE_DLFCN_H) | |||
| CHECK_FUNCTION_EXISTS(dlsym HAVE_DLSYM) | |||
| CHECK_FUNCTION_EXISTS(localeconv HAVE_LOCALECONV) | |||
| if(LIB_png) | |||
| set(CMAKE_REQUIRED_LIBRARIES png) | |||
| endif(LIB_png) | |||
| CHECK_FUNCTION_EXISTS(png_get_valid HAVE_PNG_GET_VALID) | |||
| CHECK_FUNCTION_EXISTS(png_set_tRNS_to_alpha HAVE_PNG_SET_TRNS_TO_ALPHA) | |||
| CHECK_FUNCTION_EXISTS(scandir HAVE_SCANDIR) | |||
| CHECK_FUNCTION_EXISTS(snprintf HAVE_SNPRINTF) | |||
| # not really true but we convert strcasecmp calls to _stricmp calls in flstring.h | |||
| if(MSVC) | |||
| set(HAVE_STRCASECMP 1) | |||
| endif(MSVC) | |||
| CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP) | |||
| CHECK_FUNCTION_EXISTS(strlcat HAVE_STRLCAT) | |||
| CHECK_FUNCTION_EXISTS(strlcpy HAVE_STRLCPY) | |||
| CHECK_FUNCTION_EXISTS(strtoll HAVE_STRTOLL) | |||
| CHECK_FUNCTION_EXISTS(vsnprintf HAVE_VSNPRINTF) | |||
| set(CMAKE_REQUIRED_LIBRARIES) | |||
| if(HAVE_SCANDIR AND NOT HAVE_SCANDIR_POSIX) | |||
| set(MSG "POSIX compatible scandir") | |||
| message(STATUS "Looking for ${MSG}") | |||
| try_compile(V | |||
| ${FLTK_BINARY_DIR} | |||
| ${FLTK_SOURCE_DIR}/CMake/posixScandir.cxx | |||
| ) | |||
| if(V) | |||
| message(STATUS "${MSG} - found") | |||
| set(HAVE_SCANDIR_POSIX 1 CACHE INTERNAL "") | |||
| else() | |||
| message(STATUS "${MSG} - not found") | |||
| set(HAVE_SCANDIR_POSIX HAVE_SCANDIR_POSIX-NOTFOUND) | |||
| endif(V) | |||
| endif(HAVE_SCANDIR AND NOT HAVE_SCANDIR_POSIX) | |||
| mark_as_advanced(HAVE_SCANDIR_POSIX) | |||
| ####################################################################### | |||
| # options | |||
| ####################################################################### | |||
| set(OPTION_OPTIM "" | |||
| CACHE STRING | |||
| "custom optimization flags" | |||
| ) | |||
| add_definitions(${OPTION_OPTIM}) | |||
| ####################################################################### | |||
| set(OPTION_ARCHFLAGS "" | |||
| CACHE STRING | |||
| "custom architecture flags" | |||
| ) | |||
| add_definitions(${OPTION_ARCHFLAGS}) | |||
| ####################################################################### | |||
| set(OPTION_PREFIX_BIN "" | |||
| CACHE STRING | |||
| "where to install executables - leave empty to use {CMAKE_INSTALL_PREFIX}/bin" | |||
| ) | |||
| if(OPTION_PREFIX_BIN) | |||
| set(PREFIX_BIN ${OPTION_PREFIX_BIN} CACHE INTERNAL "" FORCE) | |||
| else() | |||
| set(PREFIX_BIN ${CMAKE_INSTALL_PREFIX}/bin CACHE INTERNAL "" FORCE) | |||
| endif(OPTION_PREFIX_BIN) | |||
| ####################################################################### | |||
| set(OPTION_PREFIX_LIB "" | |||
| CACHE STRING | |||
| "where to install libraries - leave empty to use {CMAKE_INSTALL_PREFIX}/lib" | |||
| ) | |||
| if(OPTION_PREFIX_LIB) | |||
| set(PREFIX_LIB ${OPTION_PREFIX_LIB} CACHE INTERNAL "" FORCE) | |||
| else() | |||
| set(PREFIX_LIB ${CMAKE_INSTALL_PREFIX}/lib CACHE INTERNAL "" FORCE) | |||
| endif(OPTION_PREFIX_LIB) | |||
| ####################################################################### | |||
| set(OPTION_PREFIX_INCLUDE "" | |||
| CACHE STRING | |||
| "where to install include files - leave empty to use {CMAKE_INSTALL_PREFIX}/include" | |||
| ) | |||
| if(OPTION_PREFIX_INCLUDE) | |||
| set(PREFIX_INCLUDE ${OPTION_PREFIX_INCLUDE} CACHE INTERNAL "" FORCE) | |||
| else() | |||
| set(PREFIX_INCLUDE ${CMAKE_INSTALL_PREFIX}/include CACHE INTERNAL "" FORCE) | |||
| endif(OPTION_PREFIX_INCLUDE) | |||
| ####################################################################### | |||
| set(OPTION_PREFIX_DATA "" | |||
| CACHE STRING | |||
| "where to install data files - leave empty to use {CMAKE_INSTALL_PREFIX}/share/FLTK" | |||
| ) | |||
| if(OPTION_PREFIX_DATA) | |||
| set(PREFIX_DATA ${OPTION_PREFIX_DATA} CACHE INTERNAL "" FORCE) | |||
| else() | |||
| set(PREFIX_DATA ${CMAKE_INSTALL_PREFIX}/share/FLTK CACHE INTERNAL "" FORCE) | |||
| endif(OPTION_PREFIX_DATA) | |||
| ####################################################################### | |||
| set(OPTION_PREFIX_DOC "" | |||
| CACHE STRING | |||
| "where to install doc files - leave empty to use {CMAKE_INSTALL_PREFIX}/share/doc/FLTK" | |||
| ) | |||
| if(OPTION_PREFIX_DOC) | |||
| set(PREFIX_DOC ${OPTION_PREFIX_DOC} CACHE INTERNAL "" FORCE) | |||
| else() | |||
| set(PREFIX_DOC ${CMAKE_INSTALL_PREFIX}/share/doc/FLTK CACHE INTERNAL "" FORCE) | |||
| endif(OPTION_PREFIX_DOC) | |||
| ####################################################################### | |||
| if(WIN32) | |||
| set(DEFAULT_CONFIG "${CMAKE_INSTALL_PREFIX}/CMake") | |||
| elseif(APPLE) | |||
| set(DEFAULT_CONFIG "${CMAKE_INSTALL_PREFIX}/FLTK/.framework/Resources/CMake") | |||
| else() | |||
| set(DEFAULT_CONFIG "${CMAKE_INSTALL_PREFIX}/lib/FLTK-${FLTK_VERSION}") | |||
| endif(WIN32) | |||
| set(OPTION_PREFIX_CONFIG "" | |||
| CACHE STRING | |||
| "where to install CMake config files - leave empty to use ${DEFAULT_CONFIG}" | |||
| ) | |||
| if(OPTION_PREFIX_CONFIG) | |||
| set(PREFIX_CONFIG "${OPTION_PREFIX_CONFIG}" CACHE INTERNAL "" FORCE) | |||
| else() | |||
| set(PREFIX_CONFIG "${DEFAULT_CONFIG}" CACHE INTERNAL "" FORCE) | |||
| endif(OPTION_PREFIX_CONFIG) | |||
| ####################################################################### | |||
| if(CMAKE_HOST_UNIX) | |||
| set(OPTION_PREFIX_MAN "" | |||
| CACHE STRING | |||
| "where to install man files - leave empty to use {CMAKE_INSTALL_PREFIX}/man" | |||
| ) | |||
| if(OPTION_PREFIX_MAN) | |||
| set(PREFIX_MAN ${OPTION_PREFIX_MAN} CACHE INTERNAL "" FORCE) | |||
| else() | |||
| set(PREFIX_MAN ${CMAKE_INSTALL_PREFIX}/man CACHE INTERNAL "" FORCE) | |||
| endif(OPTION_PREFIX_MAN) | |||
| option(OPTION_CREATE_LINKS "create backwards compatibility links" OFF) | |||
| endif(CMAKE_HOST_UNIX) | |||
| ####################################################################### | |||
| if(APPLE) | |||
| option(OPTION_APPLE_X11 "use X11" OFF) | |||
| endif(APPLE) | |||
| if(NOT APPLE OR OPTION_APPLE_X11) | |||
| include(FindX11) | |||
| if(X11_FOUND) | |||
| set(USE_X11 1) | |||
| list(APPEND FLTK_CFLAGS -DUSE_X11) | |||
| list(APPEND FLTK_LDLIBS -lX11) | |||
| endif(X11_FOUND) | |||
| endif(NOT APPLE OR OPTION_APPLE_X11) | |||
| ####################################################################### | |||
| option(OPTION_USE_POLL "use poll if available" OFF) | |||
| if(OPTION_USE_POLL) | |||
| CHECK_FUNCTION_EXISTS(poll USE_POLL) | |||
| endif(OPTION_USE_POLL) | |||
| ####################################################################### | |||
| option(OPTION_BUILD_SHARED_LIBS "Build shared libraries" OFF) | |||
| ####################################################################### | |||
| option(OPTION_BUILD_EXAMPLES "build example programs" ON) | |||
| ####################################################################### | |||
| include(FindPkgConfig) | |||
| option(OPTION_CAIRO "use lib Cairo" OFF) | |||
| option(OPTION_CAIROEXT | |||
| "use fltk code instrumentation for cairo extended use" OFF | |||
| ) | |||
| if(OPTION_CAIRO OR OPTION_CAIROEXT AND LIB_CAIRO) | |||
| pkg_search_module(PKG_CAIRO cairo) | |||
| endif(OPTION_CAIRO OR OPTION_CAIROEXT AND LIB_CAIRO) | |||
| if(PKG_CAIRO_FOUND) | |||
| set(FLTK_HAVE_CAIRO 1) | |||
| add_subdirectory(cairo) | |||
| list(APPEND FLTK_LDLIBS -lcairo -lpixman-1) | |||
| include_directories(${PKG_CAIRO_INCLUDE_DIRS}) | |||
| string(REPLACE ";" " " CAIROFLAGS "${PKG_CAIRO_CFLAGS}") | |||
| endif(PKG_CAIRO_FOUND) | |||
| if(LIB_CAIRO AND OPTION_CAIROEXT AND PKG_CAIRO_FOUND) | |||
| set(FLTK_USE_CAIRO 1) | |||
| set(FLTK_CAIRO_FOUND TRUE) | |||
| else() | |||
| set(FLTK_CAIRO_FOUND FALSE) | |||
| endif(LIB_CAIRO AND OPTION_CAIROEXT AND PKG_CAIRO_FOUND) | |||
| ####################################################################### | |||
| set(HAVE_GL LIB_GL OR LIB_MesaGL) | |||
| if(HAVE_GL) | |||
| option(OPTION_USE_GL "use OpenGL" ON) | |||
| endif(HAVE_GL) | |||
| if(OPTION_USE_GL) | |||
| include(FindOpenGL) | |||
| endif(OPTION_USE_GL) | |||
| if(OPENGL_FOUND) | |||
| set(CMAKE_REQUIRED_INCLUDES ${OPENGL_INCLUDE_DIR}/GL) | |||
| set(CMAKE_REQUIRED_LIBRARIES -lGLU -lGL) | |||
| CHECK_FUNCTION_EXISTS(glXGetProcAddressARB HAVE_GLXGETPROCADDRESSARB) | |||
| set(FLTK_GL_FOUND TRUE) | |||
| else() | |||
| set(FLTK_GL_FOUND FALSE) | |||
| endif(OPENGL_FOUND) | |||
| ####################################################################### | |||
| option(OPTION_USE_THREADS "use multi-threading" ON) | |||
| if(OPTION_USE_THREADS) | |||
| include(FindThreads) | |||
| endif(OPTION_USE_THREADS) | |||
| if(OPTION_USE_THREADS AND CMAKE_HAVE_THREADS_LIBRARY) | |||
| add_definitions("-D_THREAD_SAFE -D_REENTRANT") | |||
| set(USE_THREADS 1) | |||
| set(FLTK_THREADS_FOUND TRUE) | |||
| else() | |||
| set(FLTK_THREADS_FOUND FALSE) | |||
| endif(OPTION_USE_THREADS AND CMAKE_HAVE_THREADS_LIBRARY) | |||
| if(OPTION_USE_THREADS AND CMAKE_USE_PTHREADS_INIT) | |||
| set(HAVE_PTHREAD 1) | |||
| list(APPEND FLTK_LDLIBS -lpthread) | |||
| list(APPEND FLTK_CFLAGS -D_THREAD_SAFE -D_REENTRANT) | |||
| set(FLTK_PTHREADS_FOUND TRUE) | |||
| else() | |||
| set(HAVE_PTHREAD 0) | |||
| set(HAVE_PTHREAD_H 0) | |||
| set(FLTK_PTHREADS_FOUND FALSE) | |||
| endif(OPTION_USE_THREADS AND CMAKE_USE_PTHREADS_INIT) | |||
| ####################################################################### | |||
| option(OPTION_LARGE_FILE "enable large file support" ON) | |||
| if(OPTION_LARGE_FILE) | |||
| if(NOT MSVC) | |||
| add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE) | |||
| list(APPEND FLTK_CFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE) | |||
| endif(NOT MSVC) | |||
| endif(OPTION_LARGE_FILE) | |||
| ####################################################################### | |||
| option(OPTION_USE_SYSTEM_LIBJPEG "Use's system libjpeg" ON) | |||
| if(OPTION_USE_SYSTEM_LIBJPEG AND LIB_jpeg) | |||
| include(FindJPEG) | |||
| endif(OPTION_USE_SYSTEM_LIBJPEG AND LIB_jpeg) | |||
| if(OPTION_USE_SYSTEM_LIBJPEG AND JPEG_FOUND) | |||
| set(FLTK_JPEG_LIBRARIES ${JPEG_LIBRARIES}) | |||
| include_directories(${JPEG_INCLUDE_DIR}) | |||
| set(FLTK_BUILTIN_JPEG_FOUND FALSE) | |||
| else() | |||
| add_subdirectory(jpeg) | |||
| set(FLTK_JPEG_LIBRARIES fltk_jpeg) | |||
| include_directories(${FLTK_SOURCE_DIR}/jpeg) | |||
| set(FLTK_BUILTIN_JPEG_FOUND TRUE) | |||
| endif(OPTION_USE_SYSTEM_LIBJPEG AND JPEG_FOUND) | |||
| if(OPTION_USE_SYSTEM_LIBJPEG AND NOT JPEG_FOUND) | |||
| message(STATUS "\ncannot find system jpeg library - using built-in\n") | |||
| endif(OPTION_USE_SYSTEM_LIBJPEG AND NOT JPEG_FOUND) | |||
| set(HAVE_LIBJPEG 1) | |||
| ####################################################################### | |||
| option(OPTION_USE_SYSTEM_ZLIB "Use's system zlib" ON) | |||
| if(OPTION_USE_SYSTEM_ZLIB AND LIB_zlib) | |||
| include(FindZLIB) | |||
| endif(OPTION_USE_SYSTEM_ZLIB AND LIB_zlib) | |||
| if(OPTION_USE_SYSTEM_ZLIB AND ZLIB_FOUND) | |||
| set(FLTK_ZLIB_LIBRARIES ${ZLIB_LIBRARIES}) | |||
| include_directories(${ZLIB_INCLUDE_DIRS}) | |||
| set(FLTK_BUILTIN_ZLIB_FOUND FALSE) | |||
| else() | |||
| add_subdirectory(zlib) | |||
| set(FLTK_ZLIB_LIBRARIES fltk_z) | |||
| set(ZLIB_INCLUDE_DIR ${FLTK_SOURCE_DIR}/zlib) | |||
| include_directories(${FLTK_SOURCE_DIR}/zlib) | |||
| set(FLTK_BUILTIN_ZLIB_FOUND TRUE) | |||
| endif(OPTION_USE_SYSTEM_ZLIB AND ZLIB_FOUND) | |||
| if(OPTION_USE_SYSTEM_ZLIB AND NOT ZLIB_FOUND) | |||
| message(STATUS "\ncannot find system zlib library - using built-in\n") | |||
| endif(OPTION_USE_SYSTEM_ZLIB AND NOT ZLIB_FOUND) | |||
| set(HAVE_LIBZ 1) | |||
| ####################################################################### | |||
| option(OPTION_USE_SYSTEM_LIBPNG "Use's system libpng" ON) | |||
| if(OPTION_USE_SYSTEM_LIBPNG AND LIB_png) | |||
| include(FindPNG) | |||
| endif(OPTION_USE_SYSTEM_LIBPNG AND LIB_png) | |||
| if(OPTION_USE_SYSTEM_LIBPNG AND PNG_FOUND) | |||
| set(FLTK_PNG_LIBRARIES ${PNG_LIBRARIES}) | |||
| include_directories(${PNG_INCLUDE_DIR}) | |||
| add_definitions(${PNG_DEFINITIONS}) | |||
| set(FLTK_BUILTIN_PNG_FOUND FALSE) | |||
| else() | |||
| add_subdirectory(png) | |||
| set(FLTK_PNG_LIBRARIES fltk_png) | |||
| set(HAVE_PNG_H 1) | |||
| set(HAVE_PNG_GET_VALID 1) | |||
| set(HAVE_PNG_SET_TRNS_TO_ALPHA 1) | |||
| include_directories(${FLTK_SOURCE_DIR}/png) | |||
| set(FLTK_BUILTIN_PNG_FOUND TRUE) | |||
| endif(OPTION_USE_SYSTEM_LIBPNG AND PNG_FOUND) | |||
| if(OPTION_USE_SYSTEM_LIBPNG AND NOT PNG_FOUND) | |||
| message(STATUS "\ncannot find system png library - using built-in\n") | |||
| endif(OPTION_USE_SYSTEM_LIBPNG AND NOT PNG_FOUND) | |||
| set(HAVE_LIBPNG 1) | |||
| ####################################################################### | |||
| if(X11_Xinerama_FOUND) | |||
| option(OPTION_USE_XINERAMA "use lib Xinerama" ON) | |||
| endif(X11_Xinerama_FOUND) | |||
| if(OPTION_USE_XINERAMA) | |||
| set(HAVE_XINERAMA ${X11_Xinerama_FOUND}) | |||
| include_directories(${X11_Xinerama_INCLUDE_PATH}) | |||
| list(APPEND FLTK_LDLIBS -lXinerama) | |||
| set(FLTK_XINERAMA_FOUND TRUE) | |||
| else() | |||
| set(FLTK_XINERAMA_FOUND FALSE) | |||
| endif(OPTION_USE_XINERAMA) | |||
| ####################################################################### | |||
| if(X11_Xft_FOUND) | |||
| option(OPTION_USE_XFT "use lib Xft" ON) | |||
| endif(X11_Xft_FOUND) | |||
| if(OPTION_USE_XFT) | |||
| set(USE_XFT X11_Xft_FOUND) | |||
| list(APPEND FLTK_LDLIBS -lXft) | |||
| set(FLTK_XFT_FOUND TRUE) | |||
| else() | |||
| set(FLTK_XFT_FOUND FALSE) | |||
| endif(OPTION_USE_XFT) | |||
| ####################################################################### | |||
| if(X11_FOUND) | |||
| option(OPTION_USE_XDBE "use lib Xdbe" ON) | |||
| endif(X11_FOUND) | |||
| if(OPTION_USE_XDBE AND HAVE_XDBE_H) | |||
| set(HAVE_XDBE 1) | |||
| set(FLTK_XDBE_FOUND TRUE) | |||
| else() | |||
| set(FLTK_XDBE_FOUND FALSE) | |||
| endif(OPTION_USE_XDBE AND HAVE_XDBE_H) | |||
| ####################################################################### | |||
| # final setup and config | |||
| ####################################################################### | |||
| # Set the fluid executable path | |||
| if(CMAKE_CROSSCOMPILING) | |||
| find_file(FLUID_PATH | |||
| NAMES fluid fluid.exe | |||
| PATHS ENV PATH | |||
| NO_CMAKE_FIND_ROOT_PATH | |||
| ) | |||
| add_executable(fluid IMPORTED) | |||
| set(FLTK_FLUID_EXECUTABLE ${FLUID_PATH}) | |||
| set(FLTK_FLUID_PATH ${FLUID_PATH}) | |||
| set_target_properties(fluid | |||
| PROPERTIES IMPORTED_LOCATION ${FLUID_PATH} | |||
| ) | |||
| else() | |||
| add_subdirectory(fluid) | |||
| set(FLTK_FLUID_EXECUTABLE fluid) | |||
| set(FLTK_FLUID_PATH ${PREFIX_BIN}/fluid) | |||
| endif(CMAKE_CROSSCOMPILING) | |||
| add_subdirectory(src) | |||
| # generate FLTKConfig.cmake | |||
| string(REPLACE ";" " " EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") | |||
| configure_file( | |||
| ${FLTK_SOURCE_DIR}/CMake/FLTKConfig.cmake.in | |||
| ${EXECUTABLE_OUTPUT_PATH}/FLTKConfig.cmake | |||
| @ONLY | |||
| ) | |||
| # generate UseFLTK.cmake | |||
| configure_file( | |||
| ${FLTK_SOURCE_DIR}/CMake/UseFLTK.cmake.in | |||
| ${EXECUTABLE_OUTPUT_PATH}/UseFLTK.cmake | |||
| @ONLY | |||
| ) | |||
| # generate config.h | |||
| configure_file( | |||
| "${FLTK_SOURCE_DIR}/configh.cmake.in" | |||
| "${FLTK_BINARY_DIR}/config.h" | |||
| @ONLY | |||
| ) | |||
| # generate fltk-config | |||
| get_filename_component(CC ${CMAKE_C_COMPILER} NAME) | |||
| get_filename_component(CXX ${CMAKE_CXX_COMPILER} NAME) | |||
| string(REPLACE ";" " " C_FLAGS "${FLTK_CFLAGS}") | |||
| if(X11_Xext_FOUND) | |||
| list(APPEND FLTK_LDLIBS -lXext) | |||
| endif(X11_Xext_FOUND) | |||
| string(REPLACE ";" " " LD_LIBS "${FLTK_LDLIBS}") | |||
| configure_file( | |||
| "${FLTK_SOURCE_DIR}/fltk-config.cmake.in" | |||
| "${FLTK_BINARY_DIR}/fltk-config" | |||
| @ONLY | |||
| ) | |||
| if(UNIX) | |||
| execute_process(COMMAND chmod 755 fltk-config | |||
| WORKING_DIRECTORY "${FLTK_BINARY_DIR}" | |||
| ) | |||
| endif(UNIX) | |||
| if(OPTION_CREATE_LINKS) | |||
| configure_file( | |||
| "${FLTK_SOURCE_DIR}/CMake/install-symlinks.cmake.in" | |||
| "${FLTK_BINARY_DIR}/install-symlinks.cmake" | |||
| @ONLY | |||
| ) | |||
| endif(OPTION_CREATE_LINKS) | |||
| # generate uninstall target | |||
| configure_file( | |||
| "${CMAKE_CURRENT_SOURCE_DIR}/CMake/cmake_uninstall.cmake.in" | |||
| "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" | |||
| @ONLY | |||
| ) | |||
| add_custom_target(uninstall | |||
| "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" | |||
| ) | |||
| ####################################################################### | |||
| # build examples - these have to be after fluid is built/imported | |||
| ####################################################################### | |||
| if(OPTION_BUILD_EXAMPLES) | |||
| add_subdirectory(test) | |||
| endif(OPTION_BUILD_EXAMPLES) | |||
| ####################################################################### | |||
| # installation | |||
| ####################################################################### | |||
| install(DIRECTORY ${FLTK_SOURCE_DIR}/FL | |||
| DESTINATION ${PREFIX_INCLUDE} USE_SOURCE_PERMISSIONS | |||
| PATTERN ".svn" EXCLUDE | |||
| ) | |||
| if(OPTION_CREATE_LINKS) | |||
| install(SCRIPT ${FLTK_BINARY_DIR}/install-symlinks.cmake) | |||
| endif(OPTION_CREATE_LINKS) | |||
| install(PROGRAMS ${FLTK_BINARY_DIR}/fltk-config | |||
| DESTINATION ${PREFIX_BIN} | |||
| OPTIONAL | |||
| ) | |||
| install(EXPORT fltk-install | |||
| DESTINATION ${PREFIX_CONFIG} | |||
| FILE FLTKLibraries.cmake | |||
| ) | |||
| install(FILES ${EXECUTABLE_OUTPUT_PATH}/FLTKConfig.cmake | |||
| DESTINATION ${PREFIX_CONFIG} | |||
| ) | |||
| install(FILES ${EXECUTABLE_OUTPUT_PATH}/UseFLTK.cmake | |||
| DESTINATION ${PREFIX_CONFIG} | |||
| ) | |||
| if(CMAKE_HOST_UNIX) | |||
| macro(INSTALL_MAN FILE LEVEL) | |||
| install(FILES | |||
| ${FLTK_SOURCE_DIR}/documentation/src/${FILE}.man | |||
| DESTINATION ${PREFIX_MAN}/man${LEVEL} | |||
| RENAME ${FILE}.${LEVEL} | |||
| ) | |||
| endmacro(INSTALL_MAN FILE LEVEL) | |||
| INSTALL_MAN(fluid 1) | |||
| INSTALL_MAN(fltk-config 1) | |||
| INSTALL_MAN(fltk 3) | |||
| INSTALL_MAN(blocks 6) | |||
| INSTALL_MAN(checkers 6) | |||
| INSTALL_MAN(sudoku 6) | |||
| endif(CMAKE_HOST_UNIX) | |||
| @@ -0,0 +1,530 @@ | |||
| FLTK License | |||
| December 11, 2001 | |||
| The FLTK library and included programs are provided under the terms | |||
| of the GNU Library General Public License (LGPL) with the following | |||
| exceptions: | |||
| 1. Modifications to the FLTK configure script, config | |||
| header file, and makefiles by themselves to support | |||
| a specific platform do not constitute a modified or | |||
| derivative work. | |||
| The authors do request that such modifications be | |||
| contributed to the FLTK project - send all contributions | |||
| through the "Software Trouble Report" on the following page: | |||
| http://www.fltk.org/str.php | |||
| 2. Widgets that are subclassed from FLTK widgets do not | |||
| constitute a derivative work. | |||
| 3. Static linking of applications and widgets to the | |||
| FLTK library does not constitute a derivative work | |||
| and does not require the author to provide source | |||
| code for the application or widget, use the shared | |||
| FLTK libraries, or link their applications or | |||
| widgets against a user-supplied version of FLTK. | |||
| If you link the application or widget to a modified | |||
| version of FLTK, then the changes to FLTK must be | |||
| provided under the terms of the LGPL in sections | |||
| 1, 2, and 4. | |||
| 4. You do not have to provide a copy of the FLTK license | |||
| with programs that are linked to the FLTK library, nor | |||
| do you have to identify the FLTK license in your | |||
| program or documentation as required by section 6 | |||
| of the LGPL. | |||
| However, programs must still identify their use of FLTK. | |||
| The following example statement can be included in user | |||
| documentation to satisfy this requirement: | |||
| [program/widget] is based in part on the work of | |||
| the FLTK project (http://www.fltk.org). | |||
| ----------------------------------------------------------------------- | |||
| GNU LIBRARY GENERAL PUBLIC LICENSE | |||
| Version 2, June 1991 | |||
| Copyright (C) 1991 Free Software Foundation, Inc. | |||
| 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
| Everyone is permitted to copy and distribute verbatim copies | |||
| of this license document, but changing it is not allowed. | |||
| [This is the first released version of the library GPL. It is | |||
| numbered 2 because it goes with version 2 of the ordinary GPL.] | |||
| Preamble | |||
| The licenses for most software are designed to take away your | |||
| freedom to share and change it. By contrast, the GNU General Public | |||
| Licenses are intended to guarantee your freedom to share and change | |||
| free software--to make sure the software is free for all its users. | |||
| This license, the Library General Public License, applies to some | |||
| specially designated Free Software Foundation software, and to any | |||
| other libraries whose authors decide to use it. You can use it for | |||
| your libraries, too. | |||
| When we speak of free software, we are referring to freedom, not | |||
| price. Our General Public Licenses are designed to make sure that you | |||
| have the freedom to distribute copies of free software (and charge for | |||
| this service if you wish), that you receive source code or can get it | |||
| if you want it, that you can change the software or use pieces of it | |||
| in new free programs; and that you know you can do these things. | |||
| To protect your rights, we need to make restrictions that forbid | |||
| anyone to deny you these rights or to ask you to surrender the rights. | |||
| These restrictions translate to certain responsibilities for you if | |||
| you distribute copies of the library, or if you modify it. | |||
| For example, if you distribute copies of the library, whether gratis | |||
| or for a fee, you must give the recipients all the rights that we gave | |||
| you. You must make sure that they, too, receive or can get the source | |||
| code. If you link a program with the library, you must provide | |||
| complete object files to the recipients so that they can relink them | |||
| with the library, after making changes to the library and recompiling | |||
| it. And you must show them these terms so they know their rights. | |||
| Our method of protecting your rights has two steps: (1) copyright | |||
| the library, and (2) offer you this license which gives you legal | |||
| permission to copy, distribute and/or modify the library. | |||
| Also, for each distributor's protection, we want to make certain | |||
| that everyone understands that there is no warranty for this free | |||
| library. If the library is modified by someone else and passed on, we | |||
| want its recipients to know that what they have is not the original | |||
| version, so that any problems introduced by others will not reflect on | |||
| the original authors' reputations. | |||
| Finally, any free program is threatened constantly by software | |||
| patents. We wish to avoid the danger that companies distributing free | |||
| software will individually obtain patent licenses, thus in effect | |||
| transforming the program into proprietary software. To prevent this, | |||
| we have made it clear that any patent must be licensed for everyone's | |||
| free use or not licensed at all. | |||
| Most GNU software, including some libraries, is covered by the ordinary | |||
| GNU General Public License, which was designed for utility programs. This | |||
| license, the GNU Library General Public License, applies to certain | |||
| designated libraries. This license is quite different from the ordinary | |||
| one; be sure to read it in full, and don't assume that anything in it is | |||
| the same as in the ordinary license. | |||
| The reason we have a separate public license for some libraries is that | |||
| they blur the distinction we usually make between modifying or adding to a | |||
| program and simply using it. Linking a program with a library, without | |||
| changing the library, is in some sense simply using the library, and is | |||
| analogous to running a utility program or application program. However, in | |||
| a textual and legal sense, the linked executable is a combined work, a | |||
| derivative of the original library, and the ordinary General Public License | |||
| treats it as such. | |||
| Because of this blurred distinction, using the ordinary General | |||
| Public License for libraries did not effectively promote software | |||
| sharing, because most developers did not use the libraries. We | |||
| concluded that weaker conditions might promote sharing better. | |||
| However, unrestricted linking of non-free programs would deprive the | |||
| users of those programs of all benefit from the free status of the | |||
| libraries themselves. This Library General Public License is intended to | |||
| permit developers of non-free programs to use free libraries, while | |||
| preserving your freedom as a user of such programs to change the free | |||
| libraries that are incorporated in them. (We have not seen how to achieve | |||
| this as regards changes in header files, but we have achieved it as regards | |||
| changes in the actual functions of the Library.) The hope is that this | |||
| will lead to faster development of free libraries. | |||
| The precise terms and conditions for copying, distribution and | |||
| modification follow. Pay close attention to the difference between a | |||
| "work based on the library" and a "work that uses the library". The | |||
| former contains code derived from the library, while the latter only | |||
| works together with the library. | |||
| Note that it is possible for a library to be covered by the ordinary | |||
| General Public License rather than by this special one. | |||
| GNU LIBRARY GENERAL PUBLIC LICENSE | |||
| TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | |||
| 0. This License Agreement applies to any software library which | |||
| contains a notice placed by the copyright holder or other authorized | |||
| party saying it may be distributed under the terms of this Library | |||
| General Public License (also called "this License"). Each licensee is | |||
| addressed as "you". | |||
| A "library" means a collection of software functions and/or data | |||
| prepared so as to be conveniently linked with application programs | |||
| (which use some of those functions and data) to form executables. | |||
| The "Library", below, refers to any such software library or work | |||
| which has been distributed under these terms. A "work based on the | |||
| Library" means either the Library or any derivative work under | |||
| copyright law: that is to say, a work containing the Library or a | |||
| portion of it, either verbatim or with modifications and/or translated | |||
| straightforwardly into another language. (Hereinafter, translation is | |||
| included without limitation in the term "modification".) | |||
| "Source code" for a work means the preferred form of the work for | |||
| making modifications to it. For a library, complete source code means | |||
| all the source code for all modules it contains, plus any associated | |||
| interface definition files, plus the scripts used to control compilation | |||
| and installation of the library. | |||
| Activities other than copying, distribution and modification are not | |||
| covered by this License; they are outside its scope. The act of | |||
| running a program using the Library is not restricted, and output from | |||
| such a program is covered only if its contents constitute a work based | |||
| on the Library (independent of the use of the Library in a tool for | |||
| writing it). Whether that is true depends on what the Library does | |||
| and what the program that uses the Library does. | |||
| 1. You may copy and distribute verbatim copies of the Library's | |||
| complete source code as you receive it, in any medium, provided that | |||
| you conspicuously and appropriately publish on each copy an | |||
| appropriate copyright notice and disclaimer of warranty; keep intact | |||
| all the notices that refer to this License and to the absence of any | |||
| warranty; and distribute a copy of this License along with the | |||
| Library. | |||
| You may charge a fee for the physical act of transferring a copy, | |||
| and you may at your option offer warranty protection in exchange for a | |||
| fee. | |||
| 2. You may modify your copy or copies of the Library or any portion | |||
| of it, thus forming a work based on the Library, and copy and | |||
| distribute such modifications or work under the terms of Section 1 | |||
| above, provided that you also meet all of these conditions: | |||
| a) The modified work must itself be a software library. | |||
| b) You must cause the files modified to carry prominent notices | |||
| stating that you changed the files and the date of any change. | |||
| c) You must cause the whole of the work to be licensed at no | |||
| charge to all third parties under the terms of this License. | |||
| d) If a facility in the modified Library refers to a function or a | |||
| table of data to be supplied by an application program that uses | |||
| the facility, other than as an argument passed when the facility | |||
| is invoked, then you must make a good faith effort to ensure that, | |||
| in the event an application does not supply such function or | |||
| table, the facility still operates, and performs whatever part of | |||
| its purpose remains meaningful. | |||
| (For example, a function in a library to compute square roots has | |||
| a purpose that is entirely well-defined independent of the | |||
| application. Therefore, Subsection 2d requires that any | |||
| application-supplied function or table used by this function must | |||
| be optional: if the application does not supply it, the square | |||
| root function must still compute square roots.) | |||
| These requirements apply to the modified work as a whole. If | |||
| identifiable sections of that work are not derived from the Library, | |||
| and can be reasonably considered independent and separate works in | |||
| themselves, then this License, and its terms, do not apply to those | |||
| sections when you distribute them as separate works. But when you | |||
| distribute the same sections as part of a whole which is a work based | |||
| on the Library, the distribution of the whole must be on the terms of | |||
| this License, whose permissions for other licensees extend to the | |||
| entire whole, and thus to each and every part regardless of who wrote | |||
| it. | |||
| Thus, it is not the intent of this section to claim rights or contest | |||
| your rights to work written entirely by you; rather, the intent is to | |||
| exercise the right to control the distribution of derivative or | |||
| collective works based on the Library. | |||
| In addition, mere aggregation of another work not based on the Library | |||
| with the Library (or with a work based on the Library) on a volume of | |||
| a storage or distribution medium does not bring the other work under | |||
| the scope of this License. | |||
| 3. You may opt to apply the terms of the ordinary GNU General Public | |||
| License instead of this License to a given copy of the Library. To do | |||
| this, you must alter all the notices that refer to this License, so | |||
| that they refer to the ordinary GNU General Public License, version 2, | |||
| instead of to this License. (If a newer version than version 2 of the | |||
| ordinary GNU General Public License has appeared, then you can specify | |||
| that version instead if you wish.) Do not make any other change in | |||
| these notices. | |||
| Once this change is made in a given copy, it is irreversible for | |||
| that copy, so the ordinary GNU General Public License applies to all | |||
| subsequent copies and derivative works made from that copy. | |||
| This option is useful when you wish to copy part of the code of | |||
| the Library into a program that is not a library. | |||
| 4. You may copy and distribute the Library (or a portion or | |||
| derivative of it, under Section 2) in object code or executable form | |||
| under the terms of Sections 1 and 2 above provided that you accompany | |||
| it with the complete corresponding machine-readable source code, which | |||
| must be distributed under the terms of Sections 1 and 2 above on a | |||
| medium customarily used for software interchange. | |||
| If distribution of object code is made by offering access to copy | |||
| from a designated place, then offering equivalent access to copy the | |||
| source code from the same place satisfies the requirement to | |||
| distribute the source code, even though third parties are not | |||
| compelled to copy the source along with the object code. | |||
| 5. A program that contains no derivative of any portion of the | |||
| Library, but is designed to work with the Library by being compiled or | |||
| linked with it, is called a "work that uses the Library". Such a | |||
| work, in isolation, is not a derivative work of the Library, and | |||
| therefore falls outside the scope of this License. | |||
| However, linking a "work that uses the Library" with the Library | |||
| creates an executable that is a derivative of the Library (because it | |||
| contains portions of the Library), rather than a "work that uses the | |||
| library". The executable is therefore covered by this License. | |||
| Section 6 states terms for distribution of such executables. | |||
| When a "work that uses the Library" uses material from a header file | |||
| that is part of the Library, the object code for the work may be a | |||
| derivative work of the Library even though the source code is not. | |||
| Whether this is true is especially significant if the work can be | |||
| linked without the Library, or if the work is itself a library. The | |||
| threshold for this to be true is not precisely defined by law. | |||
| If such an object file uses only numerical parameters, data | |||
| structure layouts and accessors, and small macros and small inline | |||
| functions (ten lines or less in length), then the use of the object | |||
| file is unrestricted, regardless of whether it is legally a derivative | |||
| work. (Executables containing this object code plus portions of the | |||
| Library will still fall under Section 6.) | |||
| Otherwise, if the work is a derivative of the Library, you may | |||
| distribute the object code for the work under the terms of Section 6. | |||
| Any executables containing that work also fall under Section 6, | |||
| whether or not they are linked directly with the Library itself. | |||
| 6. As an exception to the Sections above, you may also compile or | |||
| link a "work that uses the Library" with the Library to produce a | |||
| work containing portions of the Library, and distribute that work | |||
| under terms of your choice, provided that the terms permit | |||
| modification of the work for the customer's own use and reverse | |||
| engineering for debugging such modifications. | |||
| You must give prominent notice with each copy of the work that the | |||
| Library is used in it and that the Library and its use are covered by | |||
| this License. You must supply a copy of this License. If the work | |||
| during execution displays copyright notices, you must include the | |||
| copyright notice for the Library among them, as well as a reference | |||
| directing the user to the copy of this License. Also, you must do one | |||
| of these things: | |||
| a) Accompany the work with the complete corresponding | |||
| machine-readable source code for the Library including whatever | |||
| changes were used in the work (which must be distributed under | |||
| Sections 1 and 2 above); and, if the work is an executable linked | |||
| with the Library, with the complete machine-readable "work that | |||
| uses the Library", as object code and/or source code, so that the | |||
| user can modify the Library and then relink to produce a modified | |||
| executable containing the modified Library. (It is understood | |||
| that the user who changes the contents of definitions files in the | |||
| Library will not necessarily be able to recompile the application | |||
| to use the modified definitions.) | |||
| b) Accompany the work with a written offer, valid for at | |||
| least three years, to give the same user the materials | |||
| specified in Subsection 6a, above, for a charge no more | |||
| than the cost of performing this distribution. | |||
| c) If distribution of the work is made by offering access to copy | |||
| from a designated place, offer equivalent access to copy the above | |||
| specified materials from the same place. | |||
| d) Verify that the user has already received a copy of these | |||
| materials or that you have already sent this user a copy. | |||
| For an executable, the required form of the "work that uses the | |||
| Library" must include any data and utility programs needed for | |||
| reproducing the executable from it. However, as a special exception, | |||
| the source code distributed need not include anything that is normally | |||
| distributed (in either source or binary form) with the major | |||
| components (compiler, kernel, and so on) of the operating system on | |||
| which the executable runs, unless that component itself accompanies | |||
| the executable. | |||
| It may happen that this requirement contradicts the license | |||
| restrictions of other proprietary libraries that do not normally | |||
| accompany the operating system. Such a contradiction means you cannot | |||
| use both them and the Library together in an executable that you | |||
| distribute. | |||
| 7. You may place library facilities that are a work based on the | |||
| Library side-by-side in a single library together with other library | |||
| facilities not covered by this License, and distribute such a combined | |||
| library, provided that the separate distribution of the work based on | |||
| the Library and of the other library facilities is otherwise | |||
| permitted, and provided that you do these two things: | |||
| a) Accompany the combined library with a copy of the same work | |||
| based on the Library, uncombined with any other library | |||
| facilities. This must be distributed under the terms of the | |||
| Sections above. | |||
| b) Give prominent notice with the combined library of the fact | |||
| that part of it is a work based on the Library, and explaining | |||
| where to find the accompanying uncombined form of the same work. | |||
| 8. You may not copy, modify, sublicense, link with, or distribute | |||
| the Library except as expressly provided under this License. Any | |||
| attempt otherwise to copy, modify, sublicense, link with, or | |||
| distribute the Library is void, and will automatically terminate your | |||
| rights under this License. However, parties who have received copies, | |||
| or rights, from you under this License will not have their licenses | |||
| terminated so long as such parties remain in full compliance. | |||
| 9. You are not required to accept this License, since you have not | |||
| signed it. However, nothing else grants you permission to modify or | |||
| distribute the Library or its derivative works. These actions are | |||
| prohibited by law if you do not accept this License. Therefore, by | |||
| modifying or distributing the Library (or any work based on the | |||
| Library), you indicate your acceptance of this License to do so, and | |||
| all its terms and conditions for copying, distributing or modifying | |||
| the Library or works based on it. | |||
| 10. Each time you redistribute the Library (or any work based on the | |||
| Library), the recipient automatically receives a license from the | |||
| original licensor to copy, distribute, link with or modify the Library | |||
| subject to these terms and conditions. You may not impose any further | |||
| restrictions on the recipients' exercise of the rights granted herein. | |||
| You are not responsible for enforcing compliance by third parties to | |||
| this License. | |||
| 11. If, as a consequence of a court judgment or allegation of patent | |||
| infringement or for any other reason (not limited to patent issues), | |||
| conditions are imposed on you (whether by court order, agreement or | |||
| otherwise) that contradict the conditions of this License, they do not | |||
| excuse you from the conditions of this License. If you cannot | |||
| distribute so as to satisfy simultaneously your obligations under this | |||
| License and any other pertinent obligations, then as a consequence you | |||
| may not distribute the Library at all. For example, if a patent | |||
| license would not permit royalty-free redistribution of the Library by | |||
| all those who receive copies directly or indirectly through you, then | |||
| the only way you could satisfy both it and this License would be to | |||
| refrain entirely from distribution of the Library. | |||
| If any portion of this section is held invalid or unenforceable under any | |||
| particular circumstance, the balance of the section is intended to apply, | |||
| and the section as a whole is intended to apply in other circumstances. | |||
| It is not the purpose of this section to induce you to infringe any | |||
| patents or other property right claims or to contest validity of any | |||
| such claims; this section has the sole purpose of protecting the | |||
| integrity of the free software distribution system which is | |||
| implemented by public license practices. Many people have made | |||
| generous contributions to the wide range of software distributed | |||
| through that system in reliance on consistent application of that | |||
| system; it is up to the author/donor to decide if he or she is willing | |||
| to distribute software through any other system and a licensee cannot | |||
| impose that choice. | |||
| This section is intended to make thoroughly clear what is believed to | |||
| be a consequence of the rest of this License. | |||
| 12. If the distribution and/or use of the Library is restricted in | |||
| certain countries either by patents or by copyrighted interfaces, the | |||
| original copyright holder who places the Library under this License may add | |||
| an explicit geographical distribution limitation excluding those countries, | |||
| so that distribution is permitted only in or among countries not thus | |||
| excluded. In such case, this License incorporates the limitation as if | |||
| written in the body of this License. | |||
| 13. The Free Software Foundation may publish revised and/or new | |||
| versions of the Library General Public License from time to time. | |||
| Such new versions will be similar in spirit to the present version, | |||
| but may differ in detail to address new problems or concerns. | |||
| Each version is given a distinguishing version number. If the Library | |||
| specifies a version number of this License which applies to it and | |||
| "any later version", you have the option of following the terms and | |||
| conditions either of that version or of any later version published by | |||
| the Free Software Foundation. If the Library does not specify a | |||
| license version number, you may choose any version ever published by | |||
| the Free Software Foundation. | |||
| 14. If you wish to incorporate parts of the Library into other free | |||
| programs whose distribution conditions are incompatible with these, | |||
| write to the author to ask for permission. For software which is | |||
| copyrighted by the Free Software Foundation, write to the Free | |||
| Software Foundation; we sometimes make exceptions for this. Our | |||
| decision will be guided by the two goals of preserving the free status | |||
| of all derivatives of our free software and of promoting the sharing | |||
| and reuse of software generally. | |||
| NO WARRANTY | |||
| 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO | |||
| WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. | |||
| EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR | |||
| OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY | |||
| KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE | |||
| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |||
| PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE | |||
| LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME | |||
| THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. | |||
| 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN | |||
| WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY | |||
| AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU | |||
| FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR | |||
| CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE | |||
| LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING | |||
| RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A | |||
| FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF | |||
| SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH | |||
| DAMAGES. | |||
| END OF TERMS AND CONDITIONS | |||
| Appendix: How to Apply These Terms to Your New Libraries | |||
| If you develop a new library, and you want it to be of the greatest | |||
| possible use to the public, we recommend making it free software that | |||
| everyone can redistribute and change. You can do so by permitting | |||
| redistribution under these terms (or, alternatively, under the terms of the | |||
| ordinary General Public License). | |||
| To apply these terms, attach the following notices to the library. It is | |||
| safest to attach them to the start of each source file to most effectively | |||
| convey the exclusion of warranty; and each file should have at least the | |||
| "copyright" line and a pointer to where the full notice is found. | |||
| <one line to give the library's name and a brief idea of what it does.> | |||
| Copyright (C) <year> <name of author> | |||
| This library is free software; you can redistribute it and/or | |||
| modify it under the terms of the GNU Library General Public | |||
| License as published by the Free Software Foundation; either | |||
| version 2 of the License, or (at your option) any later version. | |||
| This library is distributed in the hope that it will be useful, | |||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| Library General Public License for more details. | |||
| You should have received a copy of the GNU Library General Public | |||
| License along with this library; if not, write to the Free | |||
| Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |||
| Also add information on how to contact you by electronic and paper mail. | |||
| You should also get your employer (if you work as a programmer) or your | |||
| school, if any, to sign a "copyright disclaimer" for the library, if | |||
| necessary. Here is a sample; alter the names: | |||
| Yoyodyne, Inc., hereby disclaims all copyright interest in the | |||
| library `Frob' (a library for tweaking knobs) written by James Random Hacker. | |||
| <signature of Ty Coon>, 1 April 1990 | |||
| Ty Coon, President of Vice | |||
| That's all there is to it! | |||
| @@ -0,0 +1,62 @@ | |||
| CREDITS - Fast Light Tool Kit (FLTK) Version 1.3.0 | |||
| -------------------------------------------------- | |||
| This file lists the people responsible for the toolkit you | |||
| are now using. If you've looking for your name in lights | |||
| but we've forgotten you here, please use the report on the | |||
| following page, and we'll update this file accordingly: | |||
| http://www.fltk.org/str.php | |||
| 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 (mm@robowerk.com) | |||
| James Dean Palmer (jamespalmer@users.sourceforge.net) | |||
| Vincent Penne (vincentp@users.sourceforge.net) | |||
| Bill Spitzak (spitzak@users.sourceforge.net) | |||
| Michael Sweet (easysw@users.sourceforge.net) | |||
| Carl Thompson (clip@users.sourceforge.net) | |||
| Nafees Bin Zafar (nafees@users.sourceforge.net) | |||
| OTHER CONTRIBUTORS | |||
| The following people have contributed fixes or enhancements | |||
| for FLTK: | |||
| Teun Burgers | |||
| Paul Chambers | |||
| Stephen Davies | |||
| Yuri D'Elia | |||
| Domingo Alvarez Duarte | |||
| Greg Ercolano | |||
| Yuri Fedorchenko | |||
| George Garvey | |||
| Duncan Gibson | |||
| Manolo Gouy | |||
| Mikael Hultgren | |||
| Stuart Levy | |||
| Howard Lightstone | |||
| Mike Lindner | |||
| Alexander Mai | |||
| Pierre Ossman | |||
| Alexander Rabi | |||
| James Roth | |||
| Albrecht Schlosser | |||
| Andrea Suatoni | |||
| Michael Surette | |||
| Paul Sydney | |||
| Aaron Ucko | |||
| Emanuele Vicentini | |||
| Josef Vitu | |||
| Jim Wilson | |||
| Ken Yarnall | |||
| @@ -0,0 +1,38 @@ | |||
| # Dashboard is opened for submissions for a 24 hour period starting at | |||
| # the specified NIGHLY_START_TIME. Time is specified in 24 hour format. | |||
| SET (NIGHTLY_START_TIME "21:00:00 EDT") | |||
| # Dart server to submit results (used by client) | |||
| SET (DROP_METHOD "http") | |||
| SET (DROP_SITE "public.kitware.com") | |||
| SET (DROP_LOCATION "/cgi-bin/HTTPUploadDartFile.cgi") | |||
| SET (TRIGGER_SITE "http://${DROP_SITE}/cgi-bin/Submit-Fltk-TestingResults.pl") | |||
| # Project Home Page | |||
| SET (PROJECT_URL "http://www.fltk.org") | |||
| # Dart server configuration | |||
| SET (ROLLUP_URL "http://${DROP_SITE}/cgi-bin/fltk-rollup-dashboard.sh") | |||
| SET (CVS_WEB_URL "http://cvs.sourceforge.net/viewcvs.py/fltk/fltk/") | |||
| SET (CVS_WEB_CVSROOT "fltk") | |||
| SET (USE_GNATS "On") | |||
| SET (GNATS_WEB_URL "http://www.fltk.org/str.php") | |||
| # Continuous email delivery variables | |||
| SET (CONTINUOUS_FROM "fltk-dashboard@public.kitware.com") | |||
| SET (SMTP_MAILHOST "public.kitware.com") | |||
| SET (CONTINUOUS_MONITOR_LIST "fltk-dashboard@public.kitware.com") | |||
| SET (CONTINUOUS_BASE_URL "http://public.kitware.com/Fltk/Testing") | |||
| SET (DELIVER_BROKEN_BUILD_EMAIL_WITH_TEST_FAILURES ON) | |||
| SET (DELIVER_BROKEN_BUILD_EMAIL "Continuous Nightly") | |||
| SET (EMAIL_FROM "fltk-dashboard@public.kitware.com") | |||
| SET (DARTBOARD_BASE_URL "http://public.kitware.com/Fltk/Testing") | |||
| SET (DELIVER_BROKEN_BUILD_EMAIL_WITH_CONFIGURE_FAILURES 1) | |||
| SET (DELIVER_BROKEN_BUILD_EMAIL_WITH_BUILD_ERRORS 1) | |||
| SET (DELIVER_BROKEN_BUILD_EMAIL_WITH_BUILD_WARNINGS 1) | |||
| SET (DELIVER_BROKEN_BUILD_EMAIL_WITH_TEST_NOT_RUNS 1) | |||
| SET (DELIVER_BROKEN_BUILD_EMAIL_WITH_TEST_FAILURES 1) | |||
| @@ -0,0 +1,959 @@ | |||
| // | |||
| // "$Id: Enumerations.H 8710 2011-05-21 21:55:59Z manolo $" | |||
| // | |||
| // Enumerations for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2011 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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 | |||
| 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 | |||
| /** | |||
| 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. | |||
| 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) | |||
| /*@}*/ // 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 for 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 (FL_KEYDOWN) or released (FL_KEYUP). | |||
| Fl_KEYBOARD is a synonym for FL_KEYDOWN. | |||
| 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 | |||
| non-ASCII 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, | |||
| /** Equivalent 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 | |||
| }; | |||
| /** \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, ///< 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 ///< ? | |||
| }; | |||
| /*@}*/ // group: When Conditions | |||
| /** \name Mouse and Keyboard Events | |||
| 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): | |||
| */ | |||
| /*@{*/ | |||
| // FIXME: These codes collide with valid Unicode 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. | |||
| // These use the Private Use Area (PUA) of the Basic Multilingual Plane | |||
| // of Unicode. Guaranteed not to conflict with a proper Unicode character. | |||
| // These primarily map to the XFree86 keysym range | |||
| #define FL_Volume_Down 0xEF11 /* Volume control down */ | |||
| #define FL_Volume_Mute 0xEF12 /* Mute sound from the system */ | |||
| #define FL_Volume_Up 0xEF13 /* Volume control up */ | |||
| #define FL_Media_Play 0xEF14 /* Start playing of audio */ | |||
| #define FL_Media_Stop 0xEF15 /* Stop playing audio */ | |||
| #define FL_Media_Prev 0xEF16 /* Previous track */ | |||
| #define FL_Media_Next 0xEF17 /* Next track */ | |||
| #define FL_Home_Page 0xEF18 /* Display user's home page */ | |||
| #define FL_Mail 0xEF19 /* Invoke user's mail program */ | |||
| #define FL_Search 0xEF1B /* Search */ | |||
| #define FL_Back 0xEF26 /* Like back on a browser */ | |||
| #define FL_Forward 0xEF27 /* Like forward on a browser */ | |||
| #define FL_Stop 0xEF28 /* Stop current operation */ | |||
| #define FL_Refresh 0xEF29 /* Refresh the page */ | |||
| #define FL_Sleep 0xEF2F /* Put system to sleep */ | |||
| #define FL_Favorites 0xEF30 /* Show favorite locations */ | |||
| /*@}*/ // 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 | |||
| // FIXME: it would be nice to have the modifiers in the upper 8 bit so that | |||
| // a unicode ke (24bit) can be sent as an unsigned with the modifiers. | |||
| #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 | |||
| #define FL_KEY_MASK 0x0000ffff ///< All keys are 16 bit for now | |||
| // FIXME: Unicode needs 24 bits! | |||
| #ifdef __APPLE__ | |||
| # define FL_COMMAND FL_META ///< An alias for FL_CTRL on WIN32 and X11, or FL_META on MacOS X | |||
| # define FL_CONTROL FL_CTRL ///< An alias for FL_META on WIN32 and X11, or FL_CTRL on MacOS X | |||
| #else | |||
| # define FL_COMMAND FL_CTRL ///< An alias for FL_CTRL on WIN32 and X11, or FL_META on MacOS X | |||
| # define FL_CONTROL FL_META ///< An alias for FL_META on WIN32 and X11, or FL_CTRL on MacOS X | |||
| #endif // __APPLE__ | |||
| /*@}*/ // group: Event States | |||
| /** \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.png "Figure 1: FLTK standard box types" | |||
| \image latex boxtypes.png "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() | |||
| #define FL_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_ROUND_UP_BOX()+1) | |||
| extern FL_EXPORT Fl_Boxtype fl_define_FL_SHADOW_BOX(); | |||
| #define FL_SHADOW_BOX fl_define_FL_SHADOW_BOX() | |||
| #define FL_SHADOW_FRAME (Fl_Boxtype)(fl_define_FL_SHADOW_BOX()+2) | |||
| extern FL_EXPORT Fl_Boxtype fl_define_FL_ROUNDED_BOX(); | |||
| #define FL_ROUNDED_BOX fl_define_FL_ROUNDED_BOX() | |||
| #define FL_ROUNDED_FRAME (Fl_Boxtype)(fl_define_FL_ROUNDED_BOX()+2) | |||
| extern FL_EXPORT Fl_Boxtype fl_define_FL_RFLAT_BOX(); | |||
| #define FL_RFLAT_BOX fl_define_FL_RFLAT_BOX() | |||
| extern FL_EXPORT Fl_Boxtype fl_define_FL_RSHADOW_BOX(); | |||
| #define FL_RSHADOW_BOX fl_define_FL_RSHADOW_BOX() | |||
| extern FL_EXPORT Fl_Boxtype fl_define_FL_DIAMOND_BOX(); | |||
| #define FL_DIAMOND_UP_BOX fl_define_FL_DIAMOND_BOX() | |||
| #define FL_DIAMOND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_DIAMOND_BOX()+1) | |||
| extern FL_EXPORT Fl_Boxtype fl_define_FL_OVAL_BOX(); | |||
| #define FL_OVAL_BOX fl_define_FL_OVAL_BOX() | |||
| #define FL_OSHADOW_BOX (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+1) | |||
| #define FL_OVAL_FRAME (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+2) | |||
| #define FL_OFLAT_BOX (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+3) | |||
| extern FL_EXPORT Fl_Boxtype fl_define_FL_PLASTIC_UP_BOX(); | |||
| #define FL_PLASTIC_UP_BOX fl_define_FL_PLASTIC_UP_BOX() | |||
| #define FL_PLASTIC_DOWN_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+1) | |||
| #define FL_PLASTIC_UP_FRAME (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+2) | |||
| #define FL_PLASTIC_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+3) | |||
| #define FL_PLASTIC_THIN_UP_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+4) | |||
| #define FL_PLASTIC_THIN_DOWN_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+5) | |||
| #define FL_PLASTIC_ROUND_UP_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+6) | |||
| #define FL_PLASTIC_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+7) | |||
| extern FL_EXPORT Fl_Boxtype fl_define_FL_GTK_UP_BOX(); | |||
| #define FL_GTK_UP_BOX fl_define_FL_GTK_UP_BOX() | |||
| #define FL_GTK_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+1) | |||
| #define FL_GTK_UP_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+2) | |||
| #define FL_GTK_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+3) | |||
| #define FL_GTK_THIN_UP_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+4) | |||
| #define FL_GTK_THIN_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+5) | |||
| #define FL_GTK_THIN_UP_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+6) | |||
| #define FL_GTK_THIN_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+7) | |||
| #define FL_GTK_ROUND_UP_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+8) | |||
| #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-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 | |||
| /*@}*/ // group: Box Types | |||
| /** | |||
| 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 though 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 and 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() | |||
| 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() | |||
| /** @} */ | |||
| /** \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. | |||
| \code | |||
| Outside alignments: | |||
| TOP_LEFT TOP TOP_RIGHT | |||
| LEFT_TOP+---------------------------------+RIGHT_TOP | |||
| | | | |||
| LEFT| |RIGHT | |||
| | | | |||
| LEFT_BOTTOM+---------------------------------+RIGHT_BOTTOM | |||
| BOTTOM_RIGHT BOTTOM BOTTOM_LEFT | |||
| Inside alignments: | |||
| +---------------------------------+ | |||
| |TOP_LEFT TOP TOP_RIGHT| | |||
| | | | |||
| |LEFT RIGHT| | |||
| | | | |||
| |BOTTOM_RIGHT BOTTOM BOTTOM_LEFT| | |||
| +---------------------------------+ | |||
| \endcode | |||
| \see #FL_ALIGN_CENTER, etc. | |||
| */ | |||
| /*@{*/ | |||
| /** FLTK type for alignment control */ | |||
| 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)0x0020; | |||
| /** If the label contains an image, draw the text below the image. */ | |||
| const Fl_Align FL_ALIGN_IMAGE_OVER_TEXT = (Fl_Align)0x0000; | |||
| /** 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; | |||
| /** If the label contains an image, draw the text to the right of the image. */ | |||
| const Fl_Align FL_ALIGN_IMAGE_NEXT_TO_TEXT = (Fl_Align)0x0100; | |||
| /** If the label contains an image, draw the text to the left of the image. */ | |||
| const Fl_Align FL_ALIGN_TEXT_NEXT_TO_IMAGE = (Fl_Align)0x0120; | |||
| /** If the label contains an image, draw the image or deimage in the background. */ | |||
| const Fl_Align FL_ALIGN_IMAGE_BACKDROP = (Fl_Align)0x0200; | |||
| 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 = 0x0007; // magic value | |||
| const Fl_Align FL_ALIGN_RIGHT_TOP = 0x000b; // magic value | |||
| const Fl_Align FL_ALIGN_LEFT_BOTTOM = 0x000d; // magic value | |||
| const Fl_Align FL_ALIGN_RIGHT_BOTTOM = 0x000e; // magic value | |||
| const Fl_Align FL_ALIGN_NOWRAP = (Fl_Align)0; // for back compatibility | |||
| const Fl_Align FL_ALIGN_POSITION_MASK = 0x000f; // left, right, top, bottom | |||
| const Fl_Align FL_ALIGN_IMAGE_MASK = 0x0320; // l/r, t/b, backdrop | |||
| /*@}*/ | |||
| /** \name Font Numbers | |||
| The following constants define the standard FLTK fonts: | |||
| */ | |||
| /*@{*/ | |||
| /** A font number is an index into the internal font table. */ | |||
| typedef int Fl_Font; | |||
| 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 type holds an 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. | |||
| <pre> | |||
| Fl_Color => 0xrrggbbii | |||
| | | | | | |||
| | | | +--- index between 0 and 255 | |||
| | | +----- blue color component (8 bit) | |||
| | +------- green component (8 bit) | |||
| +--------- red component (8 bit) | |||
| </pre> | |||
| A color can have either an index or an rgb value. Colors with rgb set | |||
| and an index >0 are reserved for special use. | |||
| */ | |||
| /*@{*/ | |||
| /** an FLTK color value */ | |||
| typedef unsigned int Fl_Color; | |||
| // Standard colors. These are used as default colors in widgets and altered as necessary | |||
| const Fl_Color FL_FOREGROUND_COLOR = 0; ///< the default foreground color (0) used for labels and text | |||
| const Fl_Color FL_BACKGROUND2_COLOR = 7; ///< the default background color for text, list, and valuator widgets | |||
| const Fl_Color FL_INACTIVE_COLOR = 8; ///< the inactive foreground color | |||
| const Fl_Color FL_SELECTION_COLOR = 15; ///< the default selection/highlight color | |||
| // boxtypes generally limit themselves to these colors so | |||
| // the whole ramp is not allocated: | |||
| const Fl_Color FL_GRAY0 = 32; // 'A' | |||
| const Fl_Color FL_DARK3 = 39; // 'H' | |||
| const Fl_Color FL_DARK2 = 45; // 'N' | |||
| const Fl_Color FL_DARK1 = 47; // 'P' | |||
| const Fl_Color FL_BACKGROUND_COLOR = 49; // 'R' default background color | |||
| const Fl_Color FL_LIGHT1 = 50; // 'S' | |||
| const Fl_Color FL_LIGHT2 = 52; // 'U' | |||
| const Fl_Color FL_LIGHT3 = 54; // 'W' | |||
| // FLTK provides a 5x8x5 color cube that is used with colormap visuals | |||
| const Fl_Color FL_BLACK = 56; | |||
| const Fl_Color FL_RED = 88; | |||
| const Fl_Color FL_GREEN = 63; | |||
| const Fl_Color FL_YELLOW = 95; | |||
| const Fl_Color FL_BLUE = 216; | |||
| const Fl_Color FL_MAGENTA = 248; | |||
| const Fl_Color FL_CYAN = 223; | |||
| const Fl_Color FL_DARK_RED = 72; | |||
| const Fl_Color FL_DARK_GREEN = 60; | |||
| const Fl_Color FL_DARK_YELLOW = 76; | |||
| const Fl_Color FL_DARK_BLUE = 136; | |||
| const Fl_Color FL_DARK_MAGENTA = 152; | |||
| const Fl_Color FL_DARK_CYAN = 140; | |||
| const Fl_Color FL_WHITE = 255; | |||
| #define FL_FREE_COLOR (Fl_Color)16 | |||
| #define FL_NUM_FREE_COLOR 16 | |||
| #define FL_GRAY_RAMP (Fl_Color)32 | |||
| #define FL_NUM_GRAY 24 | |||
| #define FL_GRAY FL_BACKGROUND_COLOR | |||
| #define FL_COLOR_CUBE (Fl_Color)56 | |||
| #define FL_NUM_RED 5 | |||
| #define FL_NUM_GREEN 8 | |||
| #define FL_NUM_BLUE 5 | |||
| FL_EXPORT Fl_Color fl_inactive(Fl_Color c); | |||
| 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); | |||
| /** Returns a lighter version of the specified color. */ | |||
| inline Fl_Color fl_lighter(Fl_Color c) { return fl_color_average(c, FL_WHITE, .67f); } | |||
| /** Returns a darker version of the specified color. */ | |||
| inline Fl_Color fl_darker(Fl_Color c) { return fl_color_average(c, FL_BLACK, .67f); } | |||
| /** Returns the 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); | |||
| } | |||
| /** Returns the 24-bit color value closest to \p g (grayscale). */ | |||
| inline Fl_Color fl_rgb_color(uchar g) { | |||
| if (!g) return FL_BLACK; | |||
| else return (Fl_Color)(((((g << 8) | g) << 8) | g) << 8); | |||
| } | |||
| /** Returns a gray color value from black (i == 0) to white (i == FL_NUM_GRAY - 1). | |||
| FL_NUM_GRAY is defined to be 24 in the current FLTK release. | |||
| To get the closest FLTK gray value to an 8-bit grayscale color 'I' use: | |||
| \code | |||
| fl_gray_ramp(I * (FL_NUM_GRAY - 1) / 255) | |||
| \endcode | |||
| */ | |||
| inline Fl_Color fl_gray_ramp(int i) {return (Fl_Color)(i+FL_GRAY_RAMP);} | |||
| /** Returns a color out of the color cube. | |||
| \p r must be in the range 0 to FL_NUM_RED (5) minus 1, | |||
| \p g must be in the range 0 to FL_NUM_GREEN (8) minus 1, | |||
| \p b must be in the range 0 to FL_NUM_BLUE (5) minus 1. | |||
| To get the closest color to a 8-bit set of R,G,B values use: | |||
| \code | |||
| fl_color_cube(R * (FL_NUM_RED - 1) / 255, | |||
| G * (FL_NUM_GREEN - 1) / 255, | |||
| B * (FL_NUM_BLUE - 1) / 255); | |||
| \endcode | |||
| */ | |||
| 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 maybe an image. | |||
| */ | |||
| enum Fl_Cursor { | |||
| FL_CURSOR_DEFAULT = 0, /**< the default cursor, usually an arrow. */ | |||
| FL_CURSOR_ARROW = 35, /**< an arrow pointer. */ | |||
| FL_CURSOR_CROSS = 66, /**< crosshair. */ | |||
| FL_CURSOR_WAIT = 76, /**< watch or hourglass. */ | |||
| FL_CURSOR_INSERT = 77, /**< I-beam. */ | |||
| FL_CURSOR_HAND = 31, /**< hand (uparrow on MSWindows). */ | |||
| FL_CURSOR_HELP = 47, /**< question mark. */ | |||
| FL_CURSOR_MOVE = 27, /**< 4-pointed arrow. */ | |||
| // fltk provides bitmaps for these: | |||
| FL_CURSOR_NS = 78, /**< up/down arrow. */ | |||
| FL_CURSOR_WE = 79, /**< left/right arrow. */ | |||
| FL_CURSOR_NWSE = 80, /**< diagonal arrow. */ | |||
| FL_CURSOR_NESW = 81, /**< diagonal arrow. */ | |||
| FL_CURSOR_NONE =255, /**< invisible. */ | |||
| // for back compatibility (non MSWindows ones): | |||
| FL_CURSOR_N = 70, /**< for back compatibility. */ | |||
| FL_CURSOR_NE = 69, /**< for back compatibility. */ | |||
| FL_CURSOR_E = 49, /**< for back compatibility. */ | |||
| FL_CURSOR_SE = 8, /**< for back compatibility. */ | |||
| FL_CURSOR_S = 9, /**< for back compatibility. */ | |||
| FL_CURSOR_SW = 7, /**< for back compatibility. */ | |||
| FL_CURSOR_W = 36, /**< for back compatibility. */ | |||
| FL_CURSOR_NW = 68 /**< for back compatibility. */ | |||
| }; | |||
| /*@}*/ // group: Cursors | |||
| /** FD "when" conditions */ | |||
| enum { // values for "when" passed to Fl::add_fd() | |||
| FL_READ = 1, /**< Call the callback when there is data to be read. */ | |||
| FL_WRITE = 4, /**< Call the callback when data can be written without blocking. */ | |||
| FL_EXCEPT = 8 /**< Call the callback if an exception occurs on the file. */ | |||
| }; | |||
| /** visual types and Fl_Gl_Window::mode() (values match Glut) */ | |||
| enum Fl_Mode { | |||
| FL_RGB = 0, | |||
| FL_INDEX = 1, | |||
| FL_SINGLE = 0, | |||
| FL_DOUBLE = 2, | |||
| FL_ACCUM = 4, | |||
| FL_ALPHA = 8, | |||
| FL_DEPTH = 16, | |||
| FL_STENCIL = 32, | |||
| FL_RGB8 = 64, | |||
| FL_MULTISAMPLE= 128, | |||
| FL_STEREO = 256, | |||
| FL_FAKE_SINGLE = 512 // Fake single buffered windows using double-buffer | |||
| }; | |||
| // image alpha blending | |||
| #define FL_IMAGE_WITH_ALPHA 0x40000000 | |||
| /** Damage masks */ | |||
| enum Fl_Damage { | |||
| FL_DAMAGE_CHILD = 0x01, /**< A child needs to be redrawn. */ | |||
| FL_DAMAGE_EXPOSE = 0x02, /**< The window was exposed. */ | |||
| FL_DAMAGE_SCROLL = 0x04, /**< The Fl_Scroll widget was scrolled. */ | |||
| FL_DAMAGE_OVERLAY = 0x08, /**< The overlay planes need to be redrawn. */ | |||
| FL_DAMAGE_USER1 = 0x10, /**< First user-defined damage bit. */ | |||
| FL_DAMAGE_USER2 = 0x20, /**< Second user-defined damage bit. */ | |||
| FL_DAMAGE_ALL = 0x80 /**< Everything needs to be redrawn. */ | |||
| }; | |||
| // FLTK 1.0.x compatibility definitions... | |||
| # ifdef FLTK_1_0_COMPAT | |||
| # define contrast fl_contrast | |||
| # define down fl_down | |||
| # define frame fl_frame | |||
| # define inactive fl_inactive | |||
| # endif // FLTK_1_0_COMPAT | |||
| #endif | |||
| // | |||
| // End of "$Id: Enumerations.H 8710 2011-05-21 21:55:59Z manolo $". | |||
| // | |||
| @@ -0,0 +1,82 @@ | |||
| // | |||
| // "$Id: Fl_Adjuster.H 7981 2010-12-08 23:53:04Z greg.ercolano $" | |||
| // | |||
| // Adjuster widget header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Adjuster widget . */ | |||
| // 3-button "slider", made for Nuke | |||
| #ifndef Fl_Adjuster_H | |||
| #define Fl_Adjuster_H | |||
| #ifndef Fl_Valuator_H | |||
| #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.png | |||
| \image latex adjuster1.png "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; | |||
| int soft_; | |||
| protected: | |||
| void draw(); | |||
| int handle(int); | |||
| 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 7981 2010-12-08 23:53:04Z greg.ercolano $". | |||
| // | |||
| @@ -0,0 +1,50 @@ | |||
| // | |||
| // "$Id: Fl_BMP_Image.H 7903 2010-11-28 21:06:39Z matt $" | |||
| // | |||
| // BMP image header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_BMP_Image widget . */ | |||
| #ifndef Fl_BMP_Image_H | |||
| #define Fl_BMP_Image_H | |||
| # include "Fl_Image.H" | |||
| /** | |||
| The Fl_BMP_Image class supports loading, caching, | |||
| and drawing of Windows Bitmap (BMP) image files. | |||
| */ | |||
| class FL_EXPORT Fl_BMP_Image : public Fl_RGB_Image { | |||
| public: | |||
| Fl_BMP_Image(const char* filename); | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_BMP_Image.H 7903 2010-11-28 21:06:39Z matt $". | |||
| // | |||
| @@ -0,0 +1,85 @@ | |||
| // | |||
| // "$Id: Fl_Bitmap.H 7903 2010-11-28 21:06:39Z matt $" | |||
| // | |||
| // Bitmap header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Bitmap widget . */ | |||
| #ifndef Fl_Bitmap_H | |||
| #define Fl_Bitmap_H | |||
| # include "Fl_Image.H" | |||
| 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 { | |||
| friend class Fl_Quartz_Graphics_Driver; | |||
| friend class Fl_GDI_Graphics_Driver; | |||
| friend class Fl_Xlib_Graphics_Driver; | |||
| public: | |||
| /** pointer to raw bitmap data */ | |||
| const uchar *array; | |||
| /** Non-zero if array points to bitmap data allocated internally */ | |||
| int alloc_array; | |||
| private: | |||
| #if defined(__APPLE__) || defined(WIN32) | |||
| /** for internal use */ | |||
| void *id_; | |||
| #else | |||
| /** for internal use */ | |||
| unsigned id_; | |||
| #endif // __APPLE__ || WIN32 | |||
| public: | |||
| /** 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(); | |||
| virtual Fl_Image *copy(int W, int H); | |||
| Fl_Image *copy() { return copy(w(), h()); } | |||
| 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);} | |||
| virtual void label(Fl_Widget*w); | |||
| virtual void label(Fl_Menu_Item*m); | |||
| virtual void uncache(); | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Bitmap.H 7903 2010-11-28 21:06:39Z matt $". | |||
| // | |||
| @@ -0,0 +1,69 @@ | |||
| // | |||
| // "$Id: Fl_Box.H 7903 2010-11-28 21:06:39Z matt $" | |||
| // | |||
| // Box header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Box widget . */ | |||
| #ifndef Fl_Box_H | |||
| #define Fl_Box_H | |||
| #ifndef Fl_Widget_H | |||
| #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: | |||
| /** | |||
| - 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) {} | |||
| /** 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); | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Box.H 7903 2010-11-28 21:06:39Z matt $". | |||
| // | |||
| @@ -0,0 +1,324 @@ | |||
| // | |||
| // "$Id: Fl_Browser.H 8623 2011-04-24 17:09:41Z AlbrechtS $" | |||
| // | |||
| // Browser header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2011 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Browser widget . */ | |||
| // Forms-compatible browser. Probably useful for other | |||
| // lists of textual data. Notice that the line numbers | |||
| // start from 1, and 0 means "no line". | |||
| #ifndef Fl_Browser_H | |||
| #define Fl_Browser_H | |||
| #include "Fl_Browser_.H" | |||
| #include "Fl_Image.H" | |||
| 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 <= 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 | |||
| FL_BLINE *last; | |||
| FL_BLINE *cache; | |||
| int cacheline; // line number of cache | |||
| int lines; // Number of lines | |||
| int full_height_; | |||
| const int* column_widths_; | |||
| char format_char_; // alternative to @-sign | |||
| char column_char_; // alternative to tab | |||
| protected: | |||
| // required routines for Fl_Browser_ subclass: | |||
| void* item_first() 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 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 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(); | |||
| /** | |||
| 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 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 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 ; | |||
| /** | |||
| 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 X, int Y, int W, int H, const char *L = 0); | |||
| /** | |||
| The destructor deletes all list items and destroys the browser. | |||
| */ | |||
| ~Fl_Browser() { clear(); } | |||
| /** | |||
| 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. | |||
| 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)); | |||
| } | |||
| // icon support | |||
| void icon(int line, Fl_Image* icon); | |||
| Fl_Image* icon(int line) const; | |||
| void remove_icon(int line); | |||
| /** 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 8623 2011-04-24 17:09:41Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,378 @@ | |||
| // | |||
| // "$Id: Fl_Browser_.H 8275 2011-01-13 22:07:31Z manolo $" | |||
| // | |||
| // Common browser header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Browser_ widget . */ | |||
| // Yes, I know this should be a template... | |||
| #ifndef Fl_Browser__H | |||
| #define Fl_Browser__H | |||
| #ifndef Fl_Group_H | |||
| #include "Fl_Group.H" | |||
| #endif | |||
| #include "Fl_Scrollbar.H" | |||
| #include <FL/Fl.H> // Fl::scrollbar_size() | |||
| #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 | |||
| int hposition_; // where user wants it panned to | |||
| int real_hposition_; // the current horizontal scrolling position | |||
| 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 | |||
| Fl_Font textfont_; | |||
| Fl_Fontsize textsize_; | |||
| Fl_Color 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_ | |||
| 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; | |||
| /** | |||
| 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 { (void)item; 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) { (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 { (void)index; 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 *item,int val=1); | |||
| virtual int item_selected(void *item) const ; | |||
| // things the subclass may want to call: | |||
| /** | |||
| 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 *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 *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 ypos); // item under mouse | |||
| void draw(); | |||
| Fl_Browser_(int X,int Y,int W,int H,const char *L=0); | |||
| public: | |||
| /** | |||
| 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 event); | |||
| void resize(int X,int Y,int W,int H); | |||
| int select(void *item,int val=1,int docallbacks=0); | |||
| int select_only(void *item,int docallbacks=0); | |||
| int deselect(int docallbacks=0); | |||
| /** | |||
| 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 *item); // scroll so this item is shown | |||
| /** | |||
| 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, ///< 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_Browser_::HORIZONTAL - Only a horizontal scrollbar. | |||
| - Fl_Browser_::VERTICAL - Only a vertical scrollbar. | |||
| - 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 textcolor_; } | |||
| /** | |||
| Sets the default text color for the lines in the browser to color \p col. | |||
| */ | |||
| void textcolor(Fl_Color 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 8275 2011-01-13 22:07:31Z manolo $". | |||
| // | |||
| @@ -0,0 +1,180 @@ | |||
| // | |||
| // "$Id: Fl_Button.H 7903 2010-11-28 21:06:39Z matt $" | |||
| // | |||
| // Button header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Button widget . */ | |||
| #ifndef Fl_Button_H | |||
| #define Fl_Button_H | |||
| #ifndef Fl_Widget_H | |||
| #include "Fl_Widget.H" | |||
| #endif | |||
| // values for type() | |||
| #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 | |||
| extern FL_EXPORT Fl_Shortcut fl_old_shortcut(const char*); | |||
| class Fl_Widget_Tracker; | |||
| /** | |||
| \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_; | |||
| char value_; | |||
| char oldval; | |||
| uchar down_box_; | |||
| protected: | |||
| static Fl_Widget_Tracker *key_release_tracker; | |||
| static void key_release_timeout(void*); | |||
| void simulate_key_action(); | |||
| virtual void draw(); | |||
| public: | |||
| virtual int handle(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;} | |||
| /// (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 7903 2010-11-28 21:06:39Z matt $". | |||
| // | |||
| @@ -0,0 +1,97 @@ | |||
| // | |||
| // "$Id: Fl_Cairo.H 8198 2011-01-06 10:24:58Z manolo $" | |||
| // | |||
| // Main header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Handling transparently platform dependent cairo include files | |||
| */ | |||
| #ifndef FL_CAIRO_H | |||
| # define FL_CAIRO_H | |||
| # ifdef FLTK_HAVE_CAIRO | |||
| // Cairo is currently supported for the following platforms: | |||
| // Win32, Apple Quartz, X11 | |||
| # include <FL/Fl_Export.H> | |||
| # if defined(USE_X11) // X11 | |||
| # include <cairo-xlib.h> | |||
| # elif defined(WIN32) | |||
| # include <cairo-win32.h> | |||
| # elif defined(__APPLE_QUARTZ__) | |||
| # include <cairo-quartz.h> | |||
| # else | |||
| # error Cairo is not supported on that platform. | |||
| # endif | |||
| /** | |||
| \addtogroup group_cairo | |||
| @{ | |||
| */ | |||
| /** | |||
| Contains all the necessary info on the current cairo context. | |||
| A private internal & unique corresponding object is created to | |||
| permit cairo context state handling while keeping it opaque. | |||
| For internal use only. | |||
| \note Only available when configure has the --enable-cairo option | |||
| */ | |||
| class FL_EXPORT Fl_Cairo_State { | |||
| public: | |||
| Fl_Cairo_State() : cc_(0), own_cc_(false), autolink_(false), window_(0), gc_(0) {} | |||
| // access attributes | |||
| cairo_t* cc() const {return cc_;} ///< Gets the current cairo context | |||
| bool autolink() const {return autolink_;} ///< Gets the autolink option. See Fl::cairo_autolink_context(bool) | |||
| /** Sets the current cairo context, \p own indicates cc deletion is handle externally by user */ | |||
| void cc(cairo_t* c, bool own=true) { | |||
| if (cc_ && own_cc_) cairo_destroy(cc_); | |||
| cc_=c; | |||
| if (!cc_) window_=0; | |||
| own_cc_=own; | |||
| } | |||
| void autolink(bool b); ///< Sets the autolink option, only available with --enable-cairoext | |||
| void window(void* w) {window_=w;} ///< Sets the window \p w to keep track on | |||
| void* window() const {return window_;} ///< Gets the last window attached to a cc | |||
| void gc(void* c) {gc_=c;} ///< Sets the gc \p c to keep track on | |||
| void* gc() const {return gc_;} ///< Gets the last gc attached to a cc | |||
| private: | |||
| cairo_t * cc_; // contains the unique autoupdated cairo context | |||
| bool own_cc_; // indicates whether we must delete the cc, useful for internal cleanup | |||
| bool autolink_; // true by default, permits to prevent the automatic cairo mapping on fltk windows for custom cairo implementations | |||
| void* window_, *gc_; // for keeping track internally of last win+gc treated | |||
| }; | |||
| /** @} */ | |||
| # endif // FLTK_HAVE_CAIRO | |||
| #endif // FL_CAIRO_H | |||
| // | |||
| // End of "$Id: Fl_Cairo.H 8198 2011-01-06 10:24:58Z manolo $" . | |||
| // | |||
| @@ -0,0 +1,92 @@ | |||
| // | |||
| // "$Id: Fl_Cairo_Window.H 8198 2011-01-06 10:24:58Z manolo $" | |||
| // | |||
| // Main header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Cairo_Window Handling transparently a fltk window incorporte a cairo draw callback. | |||
| */ | |||
| #ifndef FL_CAIRO_WINDOW_H | |||
| # define FL_CAIRO_WINDOW_H | |||
| # ifdef FLTK_HAVE_CAIRO | |||
| // Cairo is currently supported for the following platforms: | |||
| // Win32, Apple Quartz, X11 | |||
| # include <FL/Fl.H> | |||
| # include <FL/Fl_Double_Window.H> | |||
| /** | |||
| \addtogroup group_cairo | |||
| @{ | |||
| */ | |||
| /** | |||
| This defines a pre-configured cairo fltk window. | |||
| This class overloads the virtual draw() method for you, | |||
| so that the only thing you have to do is to provide your cairo code. | |||
| All cairo context handling is achieved transparently. | |||
| \note You can alternatively define your custom cairo fltk window, | |||
| and thus at least override the draw() method to provide custom cairo | |||
| support. In this case you will probably use Fl::cairo_make_current(Fl_Window*) | |||
| to attach a context to your window. You should do it only when your window is | |||
| the current window. \see Fl_Window::current() | |||
| */ | |||
| class FL_EXPORT Fl_Cairo_Window : public Fl_Double_Window { | |||
| public: | |||
| Fl_Cairo_Window(int w, int h) : Fl_Double_Window(w,h),draw_cb_(0) {} | |||
| protected: | |||
| /** Overloaded to provide cairo callback support */ | |||
| void draw() { | |||
| Fl_Double_Window::draw(); | |||
| // manual method ? if yes explicitly get a cairo_context here | |||
| if (!Fl::cairo_autolink_context()) | |||
| Fl::cairo_make_current(this); | |||
| if (draw_cb_) draw_cb_(this, Fl::cairo_cc()); | |||
| } | |||
| public: | |||
| /** This defines the cairo draw callback prototype that you must further */ | |||
| typedef void (*cairo_draw_cb) (Fl_Cairo_Window* self, cairo_t* def); | |||
| /** | |||
| You must provide a draw callback which will implement your cairo rendering. | |||
| This method will permit you to set your cairo callback to \p cb. | |||
| */ | |||
| void set_draw_cb(cairo_draw_cb cb){draw_cb_=cb;} | |||
| private: | |||
| cairo_draw_cb draw_cb_; | |||
| }; | |||
| /** @} */ | |||
| # endif // FLTK_HAVE_CAIRO | |||
| #endif // FL_CAIRO_WINDOW_H | |||
| // | |||
| // End of "$Id: Fl_Cairo_Window.H 8198 2011-01-06 10:24:58Z manolo $" . | |||
| // | |||
| @@ -0,0 +1,160 @@ | |||
| // | |||
| // "$Id: Fl_Chart.H 7981 2010-12-08 23:53:04Z greg.ercolano $" | |||
| // | |||
| // Forms chart header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Chart widget . */ | |||
| #ifndef Fl_Chart_H | |||
| #define Fl_Chart_H | |||
| #ifndef Fl_Widget_H | |||
| #include "Fl_Widget.H" | |||
| #endif | |||
| // values for type() | |||
| #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 /**< for compatibility */ | |||
| #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; /**< 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.png | |||
| \image latex charts.png "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; | |||
| int sizenumb; | |||
| FL_CHART_ENTRY *entries; | |||
| double min,max; | |||
| uchar autosize_; | |||
| Fl_Font textfont_; | |||
| Fl_Fontsize textsize_; | |||
| Fl_Color textcolor_; | |||
| protected: | |||
| void draw(); | |||
| public: | |||
| Fl_Chart(int X, int Y, int W, int H, const char *L = 0); | |||
| ~Fl_Chart(); | |||
| void clear(); | |||
| 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 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 textcolor_;} | |||
| /** gets the chart's text color to \p n. */ | |||
| void textcolor(Fl_Color 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 7981 2010-12-08 23:53:04Z greg.ercolano $". | |||
| // | |||
| @@ -0,0 +1,122 @@ | |||
| // | |||
| // "$Id: Fl_Check_Browser.H 7903 2010-11-28 21:06:39Z matt $" | |||
| // | |||
| // Fl_Check_Browser header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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: */ | |||
| void *item_first() const; | |||
| void *item_next(void *) const; | |||
| void *item_prev(void *) const; | |||
| int item_height(void *) const; | |||
| int item_width(void *) const; | |||
| void item_draw(void *, int, int, int, int) const; | |||
| void item_select(void *, int); | |||
| int item_selected(void *) const; | |||
| /* private data */ | |||
| public: // IRIX 5.3 C++ compiler doesn't support private structures... | |||
| #ifndef FL_DOXYGEN | |||
| /** For internal use only. */ | |||
| struct cb_item { | |||
| 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: | |||
| cb_item *first; | |||
| cb_item *last; | |||
| cb_item *cache; | |||
| int cached_item; | |||
| int nitems_; | |||
| int nchecked_; | |||
| cb_item *find_item(int) const; | |||
| int lineno(cb_item *) const; | |||
| 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 | |||
| // both return the new nitems() | |||
| 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(); | |||
| int value() const; // currently selected item | |||
| char *text(int item) const; // returns pointer to internal buffer | |||
| protected: | |||
| int handle(int); | |||
| }; | |||
| #endif // Fl_Check_Browser_H | |||
| // | |||
| // End of "$Id: Fl_Check_Browser.H 7903 2010-11-28 21:06:39Z matt $". | |||
| // | |||
| @@ -0,0 +1,60 @@ | |||
| // | |||
| // "$Id: Fl_Check_Button.H 7981 2010-12-08 23:53:04Z greg.ercolano $" | |||
| // | |||
| // Check button header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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.png | |||
| \image latex Fl_Check_Button.png "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); | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Check_Button.H 7981 2010-12-08 23:53:04Z greg.ercolano $". | |||
| // | |||
| @@ -0,0 +1,108 @@ | |||
| // | |||
| // "$Id: Fl_Choice.H 7981 2010-12-08 23:53:04Z greg.ercolano $" | |||
| // | |||
| // Choice header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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.png | |||
| \image latex choice.png "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 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 7981 2010-12-08 23:53:04Z greg.ercolano $". | |||
| // | |||
| @@ -0,0 +1,137 @@ | |||
| // | |||
| // "$Id: Fl_Clock.H 7981 2010-12-08 23:53:04Z greg.ercolano $" | |||
| // | |||
| // Clock header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Clock, Fl_Clock_Output widgets . */ | |||
| #ifndef Fl_Clock_H | |||
| #define Fl_Clock_H | |||
| #ifndef Fl_Widget_H | |||
| #include "Fl_Widget.H" | |||
| #endif | |||
| // values for type: | |||
| #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 */ | |||
| // fabien: Please keep the horizontal formatting of both images in class desc, | |||
| // don't lose 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.png | |||
| \htmlonly </TD> <TD> \endhtmlonly | |||
| \image html round_clock.png | |||
| \htmlonly </TD> </TR> </table> \endhtmlonly | |||
| \image latex clock.png "FL_SQUARE_CLOCK type" width=4cm | |||
| \image latex round_clock.png "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(); | |||
| 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); | |||
| void value(ulong v); // set to this Unix time | |||
| 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 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.png | |||
| \htmlonly </TD> <TD> \endhtmlonly | |||
| \image html round_clock.png | |||
| \htmlonly </TD> </TR> </table> \endhtmlonly | |||
| \image latex clock.png "FL_SQUARE_CLOCK type" width=4cm | |||
| \image latex round_clock.png "FL_ROUND_CLOCK type" width=4cm | |||
| */ | |||
| class FL_EXPORT Fl_Clock : public Fl_Clock_Output { | |||
| public: | |||
| int handle(int); | |||
| 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 7981 2010-12-08 23:53:04Z greg.ercolano $". | |||
| // | |||
| @@ -0,0 +1,199 @@ | |||
| // | |||
| // "$Id: Fl_Color_Chooser.H 7981 2010-12-08 23:53:04Z greg.ercolano $" | |||
| // | |||
| // Color chooser header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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. | |||
| #ifndef Fl_Color_Chooser_H | |||
| #define Fl_Color_Chooser_H | |||
| #include <FL/Fl_Group.H> | |||
| #include <FL/Fl_Box.H> | |||
| #include <FL/Fl_Return_Button.H> | |||
| #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: | |||
| void draw(); | |||
| int handle_key(int); | |||
| public: | |||
| int handle(int); | |||
| Flcc_HueBox(int X, int Y, int W, int H) : Fl_Widget(X,Y,W,H) { | |||
| px = py = 0;} | |||
| }; | |||
| /** For internal use only */ | |||
| class FL_EXPORT Flcc_ValueBox : public Fl_Widget { | |||
| int py; | |||
| protected: | |||
| void draw(); | |||
| int handle_key(int); | |||
| public: | |||
| int handle(int); | |||
| Flcc_ValueBox(int X, int Y, int W, int H) : Fl_Widget(X,Y,W,H) { | |||
| 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.jpg "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; | |||
| Fl_Choice choice; | |||
| Flcc_Value_Input rvalue; | |||
| Flcc_Value_Input gvalue; | |||
| Flcc_Value_Input bvalue; | |||
| Fl_Box resize_box; | |||
| double hue_, saturation_, value_; | |||
| double r_, g_, b_; | |||
| void set_valuators(); | |||
| static void rgb_cb(Fl_Widget*, void*); | |||
| static void mode_cb(Fl_Widget*, void*); | |||
| public: | |||
| /** | |||
| Returns which Fl_Color_Chooser variant is currently active | |||
| \return color modes are rgb(0), byte(1), hex(2), or hsv(3) | |||
| */ | |||
| int mode() {return choice.value();} | |||
| /** | |||
| Set which Fl_Color_Chooser variant is currently active | |||
| \param[in] newMode color modes are rgb(0), byte(1), hex(2), or hsv(3) | |||
| */ | |||
| void mode(int newMode); | |||
| /** | |||
| 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 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, int m=-1); | |||
| FL_EXPORT int fl_color_chooser(const char* name, uchar& r, uchar& g, uchar& b, int m=-1); | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Color_Chooser.H 7981 2010-12-08 23:53:04Z greg.ercolano $". | |||
| // | |||
| @@ -0,0 +1,124 @@ | |||
| // | |||
| // "$Id: Fl_Counter.H 7981 2010-12-08 23:53:04Z greg.ercolano $" | |||
| // | |||
| // Counter header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Counter widget . */ | |||
| // A numerical value with up/down step buttons. From Forms. | |||
| #ifndef Fl_Counter_H | |||
| #define Fl_Counter_H | |||
| #ifndef Fl_Valuator_H | |||
| #include "Fl_Valuator.H" | |||
| #endif | |||
| // values for type(): | |||
| #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.png</P> | |||
| \image latex counter.png "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 { | |||
| Fl_Font textfont_; | |||
| Fl_Fontsize textsize_; | |||
| Fl_Color textcolor_; | |||
| double lstep_; | |||
| uchar mouseobj; | |||
| static void repeat_callback(void *); | |||
| int calc_mouseobj(); | |||
| void increment_cb(); | |||
| protected: | |||
| void draw(); | |||
| public: | |||
| int handle(int); | |||
| 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);} | |||
| /** | |||
| Returns the increment for normal step buttons. | |||
| */ | |||
| double step() const {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 textcolor_;} | |||
| /** Sets the font color to \p s */ | |||
| void textcolor(Fl_Color s) {textcolor_ = s;} | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Counter.H 7981 2010-12-08 23:53:04Z greg.ercolano $". | |||
| // | |||
| @@ -0,0 +1,558 @@ | |||
| // | |||
| // "$Id: Fl_Device.H 8529 2011-03-23 12:49:30Z AlbrechtS $" | |||
| // | |||
| // Definition of classes Fl_Device, Fl_Graphics_Driver, Fl_Surface_Device, Fl_Display_Device | |||
| // for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 2010-2011 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /** \file Fl_Device.H | |||
| \brief declaration of classes Fl_Device, Fl_Graphics_Driver, Fl_Surface_Device, | |||
| Fl_Display_Device, Fl_Device_Plugin. | |||
| */ | |||
| #ifndef Fl_Device_H | |||
| #define Fl_Device_H | |||
| #include <FL/x.H> | |||
| #include <FL/Fl_Plugin.H> | |||
| #include <FL/Fl_Image.H> | |||
| #include <FL/Fl_Bitmap.H> | |||
| #include <FL/Fl_Pixmap.H> | |||
| #include <FL/Fl_RGB_Image.H> | |||
| class Fl_Graphics_Driver; | |||
| class Fl_Font_Descriptor; | |||
| /** \brief Points to the driver that currently receives all graphics requests */ | |||
| FL_EXPORT extern Fl_Graphics_Driver *fl_graphics_driver; | |||
| /** | |||
| signature of image generation callback function. | |||
| \param[in] data user data passed to function | |||
| \param[in] x,y,w position and width of scan line in image | |||
| \param[out] buf buffer for generated image data. You must copy \p w | |||
| pixels from scanline \p y, starting at pixel \p x | |||
| to this buffer. | |||
| */ | |||
| typedef void (*Fl_Draw_Image_Cb)(void* data,int x,int y,int w,uchar* buf); | |||
| // typedef what the x,y fields in a point are: | |||
| #ifdef WIN32 | |||
| typedef int COORD_T; | |||
| # define XPOINT XPoint | |||
| #elif defined(__APPLE__) | |||
| typedef float COORD_T; | |||
| typedef struct { float x; float y; } QPoint; | |||
| # define XPOINT QPoint | |||
| extern float fl_quartz_line_width_; | |||
| #else | |||
| typedef short COORD_T; | |||
| # define XPOINT XPoint | |||
| #endif | |||
| /** | |||
| \brief All graphical output devices and all graphics systems. | |||
| */ | |||
| class FL_EXPORT Fl_Device { | |||
| public: | |||
| /** A string that identifies each subclass of Fl_Device. | |||
| Function class_name() applied to a device of this class returns this string. | |||
| */ | |||
| static const char *class_id; | |||
| /** | |||
| Returns the name of the class of this object. | |||
| The class of an instance of an Fl_Device subclass can be checked with code such as: | |||
| \code | |||
| if ( instance->class_name() == Fl_Printer::class_id ) { ... } | |||
| \endcode | |||
| */ | |||
| virtual const char *class_name() {return class_id;}; | |||
| /** | |||
| Virtual destructor. | |||
| The destructor of Fl_Device must be virtual to make the destructors of | |||
| derived classes being called correctly on destruction. | |||
| */ | |||
| virtual ~Fl_Device() {}; | |||
| }; | |||
| #define FL_REGION_STACK_SIZE 10 | |||
| #define FL_MATRIX_STACK_SIZE 32 | |||
| /** | |||
| \brief A virtual class subclassed for each graphics driver FLTK uses. | |||
| * | |||
| The virtual methods of this class are those that a graphics driver should implement to | |||
| support all of FLTK drawing functions. | |||
| <br> The public API for drawing operations is functionally presented in \ref drawing and as function lists | |||
| in the \ref fl_drawings and \ref fl_attributes modules. | |||
| */ | |||
| class FL_EXPORT Fl_Graphics_Driver : public Fl_Device { | |||
| public: | |||
| /** A 2D coordinate transformation matrix | |||
| */ | |||
| struct matrix {double a, b, c, d, x, y;}; | |||
| private: | |||
| static const matrix m0; | |||
| Fl_Font font_; // current font | |||
| Fl_Fontsize size_; // current font size | |||
| Fl_Color color_; // current color | |||
| enum {LINE, LOOP, POLYGON, POINT_}; | |||
| int sptr; | |||
| static const int matrix_stack_size = FL_MATRIX_STACK_SIZE; | |||
| matrix stack[FL_MATRIX_STACK_SIZE]; | |||
| matrix m; | |||
| int n, p_size, gap_; | |||
| XPOINT *p; | |||
| int what; | |||
| int fl_clip_state_number; | |||
| int rstackptr; | |||
| static const int region_stack_max = FL_REGION_STACK_SIZE - 1; | |||
| Fl_Region rstack[FL_REGION_STACK_SIZE]; | |||
| #ifdef WIN32 | |||
| int numcount; | |||
| int counts[20]; | |||
| #endif | |||
| Fl_Font_Descriptor *font_descriptor_; | |||
| void transformed_vertex0(COORD_T x, COORD_T y); | |||
| void fixloop(); | |||
| protected: | |||
| /* ** \brief red color for background and/or mixing if device does not support masking or alpha * | |||
| uchar bg_r_; | |||
| ** \brief green color for background and/or mixing if device does not support masking or alpha * | |||
| uchar bg_g_; | |||
| ** \brief blue color for background and/or mixing if device does not support masking or alpha * | |||
| uchar bg_b_; */ | |||
| friend class Fl_Pixmap; | |||
| friend class Fl_Bitmap; | |||
| friend class Fl_RGB_Image; | |||
| friend void fl_rect(int x, int y, int w, int h); | |||
| friend void fl_rectf(int x, int y, int w, int h); | |||
| friend void fl_line_style(int style, int width, char* dashes); | |||
| friend void fl_xyline(int x, int y, int x1); | |||
| friend void fl_xyline(int x, int y, int x1, int y2); | |||
| friend void fl_xyline(int x, int y, int x1, int y2, int x3); | |||
| friend void fl_yxline(int x, int y, int y1); | |||
| friend void fl_yxline(int x, int y, int y1, int x2); | |||
| friend void fl_yxline(int x, int y, int y1, int x2, int y3); | |||
| friend void fl_line(int x, int y, int x1, int y1); | |||
| friend void fl_line(int x, int y, int x1, int y1, int x2, int y2); | |||
| friend void fl_draw(const char *str, int n, int x, int y); | |||
| #ifdef __APPLE__ | |||
| friend void fl_draw(const char *str, int n, float x, float y); | |||
| #endif | |||
| friend void fl_draw(int angle, const char *str, int n, int x, int y); | |||
| friend void fl_rtl_draw(const char *str, int n, int x, int y); | |||
| friend void fl_font(Fl_Font face, Fl_Fontsize size); | |||
| friend void fl_color(Fl_Color c); | |||
| friend void fl_color(uchar r, uchar g, uchar b); | |||
| friend void fl_point(int x, int y); | |||
| friend void fl_loop(int x0, int y0, int x1, int y1, int x2, int y2); | |||
| friend void fl_loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3); | |||
| friend void fl_polygon(int x0, int y0, int x1, int y1, int x2, int y2); | |||
| friend void fl_polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3); | |||
| friend void fl_begin_points(); | |||
| friend void fl_begin_line(); | |||
| friend void fl_begin_loop(); | |||
| friend void fl_begin_polygon(); | |||
| friend void fl_vertex(double x, double y); | |||
| friend void fl_curve(double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3); | |||
| friend void fl_circle(double x, double y, double r); | |||
| friend void fl_arc(double x, double y, double r, double start, double end); | |||
| friend void fl_arc(int x, int y, int w, int h, double a1, double a2); | |||
| friend void fl_pie(int x, int y, int w, int h, double a1, double a2); | |||
| friend void fl_end_points(); | |||
| friend void fl_end_line(); | |||
| friend void fl_end_loop(); | |||
| friend void fl_end_polygon(); | |||
| friend void fl_transformed_vertex(double xf, double yf); | |||
| friend void fl_push_clip(int x, int y, int w, int h); | |||
| friend int fl_clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H); | |||
| friend int fl_not_clipped(int x, int y, int w, int h); | |||
| friend void fl_push_no_clip(); | |||
| friend void fl_pop_clip(); | |||
| friend void fl_begin_complex_polygon(); | |||
| friend void fl_gap(); | |||
| friend void fl_end_complex_polygon(); | |||
| friend void fl_push_matrix(); | |||
| friend void fl_pop_matrix(); | |||
| friend void fl_mult_matrix(double a, double b, double c, double d, double x, double y); | |||
| friend void fl_scale(double x, double y); | |||
| friend void fl_scale(double x); | |||
| friend void fl_translate(double x, double y); | |||
| friend void fl_rotate(double d); | |||
| friend double fl_transform_x(double x, double y); | |||
| friend double fl_transform_y(double x, double y); | |||
| friend double fl_transform_dx(double x, double y); | |||
| friend double fl_transform_dy(double x, double y); | |||
| friend Fl_Region fl_clip_region(); | |||
| friend void fl_clip_region(Fl_Region r); | |||
| friend void fl_restore_clip(); | |||
| friend void fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D, int L); | |||
| friend void fl_draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D, int L); | |||
| friend void fl_draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D); | |||
| friend FL_EXPORT void fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D); | |||
| friend FL_EXPORT void gl_start(); | |||
| matrix *fl_matrix; /**< Points to the current coordinate transformation matrix */ | |||
| /** \brief The constructor. */ | |||
| Fl_Graphics_Driver(); | |||
| /** \brief see fl_rect(int x, int y, int w, int h). */ | |||
| virtual void rect(int x, int y, int w, int h); | |||
| /** \brief see fl_rectf(int x, int y, int w, int h). */ | |||
| virtual void rectf(int x, int y, int w, int h); | |||
| /** \brief see fl_line_style(int style, int width, char* dashes). */ | |||
| virtual void line_style(int style, int width=0, char* dashes=0); | |||
| /** \brief see fl_xyline(int x, int y, int x1). */ | |||
| virtual void xyline(int x, int y, int x1); | |||
| /** \brief see fl_xyline(int x, int y, int x1, int y2). */ | |||
| virtual void xyline(int x, int y, int x1, int y2); | |||
| /** \brief see fl_xyline(int x, int y, int x1, int y2, int x3). */ | |||
| virtual void xyline(int x, int y, int x1, int y2, int x3); | |||
| /** \brief see fl_yxline(int x, int y, int y1). */ | |||
| virtual void yxline(int x, int y, int y1); | |||
| /** \brief see fl_yxline(int x, int y, int y1, int x2). */ | |||
| virtual void yxline(int x, int y, int y1, int x2); | |||
| /** \brief see fl_yxline(int x, int y, int y1, int x2, int y3). */ | |||
| virtual void yxline(int x, int y, int y1, int x2, int y3); | |||
| /** \brief see fl_line(int x, int y, int x1, int y1). */ | |||
| virtual void line(int x, int y, int x1, int y1); | |||
| /** \brief see fl_line(int x, int y, int x1, int y1, int x2, int y2). */ | |||
| virtual void line(int x, int y, int x1, int y1, int x2, int y2); | |||
| /** \brief see fl_draw(const char *str, int n, int x, int y). */ | |||
| virtual void draw(const char *str, int n, int x, int y) = 0; | |||
| #ifdef __APPLE__ | |||
| virtual void draw(const char *str, int n, float x, float y) = 0; | |||
| #endif | |||
| /** \brief see fl_draw(int angle, const char *str, int n, int x, int y). */ | |||
| virtual void draw(int angle, const char *str, int n, int x, int y) = 0; | |||
| /** \brief see fl_rtl_draw(const char *str, int n, int x, int y). */ | |||
| virtual void rtl_draw(const char *str, int n, int x, int y) = 0; | |||
| /** \brief see fl_color(Fl_Color c). */ | |||
| virtual void color(Fl_Color c) {color_ = c;} | |||
| /** \brief see fl_color(uchar r, uchar g, uchar b). */ | |||
| virtual void color(uchar r, uchar g, uchar b) = 0; | |||
| /** \brief see fl_point(int x, int y). */ | |||
| virtual void point(int x, int y); | |||
| /** \brief see fl_loop(int x0, int y0, int x1, int y1, int x2, int y2). */ | |||
| virtual void loop(int x0, int y0, int x1, int y1, int x2, int y2); | |||
| /** \brief see fl_loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3). */ | |||
| virtual void loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3); | |||
| /** \brief see fl_polygon(int x0, int y0, int x1, int y1, int x2, int y2). */ | |||
| virtual void polygon(int x0, int y0, int x1, int y1, int x2, int y2); | |||
| /** \brief see fl_polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3). */ | |||
| virtual void polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3); | |||
| /** \brief see fl_begin_points(). */ | |||
| virtual void begin_points(); | |||
| /** \brief see fl_begin_line(). */ | |||
| virtual void begin_line(); | |||
| /** \brief see fl_begin_loop(). */ | |||
| virtual void begin_loop(); | |||
| /** \brief see fl_begin_polygon(). */ | |||
| virtual void begin_polygon(); | |||
| /** \brief see fl_vertex(double x, double y). */ | |||
| virtual void vertex(double x, double y); | |||
| /** \brief see fl_curve(double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3). */ | |||
| virtual void curve(double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3); | |||
| /** \brief see fl_circle(double x, double y, double r). */ | |||
| virtual void circle(double x, double y, double r); | |||
| /** \brief see fl_arc(double x, double y, double r, double start, double end). */ | |||
| virtual void arc(double x, double y, double r, double start, double end); | |||
| /** \brief see fl_arc(int x, int y, int w, int h, double a1, double a2). */ | |||
| virtual void arc(int x, int y, int w, int h, double a1, double a2); | |||
| /** \brief see fl_pie(int x, int y, int w, int h, double a1, double a2). */ | |||
| virtual void pie(int x, int y, int w, int h, double a1, double a2); | |||
| /** \brief see fl_end_points(). */ | |||
| virtual void end_points(); | |||
| /** \brief see fl_end_line(). */ | |||
| virtual void end_line(); | |||
| /** \brief see fl_end_loop(). */ | |||
| virtual void end_loop(); | |||
| /** \brief see fl_end_polygon(). */ | |||
| virtual void end_polygon(); | |||
| /** \brief see fl_begin_complex_polygon(). */ | |||
| virtual void begin_complex_polygon(); | |||
| /** \brief see fl_gap(). */ | |||
| virtual void gap(); | |||
| /** \brief see fl_end_complex_polygon(). */ | |||
| virtual void end_complex_polygon(); | |||
| /** \brief see fl_transformed_vertex(double xf, double yf). */ | |||
| virtual void transformed_vertex(double xf, double yf); | |||
| /** \brief see fl_push_clip(int x, int y, int w, int h). */ | |||
| virtual void push_clip(int x, int y, int w, int h); | |||
| /** \brief see fl_clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H). */ | |||
| virtual int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H); | |||
| /** \brief see fl_not_clipped(int x, int y, int w, int h). */ | |||
| virtual int not_clipped(int x, int y, int w, int h); | |||
| /** \brief see fl_push_no_clip(). */ | |||
| virtual void push_no_clip(); | |||
| /** \brief see fl_pop_clip(). */ | |||
| virtual void pop_clip(); | |||
| /** \brief see fl_push_matrix(). */ | |||
| void push_matrix(); | |||
| /** \brief see fl_pop_matrix(). */ | |||
| void pop_matrix(); | |||
| /** \brief see fl_mult_matrix(double a, double b, double c, double d, double x, double y). */ | |||
| void mult_matrix(double a, double b, double c, double d, double x, double y); | |||
| /** \brief see fl_scale(double x, double y). */ | |||
| inline void scale(double x, double y) { mult_matrix(x,0,0,y,0,0); } | |||
| /** \brief see fl_scale(double x). */ | |||
| inline void scale(double x) { mult_matrix(x,0,0,x,0,0); } | |||
| /** \brief see fl_translate(double x, double y). */ | |||
| inline void translate(double x,double y) { mult_matrix(1,0,0,1,x,y); } | |||
| /** \brief see fl_rotate(double d). */ | |||
| void rotate(double d); | |||
| /** \brief see fl_transform_x(double x, double y). */ | |||
| double transform_x(double x, double y); | |||
| /** \brief see fl_transform_y(double x, double y). */ | |||
| double transform_y(double x, double y); | |||
| /** \brief see fl_transform_dx(double x, double y). */ | |||
| double transform_dx(double x, double y); | |||
| /** \brief see fl_transform_dy(double x, double y). */ | |||
| double transform_dy(double x, double y); | |||
| /** \brief see fl_clip_region(). */ | |||
| Fl_Region clip_region(); | |||
| /** \brief see fl_clip_region(Fl_Region r). */ | |||
| void clip_region(Fl_Region r); | |||
| /** \brief see fl_restore_clip(). */ | |||
| void restore_clip(); | |||
| // Images | |||
| /** \brief see fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D, int L). */ | |||
| virtual void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0) = 0; | |||
| /** \brief see fl_draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D, int L). */ | |||
| virtual void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0) = 0; | |||
| /** \brief see fl_draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D). */ | |||
| virtual void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3) = 0; | |||
| /** \brief see fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D). */ | |||
| virtual void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1) = 0; | |||
| // Image classes | |||
| /** \brief Draws an Fl_RGB_Image object to the device. | |||
| * | |||
| Specifies a bounding box for the image, with the origin (upper left-hand corner) of | |||
| the image offset by the cx and cy arguments. | |||
| */ | |||
| virtual void draw(Fl_RGB_Image * rgb,int XP, int YP, int WP, int HP, int cx, int cy) = 0; | |||
| /** \brief Draws an Fl_Pixmap object to the device. | |||
| * | |||
| Specifies a bounding box for the image, with the origin (upper left-hand corner) of | |||
| the image offset by the cx and cy arguments. | |||
| */ | |||
| virtual void draw(Fl_Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy) = 0; | |||
| /** \brief Draws an Fl_Bitmap object to the device. | |||
| * | |||
| Specifies a bounding box for the image, with the origin (upper left-hand corner) of | |||
| the image offset by the cx and cy arguments. | |||
| */ | |||
| virtual void draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy) = 0; | |||
| public: | |||
| static const char *class_id; | |||
| virtual const char *class_name() {return class_id;}; | |||
| /** \brief see fl_font(Fl_Font face, Fl_Fontsize size). */ | |||
| virtual void font(Fl_Font face, Fl_Fontsize size) {font_ = face; size_ = size;} | |||
| /** \brief see fl_font(void). */ | |||
| Fl_Font font() {return font_; } | |||
| /** \brief see fl_size(). */ | |||
| Fl_Fontsize size() {return size_; } | |||
| /** \brief see fl_width(const char *str, int n). */ | |||
| virtual double width(const char *str, int n) = 0; | |||
| /** \brief see fl_width(unsigned int n). */ | |||
| virtual inline double width(unsigned int c) { char ch = (char)c; return width(&ch, 1); } | |||
| /** \brief see fl_text_extents(const char*, int n, int& dx, int& dy, int& w, int& h). */ | |||
| virtual void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h); | |||
| /** \brief see fl_height(). */ | |||
| virtual int height() = 0; | |||
| /** \brief see fl_descent(). */ | |||
| virtual int descent() = 0; | |||
| /** \brief see fl_color(void). */ | |||
| Fl_Color color() {return color_;} | |||
| /** Returns a pointer to the current Fl_Font_Descriptor for the graphics driver */ | |||
| inline Fl_Font_Descriptor *font_descriptor() { return font_descriptor_;} | |||
| /** Sets the current Fl_Font_Descriptor for the graphics driver */ | |||
| inline void font_descriptor(Fl_Font_Descriptor *d) { font_descriptor_ = d;} | |||
| /** \brief The destructor */ | |||
| virtual ~Fl_Graphics_Driver() {}; | |||
| }; | |||
| #if defined(__APPLE__) || defined(FL_DOXYGEN) | |||
| /** | |||
| \brief The Mac OS X-specific graphics class. | |||
| * | |||
| This class is implemented only on the Mac OS X platform. | |||
| */ | |||
| class FL_EXPORT Fl_Quartz_Graphics_Driver : public Fl_Graphics_Driver { | |||
| public: | |||
| static const char *class_id; | |||
| const char *class_name() {return class_id;}; | |||
| void color(Fl_Color c); | |||
| void color(uchar r, uchar g, uchar b); | |||
| void draw(const char* str, int n, int x, int y); | |||
| #ifdef __APPLE__ | |||
| void draw(const char *str, int n, float x, float y); | |||
| #endif | |||
| void draw(int angle, const char *str, int n, int x, int y); | |||
| void rtl_draw(const char* str, int n, int x, int y); | |||
| void font(Fl_Font face, Fl_Fontsize size); | |||
| void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy); | |||
| void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy); | |||
| void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy); | |||
| void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0); | |||
| void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3); | |||
| void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0); | |||
| void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1); | |||
| double width(const char *str, int n); | |||
| double width(unsigned int c); | |||
| void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h); | |||
| int height(); | |||
| int descent(); | |||
| }; | |||
| #endif | |||
| #if defined(WIN32) || defined(FL_DOXYGEN) | |||
| /** | |||
| \brief The MSWindows-specific graphics class. | |||
| * | |||
| This class is implemented only on the MSWindows platform. | |||
| */ | |||
| class FL_EXPORT Fl_GDI_Graphics_Driver : public Fl_Graphics_Driver { | |||
| public: | |||
| static const char *class_id; | |||
| const char *class_name() {return class_id;}; | |||
| void color(Fl_Color c); | |||
| void color(uchar r, uchar g, uchar b); | |||
| void draw(const char* str, int n, int x, int y); | |||
| void draw(int angle, const char *str, int n, int x, int y); | |||
| void rtl_draw(const char* str, int n, int x, int y); | |||
| void font(Fl_Font face, Fl_Fontsize size); | |||
| void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy); | |||
| void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy); | |||
| void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy); | |||
| void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0); | |||
| void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3); | |||
| void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0); | |||
| void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1); | |||
| double width(const char *str, int n); | |||
| double width(unsigned int c); | |||
| void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h); | |||
| int height(); | |||
| int descent(); | |||
| }; | |||
| #endif | |||
| #if !(defined(__APPLE__) || defined(WIN32)) | |||
| /** | |||
| \brief The Xlib-specific graphics class. | |||
| * | |||
| This class is implemented only on the Xlib platform. | |||
| */ | |||
| class Fl_Xlib_Graphics_Driver : public Fl_Graphics_Driver { | |||
| public: | |||
| static const char *class_id; | |||
| const char *class_name() {return class_id;}; | |||
| void color(Fl_Color c); | |||
| void color(uchar r, uchar g, uchar b); | |||
| void draw(const char* str, int n, int x, int y); | |||
| void draw(int angle, const char *str, int n, int x, int y); | |||
| void rtl_draw(const char* str, int n, int x, int y); | |||
| void font(Fl_Font face, Fl_Fontsize size); | |||
| void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy); | |||
| void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy); | |||
| void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy); | |||
| void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0); | |||
| void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3); | |||
| void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0); | |||
| void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1); | |||
| double width(const char *str, int n); | |||
| double width(unsigned int c); | |||
| void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h); | |||
| int height(); | |||
| int descent(); | |||
| }; | |||
| #endif | |||
| /** | |||
| \brief A surface that's susceptible to receive graphical output. | |||
| */ | |||
| class FL_EXPORT Fl_Surface_Device : public Fl_Device { | |||
| /** \brief The graphics driver in use by this surface. */ | |||
| Fl_Graphics_Driver *_driver; | |||
| static Fl_Surface_Device *_surface; // the surface that currently receives graphics output | |||
| protected: | |||
| /** \brief Constructor that sets the graphics driver to use for the created surface. */ | |||
| Fl_Surface_Device(Fl_Graphics_Driver *graphics_driver) {_driver = graphics_driver; }; | |||
| public: | |||
| static const char *class_id; | |||
| const char *class_name() {return class_id;}; | |||
| virtual void set_current(void); | |||
| /** \brief Sets the graphics driver of this drawing surface. */ | |||
| inline void driver(Fl_Graphics_Driver *graphics_driver) {_driver = graphics_driver;}; | |||
| /** \brief Returns the graphics driver of this drawing surface. */ | |||
| inline Fl_Graphics_Driver *driver() {return _driver; }; | |||
| /** \brief the surface that currently receives graphics output */ | |||
| static inline Fl_Surface_Device *surface() {return _surface; }; | |||
| /** \brief The destructor. */ | |||
| virtual ~Fl_Surface_Device() {} | |||
| }; | |||
| /** | |||
| \brief A display to which the computer can draw. | |||
| */ | |||
| class FL_EXPORT Fl_Display_Device : public Fl_Surface_Device { | |||
| static Fl_Display_Device *_display; // the platform display device | |||
| public: | |||
| static const char *class_id; | |||
| const char *class_name() {return class_id;}; | |||
| /** \brief A constructor that sets the graphics driver used by the display */ | |||
| Fl_Display_Device(Fl_Graphics_Driver *graphics_driver); | |||
| /** Returns the platform display device. */ | |||
| static inline Fl_Display_Device *display_device() {return _display;}; | |||
| }; | |||
| /** | |||
| This plugin socket allows the integration of new device drivers for special | |||
| window or screen types. It is currently used to provide an automated printing | |||
| service for OpenGL windows, if linked with fltk_gl. | |||
| */ | |||
| class FL_EXPORT Fl_Device_Plugin : public Fl_Plugin { | |||
| public: | |||
| /** \brief The constructor */ | |||
| Fl_Device_Plugin(const char *name) | |||
| : Fl_Plugin(klass(), name) { } | |||
| /** \brief Returns the class name */ | |||
| virtual const char *klass() { return "fltk:device"; } | |||
| /** \brief Returns the plugin name */ | |||
| virtual const char *name() = 0; | |||
| /** \brief Prints a widget | |||
| \param w the widget | |||
| \param x,y offsets where to print relatively to coordinates origin | |||
| \param height height of the current drawing area | |||
| */ | |||
| virtual int print(Fl_Widget* w, int x, int y, int height) = 0; | |||
| }; | |||
| #endif // Fl_Device_H | |||
| // | |||
| // End of "$Id: Fl_Device.H 8529 2011-03-23 12:49:30Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,97 @@ | |||
| // | |||
| // "$Id: Fl_Dial.H 7981 2010-12-08 23:53:04Z greg.ercolano $" | |||
| // | |||
| // Dial header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Dial widget . */ | |||
| #ifndef Fl_Dial_H | |||
| #define Fl_Dial_H | |||
| #ifndef Fl_Valuator_H | |||
| #include "Fl_Valuator.H" | |||
| #endif | |||
| // values for type(): | |||
| #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.png | |||
| \image latex dial.png "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; | |||
| protected: | |||
| // these allow subclasses to put the dial in a smaller area: | |||
| 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;} | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Dial.H 7981 2010-12-08 23:53:04Z greg.ercolano $". | |||
| // | |||
| @@ -0,0 +1,81 @@ | |||
| // | |||
| // "$Id: Fl_Double_Window.H 7903 2010-11-28 21:06:39Z matt $" | |||
| // | |||
| // Double-buffered window header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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); | |||
| /** | |||
| 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);} | |||
| void flush(); | |||
| 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); } | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Double_Window.H 7903 2010-11-28 21:06:39Z matt $". | |||
| // | |||
| @@ -0,0 +1,49 @@ | |||
| /* | |||
| * "$Id: Fl_Export.H 7903 2010-11-28 21:06:39Z matt $" | |||
| * | |||
| * WIN32 DLL export . | |||
| * | |||
| * Copyright 1998-2010 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 | |||
| * License as published by the Free Software Foundation; either | |||
| * version 2 of the License, or (at your option) any later version. | |||
| * | |||
| * This library is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| * Library General Public License for more details. | |||
| * | |||
| * You should have received a copy of the GNU Library General Public | |||
| * License along with this library; if not, write to the Free Software | |||
| * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| * USA. | |||
| * | |||
| * Please report all bugs and problems on the following page: | |||
| * | |||
| * http://www.fltk.org/str.php | |||
| */ | |||
| #ifndef Fl_Export_H | |||
| # define Fl_Export_H | |||
| /* | |||
| * The following is only used when building DLLs under WIN32... | |||
| */ | |||
| # if defined(FL_DLL) | |||
| # ifdef FL_LIBRARY | |||
| # define FL_EXPORT __declspec(dllexport) | |||
| # else | |||
| # define FL_EXPORT __declspec(dllimport) | |||
| # endif /* FL_LIBRARY */ | |||
| # else | |||
| # define FL_EXPORT | |||
| # endif /* FL_DLL */ | |||
| #endif /* !Fl_Export_H */ | |||
| /* | |||
| * End of "$Id: Fl_Export.H 7903 2010-11-28 21:06:39Z matt $". | |||
| */ | |||
| @@ -0,0 +1,120 @@ | |||
| // | |||
| // "$Id: Fl_File_Browser.H 8306 2011-01-24 17:04:22Z matt $" | |||
| // | |||
| // FileBrowser definitions. | |||
| // | |||
| // Copyright 1999-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_File_Browser widget . */ | |||
| // | |||
| // Include necessary header files... | |||
| // | |||
| #ifndef _Fl_File_Browser_H_ | |||
| # define _Fl_File_Browser_H_ | |||
| # include "Fl_Browser.H" | |||
| # include "Fl_File_Icon.H" | |||
| # include "filename.H" | |||
| // | |||
| // 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_; | |||
| const char *directory_; | |||
| uchar iconsize_; | |||
| const char *pattern_; | |||
| int full_height() const; | |||
| int item_height(void *) const; | |||
| int item_width(void *) const; | |||
| void item_draw(void *, int, int, int, int) const; | |||
| int incr_height() const { return (item_height(0)); } | |||
| 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); | |||
| 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 8306 2011-01-24 17:04:22Z matt $". | |||
| // | |||
| @@ -0,0 +1,247 @@ | |||
| // | |||
| // "$Id: Fl_File_Chooser.H 8786 2011-06-07 11:41:36Z manolo $" | |||
| // | |||
| // Fl_File_Chooser dialog for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2011 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| // generated by Fast Light User Interface Designer (fluid) version 1.0300 | |||
| #ifndef Fl_File_Chooser_H | |||
| #define Fl_File_Chooser_H | |||
| #include <FL/Fl.H> | |||
| #include <FL/Fl_Double_Window.H> | |||
| #include <stdio.h> | |||
| #include <stdlib.h> | |||
| #include <string.h> | |||
| #include <FL/Fl_Group.H> | |||
| #include <FL/Fl_Choice.H> | |||
| #include <FL/Fl_Menu_Button.H> | |||
| #include <FL/Fl_Button.H> | |||
| #include <FL/Fl_Preferences.H> | |||
| #include <FL/Fl_Tile.H> | |||
| #include <FL/Fl_File_Browser.H> | |||
| #include <FL/Fl_Box.H> | |||
| #include <FL/Fl_Check_Button.H> | |||
| #include <FL/Fl_File_Input.H> | |||
| #include <FL/Fl_Return_Button.H> | |||
| #include <FL/fl_ask.H> | |||
| class FL_EXPORT Fl_File_Chooser { | |||
| public: | |||
| enum { SINGLE = 0, MULTI = 1, CREATE = 2, DIRECTORY = 4 }; | |||
| private: | |||
| static Fl_Preferences prefs_; | |||
| void (*callback_)(Fl_File_Chooser*, void *); | |||
| void *data_; | |||
| char directory_[FL_PATH_MAX]; | |||
| char pattern_[FL_PATH_MAX]; | |||
| char preview_text_[2048]; | |||
| int type_; | |||
| void favoritesButtonCB(); | |||
| void favoritesCB(Fl_Widget *w); | |||
| void fileListCB(); | |||
| void fileNameCB(); | |||
| void newdir(); | |||
| static void previewCB(Fl_File_Chooser *fc); | |||
| void showChoiceCB(); | |||
| void update_favorites(); | |||
| void update_preview(); | |||
| public: | |||
| Fl_File_Chooser(const char *d, const char *p, int t, const char *title); | |||
| private: | |||
| Fl_Double_Window *window; | |||
| void cb_window_i(Fl_Double_Window*, void*); | |||
| static void cb_window(Fl_Double_Window*, void*); | |||
| Fl_Choice *showChoice; | |||
| void cb_showChoice_i(Fl_Choice*, void*); | |||
| static void cb_showChoice(Fl_Choice*, void*); | |||
| Fl_Menu_Button *favoritesButton; | |||
| void cb_favoritesButton_i(Fl_Menu_Button*, void*); | |||
| static void cb_favoritesButton(Fl_Menu_Button*, void*); | |||
| public: | |||
| Fl_Button *newButton; | |||
| private: | |||
| void cb_newButton_i(Fl_Button*, void*); | |||
| static void cb_newButton(Fl_Button*, void*); | |||
| void cb__i(Fl_Tile*, void*); | |||
| static void cb_(Fl_Tile*, void*); | |||
| Fl_File_Browser *fileList; | |||
| void cb_fileList_i(Fl_File_Browser*, void*); | |||
| static void cb_fileList(Fl_File_Browser*, void*); | |||
| Fl_Box *previewBox; | |||
| public: | |||
| Fl_Check_Button *previewButton; | |||
| private: | |||
| void cb_previewButton_i(Fl_Check_Button*, void*); | |||
| static void cb_previewButton(Fl_Check_Button*, void*); | |||
| public: | |||
| Fl_Check_Button *showHiddenButton; | |||
| private: | |||
| void cb_showHiddenButton_i(Fl_Check_Button*, void*); | |||
| static void cb_showHiddenButton(Fl_Check_Button*, void*); | |||
| Fl_File_Input *fileName; | |||
| void cb_fileName_i(Fl_File_Input*, void*); | |||
| static void cb_fileName(Fl_File_Input*, void*); | |||
| Fl_Return_Button *okButton; | |||
| void cb_okButton_i(Fl_Return_Button*, void*); | |||
| static void cb_okButton(Fl_Return_Button*, void*); | |||
| Fl_Button *cancelButton; | |||
| void cb_cancelButton_i(Fl_Button*, void*); | |||
| static void cb_cancelButton(Fl_Button*, void*); | |||
| Fl_Double_Window *favWindow; | |||
| Fl_File_Browser *favList; | |||
| void cb_favList_i(Fl_File_Browser*, void*); | |||
| static void cb_favList(Fl_File_Browser*, void*); | |||
| Fl_Button *favUpButton; | |||
| void cb_favUpButton_i(Fl_Button*, void*); | |||
| static void cb_favUpButton(Fl_Button*, void*); | |||
| Fl_Button *favDeleteButton; | |||
| void cb_favDeleteButton_i(Fl_Button*, void*); | |||
| static void cb_favDeleteButton(Fl_Button*, void*); | |||
| Fl_Button *favDownButton; | |||
| void cb_favDownButton_i(Fl_Button*, void*); | |||
| static void cb_favDownButton(Fl_Button*, void*); | |||
| Fl_Button *favCancelButton; | |||
| void cb_favCancelButton_i(Fl_Button*, void*); | |||
| static void cb_favCancelButton(Fl_Button*, void*); | |||
| Fl_Return_Button *favOkButton; | |||
| void cb_favOkButton_i(Fl_Return_Button*, void*); | |||
| static void cb_favOkButton(Fl_Return_Button*, void*); | |||
| public: | |||
| ~Fl_File_Chooser(); | |||
| void callback(void (*cb)(Fl_File_Chooser *, void *), void *d = 0); | |||
| void color(Fl_Color c); | |||
| Fl_Color color(); | |||
| int count(); | |||
| void directory(const char *d); | |||
| char * directory(); | |||
| void filter(const char *p); | |||
| const char * filter(); | |||
| int filter_value(); | |||
| void filter_value(int f); | |||
| void hide(); | |||
| void iconsize(uchar s); | |||
| uchar iconsize(); | |||
| void label(const char *l); | |||
| const char * label(); | |||
| void ok_label(const char *l); | |||
| const char * ok_label(); | |||
| void preview(int e); | |||
| int preview() const { return previewButton->value(); }; | |||
| private: | |||
| void showHidden(int e); | |||
| void remove_hidden_files(); | |||
| public: | |||
| void rescan(); | |||
| void rescan_keep_filename(); | |||
| void show(); | |||
| int shown(); | |||
| void textcolor(Fl_Color c); | |||
| Fl_Color textcolor(); | |||
| 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; | |||
| void user_data(void *d); | |||
| 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; | |||
| /** | |||
| [standard text may be customized at run-time] | |||
| */ | |||
| static const char *hidden_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); | |||
| FL_EXPORT void fl_file_chooser_callback(void (*cb)(const char*)); | |||
| FL_EXPORT void fl_file_chooser_ok_label(const char*l); | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_File_Chooser.H 8786 2011-06-07 11:41:36Z manolo $". | |||
| // | |||
| @@ -0,0 +1,168 @@ | |||
| // | |||
| // "$Id: Fl_File_Icon.H 8306 2011-01-24 17:04:22Z matt $" | |||
| // | |||
| // Fl_File_Icon definitions. | |||
| // | |||
| // Copyright 1999-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_File_Icon widget . */ | |||
| // | |||
| // Include necessary header files... | |||
| // | |||
| #ifndef _Fl_Fl_File_Icon_H_ | |||
| # define _Fl_Fl_File_Icon_H_ | |||
| # include "Fl.H" | |||
| // | |||
| // Special color value for the icon color. | |||
| // | |||
| # 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 | |||
| Fl_File_Icon *next_; // Pointer to next icon/filetype | |||
| const char *pattern_; // Pattern string | |||
| int type_; // Match only if directory or file? | |||
| int num_data_; // Number of data elements | |||
| int alloc_data_; // Number of allocated elements | |||
| short *data_; // Icon data | |||
| public: | |||
| enum // File types | |||
| { | |||
| ANY, // Any kind of file | |||
| PLAIN, // Only plain files | |||
| FIFO, // Only named pipes | |||
| DEVICE, // Only character and block devices | |||
| LINK, // Only symbolic links | |||
| DIRECTORY // Only directories | |||
| }; | |||
| enum // Data opcodes | |||
| { | |||
| END, // End of primitive/icon | |||
| COLOR, // Followed by color value (2 shorts) | |||
| LINE, // Start of line | |||
| CLOSEDLINE, // Start of closed line | |||
| POLYGON, // Start of polygon | |||
| OUTLINEPOLYGON, // Followed by outline color (2 shorts) | |||
| VERTEX // Followed by scaled X,Y | |||
| }; | |||
| Fl_File_Icon(const char *p, int t, int nd = 0, short *d = 0); | |||
| ~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); | |||
| }; | |||
| #endif // !_Fl_Fl_File_Icon_H_ | |||
| // | |||
| // End of "$Id: Fl_File_Icon.H 8306 2011-01-24 17:04:22Z matt $". | |||
| // | |||
| @@ -0,0 +1,106 @@ | |||
| // | |||
| // "$Id: Fl_File_Input.H 8712 2011-05-22 09:45:40Z AlbrechtS $" | |||
| // | |||
| // File_Input header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 by Bill Spitzak and others. | |||
| // Original version Copyright 1998 by Curtis Edwards. | |||
| // | |||
| // This library is free software; you can redistribute it and/or | |||
| // modify it under the terms of the GNU Library General Public | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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 as the current one. | |||
| <P align=CENTER> \image html Fl_File_Input.png </P> | |||
| \image latex Fl_File_Input.png "Fl_File_Input" width=6cm | |||
| \note As all Fl_Input derived objects, Fl_File_Input may call its callback | |||
| when losing 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_; | |||
| char ok_entry_; | |||
| uchar down_box_; | |||
| short buttons_[200]; | |||
| short pressed_; | |||
| void draw_buttons(); | |||
| int handle_button(int event); | |||
| void update_buttons(); | |||
| public: | |||
| Fl_File_Input(int X, int Y, int W, int H, const char *L=0); | |||
| 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 *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(); } | |||
| }; | |||
| #endif // !Fl_File_Input_H | |||
| // | |||
| // End of "$Id: Fl_File_Input.H 8712 2011-05-22 09:45:40Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,48 @@ | |||
| // | |||
| // "$Id: Fl_Fill_Dial.H 8022 2010-12-12 23:21:03Z AlbrechtS $" | |||
| // | |||
| // Filled dial header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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_EXPORT 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);} | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Fill_Dial.H 8022 2010-12-12 23:21:03Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,47 @@ | |||
| // | |||
| // "$Id: Fl_Fill_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $" | |||
| // | |||
| // Filled slider header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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_EXPORT 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);} | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Fill_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,62 @@ | |||
| // | |||
| // "$Id: Fl_Float_Input.H 8726 2011-05-23 18:32:47Z AlbrechtS $" | |||
| // | |||
| // Floating point input header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2011 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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_EXPORT Fl_Float_Input : public Fl_Input { | |||
| public: | |||
| /** | |||
| Creates a new Fl_Float_Input widget using the given position, | |||
| size, and label string. The default boxtype is FL_DOWN_BOX. | |||
| Inherited destructor destroys the widget and any value associated with it. | |||
| */ | |||
| #if defined(FL_DLL) // implementation in src/Fl_Input.cxx | |||
| Fl_Float_Input(int X,int Y,int W,int H,const char *l = 0); | |||
| #else | |||
| 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 | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Float_Input.H 8726 2011-05-23 18:32:47Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,56 @@ | |||
| // | |||
| // "$Id: Fl_FormsBitmap.H 7903 2010-11-28 21:06:39Z matt $" | |||
| // | |||
| // Forms bitmap header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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: | |||
| void draw(); | |||
| 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 7903 2010-11-28 21:06:39Z matt $". | |||
| // | |||
| @@ -0,0 +1,63 @@ | |||
| // | |||
| // "$Id: Fl_FormsPixmap.H 7903 2010-11-28 21:06:39Z matt $" | |||
| // | |||
| // Forms pixmap header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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 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 7903 2010-11-28 21:06:39Z matt $". | |||
| // | |||
| @@ -0,0 +1,89 @@ | |||
| // | |||
| // "$Id: Fl_Free.H 7903 2010-11-28 21:06:39Z matt $" | |||
| // | |||
| // Forms free header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Free widget . */ | |||
| #ifndef Fl_Free_H | |||
| #define Fl_Free_H | |||
| #ifndef Fl_Widget_H | |||
| #include "Fl_Widget.H" | |||
| #endif | |||
| #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 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 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 7903 2010-11-28 21:06:39Z matt $". | |||
| // | |||
| @@ -0,0 +1,51 @@ | |||
| // | |||
| // "$Id: Fl_GIF_Image.H 7903 2010-11-28 21:06:39Z matt $" | |||
| // | |||
| // GIF image header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_GIF_Image widget . */ | |||
| #ifndef Fl_GIF_Image_H | |||
| #define Fl_GIF_Image_H | |||
| # include "Fl_Pixmap.H" | |||
| /** | |||
| The Fl_GIF_Image class supports loading, caching, | |||
| and drawing of Compuserve GIF<SUP>SM</SUP> images. The class | |||
| loads the first image and supports transparency. | |||
| */ | |||
| class FL_EXPORT Fl_GIF_Image : public Fl_Pixmap { | |||
| public: | |||
| Fl_GIF_Image(const char* filename); | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_GIF_Image.H 7903 2010-11-28 21:06:39Z matt $". | |||
| // | |||
| @@ -0,0 +1,240 @@ | |||
| // | |||
| // "$Id: Fl_Gl_Window.H 8157 2011-01-01 14:01:53Z AlbrechtS $" | |||
| // | |||
| // OpenGL header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Gl_Window widget . */ | |||
| #ifndef Fl_Gl_Window_H | |||
| #define Fl_Gl_Window_H | |||
| #include "Fl_Window.H" | |||
| #ifndef GLContext | |||
| /** | |||
| Opaque pointer type to hide system specific implementation. | |||
| */ | |||
| typedef void* GLContext; // actually a GLXContext or HGLDC | |||
| #endif | |||
| class Fl_Gl_Choice; // structure to hold result of glXChooseVisual | |||
| /** | |||
| The Fl_Gl_Window widget sets things up so OpenGL works. | |||
| It also keeps an OpenGL "context" for that window, so that changes to the | |||
| lighting and projection may be reused between redraws. Fl_Gl_Window | |||
| also flushes the OpenGL streams and swaps buffers after draw() returns. | |||
| OpenGL hardware typically provides some overlay bit planes, which | |||
| are very useful for drawing UI controls atop your 3D graphics. If the | |||
| overlay hardware is not provided, FLTK tries to simulate the overlay. | |||
| This works pretty well if your graphics are double buffered, but not | |||
| very well for single-buffered. | |||
| Please note that the FLTK drawing and clipping functions | |||
| will not work inside an Fl_Gl_Window. All drawing | |||
| should be done using OpenGL calls exclusively. | |||
| Even though Fl_Gl_Window is derived from Fl_Group, | |||
| it is not useful to add other FLTK Widgets as children, | |||
| unless those widgets are modified to draw using OpenGL calls. | |||
| */ | |||
| class FL_EXPORT Fl_Gl_Window : public Fl_Window { | |||
| int mode_; | |||
| const int *alist; | |||
| Fl_Gl_Choice *g; | |||
| GLContext context_; | |||
| char valid_f_; | |||
| char damage1_; // damage() of back buffer | |||
| virtual void draw_overlay(); | |||
| void init(); | |||
| void *overlay; | |||
| void make_overlay(); | |||
| friend class _Fl_Gl_Overlay; | |||
| static int can_do(int, const int *); | |||
| int mode(int, const int *); | |||
| public: | |||
| void show(); | |||
| void show(int a, char **b) {Fl_Window::show(a,b);} | |||
| void flush(); | |||
| void hide(); | |||
| void resize(int,int,int,int); | |||
| int handle(int); | |||
| /** | |||
| Is turned off when FLTK creates a new context for this window or | |||
| when the window resizes, and is turned on \e after draw() is called. | |||
| You can use this inside your draw() method to avoid unnecessarily | |||
| initializing the OpenGL context. Just do this: | |||
| \code | |||
| void mywindow::draw() { | |||
| if (!valid()) { | |||
| glViewport(0,0,w(),h()); | |||
| glFrustum(...); | |||
| ...other initialization... | |||
| } | |||
| if (!context_valid()) { | |||
| ...load textures, etc. ... | |||
| } | |||
| ... draw your geometry here ... | |||
| } | |||
| \endcode | |||
| You can turn valid() on by calling valid(1). You | |||
| should only do this after fixing the transformation inside a draw() | |||
| or after make_current(). This is done automatically after | |||
| draw() returns. | |||
| */ | |||
| char valid() const {return valid_f_ & 1;} | |||
| /** | |||
| See char Fl_Gl_Window::valid() const | |||
| */ | |||
| void valid(char v) {if (v) valid_f_ |= 1; else valid_f_ &= 0xfe;} | |||
| void invalidate(); | |||
| /** | |||
| Will only be set if the | |||
| OpenGL context is created or recreated. It differs from | |||
| Fl_Gl_Window::valid() which is also set whenever the context | |||
| changes size. | |||
| */ | |||
| char context_valid() const {return valid_f_ & 2;} | |||
| /** | |||
| See char Fl_Gl_Window::context_valid() const | |||
| */ | |||
| void context_valid(char v) {if (v) valid_f_ |= 2; else valid_f_ &= 0xfd;} | |||
| /** Returns non-zero if the hardware supports the given or current OpenGL mode. */ | |||
| static int can_do(int m) {return can_do(m,0);} | |||
| /** Returns non-zero if the hardware supports the given or current OpenGL mode. */ | |||
| static int can_do(const int *m) {return can_do(0, m);} | |||
| /** Returns non-zero if the hardware supports the given or current OpenGL mode. */ | |||
| int can_do() {return can_do(mode_,alist);} | |||
| /** | |||
| Set or change the OpenGL capabilites of the window. The value can be | |||
| any of the following OR'd together: | |||
| - \c FL_RGB - RGB color (not indexed) | |||
| - \c FL_RGB8 - RGB color with at least 8 bits of each color | |||
| - \c FL_INDEX - Indexed mode | |||
| - \c FL_SINGLE - not double buffered | |||
| - \c FL_DOUBLE - double buffered | |||
| - \c FL_ACCUM - accumulation buffer | |||
| - \c FL_ALPHA - alpha channel in color | |||
| - \c FL_DEPTH - depth buffer | |||
| - \c FL_STENCIL - stencil buffer | |||
| - \c FL_MULTISAMPLE - multisample antialiasing | |||
| FL_RGB and FL_SINGLE have a value of zero, so they | |||
| are "on" unless you give FL_INDEX or FL_DOUBLE. | |||
| If the desired combination cannot be done, FLTK will try turning off | |||
| FL_MULTISAMPLE. If this also fails the show() will call | |||
| Fl::error() and not show the window. | |||
| You can change the mode while the window is displayed. This is most | |||
| useful for turning double-buffering on and off. Under X this will | |||
| cause the old X window to be destroyed and a new one to be created. If | |||
| this is a top-level window this will unfortunately also cause the | |||
| window to blink, raise to the top, and be de-iconized, and the xid() | |||
| will change, possibly breaking other code. It is best to make the GL | |||
| window a child of another window if you wish to do this! | |||
| mode() must not be called within draw() since it | |||
| changes the current context. | |||
| */ | |||
| Fl_Mode mode() const {return (Fl_Mode)mode_;} | |||
| /** See Fl_Mode mode() const */ | |||
| int mode(int a) {return mode(a,0);} | |||
| /** See Fl_Mode mode() const */ | |||
| int mode(const int *a) {return mode(0, a);} | |||
| /** void See void context(void* v, int destroy_flag) */ | |||
| void* context() const {return context_;} | |||
| void context(void*, int destroy_flag = 0); | |||
| void make_current(); | |||
| void swap_buffers(); | |||
| void ortho(); | |||
| /** | |||
| Returns true if the hardware overlay is possible. If this is false, | |||
| FLTK will try to simulate the overlay, with significant loss of update | |||
| speed. Calling this will cause FLTK to open the display. | |||
| */ | |||
| int can_do_overlay(); | |||
| /** | |||
| This method causes draw_overlay() to be called at a later time. | |||
| Initially the overlay is clear. If you want the window to display | |||
| something in the overlay when it first appears, you must call this | |||
| immediately after you show() your window. | |||
| */ | |||
| void redraw_overlay(); | |||
| void hide_overlay(); | |||
| /** | |||
| The make_overlay_current() method selects the OpenGL context | |||
| for the widget's overlay. It is called automatically prior to the | |||
| draw_overlay() method being called and can also be used to | |||
| implement feedback and/or selection within the handle() | |||
| method. | |||
| */ | |||
| void make_overlay_current(); | |||
| // Note: Doxygen docs in Fl_Widget.H to avoid redundancy. | |||
| virtual Fl_Gl_Window* as_gl_window() {return this;} | |||
| ~Fl_Gl_Window(); | |||
| /** | |||
| Creates a new Fl_Gl_Window widget using the given size, and label string. | |||
| The default boxtype is FL_NO_BOX. The default mode is FL_RGB|FL_DOUBLE|FL_DEPTH. | |||
| */ | |||
| Fl_Gl_Window(int W, int H, const char *l=0) : Fl_Window(W,H,l) {init();} | |||
| /** | |||
| Creates a new Fl_Gl_Window widget using the given position, | |||
| size, and label string. The default boxtype is FL_NO_BOX. The | |||
| default mode is FL_RGB|FL_DOUBLE|FL_DEPTH. | |||
| */ | |||
| Fl_Gl_Window(int X, int Y, int W, int H, const char *l=0) | |||
| : Fl_Window(X,Y,W,H,l) {init();} | |||
| protected: | |||
| /** | |||
| Draws the Fl_Gl_Window. | |||
| You \e \b must override the draw() method. | |||
| */ | |||
| virtual void draw(); | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Gl_Window.H 8157 2011-01-01 14:01:53Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,230 @@ | |||
| // | |||
| // "$Id: Fl_Group.H 8157 2011-01-01 14:01:53Z AlbrechtS $" | |||
| // | |||
| // Group header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Group, Fl_End classes . */ | |||
| #ifndef Fl_Group_H | |||
| #define Fl_Group_H | |||
| #ifndef Fl_Widget_H | |||
| #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_; | |||
| int *sizes_; // remembered initial sizes of children | |||
| int navigation(int); | |||
| static Fl_Group *current_; | |||
| // unimplemented copy ctor and assignment operator | |||
| Fl_Group(const Fl_Group&); | |||
| Fl_Group& operator=(const Fl_Group&); | |||
| protected: | |||
| void draw(); | |||
| void draw_child(Fl_Widget& widget) const; | |||
| void draw_children(); | |||
| void draw_outside_label(const Fl_Widget& widget) const ; | |||
| void update_child(Fl_Widget& widget) const; | |||
| int *sizes(); | |||
| public: | |||
| int handle(int); | |||
| void begin(); | |||
| void end(); | |||
| 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(int index); | |||
| 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.png | |||
| \image html resizebox2.png | |||
| \image latex resizebox1.png "before resize" width=4cm | |||
| \image latex resizebox2.png "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(); | |||
| /** | |||
| 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) | |||
| */ | |||
| unsigned int clip_children() { return (flags() & CLIP_CHILDREN) != 0; } | |||
| // Note: Doxygen docs in Fl_Widget.H to avoid redundancy. | |||
| virtual Fl_Group* as_group() { return this; } | |||
| // 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 8157 2011-01-01 14:01:53Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,95 @@ | |||
| // | |||
| // "$Id: Fl_Help_Dialog.H 8063 2010-12-19 21:20:10Z matt $" | |||
| // | |||
| // Fl_Help_Dialog dialog for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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 | |||
| #define Fl_Help_Dialog_H | |||
| #include <FL/Fl.H> | |||
| #include <FL/Fl_Double_Window.H> | |||
| #include <FL/Fl_Group.H> | |||
| #include <FL/Fl_Button.H> | |||
| #include <FL/Fl_Input.H> | |||
| #include <FL/Fl_Box.H> | |||
| #include <FL/Fl_Help_View.H> | |||
| class FL_EXPORT Fl_Help_Dialog { | |||
| int index_; | |||
| int max_; | |||
| int line_[100]; // FIXME: we must remove those static numbers | |||
| char file_[100][FL_PATH_MAX]; // FIXME: we must remove those static numbers | |||
| int find_pos_; | |||
| public: | |||
| Fl_Help_Dialog(); | |||
| private: | |||
| Fl_Double_Window *window_; | |||
| Fl_Button *back_; | |||
| void cb_back__i(Fl_Button*, void*); | |||
| static void cb_back_(Fl_Button*, void*); | |||
| Fl_Button *forward_; | |||
| void cb_forward__i(Fl_Button*, void*); | |||
| static void cb_forward_(Fl_Button*, void*); | |||
| Fl_Button *smaller_; | |||
| void cb_smaller__i(Fl_Button*, void*); | |||
| static void cb_smaller_(Fl_Button*, void*); | |||
| Fl_Button *larger_; | |||
| void cb_larger__i(Fl_Button*, void*); | |||
| static void cb_larger_(Fl_Button*, void*); | |||
| Fl_Input *find_; | |||
| void cb_find__i(Fl_Input*, void*); | |||
| static void cb_find_(Fl_Input*, void*); | |||
| Fl_Help_View *view_; | |||
| void cb_view__i(Fl_Help_View*, void*); | |||
| static void cb_view_(Fl_Help_View*, void*); | |||
| public: | |||
| ~Fl_Help_Dialog(); | |||
| int h(); | |||
| void hide(); | |||
| void load(const char *f); | |||
| void position(int xx, int yy); | |||
| void resize(int xx, int yy, int ww, int hh); | |||
| void show(); | |||
| void show(int argc, char **argv); | |||
| void textsize(Fl_Fontsize s); | |||
| Fl_Fontsize textsize(); | |||
| void topline(const char *n); | |||
| void topline(int n); | |||
| void value(const char *f); | |||
| const char * value() const; | |||
| int visible(); | |||
| int w(); | |||
| int x(); | |||
| int y(); | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Help_Dialog.H 8063 2010-12-19 21:20:10Z matt $". | |||
| // | |||
| @@ -0,0 +1,396 @@ | |||
| // | |||
| // "$Id: Fl_Help_View.H 8306 2011-01-24 17:04:22Z matt $" | |||
| // | |||
| // Help Viewer widget definitions. | |||
| // | |||
| // Copyright 1997-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Help_View widget . */ | |||
| #ifndef Fl_Help_View_H | |||
| # define Fl_Help_View_H | |||
| // | |||
| // Include necessary header files... | |||
| // | |||
| # include <stdio.h> | |||
| # include "Fl.H" | |||
| # include "Fl_Group.H" | |||
| # include "Fl_Scrollbar.H" | |||
| # include "fl_draw.H" | |||
| # include "Fl_Shared_Image.H" | |||
| # include "filename.H" | |||
| // | |||
| // Fl_Help_Func type - link callback function for files... | |||
| // | |||
| typedef const char *(Fl_Help_Func)(Fl_Widget *, const char *); | |||
| // | |||
| // Fl_Help_Block structure... | |||
| // | |||
| struct Fl_Help_Block { | |||
| const char *start, // Start of text | |||
| *end; // End of text | |||
| uchar border; // Draw border? | |||
| Fl_Color bgcolor; // Background color | |||
| int x, // Indentation/starting X coordinate | |||
| y, // Starting Y coordinate | |||
| w, // Width | |||
| h; // Height | |||
| int line[32]; // Left starting position for each line | |||
| }; | |||
| // | |||
| // 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 | |||
| }; | |||
| /* | |||
| * Fl_Help_View font stack opaque implementation | |||
| */ | |||
| /** Fl_Help_View font stack element definition. */ | |||
| struct FL_EXPORT 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_EXPORT 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 | |||
| }; | |||
| /** | |||
| 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. | |||
| Supported HTML tags: | |||
| - A: HREF/NAME | |||
| - B | |||
| - BODY: BGCOLOR/TEXT/LINK | |||
| - BR | |||
| - CENTER | |||
| - CODE | |||
| - DD | |||
| - DL | |||
| - DT | |||
| - EM | |||
| - FONT: COLOR/SIZE/FACE=(helvetica/arial/sans/times/serif/symbol/courier) | |||
| - H1/H2/H3/H4/H5/H6 | |||
| - HEAD | |||
| - HR | |||
| - I | |||
| - IMG: SRC/WIDTH/HEIGHT/ALT | |||
| - KBD | |||
| - LI | |||
| - OL | |||
| - P | |||
| - PRE | |||
| - STRONG | |||
| - TABLE: TH/TD/TR/BORDER/BGCOLOR/COLSPAN/ALIGN=CENTER|RIGHT|LEFT | |||
| - TITLE | |||
| - TT | |||
| - U | |||
| - UL | |||
| - VAR | |||
| Supported color names: | |||
| - black,red,green,yellow,blue,magenta,fuchsia,cyan,aqua,white,gray,grey,lime,maroon,navy,olive,purple,silver,teal. | |||
| Supported urls: | |||
| - Internal: file: | |||
| - External: http: ftp: https: ipp: mailto: news: | |||
| Quoted char names: | |||
| - Aacute aacute Acirc acirc acute AElig aelig Agrave agrave amp Aring aring Atilde atilde Auml auml | |||
| - brvbar bull | |||
| - Ccedil ccedil cedil cent copy curren | |||
| - deg divide | |||
| - Eacute eacute Ecirc ecirc Egrave egrave ETH eth Euml euml euro | |||
| - frac12 frac14 frac34 | |||
| - gt | |||
| - Iacute iacute Icirc icirc iexcl Igrave igrave iquest Iuml iuml | |||
| - laquo lt | |||
| - macr micro middot | |||
| - nbsp not Ntilde ntilde | |||
| - Oacute oacute Ocirc ocirc Ograve ograve ordf ordm Oslash oslash Otilde otilde Ouml ouml | |||
| - para premil plusmn pound | |||
| - quot | |||
| - raquo reg | |||
| - sect shy sup1 sup2 sup3 szlig | |||
| - THORN thorn times trade | |||
| - Uacute uacute Ucirc ucirc Ugrave ugrave uml Uuml uuml | |||
| - Yacute yacute | |||
| - yen Yuml yuml | |||
| */ | |||
| class FL_EXPORT Fl_Help_View : public Fl_Group { // Help viewer widget | |||
| 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 | |||
| 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 | |||
| Fl_Help_Func *link_; ///< Link transform function | |||
| 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_[FL_PATH_MAX];///< Directory for current file | |||
| char filename_[FL_PATH_MAX]; ///< 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; | |||
| static int selection_push_first; | |||
| static int selection_push_last; | |||
| static int selection_drag_first; | |||
| static int selection_drag_last; | |||
| static int selected; | |||
| static int draw_mode; | |||
| static int mouse_x; | |||
| static int mouse_y; | |||
| static int current_pos; | |||
| static Fl_Help_View *current_view; | |||
| 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); | |||
| static int compare_targets(const Fl_Help_Target *t0, const Fl_Help_Target *t1); | |||
| int do_align(Fl_Help_Block *block, int line, int xx, int a, int &l); | |||
| void draw(); | |||
| void format(); | |||
| void format_table(int *table_width, int *columns, const char *table); | |||
| void free_data(); | |||
| int get_align(const char *p, int a); | |||
| const char *get_attr(const char *p, const char *n, char *buf, int bufsize); | |||
| Fl_Color get_color(const char *n, Fl_Color c); | |||
| Fl_Shared_Image *get_image(const char *name, int W, int H); | |||
| int get_length(const char *l); | |||
| int handle(int); | |||
| void hv_draw(const char *t, int x, int y); | |||
| char begin_selection(); | |||
| char extend_selection(); | |||
| void end_selection(int c=0); | |||
| void clear_global_selection(); | |||
| Fl_Help_Link *find_link(int, int); | |||
| void follow_link(Fl_Help_Link*); | |||
| 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_); } | |||
| /** 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 *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 8306 2011-01-24 17:04:22Z matt $". | |||
| // | |||
| @@ -0,0 +1,65 @@ | |||
| // | |||
| // "$Id: Fl_Hold_Browser.H 8736 2011-05-24 20:00:56Z AlbrechtS $" | |||
| // | |||
| // Hold browser header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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_EXPORT Fl_Hold_Browser : public Fl_Browser { | |||
| public: | |||
| /** | |||
| 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. | |||
| */ | |||
| #if defined(FL_DLL) // implementation in src/Fl_Browser.cxx | |||
| Fl_Hold_Browser(int X,int Y,int W,int H,const char *L=0); | |||
| #else | |||
| 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 | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Hold_Browser.H 8736 2011-05-24 20:00:56Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,46 @@ | |||
| // | |||
| // "$Id: Fl_Hor_Fill_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $" | |||
| // | |||
| // Horizontal fill slider header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Hor_Fill_Slider widget . */ | |||
| #ifndef Fl_Hor_Fill_Slider_H | |||
| #define Fl_Hor_Fill_Slider_H | |||
| #include "Fl_Slider.H" | |||
| class FL_EXPORT Fl_Hor_Fill_Slider : public Fl_Slider { | |||
| public: | |||
| Fl_Hor_Fill_Slider(int x,int y,int w,int h,const char *l=0) | |||
| : Fl_Slider(x,y,w,h,l) {type(FL_HOR_FILL_SLIDER);} | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Hor_Fill_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,46 @@ | |||
| // | |||
| // "$Id: Fl_Hor_Nice_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $" | |||
| // | |||
| // Horizontal "nice" slider header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Hor_Nice_Slider widget . */ | |||
| #ifndef Fl_Hor_Nice_Slider_H | |||
| #define Fl_Hor_Nice_Slider_H | |||
| #include "Fl_Slider.H" | |||
| class FL_EXPORT Fl_Hor_Nice_Slider : public Fl_Slider { | |||
| public: | |||
| Fl_Hor_Nice_Slider(int x,int y,int w,int h,const char *l=0) | |||
| : Fl_Slider(x,y,w,h,l) {type(FL_HOR_NICE_SLIDER); box(FL_FLAT_BOX);} | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Hor_Nice_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,60 @@ | |||
| // | |||
| // "$Id: Fl_Hor_Slider.H 8726 2011-05-23 18:32:47Z AlbrechtS $" | |||
| // | |||
| // Horizontal slider header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2011 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Hor_Slider widget . */ | |||
| #ifndef Fl_Hor_Slider_H | |||
| #define Fl_Hor_Slider_H | |||
| #include "Fl_Slider.H" | |||
| /** Horizontal Slider class. | |||
| \see class Fl_Slider. | |||
| */ | |||
| class FL_EXPORT Fl_Hor_Slider : public Fl_Slider { | |||
| public: | |||
| /** | |||
| Creates a new Fl_Hor_Slider widget using the given position, | |||
| size, and label string. | |||
| */ | |||
| #if defined(FL_DLL) // implementation in src/Fl_Slider.cxx | |||
| Fl_Hor_Slider(int X,int Y,int W,int H,const char *l=0); | |||
| #else | |||
| Fl_Hor_Slider(int X,int Y,int W,int H,const char *l=0) | |||
| : Fl_Slider(X,Y,W,H,l) { type(FL_HOR_SLIDER); } | |||
| #endif | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Hor_Slider.H 8726 2011-05-23 18:32:47Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,46 @@ | |||
| // | |||
| // "$Id: Fl_Hor_Value_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $" | |||
| // | |||
| // Horizontal value slider header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Hor_Value_Slider widget . */ | |||
| #ifndef Fl_Hor_Value_Slider_H | |||
| #define Fl_Hor_Value_Slider_H | |||
| #include "Fl_Value_Slider.H" | |||
| class FL_EXPORT Fl_Hor_Value_Slider : public Fl_Value_Slider { | |||
| public: | |||
| Fl_Hor_Value_Slider(int X,int Y,int W,int H,const char *l=0) | |||
| : Fl_Value_Slider(X,Y,W,H,l) {type(FL_HOR_SLIDER);} | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Hor_Value_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,215 @@ | |||
| // | |||
| // "$Id: Fl_Image.H 8338 2011-01-30 09:24:40Z manolo $" | |||
| // | |||
| // Image header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2011 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Image, Fl_RGB_Image classes . */ | |||
| #ifndef Fl_Image_H | |||
| # define Fl_Image_H | |||
| # include "Enumerations.H" | |||
| 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_; | |||
| // Forbid use of copy contructor and assign operator | |||
| Fl_Image & operator=(const Fl_Image &); | |||
| Fl_Image(const Fl_Image &); | |||
| protected: | |||
| /** | |||
| Sets the current image width in pixels. | |||
| */ | |||
| void w(int W) {w_ = W;} | |||
| /** | |||
| Sets the current image height in pixels. | |||
| */ | |||
| void h(int H) {h_ = H;} | |||
| /** | |||
| Sets the current image depth. | |||
| */ | |||
| void d(int D) {d_ = D;} | |||
| /** | |||
| Sets the current line data size in bytes. | |||
| */ | |||
| void ld(int LD) {ld_ = LD;} | |||
| /** | |||
| Sets the current array pointer and count of pointers in the array. | |||
| */ | |||
| void data(const char * const *p, int c) {data_ = p; count_ = c;} | |||
| void draw_empty(int X, int Y); | |||
| static void labeltype(const Fl_Label *lo, int lx, int ly, int lw, int lh, Fl_Align la); | |||
| static void measure(const Fl_Label *lo, int &lw, int &lh); | |||
| public: | |||
| /** | |||
| Returns the current image width in pixels. | |||
| */ | |||
| int w() const {return w_;} | |||
| /** Returns the current image height in pixels. | |||
| */ | |||
| int h() const {return h_;} | |||
| /** | |||
| Returns the current image depth. | |||
| The return value will be 0 for bitmaps, 1 for | |||
| pixmaps, and 1 to 4 for color images.</P> | |||
| */ | |||
| int d() const {return d_;} | |||
| /** | |||
| 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. | |||
| */ | |||
| 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_;} | |||
| /** | |||
| Returns a pointer to the current image data array. | |||
| Use the count() method to find the size of the data 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); | |||
| /** | |||
| Draws the image with a bounding box. | |||
| 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 | |||
| /** | |||
| Draws 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 | |||
| <FL/Fl_Image.H>, however for compatibility reasons | |||
| <FL/Fl_RGB_Image.H> should be included. | |||
| */ | |||
| class FL_EXPORT Fl_RGB_Image : public Fl_Image { | |||
| friend class Fl_Quartz_Graphics_Driver; | |||
| friend class Fl_GDI_Graphics_Driver; | |||
| friend class Fl_Xlib_Graphics_Driver; | |||
| public: | |||
| const uchar *array; | |||
| int alloc_array; // Non-zero if array was allocated | |||
| private: | |||
| #if defined(__APPLE__) || defined(WIN32) | |||
| void *id_; // for internal use | |||
| void *mask_; // for internal use (mask bitmap) | |||
| #else | |||
| unsigned id_; // for internal use | |||
| unsigned mask_; // for internal use (mask bitmap) | |||
| #endif // __APPLE__ || WIN32 | |||
| public: | |||
| /** 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(); | |||
| virtual Fl_Image *copy(int W, int H); | |||
| Fl_Image *copy() { return copy(w(), h()); } | |||
| virtual void color_average(Fl_Color c, float i); | |||
| virtual void desaturate(); | |||
| 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);} | |||
| virtual void label(Fl_Widget*w); | |||
| virtual void label(Fl_Menu_Item*m); | |||
| virtual void uncache(); | |||
| }; | |||
| #endif // !Fl_Image_H | |||
| // | |||
| // End of "$Id: Fl_Image.H 8338 2011-01-30 09:24:40Z manolo $". | |||
| // | |||
| @@ -0,0 +1,277 @@ | |||
| // | |||
| // "$Id: Fl_Input.H 8111 2010-12-23 08:13:18Z manolo $" | |||
| // | |||
| // Input header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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, and will correctly display any UTF text, using | |||
| ^X notation for unprintable control characters. It assumes the | |||
| font can draw any characters of the used scripts, which is true | |||
| for standard fonts under MSWindows and Mac OS X. | |||
| Characters can be input using the keyboard or the character palette/map. | |||
| Character composition is done using dead keys and/or a compose | |||
| key as defined by the operating system. | |||
| <P> | |||
| <TABLE WIDTH=90% BORDER=1 SUMMARY="Fl_Input keyboard and mouse bindings."> | |||
| <CAPTION ALIGN=TOP>Fl_Input keyboard and mouse bindings.</CAPTION> | |||
| <TR><TD NOWRAP="NOWRAP" WIDTH="1%"> | |||
| <B>Mouse button 1</B> | |||
| </TD><TD> | |||
| Moves the cursor to this point. | |||
| Drag selects characters. | |||
| Double click selects words. | |||
| Triple click selects all line. | |||
| Shift+click extends the selection. | |||
| When you select text it is automatically copied to the selection buffer. | |||
| </TD></TR><TR><TD NOWRAP="NOWRAP"> | |||
| <B>Mouse button 2</B> | |||
| </TD><TD> | |||
| Insert the selection buffer at the point clicked. | |||
| You can also select a region and replace it with the selection buffer | |||
| by selecting the region with mouse button 2. | |||
| </TD></TR><TR><TD NOWRAP="NOWRAP"> | |||
| <B>Mouse button 3</B> | |||
| </TD><TD> | |||
| Currently acts like button 1. | |||
| </TD></TR><TR><TD NOWRAP="NOWRAP"> | |||
| <B>Backspace</B> | |||
| </TD><TD> | |||
| Deletes one character to the left, or deletes the selected region. | |||
| </TD></TR><TR><TD NOWRAP="NOWRAP"> | |||
| <B>Delete</B> | |||
| </TD><TD> | |||
| Deletes one character to the right, or deletes the selected region. | |||
| Combine with Shift for equivalent of ^X (copy+cut). | |||
| </TD></TR><TR><TD NOWRAP="NOWRAP"> | |||
| <B>Enter</b> | |||
| </TD><TD> | |||
| May cause the callback, see when(). | |||
| </TD></TR></TABLE> | |||
| <P> | |||
| <TABLE WIDTH="90%" BORDER="1" SUMMARY="Fl_Input platform specific keyboard bindings."> | |||
| <CAPTION ALIGN=TOP>Fl_Input platform specific keyboard bindings.</CAPTION> | |||
| <TR> | |||
| <TD NOWRAP="NOWRAP" WIDTH="1%"><B> Windows/Linux </B></TD> | |||
| <TD NOWRAP="NOWRAP" WIDTH="1%"><B> Mac </B></TD> | |||
| <TD NOWRAP="NOWRAP" ><B> Function </B></TD> | |||
| </TR><TR> | |||
| <TD NOWRAP="NOWRAP"><B> ^A </B></TD> | |||
| <TD NOWRAP="NOWRAP"><B> Command-A </B></TD> | |||
| <TD> | |||
| <B>Selects all text in the widget.</B> | |||
| </TD></TR><TR> | |||
| <TD NOWRAP="NOWRAP"><B> ^C </B></TD> | |||
| <TD NOWRAP="NOWRAP"><B> Command-C </B></TD> | |||
| <TD> | |||
| <B>Copy the current selection to the clipboard.</B> | |||
| </TD></TR><TR> | |||
| <TD NOWRAP="NOWRAP"><B> ^I </B></TD> | |||
| <TD NOWRAP="NOWRAP"><B> ^I </B></TD> | |||
| <TD> | |||
| <B>Insert a tab.</B> | |||
| </TD></TR><TR> | |||
| <TD NOWRAP="NOWRAP"><B> ^J </B></TD> | |||
| <TD NOWRAP="NOWRAP"><B> ^J </B></TD> | |||
| <TD> | |||
| <B>Insert a Line Feed.</B> <BR> | |||
| (Similar to literal 'Enter' character) | |||
| </TD></TR><TR> | |||
| <TD NOWRAP="NOWRAP"><B> ^L </B></TD> | |||
| <TD NOWRAP="NOWRAP"><B> ^L </B></TD> | |||
| <TD> | |||
| <B>Insert a Form Feed.</B> | |||
| </TD></TR><TR> | |||
| <TD NOWRAP="NOWRAP"><B> ^M </B></TD> | |||
| <TD NOWRAP="NOWRAP"><B> ^M </B></TD> | |||
| <TD> | |||
| <B>Insert a Carriage Return.</B> | |||
| </TD></TR><TR> | |||
| <TD NOWRAP="NOWRAP"><B> ^V,<BR>Shift-Insert </B></TD> | |||
| <TD NOWRAP="NOWRAP"><B> Command-V </B></TD> | |||
| <TD> | |||
| <B>Paste the clipboard.</B> <BR> | |||
| (Macs keyboards don't have "Insert" keys, | |||
| but if they did, Shift-Insert would work) | |||
| </TD></TR><TR> | |||
| <TD NOWRAP="NOWRAP"><B> ^X,<BR>Shift-Delete </B></TD> | |||
| <TD NOWRAP="NOWRAP"><B> Command-X,<BR>Shift-Delete </B></TD> | |||
| <TD> | |||
| <B>Cut.</B> <BR> | |||
| Copy the selection to the clipboard and delete it. | |||
| (If there's no selection, Shift-Delete acts like Delete) | |||
| </TD></TR><TR> | |||
| <TD NOWRAP="NOWRAP"><B> ^Z </B></TD> | |||
| <TD NOWRAP="NOWRAP"><B> Command-Z </B></TD> | |||
| <TD> | |||
| <B>Undo.</B> <BR> | |||
| 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 NOWRAP="NOWRAP"><B> Shift-^Z </B></TD> | |||
| <TD NOWRAP="NOWRAP"><B> Shift-Command-Z </B></TD> | |||
| <TD> | |||
| <B>Redo.</B> <BR> | |||
| Currently same behavior as ^Z. | |||
| Reserved for future multilevel undo/redo. | |||
| </TD></TR><TR> | |||
| <TD NOWRAP="NOWRAP"><B> Arrow Keys </B></TD> | |||
| <TD NOWRAP="NOWRAP"><B> Arrow Keys </B></TD> | |||
| <TD> | |||
| <B>Standard cursor movement.</B> <BR> | |||
| Can be combined with Shift to extend selection. | |||
| </TD></TR><TR> | |||
| <TD NOWRAP="NOWRAP"><B> Home </B></TD> | |||
| <TD NOWRAP="NOWRAP"><B> Command-Up,<BR>Command-Left </B></TD> | |||
| <TD> | |||
| <B>Move to start of line.</B> <BR> | |||
| Can be combined with Shift to extend selection. | |||
| </TD></TR><TR> | |||
| <TD NOWRAP="NOWRAP"><B> End </B></TD> | |||
| <TD NOWRAP="NOWRAP"><B> Command-Down,<BR>Command-Right </B></TD> | |||
| <TD> | |||
| <B>Move to end of line.</B> <BR> | |||
| Can be combined with Shift to extend selection. | |||
| </TD></TR><TR> | |||
| <TD NOWRAP="NOWRAP"><B>Ctrl-Home</B></TD> | |||
| <TD NOWRAP="NOWRAP"><B>Command-Up,<BR>Command-PgUp,<BR>Ctrl-Left</B></TD> | |||
| <TD> | |||
| <B>Move to top of document/field.</B> <BR> | |||
| In single line input, moves to start of line. | |||
| In multiline input, moves to start of top line. | |||
| Can be combined with Shift to extend selection. | |||
| </TD></TR><TR> | |||
| <TD NOWRAP="NOWRAP"><B> Ctrl-End </B></TD> | |||
| <TD NOWRAP="NOWRAP"><B> Command-End,<BR>Command-PgDn,<BR>Ctrl-Right</B></TD> | |||
| <TD> | |||
| <B>Move to bottom of document/field.</B> <BR> | |||
| In single line input, moves to end of line. | |||
| In multiline input, moves to end of last line. | |||
| Can be combined with Shift to extend selection. | |||
| </TD></TR><TR> | |||
| <TD NOWRAP="NOWRAP"><B> Ctrl-Left </B></TD> | |||
| <TD NOWRAP="NOWRAP"><B> Alt-Left </B></TD> | |||
| <TD> | |||
| <B>Word left.</B> <BR> | |||
| Can be combined with Shift to extend selection. | |||
| </TD></TR><TR> | |||
| <TD NOWRAP="NOWRAP"><B> Ctrl-Right </B></TD> | |||
| <TD NOWRAP="NOWRAP"><B> Alt-Right </B></TD> | |||
| <TD> | |||
| <B>Word right.</B> <BR> | |||
| Can be combined with Shift to extend selection. | |||
| </TD></TR><TR> | |||
| <TD NOWRAP="NOWRAP"><B> Ctrl-Backspace </B></TD> | |||
| <TD NOWRAP="NOWRAP"><B> Alt-Backspace </B></TD> | |||
| <TD> | |||
| <B>Delete word left.</B> | |||
| </TD></TR><TR> | |||
| <TD NOWRAP="NOWRAP"><B> Ctrl-Delete </B></TD> | |||
| <TD NOWRAP="NOWRAP"><B> Alt-Delete </B></TD> | |||
| <TD> | |||
| <B>Delete word right.</B> | |||
| </TD></TR></TABLE> | |||
| */ | |||
| class FL_EXPORT Fl_Input : public Fl_Input_ { | |||
| int handle_key(); | |||
| int shift_position(int p); | |||
| int shift_up_down_position(int p); | |||
| void handle_mouse(int keepmark=0); | |||
| // Private keyboard functions | |||
| int kf_lines_up(int repeat_num); | |||
| int kf_lines_down(int repeat_num); | |||
| int kf_page_up(); | |||
| int kf_page_down(); | |||
| int kf_insert_toggle(); | |||
| int kf_delete_word_right(); | |||
| int kf_delete_word_left(); | |||
| int kf_delete_sol(); | |||
| int kf_delete_eol(); | |||
| int kf_delete_char_right(); | |||
| int kf_delete_char_left(); | |||
| int kf_move_sol(); | |||
| int kf_move_eol(); | |||
| int kf_clear_eol(); | |||
| int kf_move_char_left(); | |||
| int kf_move_char_right(); | |||
| int kf_move_word_left(); | |||
| int kf_move_word_right(); | |||
| int kf_move_up_and_sol(); | |||
| int kf_move_down_and_eol(); | |||
| int kf_top(); | |||
| int kf_bottom(); | |||
| int kf_select_all(); | |||
| int kf_undo(); | |||
| int kf_redo(); | |||
| int kf_copy(); | |||
| int kf_paste(); | |||
| int kf_copy_cut(); | |||
| protected: | |||
| void draw(); | |||
| public: | |||
| int handle(int); | |||
| Fl_Input(int,int,int,int,const char * = 0); | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Input.H 8111 2010-12-23 08:13:18Z manolo $". | |||
| // | |||
| @@ -0,0 +1,497 @@ | |||
| // | |||
| // "$Id: Fl_Input_.H 8068 2010-12-20 07:48:59Z greg.ercolano $" | |||
| // | |||
| // Input base class header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Input_ widget . */ | |||
| #ifndef Fl_Input__H | |||
| #define Fl_Input__H | |||
| #ifndef Fl_Widget_H | |||
| #include "Fl_Widget.H" | |||
| #endif | |||
| #define FL_NORMAL_INPUT 0 | |||
| #define FL_FLOAT_INPUT 1 | |||
| #define FL_INT_INPUT 2 | |||
| #define FL_HIDDEN_INPUT 3 | |||
| #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) | |||
| /** | |||
| 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 UTF-8 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 should always point at a 7 bit ASCII | |||
| character or the beginning of a UTF-8 character sequence. Behavior for false | |||
| UTF-8 sequences and pointers into the middle of a sequence are undefined. | |||
| \see Fl_Text_Display, Fl_Text_Editor for more powerful text handling widgets | |||
| \internal | |||
| When porting this widget from ASCII to UTF-8, previously legal pointers into | |||
| the text of this widget can become illegal by pointing into the middle of | |||
| a UTF-8 sequence. 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. Additionally, | |||
| a careless "copy" call can put partial UTF-8 sequences into the clipboard. | |||
| None of these issues should be disastrous. Nevertheless, we should | |||
| discuss how FLTK should handle false UTF-8 sequences 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 Position of the cursor in the document. */ | |||
| int position_; | |||
| /** \internal Position of the other end of the selected text. If \p position_ equals | |||
| \p mark_, no text is selected */ | |||
| int mark_; | |||
| /** \internal Behavior of Tab key in multiline input widget. | |||
| If enabled (default) Tab causes focus nav, otherwise Tab is inserted | |||
| as a character. */ | |||
| int tab_nav_; | |||
| /** \internal Offset to text origin within widget bounds */ | |||
| int xscroll_, yscroll_; | |||
| /** \internal Minimal update pointer. Display requires 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 Shortcut key that will fetch focus for this widget. */ | |||
| int shortcut_; | |||
| /** \internal This is set if no text but only the cursor needs updating. */ | |||
| uchar erase_cursor_only; | |||
| /** \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 */ | |||
| Fl_Color textcolor_; | |||
| /** \internal color of the text cursor */ | |||
| Fl_Color cursor_color_; | |||
| /** \internal Horizontal cursor position in pixels while moving up or down. */ | |||
| static double up_down_pos; | |||
| /** \internal Flag to remember 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: | |||
| /* Find the start of a word. */ | |||
| int word_start(int i) const; | |||
| /* Find the end of a word. */ | |||
| int word_end(int i) const; | |||
| /* Find the start of a line. */ | |||
| int line_start(int i) const; | |||
| /* Find 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 mouse 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_;} | |||
| void yscroll(int y) { yscroll_ = y; damage(FL_DAMAGE_EXPOSE);} | |||
| /* 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); | |||
| /* Constructor */ | |||
| 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_;} | |||
| /* 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(); | |||
| /** Return the shortcut key associated with this widget. | |||
| \return shortcut keystroke | |||
| \see Fl_Button::shortcut() */ | |||
| int shortcut() const {return shortcut_;} | |||
| /** | |||
| Sets the shortcut key associated 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(Fl_Color) */ | |||
| Fl_Color textcolor() const {return 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(Fl_Color n) {textcolor_ = n;} | |||
| /** Gets the color of the cursor. | |||
| \return the current cursor color */ | |||
| Fl_Color cursor_color() const {return 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(Fl_Color 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)); } | |||
| /** | |||
| Sets whether the Tab key does focus navigation, | |||
| or inserts tab characters into Fl_Multiline_Input. | |||
| By default this flag is enabled to provide the 'normal' behavior | |||
| most users expect; Tab navigates focus to the next widget. | |||
| To inserting an actual Tab character, users can use Ctrl-I | |||
| or copy/paste. | |||
| Disabling this flag gives the old FLTK behavior where Tab | |||
| inserts a tab character into the text field, in which case | |||
| only the mouse can be used to navigate to the next field. | |||
| History: This flag was provided for backwards support of FLTK's old 1.1.x | |||
| behavior where Tab inserts a tab character instead of navigating | |||
| focus to the next widget. This behavior was unique to Fl_Multiline_Input. | |||
| With the advent of Fl_Text_Editor, this old behavior has been deprecated. | |||
| \param [in] val If \p val is 1, Tab advances focus (default).<BR> | |||
| If \p val is 0, Tab inserts a tab character (old FLTK behavior). | |||
| */ | |||
| void tab_nav(int val) { | |||
| tab_nav_ = val; | |||
| } | |||
| /** | |||
| Gets whether the Tab key causes focus navigation in multiline input fields or not. | |||
| If enabled (default), hitting Tab causes focus navigation to the next widget. | |||
| If disabled, hitting Tab inserts a tab character into the text field. | |||
| \returns 1 if Tab advances focus (default), 0 if Tab inserts tab characters. | |||
| \see tab_nav(int) | |||
| */ | |||
| int tab_nav() const { | |||
| return tab_nav_; | |||
| } | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Input_.H 8068 2010-12-20 07:48:59Z greg.ercolano $". | |||
| // | |||
| @@ -0,0 +1,222 @@ | |||
| // | |||
| // "$Id: Fl_Input_Choice.H 8022 2010-12-12 23:21:03Z AlbrechtS $" | |||
| // | |||
| // An input/chooser widget. | |||
| // ______________ ____ | |||
| // | || __ | | |||
| // | input area || \/ | | |||
| // |______________||____| | |||
| // | |||
| // Copyright 1998-2010 by Bill Spitzak and others. | |||
| // Copyright 2004 by Greg Ercolano. | |||
| // | |||
| // This library is free software; you can redistribute it and/or | |||
| // modify it under the terms of the GNU Library General Public | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Input_Choice widget . */ | |||
| #ifndef Fl_Input_Choice_H | |||
| #define Fl_Input_Choice_H | |||
| #include <FL/Fl.H> | |||
| #include <FL/Fl_Group.H> | |||
| #include <FL/Fl_Input.H> | |||
| #include <FL/Fl_Menu_Button.H> | |||
| #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_EXPORT Fl_Input_Choice : public Fl_Group { | |||
| // Private class to handle slightly 'special' behavior of menu button | |||
| class InputMenuButton : public Fl_Menu_Button { | |||
| void draw() { | |||
| draw_box(FL_UP_BOX, color()); | |||
| fl_color(active_r() ? labelcolor() : fl_inactive(labelcolor())); | |||
| int xc = x()+w()/2, yc=y()+h()/2; | |||
| fl_polygon(xc-5,yc-3,xc+5,yc-3,xc,yc+3); | |||
| if (Fl::focus() == this) draw_focus(); | |||
| } | |||
| public: | |||
| InputMenuButton(int x,int y,int w,int h,const char*l=0) : | |||
| Fl_Menu_Button(x,y,w,h,l) { box(FL_UP_BOX); } | |||
| }; | |||
| Fl_Input *inp_; | |||
| InputMenuButton *menu_; | |||
| static void menu_cb(Fl_Widget*, void *data) { | |||
| Fl_Input_Choice *o=(Fl_Input_Choice *)data; | |||
| Fl_Widget_Tracker wp(o); | |||
| const Fl_Menu_Item *item = o->menubutton()->mvalue(); | |||
| if (item && item->flags & (FL_SUBMENU|FL_SUBMENU_POINTER)) return; // ignore submenus | |||
| if (!strcmp(o->inp_->value(), o->menu_->text())) | |||
| { | |||
| o->Fl_Widget::clear_changed(); | |||
| if (o->when() & FL_WHEN_NOT_CHANGED) | |||
| o->do_callback(); | |||
| } | |||
| else | |||
| { | |||
| o->inp_->value(o->menu_->text()); | |||
| o->inp_->set_changed(); | |||
| o->Fl_Widget::set_changed(); | |||
| if (o->when() & (FL_WHEN_CHANGED|FL_WHEN_RELEASE)) | |||
| o->do_callback(); | |||
| } | |||
| if (wp.deleted()) return; | |||
| if (o->callback() != default_callback) | |||
| { | |||
| o->Fl_Widget::clear_changed(); | |||
| o->inp_->clear_changed(); | |||
| } | |||
| } | |||
| static void inp_cb(Fl_Widget*, void *data) { | |||
| Fl_Input_Choice *o=(Fl_Input_Choice *)data; | |||
| Fl_Widget_Tracker wp(o); | |||
| if (o->inp_->changed()) { | |||
| o->Fl_Widget::set_changed(); | |||
| if (o->when() & (FL_WHEN_CHANGED|FL_WHEN_RELEASE)) | |||
| o->do_callback(); | |||
| } else { | |||
| o->Fl_Widget::clear_changed(); | |||
| if (o->when() & FL_WHEN_NOT_CHANGED) | |||
| o->do_callback(); | |||
| } | |||
| if (wp.deleted()) return; | |||
| if (o->callback() != default_callback) | |||
| o->Fl_Widget::clear_changed(); | |||
| } | |||
| // Custom resize behavior -- input stretches, menu button doesn't | |||
| inline int inp_x() { return(x() + Fl::box_dx(box())); } | |||
| inline int inp_y() { return(y() + Fl::box_dy(box())); } | |||
| inline int inp_w() { return(w() - Fl::box_dw(box()) - 20); } | |||
| inline int inp_h() { return(h() - Fl::box_dh(box())); } | |||
| inline int menu_x() { return(x() + w() - 20 - Fl::box_dx(box())); } | |||
| inline int menu_y() { return(y() + Fl::box_dy(box())); } | |||
| inline int menu_w() { return(20); } | |||
| 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 | |||
| inp_ = new Fl_Input(inp_x(), inp_y(), | |||
| inp_w(), inp_h()); | |||
| inp_->callback(inp_cb, (void*)this); | |||
| inp_->box(FL_FLAT_BOX); // cosmetic | |||
| inp_->when(FL_WHEN_CHANGED|FL_WHEN_NOT_CHANGED); | |||
| menu_ = new InputMenuButton(menu_x(), menu_y(), | |||
| menu_w(), menu_h()); | |||
| menu_->callback(menu_cb, (void*)this); | |||
| menu_->box(FL_FLAT_BOX); // cosmetic | |||
| end(); | |||
| } | |||
| /** 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(); | |||
| } | |||
| void set_changed() { | |||
| inp_->set_changed(); | |||
| // no need to call Fl_Widget::set_changed() | |||
| } | |||
| /** 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()); | |||
| } | |||
| /** 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: Fl_Input_Choice.H 8022 2010-12-12 23:21:03Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,61 @@ | |||
| // | |||
| // "$Id: Fl_Int_Input.H 8726 2011-05-23 18:32:47Z AlbrechtS $" | |||
| // | |||
| // Integer input header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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_EXPORT Fl_Int_Input : public Fl_Input { | |||
| public: | |||
| /** | |||
| Creates a new Fl_Int_Input widget using the given position, | |||
| size, and label string. The default boxtype is FL_DOWN_BOX. | |||
| Inherited destructor destroys the widget and any value associated with it. | |||
| */ | |||
| #if defined(FL_DLL) // implementation in src/Fl_Input.cxx | |||
| Fl_Int_Input(int X,int Y,int W,int H,const char *l = 0); | |||
| #else | |||
| 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 | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Int_Input.H 8726 2011-05-23 18:32:47Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,53 @@ | |||
| // | |||
| // "$Id: Fl_JPEG_Image.H 7903 2010-11-28 21:06:39Z matt $" | |||
| // | |||
| // JPEG image header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_JPEG_Image class . */ | |||
| #ifndef Fl_JPEG_Image_H | |||
| #define Fl_JPEG_Image_H | |||
| # include "Fl_Image.H" | |||
| /** | |||
| The Fl_JPEG_Image class supports loading, caching, | |||
| and drawing of Joint Photographic Experts Group (JPEG) File | |||
| Interchange Format (JFIF) images. The class supports grayscale | |||
| and color (RGB) JPEG image files. | |||
| */ | |||
| class FL_EXPORT Fl_JPEG_Image : public Fl_RGB_Image { | |||
| public: | |||
| Fl_JPEG_Image(const char *filename); | |||
| Fl_JPEG_Image(const char *name, const unsigned char *data); | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_JPEG_Image.H 7903 2010-11-28 21:06:39Z matt $". | |||
| // | |||
| @@ -0,0 +1,59 @@ | |||
| // | |||
| // "$Id: Fl_Light_Button.H 8178 2011-01-04 14:09:37Z manolo $" | |||
| // | |||
| // Lighted button header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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" | |||
| /** | |||
| 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.png</P> | |||
| \image latex Fl_Light_Button.png "Fl_Light_Button" width=4cm | |||
| */ | |||
| class FL_EXPORT Fl_Light_Button : public Fl_Button { | |||
| protected: | |||
| virtual void draw(); | |||
| public: | |||
| virtual int handle(int); | |||
| Fl_Light_Button(int x,int y,int w,int h,const char *l = 0); | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Light_Button.H 8178 2011-01-04 14:09:37Z manolo $". | |||
| // | |||
| @@ -0,0 +1,46 @@ | |||
| // | |||
| // "$Id: Fl_Line_Dial.H 8022 2010-12-12 23:21:03Z AlbrechtS $" | |||
| // | |||
| // Line dial header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Line_Dial widget . */ | |||
| #ifndef Fl_Line_Dial_H | |||
| #define Fl_Line_Dial_H | |||
| #include "Fl_Dial.H" | |||
| class FL_EXPORT Fl_Line_Dial : public Fl_Dial { | |||
| public: | |||
| Fl_Line_Dial(int x,int y,int w,int h, const char *l = 0) | |||
| : Fl_Dial(x,y,w,h,l) {type(FL_LINE_DIAL);} | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Line_Dial.H 8022 2010-12-12 23:21:03Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,33 @@ | |||
| // | |||
| // "$Id: Fl_Menu.H 7903 2010-11-28 21:06:39Z matt $" | |||
| // | |||
| // Old menu header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| // this include file is for back compatibility only | |||
| #include "Fl_Menu_Item.H" | |||
| // | |||
| // End of "$Id: Fl_Menu.H 7903 2010-11-28 21:06:39Z matt $". | |||
| // | |||
| @@ -0,0 +1,168 @@ | |||
| // | |||
| // "$Id: Fl_Menu_.H 7903 2010-11-28 21:06:39Z matt $" | |||
| // | |||
| // Menu base class header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Menu_ widget . */ | |||
| #ifndef Fl_Menu__H | |||
| #define Fl_Menu__H | |||
| #ifndef Fl_Widget_H | |||
| #include "Fl_Widget.H" | |||
| #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_; | |||
| const Fl_Menu_Item *value_; | |||
| protected: | |||
| uchar alloc; // flag indicates if menu_ is a dynamic copy (=1) or not (=0) | |||
| uchar down_box_; | |||
| Fl_Font textfont_; | |||
| Fl_Fontsize textsize_; | |||
| Fl_Color textcolor_; | |||
| public: | |||
| Fl_Menu_(int,int,int,int,const char * =0); | |||
| ~Fl_Menu_(); | |||
| int item_pathname(char *name, int namelen, const Fl_Menu_Item *finditem=0) const; | |||
| const Fl_Menu_Item* picked(const Fl_Menu_Item*); | |||
| const Fl_Menu_Item* find_item(const char *name); | |||
| const Fl_Menu_Item* find_item(Fl_Callback*); | |||
| int find_index(const char *name) const; | |||
| int find_index(const Fl_Menu_Item *item) const; | |||
| int find_index(Fl_Callback *cb) const; | |||
| /** | |||
| Returns the menu item with the entered shortcut (key value). | |||
| This searches the complete menu() for a shortcut that matches the | |||
| entered key value. It must be called for a FL_KEYBOARD or FL_SHORTCUT | |||
| event. | |||
| If a match is found, the menu's callback will be called. | |||
| \return matched Fl_Menu_Item or NULL. | |||
| */ | |||
| 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 insert(int index, const char*, int shortcut, Fl_Callback*, void* = 0, int = 0); | |||
| int add(const char*, int shortcut, Fl_Callback*, void* = 0, int = 0); | |||
| /** 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); | |||
| } | |||
| /** See int Fl_Menu_::insert(const char* label, int shortcut, Fl_Callback*, void *user_data=0, int flags=0) */ | |||
| int insert(int index, const char* a, const char* b, Fl_Callback* c, void* d = 0, int e = 0) { | |||
| return insert(index,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 clear_submenu(int index); | |||
| 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. */ | |||
| const char *text() const {return value_ ? value_->text : 0;} | |||
| /** Returns the title of item i. */ | |||
| const char *text(int i) const {return menu_[i].text;} | |||
| /** 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 textcolor_;} | |||
| /** Sets the current color of menu item labels. */ | |||
| void textcolor(Fl_Color 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;} | |||
| /** 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 7903 2010-11-28 21:06:39Z matt $". | |||
| // | |||
| @@ -0,0 +1,89 @@ | |||
| // | |||
| // "$Id: Fl_Menu_Bar.H 7981 2010-12-08 23:53:04Z greg.ercolano $" | |||
| // | |||
| // Menu bar header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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.png</P> | |||
| \image latex menubar.png " 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) {} | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Menu_Bar.H 7981 2010-12-08 23:53:04Z greg.ercolano $". | |||
| // | |||
| @@ -0,0 +1,86 @@ | |||
| // | |||
| // "$Id: Fl_Menu_Button.H 8016 2010-12-12 11:19:12Z manolo $" | |||
| // | |||
| // Menu button header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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.png</P> | |||
| \image latex menu_button.png " 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(). | |||
| If type() is zero a normal menu button is produced. | |||
| If it is nonzero then this is a pop-up menu. The bits in type() indicate | |||
| what mouse buttons pop up the menu (see Fl_Menu_Button::popup_buttons). </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(); | |||
| public: | |||
| /** | |||
| \brief indicate what mouse buttons pop up the menu. | |||
| Values for type() used to indicate what mouse buttons pop up the menu. | |||
| Fl_Menu_Button::POPUP3 is usually what you want. | |||
| */ | |||
| enum popup_buttons {POPUP1 = 1, /**< pops up with the mouse 1st button. */ | |||
| POPUP2, /**< pops up with the mouse 2nd button. */ | |||
| POPUP12, /**< pops up with the mouse 1st or 2nd buttons. */ | |||
| POPUP3, /**< pops up with the mouse 3rd button. */ | |||
| POPUP13, /**< pops up with the mouse 1st or 3rd buttons. */ | |||
| POPUP23, /**< pops up with the mouse 2nd or 3rd buttons. */ | |||
| POPUP123 /**< pops up with any mouse button. */ | |||
| }; | |||
| int handle(int); | |||
| const Fl_Menu_Item* popup(); | |||
| Fl_Menu_Button(int,int,int,int,const char * =0); | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Menu_Button.H 8016 2010-12-12 11:19:12Z manolo $". | |||
| // | |||
| @@ -0,0 +1,443 @@ | |||
| // | |||
| // "$Id: Fl_Menu_Item.H 7983 2010-12-09 00:04:06Z AlbrechtS $" | |||
| // | |||
| // Menu item header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| #ifndef Fl_Menu_Item_H | |||
| #define Fl_Menu_Item_H | |||
| # include "Fl_Widget.H" | |||
| # include "Fl_Image.H" | |||
| # if defined(__APPLE__) && defined(check) | |||
| # undef check | |||
| # endif | |||
| enum { // values for flags: | |||
| FL_MENU_INACTIVE = 1, ///< Deactivate menu item (gray out) | |||
| FL_MENU_TOGGLE= 2, ///< Item is a checkbox toggle (shows checkbox for on/off state) | |||
| FL_MENU_VALUE = 4, ///< The on/off state for checkbox/radio buttons (if set, state is 'on') | |||
| FL_MENU_RADIO = 8, ///< Item is a radio button (one checkbox of many can be on) | |||
| FL_MENU_INVISIBLE = 0x10, ///< Item will not show up (shortcut will work) | |||
| FL_SUBMENU_POINTER = 0x20, ///< Indicates user_data() is a pointer to another menu array | |||
| FL_SUBMENU = 0x40, ///< This item is a submenu to other items | |||
| FL_MENU_DIVIDER = 0x80, ///< Creates divider line below this item. Also ends a group of radio buttons. | |||
| FL_MENU_HORIZONTAL = 0x100 ///< ??? -- reserved | |||
| }; | |||
| extern FL_EXPORT Fl_Shortcut 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, // Deactivate menu item (gray out) | |||
| FL_MENU_TOGGLE = 2, // Item is a checkbox toggle (shows checkbox for on/off state) | |||
| FL_MENU_VALUE = 4, // The on/off state for checkbox/radio buttons (if set, state is 'on') | |||
| FL_MENU_RADIO = 8, // Item is a radio button (one checkbox of many can be on) | |||
| FL_MENU_INVISIBLE = 0x10, // Item will not show up (shortcut will work) | |||
| FL_SUBMENU_POINTER = 0x20, // Indicates user_data() is a pointer to another menu array | |||
| FL_SUBMENU = 0x40, // This item is a submenu to other items | |||
| FL_MENU_DIVIDER = 0x80, // Creates divider line below this item. Also ends a group of radio buttons. | |||
| FL_MENU_HORIZONTAL = 0x100 // ??? -- reserved | |||
| }; | |||
| \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.png | |||
| \image latex menu.png "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; ///< 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 the menu's callback | |||
| 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 | |||
| Fl_Color 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;} | |||
| /** | |||
| Returns the menu item's 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. | |||
| */ | |||
| Fl_Labeltype labeltype() const {return (Fl_Labeltype)labeltype_;} | |||
| /** | |||
| Sets the menu item's 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;} | |||
| /** | |||
| Gets the menu item's label color. | |||
| 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 \b not use overlay bitplanes to draw | |||
| the menu - this is so that images put in the menu draw correctly. | |||
| */ | |||
| Fl_Color labelcolor() const {return labelcolor_;} | |||
| /** | |||
| Sets the menu item's label color. | |||
| \see Fl_Color Fl_Menu_Item::labelcolor() const | |||
| */ | |||
| void labelcolor(Fl_Color a) {labelcolor_ = a;} | |||
| /** | |||
| Gets the menu item's label font. | |||
| 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_;} | |||
| /** | |||
| Sets the menu item's label font. | |||
| 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;} | |||
| /** | |||
| Returns the callback function that is set for the menu item. | |||
| 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_;} | |||
| /** | |||
| Sets the menu item's callback function and userdata() argument. | |||
| \see Fl_Callback_p Fl_MenuItem::callback() const | |||
| */ | |||
| void callback(Fl_Callback* c, void* p) {callback_=c; user_data_=p;} | |||
| /** | |||
| Sets the menu item's callback function. | |||
| This method does not set the userdata() argument. | |||
| \see Fl_Callback_p Fl_MenuItem::callback() const | |||
| */ | |||
| void callback(Fl_Callback* c) {callback_=c;} | |||
| /** | |||
| Sets the menu item's callback function. | |||
| This method does not set the userdata() argument. | |||
| \see Fl_Callback_p Fl_MenuItem::callback() const | |||
| */ | |||
| void callback(Fl_Callback0*c) {callback_=(Fl_Callback*)c;} | |||
| /** | |||
| Sets the menu item's callback function and userdata() argument. | |||
| This method does not set the userdata() argument. | |||
| The argument \p is cast to void* and stored as the userdata() | |||
| for the menu item's callback function. | |||
| \see Fl_Callback_p Fl_MenuItem::callback() const | |||
| */ | |||
| void callback(Fl_Callback1*c, long p=0) {callback_=(Fl_Callback*)c; user_data_=(void*)p;} | |||
| /** | |||
| Gets the user_data() argument that is sent to the callback function. | |||
| */ | |||
| void* user_data() const {return user_data_;} | |||
| /** | |||
| Sets the user_data() argument that is sent to the callback function. | |||
| */ | |||
| void user_data(void* v) {user_data_ = v;} | |||
| /** | |||
| Gets the user_data() argument that is sent to the callback function. | |||
| For convenience you can also define the callback as taking a long | |||
| argument. This method casts the stored userdata() argument to long | |||
| and returns it as a \e long value. | |||
| */ | |||
| long argument() const {return (long)(fl_intptr_t)user_data_;} | |||
| /** | |||
| Sets the user_data() argument that is sent to the callback function. | |||
| For convenience you can also define the callback as taking a long | |||
| argument. This method casts the given argument \p v to void* | |||
| and stores it in the menu item's userdata() member. | |||
| This 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;} | |||
| /** 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: | |||
| int measure(int* h, const Fl_Menu_*) const; | |||
| void draw(int x, int y, int w, int h, const Fl_Menu_*, int t=0) const; | |||
| // popup menus without using an Fl_Menu_ widget: | |||
| const Fl_Menu_Item* popup( | |||
| int X, int Y, | |||
| const char *title = 0, | |||
| const Fl_Menu_Item* picked=0, | |||
| const Fl_Menu_* = 0) const; | |||
| const Fl_Menu_Item* pulldown( | |||
| int X, int Y, int W, int H, | |||
| const Fl_Menu_Item* picked = 0, | |||
| const Fl_Menu_* = 0, | |||
| const Fl_Menu_Item* title = 0, | |||
| int menubar=0) const; | |||
| const Fl_Menu_Item* test_shortcut() const; | |||
| const Fl_Menu_Item* find_shortcut(int *ip=0, const bool require_alt = false) const; | |||
| /** | |||
| Calls the Fl_Menu_Item item's callback, and provides the Fl_Widget argument. | |||
| The callback is called with the stored user_data() as its second 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. | |||
| This call overrides the callback's second argument with the given value \p arg. | |||
| 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. | |||
| This call overrides the callback's second argument with the | |||
| given value \p arg. long \p arg is cast to void* when calling | |||
| the callback. | |||
| 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-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 insert(int,const char*,int,Fl_Callback*,void* =0, int =0); | |||
| 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 compatibility | |||
| enum { // back-compatibility enum: | |||
| FL_PUP_NONE = 0, | |||
| FL_PUP_GREY = FL_MENU_INACTIVE, | |||
| FL_PUP_GRAY = FL_MENU_INACTIVE, | |||
| FL_MENU_BOX = FL_MENU_TOGGLE, | |||
| FL_PUP_BOX = FL_MENU_TOGGLE, | |||
| FL_MENU_CHECK = FL_MENU_VALUE, | |||
| FL_PUP_CHECK = FL_MENU_VALUE, | |||
| FL_PUP_RADIO = FL_MENU_RADIO, | |||
| FL_PUP_INVISIBLE = FL_MENU_INVISIBLE, | |||
| FL_PUP_SUBMENU = FL_SUBMENU_POINTER | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Menu_Item.H 7983 2010-12-09 00:04:06Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,68 @@ | |||
| // | |||
| // "$Id: Fl_Menu_Window.H 7903 2010-11-28 21:06:39Z matt $" | |||
| // | |||
| // Menu window header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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 { | |||
| public: | |||
| void show(); | |||
| void erase(); | |||
| void flush(); | |||
| void hide(); | |||
| /** Tells if hardware overlay mode is set */ | |||
| unsigned 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); } | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Menu_Window.H 7903 2010-11-28 21:06:39Z matt $". | |||
| // | |||
| @@ -0,0 +1,66 @@ | |||
| // | |||
| // "$Id: Fl_Multi_Browser.H 8736 2011-05-24 20:00:56Z AlbrechtS $" | |||
| // | |||
| // Multi browser header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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_EXPORT 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. | |||
| */ | |||
| #if defined(FL_DLL) // implementation in src/Fl_Browser.cxx | |||
| Fl_Multi_Browser(int X,int Y,int W,int H,const char *L=0); | |||
| #else | |||
| 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);} | |||
| #endif | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Multi_Browser.H 8736 2011-05-24 20:00:56Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,47 @@ | |||
| // | |||
| // "$Id: Fl_Multi_Label.H 7903 2010-11-28 21:06:39Z matt $" | |||
| // | |||
| // Multi-label header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| #ifndef Fl_Multi_Label_H | |||
| #define Fl_Multi_Label_H | |||
| class Fl_Widget; | |||
| struct Fl_Menu_Item; | |||
| struct FL_EXPORT Fl_Multi_Label { | |||
| const char* labela; | |||
| const char* labelb; | |||
| uchar typea; | |||
| uchar typeb; | |||
| void label(Fl_Widget*); | |||
| void label(Fl_Menu_Item*); | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Multi_Label.H 7903 2010-11-28 21:06:39Z matt $". | |||
| // | |||
| @@ -0,0 +1,75 @@ | |||
| // | |||
| // "$Id: Fl_Multiline_Input.H 8726 2011-05-23 18:32:47Z AlbrechtS $" | |||
| // | |||
| // Multiline input header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2011 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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. | |||
| This is far from the nirvana of text editors, and is probably only | |||
| good for small bits of text, 10 lines at most. Note that this widget | |||
| does not support scrollbars or per-character color control. | |||
| If you are presenting large amounts of text and need scrollbars | |||
| or full color control of characters, you probably want Fl_Text_Editor | |||
| instead. | |||
| In FLTK 1.3.x, the default behavior of the 'Tab' key was changed | |||
| to support consistent focus navigation. To get the older FLTK 1.1.x | |||
| behavior, set Fl_Input_::tab_nav() to 0. Newer programs should consider using | |||
| Fl_Text_Editor. | |||
| */ | |||
| class FL_EXPORT Fl_Multiline_Input : public Fl_Input { | |||
| public: | |||
| /** | |||
| Creates a new Fl_Multiline_Input widget using the given | |||
| position, size, and label string. The default boxtype is FL_DOWN_BOX. | |||
| Inherited destructor destroys the widget and any value associated with it. | |||
| */ | |||
| #if defined(FL_DLL) // implementation in src/Fl_Input.cxx | |||
| Fl_Multiline_Input(int X,int Y,int W,int H,const char *l = 0); | |||
| #else | |||
| 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 | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Multiline_Input.H 8726 2011-05-23 18:32:47Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,70 @@ | |||
| // | |||
| // "$Id: Fl_Multiline_Output.H 8726 2011-05-23 18:32:47Z AlbrechtS $" | |||
| // | |||
| // Multi line output header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2011 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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. | |||
| Note that this widget does not support scrollbars, or per-character | |||
| color control. | |||
| If you are presenting large amounts of read-only text | |||
| and need scrollbars, or full color control of characters, | |||
| then use Fl_Text_Display. If you want to display HTML text, | |||
| use Fl_Help_View. | |||
| */ | |||
| class FL_EXPORT Fl_Multiline_Output : public Fl_Output { | |||
| public: | |||
| /** | |||
| Creates a new Fl_Multiline_Output widget using the given position, | |||
| size, and label string. The default boxtype is FL_DOWN_BOX. | |||
| Inherited destructor destroys the widget and any value associated with it. | |||
| */ | |||
| #if defined(FL_DLL) // implementation in src/Fl_Input.cxx | |||
| Fl_Multiline_Output(int X,int Y,int W,int H,const char *l = 0); | |||
| #else | |||
| 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 | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Multiline_Output.H 8726 2011-05-23 18:32:47Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,305 @@ | |||
| // | |||
| // "$Id: Fl_Native_File_Chooser.H 8380 2011-02-06 10:07:28Z manolo $" | |||
| // | |||
| // FLTK native OS file chooser widget | |||
| // | |||
| // Copyright 1998-2010 by Bill Spitzak and others. | |||
| // Copyright 2004 Greg Ercolano. | |||
| // | |||
| // This library is free software; you can redistribute it and/or | |||
| // modify it under the terms of the GNU Library General Public | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /** \file | |||
| Fl_Native_File_Chooser widget. */ | |||
| /** | |||
| \class Fl_Native_File_Chooser | |||
| This class lets an FLTK application easily and consistently access | |||
| the operating system's native file chooser. Some operating systems | |||
| have very complex and specific file choosers that many users want | |||
| access to specifically, instead of FLTK's default file chooser(s). | |||
| In cases where there is no native file browser, FLTK's own file browser | |||
| is used instead. | |||
| To use this widget correctly, use the following include in your code: | |||
| \code | |||
| #include <FL/Fl_Native_File_Chooser.H> | |||
| \endcode | |||
| Do not include the other Fl_Native_File_Choser_XXX.H files in your code; | |||
| those are platform specific files that will be included automatically | |||
| depending on your build platform. | |||
| The following example shows how to pick a single file: | |||
| \code | |||
| // Create and post the local native file chooser | |||
| #include <FL/Fl_Native_File_Chooser.H> | |||
| [..] | |||
| Fl_Native_File_Chooser fnfc; | |||
| fnfc.title("Pick a file"); | |||
| fnfc.type(Fl_Native_File_Chooser::BROWSE_FILE); | |||
| fnfc.filter("Text\t*.txt\n" | |||
| "C Files\t*.{cxx,h,c}"); | |||
| fnfc.directory("/var/tmp"); // default directory to use | |||
| // Show native chooser | |||
| switch ( fnfc.show() ) { | |||
| case -1: printf("ERROR: %s\n", fnfc.errmsg()); break; // ERROR | |||
| case 1: printf("CANCEL\n"); break; // CANCEL | |||
| default: printf("PICKED: %s\n", fnfc.filename()); break; // FILE CHOSEN | |||
| } | |||
| \endcode | |||
| <B>Platform Specific Caveats</B> | |||
| - Under X windows, it's best if you call Fl_File_Icon::load_system_icons() | |||
| at the start of main(), to enable the nicer looking file browser widgets. | |||
| Use the static public attributes of class Fl_File_Chooser to localize | |||
| the browser. | |||
| - Some operating systems support certain OS specific options; see | |||
| Fl_Native_File_Chooser::options() for a list. | |||
| \image html Fl_Native_File_Chooser.png "The Fl_Native_File_Chooser on different platforms." | |||
| \image latex Fl_Native_File_Chooser.png "The Fl_Native_File_Chooser on different platforms" width=14cm | |||
| */ | |||
| #ifndef FL_NATIVE_FILE_CHOOSER_H | |||
| #define FL_NATIVE_FILE_CHOOSER_H | |||
| /* \file | |||
| Fl_Native_File_Chooser widget. */ | |||
| // Use Windows' chooser | |||
| #ifdef WIN32 | |||
| // #define _WIN32_WINNT 0x0501 // needed for OPENFILENAME's 'FlagsEx' | |||
| #include <stdio.h> | |||
| #include <stdlib.h> // malloc | |||
| #include <windows.h> | |||
| #include <commdlg.h> // OPENFILENAME, GetOpenFileName() | |||
| #include <shlobj.h> // BROWSEINFO, SHBrowseForFolder() | |||
| #endif | |||
| // Use Apple's chooser | |||
| #ifdef __APPLE__ | |||
| #include <FL/filename.H> | |||
| #define MAXFILTERS 80 | |||
| #endif | |||
| // All else falls back to FLTK's own chooser | |||
| #if ! defined(__APPLE__) && !defined(WIN32) | |||
| #include <FL/Fl_File_Chooser.H> | |||
| #include <unistd.h> // _POSIX_NAME_MAX | |||
| #endif | |||
| /** | |||
| This class lets an FLTK application easily and consistently access | |||
| the operating system's native file chooser. Some operating systems | |||
| have very complex and specific file choosers that many users want | |||
| access to specifically, instead of FLTK's default file chooser(s). | |||
| In cases where there is no native file browser, FLTK's own file browser | |||
| is used instead. | |||
| To use this widget, use the following include in your code: | |||
| \code | |||
| #include <FL/Fl_Native_File_Chooser.H> | |||
| \endcode | |||
| The following example shows how to pick a single file: | |||
| \code | |||
| // Create and post the local native file chooser | |||
| #include <FL/Fl_Native_File_Chooser.H> | |||
| [..] | |||
| Fl_Native_File_Chooser fnfc; | |||
| fnfc.title("Pick a file"); | |||
| fnfc.type(Fl_Native_File_Chooser::BROWSE_FILE); | |||
| fnfc.filter("Text\t*.txt\n" | |||
| "C Files\t*.{cxx,h,c}"); | |||
| fnfc.directory("/var/tmp"); // default directory to use | |||
| // Show native chooser | |||
| switch ( fnfc.show() ) { | |||
| case -1: printf("ERROR: %s\n", fnfc.errmsg()); break; // ERROR | |||
| case 1: printf("CANCEL\n"); break; // CANCEL | |||
| default: printf("PICKED: %s\n", fnfc.filename()); break; // FILE CHOSEN | |||
| } | |||
| \endcode | |||
| <B>Platform Specific Caveats</B> | |||
| - Under X windows, it's best if you call Fl_File_Icon::load_system_icons() | |||
| at the start of main(), to enable the nicer looking file browser widgets. | |||
| Use the static public attributes of class Fl_File_Chooser to localize | |||
| the browser. | |||
| - Some operating systems support certain OS specific options; see | |||
| Fl_Native_File_Chooser::options() for a list. | |||
| \image html Fl_Native_File_Chooser.png "The Fl_Native_File_Chooser on different platforms." | |||
| \image latex Fl_Native_File_Chooser.png "The Fl_Native_File_Chooser on different platforms" width=14cm | |||
| */ | |||
| class FL_EXPORT Fl_Native_File_Chooser { | |||
| public: | |||
| enum Type { | |||
| BROWSE_FILE = 0, ///< browse files (lets user choose one file) | |||
| BROWSE_DIRECTORY, ///< browse directories (lets user choose one directory) | |||
| BROWSE_MULTI_FILE, ///< browse files (lets user choose multiple files) | |||
| BROWSE_MULTI_DIRECTORY, ///< browse directories (lets user choose multiple directories) | |||
| BROWSE_SAVE_FILE, ///< browse to save a file | |||
| BROWSE_SAVE_DIRECTORY ///< browse to save a directory | |||
| }; | |||
| enum Option { | |||
| NO_OPTIONS = 0x0000, ///< no options enabled | |||
| SAVEAS_CONFIRM = 0x0001, ///< Show native 'Save As' overwrite confirm dialog (if supported) | |||
| NEW_FOLDER = 0x0002, ///< Show 'New Folder' icon (if supported) | |||
| PREVIEW = 0x0004 ///< enable preview mode | |||
| }; | |||
| /** Localizable message */ | |||
| static const char *file_exists_message; | |||
| public: | |||
| Fl_Native_File_Chooser(int val=BROWSE_FILE); | |||
| ~Fl_Native_File_Chooser(); | |||
| // Public methods | |||
| void type(int); | |||
| int type() const; | |||
| void options(int); | |||
| int options() const; | |||
| int count() const; | |||
| const char *filename() const; | |||
| const char *filename(int i) const; | |||
| void directory(const char *val); | |||
| const char *directory() const; | |||
| void title(const char *); | |||
| const char* title() const; | |||
| const char *filter() const; | |||
| void filter(const char *); | |||
| int filters() const; | |||
| void filter_value(int i); | |||
| int filter_value() const; | |||
| void preset_file(const char*); | |||
| const char* preset_file() const; | |||
| const char *errmsg() const; | |||
| int show(); | |||
| #ifdef WIN32 | |||
| private: | |||
| int _btype; // kind-of browser to show() | |||
| int _options; // general options | |||
| OPENFILENAMEW _ofn; // GetOpenFileName() & GetSaveFileName() struct | |||
| BROWSEINFO _binf; // SHBrowseForFolder() struct | |||
| char **_pathnames; // array of pathnames | |||
| int _tpathnames; // total pathnames | |||
| char *_directory; // default pathname to use | |||
| char *_title; // title for window | |||
| char *_filter; // user-side search filter | |||
| char *_parsedfilt; // filter parsed for Windows dialog | |||
| int _nfilters; // number of filters parse_filter counted | |||
| char *_preset_file; // the file to preselect | |||
| char *_errmsg; // error message | |||
| // Private methods | |||
| void errmsg(const char *msg); | |||
| void clear_pathnames(); | |||
| void set_single_pathname(const char *s); | |||
| void add_pathname(const char *s); | |||
| void FreePIDL(ITEMIDLIST *pidl); | |||
| void ClearOFN(); | |||
| void ClearBINF(); | |||
| void Win2Unix(char *s); | |||
| void Unix2Win(char *s); | |||
| int showfile(); | |||
| static int CALLBACK Dir_CB(HWND win, UINT msg, LPARAM param, LPARAM data); | |||
| int showdir(); | |||
| void parse_filter(const char *); | |||
| void clear_filters(); | |||
| void add_filter(const char *, const char *); | |||
| #endif | |||
| #ifdef __APPLE__ | |||
| private: | |||
| int _btype; // kind-of browser to show() | |||
| int _options; // general options | |||
| void *_panel; | |||
| char **_pathnames; // array of pathnames | |||
| int _tpathnames; // total pathnames | |||
| char *_directory; // default pathname to use | |||
| char *_title; // title for window | |||
| char *_preset_file; // the 'save as' filename | |||
| char *_filter; // user-side search filter, eg: | |||
| // C Files\t*.[ch]\nText Files\t*.txt" | |||
| char *_filt_names; // filter names (tab delimited) | |||
| // eg. "C Files\tText Files" | |||
| char *_filt_patt[MAXFILTERS]; | |||
| // array of filter patterns, eg: | |||
| // _filt_patt[0]="*.{cxx,h}" | |||
| // _filt_patt[1]="*.txt" | |||
| int _filt_total; // parse_filter() # of filters loaded | |||
| int _filt_value; // index of the selected filter | |||
| char *_errmsg; // error message | |||
| // Private methods | |||
| void errmsg(const char *msg); | |||
| void clear_pathnames(); | |||
| void set_single_pathname(const char *s); | |||
| int get_saveas_basename(void); | |||
| void clear_filters(); | |||
| void add_filter(const char *, const char *); | |||
| void parse_filter(const char *from); | |||
| int post(); | |||
| #endif | |||
| #if ! defined(__APPLE__) && !defined(WIN32) | |||
| private: | |||
| int _btype; // kind-of browser to show() | |||
| int _options; // general options | |||
| int _nfilters; | |||
| char *_filter; // user supplied filter | |||
| char *_parsedfilt; // parsed filter | |||
| int _filtvalue; // selected filter | |||
| char *_preset_file; | |||
| char *_prevvalue; // Returned filename | |||
| char *_directory; | |||
| char *_errmsg; // error message | |||
| Fl_File_Chooser *_file_chooser; | |||
| // Private methods | |||
| void errmsg(const char *msg); | |||
| int type_fl_file(int); | |||
| void parse_filter(); | |||
| void keeplocation(); | |||
| int exist_dialog(); | |||
| #endif | |||
| }; | |||
| #endif /*FL_NATIVE_FILE_CHOOSER_H*/ | |||
| // | |||
| // End of "$Id: Fl_Native_File_Chooser.H 8380 2011-02-06 10:07:28Z manolo $". | |||
| // | |||
| @@ -0,0 +1,46 @@ | |||
| // | |||
| // "$Id: Fl_Nice_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $" | |||
| // | |||
| // "Nice" slider header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Nice_Slider widget . */ | |||
| #ifndef Fl_Nice_Slider_H | |||
| #define Fl_Nice_Slider_H | |||
| #include "Fl_Slider.H" | |||
| class FL_EXPORT Fl_Nice_Slider : public Fl_Slider { | |||
| public: | |||
| Fl_Nice_Slider(int x,int y,int w,int h,const char *l=0) | |||
| : Fl_Slider(x,y,w,h,l) {type(FL_VERT_NICE_SLIDER); box(FL_FLAT_BOX);} | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Nice_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,36 @@ | |||
| // | |||
| // "$Id: Fl_Object.H 7903 2010-11-28 21:06:39Z matt $" | |||
| // | |||
| // Old Fl_Object header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| // 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 7903 2010-11-28 21:06:39Z matt $". | |||
| // | |||
| @@ -0,0 +1,77 @@ | |||
| // | |||
| // "$Id: Fl_Output.H 8726 2011-05-23 18:32:47Z AlbrechtS $" | |||
| // | |||
| // Output header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2011 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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 its 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.png</P> | |||
| \image latex text.png "Fl_Output" width=8cm | |||
| There is a single subclass, Fl_Multiline_Output, which allows you to | |||
| display multiple lines of text. Fl_Multiline_Output does not provide | |||
| scroll bars. If a more complete text editing widget is needed, use | |||
| Fl_Text_Display instead. | |||
| 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_EXPORT Fl_Output : public Fl_Input { | |||
| public: | |||
| /** | |||
| Creates a new Fl_Output widget using the given position, | |||
| size, and label string. The default boxtype is FL_DOWN_BOX. | |||
| Inherited destructor destroys the widget and any value associated with it. | |||
| */ | |||
| #if defined(FL_DLL) // implementation in src/Fl_Input.cxx | |||
| Fl_Output(int X,int Y,int W,int H, const char *l = 0); | |||
| #else | |||
| 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 | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Output.H 8726 2011-05-23 18:32:47Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,79 @@ | |||
| // | |||
| // "$Id: Fl_Overlay_Window.H 7903 2010-11-28 21:06:39Z matt $" | |||
| // | |||
| // Overlay window header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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; | |||
| Fl_Window *overlay_; | |||
| public: | |||
| void show(); | |||
| void flush(); | |||
| void hide(); | |||
| void resize(int,int,int,int); | |||
| ~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); } | |||
| /** | |||
| 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);} | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Overlay_Window.H 7903 2010-11-28 21:06:39Z matt $". | |||
| // | |||
| @@ -0,0 +1,55 @@ | |||
| // | |||
| // "$Id: Fl_PNG_Image.H 8287 2011-01-17 20:51:12Z manolo $" | |||
| // | |||
| // PNG image header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_PNG_Image class . */ | |||
| #ifndef Fl_PNG_Image_H | |||
| #define Fl_PNG_Image_H | |||
| # include "Fl_Image.H" | |||
| /** | |||
| The Fl_PNG_Image class supports loading, caching, | |||
| and drawing of Portable Network Graphics (PNG) image files. The | |||
| class loads colormapped and full-color images and handles color- | |||
| and alpha-based transparency. | |||
| */ | |||
| class FL_EXPORT Fl_PNG_Image : public Fl_RGB_Image { | |||
| public: | |||
| Fl_PNG_Image(const char* filename); | |||
| Fl_PNG_Image (const char *name_png, const unsigned char *buffer, int datasize); | |||
| private: | |||
| void load_png_(const char *name_png, const unsigned char *buffer_png, int datasize); | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_PNG_Image.H 8287 2011-01-17 20:51:12Z manolo $". | |||
| // | |||
| @@ -0,0 +1,52 @@ | |||
| // | |||
| // "$Id: Fl_PNM_Image.H 7903 2010-11-28 21:06:39Z matt $" | |||
| // | |||
| // PNM image header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_PNM_Image class . */ | |||
| #ifndef Fl_PNM_Image_H | |||
| #define Fl_PNM_Image_H | |||
| # include "Fl_Image.H" | |||
| /** | |||
| The Fl_PNM_Image class supports loading, caching, | |||
| and drawing of Portable Anymap (PNM, PBM, PGM, PPM) image files. The class | |||
| loads bitmap, grayscale, and full-color images in both ASCII and | |||
| binary formats. | |||
| */ | |||
| class FL_EXPORT Fl_PNM_Image : public Fl_RGB_Image { | |||
| public: | |||
| Fl_PNM_Image(const char* filename); | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_PNM_Image.H 7903 2010-11-28 21:06:39Z matt $". | |||
| // | |||
| @@ -0,0 +1,84 @@ | |||
| // | |||
| // "$Id: Fl_Pack.H 7903 2010-11-28 21:06:39Z matt $" | |||
| // | |||
| // Pack header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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 7903 2010-11-28 21:06:39Z matt $". | |||
| // | |||
| @@ -0,0 +1,153 @@ | |||
| // | |||
| // "$Id: Fl_Paged_Device.H 8699 2011-05-20 16:39:06Z manolo $" | |||
| // | |||
| // Printing support for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /** \file Fl_Paged_Device.H | |||
| \brief declaration of class Fl_Paged_Device. | |||
| */ | |||
| #ifndef Fl_Paged_Device_H | |||
| #define Fl_Paged_Device_H | |||
| #include <FL/Fl_Device.H> | |||
| #include <FL/Fl_Window.H> | |||
| /** \brief Number of elements in enum Page_Format */ | |||
| #define NO_PAGE_FORMATS 30 /* MSVC6 compilation fix */ | |||
| /** | |||
| \brief Represents page-structured drawing surfaces. | |||
| * | |||
| This class has no public constructor: don't instantiate it; use Fl_Printer | |||
| or Fl_PostScript_File_Device instead. | |||
| */ | |||
| class FL_EXPORT Fl_Paged_Device : public Fl_Surface_Device { | |||
| public: | |||
| /** | |||
| \brief Possible page formats. | |||
| All paper formats with pre-defined width and height. | |||
| */ | |||
| enum Page_Format { | |||
| A0 = 0, /**< A0 format */ | |||
| A1, | |||
| A2, | |||
| A3, | |||
| A4, /**< A4 format */ | |||
| A5, | |||
| A6, | |||
| A7, | |||
| A8, | |||
| A9, | |||
| B0, | |||
| B1, | |||
| B2, | |||
| B3, | |||
| B4, | |||
| B5, | |||
| B6, | |||
| B7, | |||
| B8, | |||
| B9, | |||
| B10, | |||
| C5E, | |||
| DLE, | |||
| EXECUTIVE, | |||
| FOLIO, | |||
| LEDGER, | |||
| LEGAL, | |||
| LETTER, /**< Letter format */ | |||
| TABLOID, | |||
| ENVELOPE, | |||
| MEDIA = 0x1000 | |||
| }; | |||
| /** | |||
| \brief Possible page layouts. | |||
| */ | |||
| enum Page_Layout { | |||
| PORTRAIT = 0, /**< Portrait orientation */ | |||
| LANDSCAPE = 0x100, /**< Landscape orientation */ | |||
| REVERSED = 0x200, /**< Reversed orientation */ | |||
| ORIENTATION = 0x300 /**< orientation */ | |||
| }; | |||
| /** \brief width, height and name of a page format | |||
| */ | |||
| typedef struct { | |||
| /** \brief width in points */ | |||
| int width; | |||
| /** \brief height in points */ | |||
| int height; | |||
| /** \brief format name */ | |||
| const char *name; | |||
| } page_format; | |||
| /** \brief width, height and name of all elements of the enum \ref Page_Format. | |||
| */ | |||
| static const page_format page_formats[NO_PAGE_FORMATS]; | |||
| private: | |||
| void traverse(Fl_Widget *widget); // finds subwindows of widget and prints them | |||
| protected: | |||
| /** \brief horizontal offset to the origin of graphics coordinates */ | |||
| int x_offset; | |||
| /** \brief vertical offset to the origin of graphics coordinates */ | |||
| int y_offset; | |||
| /** \brief The constructor */ | |||
| Fl_Paged_Device() : Fl_Surface_Device(NULL) {}; | |||
| /** \brief The destructor */ | |||
| virtual ~Fl_Paged_Device() {}; | |||
| public: | |||
| static const char *class_id; | |||
| const char *class_name() {return class_id;}; | |||
| virtual int start_job(int pagecount, int *frompage = NULL, int *topage = NULL); | |||
| virtual int start_page(void); | |||
| virtual int printable_rect(int *w, int *h); | |||
| virtual void margins(int *left, int *top, int *right, int *bottom); | |||
| virtual void origin(int x, int y); | |||
| virtual void origin(int *x, int *y); | |||
| virtual void scale(float scale_x, float scale_y = 0.); | |||
| virtual void rotate(float angle); | |||
| virtual void translate(int x, int y); | |||
| virtual void untranslate(void); | |||
| virtual void print_widget(Fl_Widget* widget, int delta_x = 0, int delta_y = 0); | |||
| /** Prints a window with its title bar and frame if any. | |||
| \p x_offset and \p y_offset are optional coordinates of where to position the window top left. | |||
| Equivalent to print_widget() if \p win is a subwindow or has no border. | |||
| Use Fl_Window::decorated_w() and Fl_Window::decorated_h() to get the size of the | |||
| printed window. | |||
| */ | |||
| void print_window(Fl_Window *win, int x_offset = 0, int y_offset = 0); | |||
| virtual void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x = 0, int delta_y = 0); | |||
| virtual int end_page (void); | |||
| virtual void end_job (void); | |||
| }; | |||
| #endif // Fl_Paged_Device_H | |||
| // | |||
| // End of "$Id: Fl_Paged_Device.H 8699 2011-05-20 16:39:06Z manolo $" | |||
| // | |||
| @@ -0,0 +1,99 @@ | |||
| // | |||
| // "$Id: Fl_Pixmap.H 7903 2010-11-28 21:06:39Z matt $" | |||
| // | |||
| // Pixmap header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Pixmap widget . */ | |||
| #ifndef Fl_Pixmap_H | |||
| #define Fl_Pixmap_H | |||
| # include "Fl_Image.H" | |||
| class Fl_Widget; | |||
| struct Fl_Menu_Item; | |||
| // Older C++ compilers don't support the explicit keyword... :( | |||
| # if defined(__sgi) && !defined(_COMPILER_VERSION) | |||
| # 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 { | |||
| friend class Fl_Quartz_Graphics_Driver; | |||
| friend class Fl_GDI_Graphics_Driver; | |||
| friend class Fl_Xlib_Graphics_Driver; | |||
| void copy_data(); | |||
| void delete_data(); | |||
| void set_data(const char * const *p); | |||
| protected: | |||
| void measure(); | |||
| public: | |||
| int alloc_data; // Non-zero if data was allocated | |||
| private: | |||
| #if defined(__APPLE__) || defined(WIN32) | |||
| void *id_; // for internal use | |||
| void *mask_; // for internal use (mask bitmap) | |||
| #else | |||
| unsigned id_; // for internal use | |||
| unsigned mask_; // for internal use (mask bitmap) | |||
| #endif // __APPLE__ || WIN32 | |||
| public: | |||
| /** 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); | |||
| Fl_Image *copy() { return copy(w(), h()); } | |||
| virtual void color_average(Fl_Color c, float i); | |||
| virtual void desaturate(); | |||
| 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);} | |||
| virtual void label(Fl_Widget*w); | |||
| virtual void label(Fl_Menu_Item*m); | |||
| virtual void uncache(); | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Pixmap.H 7903 2010-11-28 21:06:39Z matt $". | |||
| // | |||
| @@ -0,0 +1,104 @@ | |||
| // | |||
| // "$Id: Fl_Plugin.H 6995 2010-01-12 08:48:55Z matt $" | |||
| // | |||
| // A Plugin system for FLTK, implemented in Fl_Preferences.cxx. | |||
| // | |||
| // Copyright 2002-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Plugin class . */ | |||
| #ifndef Fl_Plugin_H | |||
| # define Fl_Plugin_H | |||
| # include "Fl_Preferences.H" | |||
| /** | |||
| \brief Fl_Plugin allows link-time and run-time integration of binary modules. | |||
| Fl_Plugin and Fl_Plugin_Manager provide a small and simple solution for | |||
| linking C++ classes at run-time, or optionally linking modules at compile | |||
| time without the need to change the main application. | |||
| Fl_Plugin_Manager uses static initialisation to create the plugin interface | |||
| early during startup. Plugins are stored in a temporary database, organized | |||
| in classes. | |||
| Plugins should derive a new class from Fl_Plugin as a base: | |||
| \code | |||
| class My_Plugin : public Fl_Plugin { | |||
| public: | |||
| My_Plugin() : Fl_Plugin("effects", "blur") { } | |||
| void do_something(...); | |||
| }; | |||
| My_Plugin blur_plugin(); | |||
| \endcode | |||
| Plugins can be put into modules and either linked before distribution, or loaded | |||
| from dynamically linkable files. An Fl_Plugin_Manager is used to list and | |||
| access all currently loaded plugins. | |||
| \code | |||
| Fl_Plugin_Manager mgr("effects"); | |||
| int i, n = mgr.plugins(); | |||
| for (i=0; i<n; i++) { | |||
| My_Plugin *pin = (My_Plugin*)mgr.plugin(i); | |||
| pin->do_something(); | |||
| } | |||
| \endcode | |||
| */ | |||
| class FL_EXPORT Fl_Plugin { | |||
| Fl_Preferences::ID id; | |||
| public: | |||
| Fl_Plugin(const char *klass, const char *name); | |||
| virtual ~Fl_Plugin(); | |||
| }; | |||
| /** | |||
| \brief Fl_Plugin_Manager manages link-time and run-time plugin binaries. | |||
| \see Fl_Plugin | |||
| */ | |||
| class FL_EXPORT Fl_Plugin_Manager : public Fl_Preferences { | |||
| public: | |||
| Fl_Plugin_Manager(const char *klass); | |||
| ~Fl_Plugin_Manager(); | |||
| /** \brief Return the number of plugins in the klass. | |||
| */ | |||
| int plugins() { return groups(); } | |||
| Fl_Plugin *plugin(int index); | |||
| Fl_Plugin *plugin(const char *name); | |||
| Fl_Preferences::ID addPlugin(const char *name, Fl_Plugin *plugin); | |||
| static void removePlugin(Fl_Preferences::ID id); | |||
| static int load(const char *filename); | |||
| static int loadAll(const char *filepath, const char *pattern=0); | |||
| }; | |||
| #endif // !Fl_Preferences_H | |||
| // | |||
| // End of "$Id: Fl_Preferences.H 6995 2010-01-12 08:48:55Z matt $". | |||
| // | |||
| @@ -0,0 +1,103 @@ | |||
| // | |||
| // "$Id: Fl_Positioner.H 7981 2010-12-08 23:53:04Z greg.ercolano $" | |||
| // | |||
| // Positioner header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Positioner widget . */ | |||
| #ifndef Fl_Positioner_H | |||
| #define Fl_Positioner_H | |||
| #ifndef Fl_Widget_H | |||
| #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.png </P> | |||
| \image latex positioner.png " Fl_Positioner" width=4cm | |||
| */ | |||
| class FL_EXPORT Fl_Positioner : public Fl_Widget { | |||
| double xmin, ymin; | |||
| double xmax, ymax; | |||
| double xvalue_, yvalue_; | |||
| double xstep_, ystep_; | |||
| 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(); | |||
| 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;} | |||
| /** Same as ybounds(a, ymaximum()) */ | |||
| void yminimum(double a) {ybounds(a, ymax);} | |||
| /** Gets the Y axis maximum */ | |||
| double ymaximum() const {return ymax;} | |||
| /** 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 7981 2010-12-08 23:53:04Z greg.ercolano $". | |||
| // | |||
| @@ -0,0 +1,253 @@ | |||
| // | |||
| // "$Id: Fl_PostScript.H 8699 2011-05-20 16:39:06Z manolo $" | |||
| // | |||
| // Support for graphics output to PostScript file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 2010-2011 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /** \file Fl_PostScript.H | |||
| \brief declaration of classes Fl_PostScript_Graphics_Driver, Fl_PostScript_File_Device. | |||
| */ | |||
| #ifndef Fl_PostScript_H | |||
| #define Fl_PostScript_H | |||
| #include <FL/Fl_Paged_Device.H> | |||
| #include <FL/fl_draw.H> | |||
| /** | |||
| \brief PostScript graphical backend. | |||
| * | |||
| PostScript text uses vectorial fonts for the latin alphabet (exactly: all unicode | |||
| characters between U+0020 and U+017F, that is, ASCII, Latin-1 Supplement and Latin Extended-A charts) | |||
| plus a few other characters: | |||
| <table> | |||
| <tr> <th>Char</th><th>Codepoint</th><th>Name</th> <th>Char</th><th>Codepoint</th><th>Name</th> <th>Char</th><th>Codepoint</th><th>Name</th></tr> | |||
| <tr><td>ƒ</td><td>U+0192</td><td>florin</td><td>‚</td><td>U+201A</td><td>quotesinglbase</td><td>™</td><td>U+2122</td><td>trademark</td></tr> | |||
| <tr><td>ˆ</td><td>U+02C6</td><td>circumflex</td><td>“</td><td>U+201C</td><td>quotedblleft</td><td>∂</td><td>U+2202</td><td>partialdiff</td></tr> | |||
| <tr><td>ˇ</td><td>U+02C7</td><td>caron</td><td>”</td><td>U+201D</td><td>quotedblright</td><td>Δ</td><td>U+2206</td><td>Delta</td></tr> | |||
| <tr><td>˘</td><td>U+02D8</td><td>breve</td><td>„</td><td>U+201E</td><td>quotedblbase</td><td>∑</td><td>U+2211</td><td>summation</td></tr> | |||
| <tr><td>˙</td><td>U+02D9</td><td>dotaccent</td><td>†</td><td>U+2020</td><td>dagger</td><td>√</td><td>U+221A</td><td>radical</td></tr> | |||
| <tr><td>˚</td><td>U+02DA</td><td>ring</td><td>‡</td><td>U+2021</td><td>daggerdbl</td><td>∞</td><td>U+221E</td><td>infinity</td></tr> | |||
| <tr><td>˛</td><td>U+02DB</td><td>ogonek</td><td>•</td><td>U+2022</td><td>bullet</td><td>≠</td><td>U+2260</td><td>notequal</td></tr> | |||
| <tr><td>˜</td><td>U+02DC</td><td>tilde</td><td>…</td><td>U+2026</td><td>ellipsis</td><td>≤</td><td>U+2264</td><td>lessequal</td></tr> | |||
| <tr><td>˝</td><td>U+02DD</td><td>hungarumlaut</td><td>‰</td><td>U+2030</td><td>perthousand</td><td>≥</td><td>U+2265</td><td>greaterequal</td></tr> | |||
| <tr><td>–</td><td>U+2013</td><td>endash</td><td>‹</td><td>U+2039</td><td>guilsinglleft</td><td>◊</td><td>U+25CA</td><td>lozenge</td></tr> | |||
| <tr><td>—</td><td>U+2014</td><td>emdash</td><td>›</td><td>U+203A</td><td>guilsinglright</td><td>fi</td><td>U+FB01</td><td>fi</td></tr> | |||
| <tr><td>‘</td><td>U+2018</td><td>quoteleft</td><td>/</td><td>U+2044</td><td>fraction</td><td>fl</td><td>U+FB02</td><td>fl</td></tr> | |||
| <tr><td>’</td><td>U+2019</td><td>quoteright</td><td>€</td><td>U+20AC</td><td>Euro</td><td></td><td>U+F8FF</td><td>apple (Mac OS only)</td></tr> | |||
| </table> | |||
| <br> All other unicode characters are output as a bitmap. | |||
| <br> FLTK standard fonts are output using PostScript standard fonts: Helvetica, Courier, | |||
| Times (and their bold, oblique, italic variants). | |||
| */ | |||
| class FL_EXPORT Fl_PostScript_Graphics_Driver : public Fl_Graphics_Driver { | |||
| public: | |||
| static const char *class_id; | |||
| const char *class_name() {return class_id;}; | |||
| Fl_PostScript_Graphics_Driver(); | |||
| #ifndef FL_DOXYGEN | |||
| enum SHAPE{NONE=0, LINE, LOOP, POLYGON, POINTS}; | |||
| class Clip { | |||
| public: | |||
| int x, y, w, h; | |||
| Clip *prev; | |||
| }; | |||
| Clip * clip_; | |||
| int lang_level_; | |||
| int gap_; | |||
| int pages_; | |||
| double width_; | |||
| double height_; | |||
| int shape_; | |||
| int linewidth_;// need for clipping, lang level 1-2 | |||
| int linestyle_;// | |||
| int interpolate_; //interpolation of images | |||
| unsigned char cr_,cg_,cb_; | |||
| char linedash_[256];//should be enough | |||
| void concat(); // transform ror scalable dradings... | |||
| void reconcat(); //invert | |||
| void recover(); //recovers the state after grestore (such as line styles...) | |||
| void reset(); | |||
| uchar * mask; | |||
| int mx; // width of mask; | |||
| int my; // mask lines | |||
| //Fl_Color bg_; | |||
| int (*close_cmd_)(FILE *); | |||
| int page_policy_; | |||
| int nPages; | |||
| int orientation_; | |||
| float scale_x; | |||
| float scale_y; | |||
| float angle; | |||
| int left_margin; | |||
| int top_margin; | |||
| FILE *output; | |||
| double pw_, ph_; | |||
| uchar bg_r, bg_g, bg_b; | |||
| int start_postscript (int pagecount, enum Fl_Paged_Device::Page_Format format, enum Fl_Paged_Device::Page_Layout layout); | |||
| /* int alpha_mask(const uchar * data, int w, int h, int D, int LD=0); | |||
| */ | |||
| void transformed_draw(const char* s, int n, double x, double y); //precise text placing | |||
| void transformed_draw(const char* s, double x, double y); | |||
| int alpha_mask(const uchar * data, int w, int h, int D, int LD=0); | |||
| enum Fl_Paged_Device::Page_Format page_format_; | |||
| char *ps_filename_; | |||
| void page_policy(int p); | |||
| int page_policy(){return page_policy_;}; | |||
| void close_command( int (*cmd)(FILE *)){close_cmd_=cmd;}; | |||
| FILE * file() {return output;}; | |||
| //void orientation (int o); | |||
| //Fl_PostScript_Graphics_Driver(FILE *o, int lang_level, int pages = 0); // ps (also multi-page) constructor | |||
| //Fl_PostScript_Graphics_Driver(FILE *o, int lang_level, int x, int y, int w, int h); //eps constructor | |||
| void interpolate(int i){interpolate_=i;}; | |||
| int interpolate(){return interpolate_;} | |||
| void page(double pw, double ph, int media = 0); | |||
| void page(int format); | |||
| #endif // FL_DOXYGEN | |||
| // implementation of drawing methods | |||
| void color(Fl_Color c); | |||
| void color(uchar r, uchar g, uchar b); | |||
| void push_clip(int x, int y, int w, int h); | |||
| int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H); | |||
| int not_clipped(int x, int y, int w, int h); | |||
| void push_no_clip(); | |||
| void pop_clip(); | |||
| void line_style(int style, int width=0, char* dashes=0); | |||
| void rect(int x, int y, int w, int h); | |||
| void rectf(int x, int y, int w, int h); | |||
| void xyline(int x, int y, int x1); | |||
| void xyline(int x, int y, int x1, int y2); | |||
| void xyline(int x, int y, int x1, int y2, int x3); | |||
| void yxline(int x, int y, int y1); | |||
| void yxline(int x, int y, int y1, int x2); | |||
| void yxline(int x, int y, int y1, int x2, int y3); | |||
| void line(int x1, int y1, int x2, int y2); | |||
| void line(int x1, int y1, int x2, int y2, int x3, int y3); | |||
| void loop(int x0, int y0, int x1, int y1, int x2, int y2); | |||
| void loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3); | |||
| void polygon(int x0, int y0, int x1, int y1, int x2, int y2); | |||
| void polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3); | |||
| void point(int x, int y); | |||
| void begin_points(); | |||
| void begin_line(); | |||
| void begin_loop(); | |||
| void begin_polygon(); | |||
| void vertex(double x, double y); | |||
| void curve(double x, double y, double x1, double y1, double x2, double y2, double x3, double y3); | |||
| void circle(double x, double y, double r); | |||
| void arc(double x, double y, double r, double start, double a); | |||
| void arc(int x, int y, int w, int h, double a1, double a2); | |||
| void pie(int x, int y, int w, int h, double a1, double a2); | |||
| void end_points(); | |||
| void end_line(); | |||
| void end_loop(); | |||
| void end_polygon(); | |||
| void begin_complex_polygon(){begin_polygon();}; | |||
| void gap(){gap_=1;}; | |||
| void end_complex_polygon(){end_polygon();}; | |||
| void transformed_vertex(double x, double y); | |||
| void draw_image(const uchar* d, int x,int y,int w,int h, int delta=3, int ldelta=0); | |||
| void draw_image_mono(const uchar* d, int x,int y,int w,int h, int delta=1, int ld=0); | |||
| void draw_image(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=3); | |||
| void draw_image_mono(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=1); | |||
| void draw(const char* s, int n, int x, int y) {transformed_draw(s,n,x,y); }; | |||
| #ifdef __APPLE__ | |||
| void draw(const char* s, int n, float x, float y) {transformed_draw(s,n,x,y); }; | |||
| #endif | |||
| void draw(int angle, const char *str, int n, int x, int y); | |||
| void rtl_draw(const char* s, int n, int x, int y); | |||
| void font(int face, int size); | |||
| double width(const char *, int); | |||
| void text_extents(const char *c, int n, int &dx, int &dy, int &w, int &h); | |||
| int height(); | |||
| int descent(); | |||
| void draw(Fl_Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy); | |||
| void draw(Fl_Bitmap * bitmap,int XP, int YP, int WP, int HP, int cx, int cy); | |||
| void draw(Fl_RGB_Image * rgb,int XP, int YP, int WP, int HP, int cx, int cy); | |||
| ~Fl_PostScript_Graphics_Driver(); | |||
| }; | |||
| /** | |||
| \brief To send graphical output to a PostScript file. | |||
| */ | |||
| class FL_EXPORT Fl_PostScript_File_Device : public Fl_Paged_Device { | |||
| #ifdef __APPLE__ | |||
| Fl_CGContextRef gc; | |||
| #endif | |||
| protected: | |||
| Fl_PostScript_Graphics_Driver *driver(); | |||
| public: | |||
| static const char *class_id; | |||
| const char *class_name() {return class_id;}; | |||
| Fl_PostScript_File_Device(); | |||
| ~Fl_PostScript_File_Device(); | |||
| int start_job(int pagecount, enum Fl_Paged_Device::Page_Format format = Fl_Paged_Device::A4, | |||
| enum Fl_Paged_Device::Page_Layout layout = Fl_Paged_Device::PORTRAIT); | |||
| int start_job(FILE *ps_output, int pagecount, enum Fl_Paged_Device::Page_Format format = Fl_Paged_Device::A4, | |||
| enum Fl_Paged_Device::Page_Layout layout = Fl_Paged_Device::PORTRAIT); | |||
| int start_page (void); | |||
| int printable_rect(int *w, int *h); | |||
| void margins(int *left, int *top, int *right, int *bottom); | |||
| void origin(int *x, int *y); | |||
| void origin(int x, int y); | |||
| void scale (float scale_x, float scale_y = 0.); | |||
| void rotate(float angle); | |||
| void translate(int x, int y); | |||
| void untranslate(void); | |||
| int end_page (void); | |||
| void end_job(void); | |||
| #ifdef __APPLE__ | |||
| void set_current() { fl_gc = gc; Fl_Paged_Device::set_current(); } | |||
| #endif | |||
| static const char *file_chooser_title; | |||
| }; | |||
| #endif // Fl_PostScript_H | |||
| // | |||
| // End of "$Id: Fl_PostScript.H 8699 2011-05-20 16:39:06Z manolo $" | |||
| // | |||
| @@ -0,0 +1,276 @@ | |||
| // | |||
| // "$Id: Fl_Preferences.H 7949 2010-12-05 00:38:16Z greg.ercolano $" | |||
| // | |||
| // Preferences . | |||
| // | |||
| // Copyright 2002-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Preferences class . */ | |||
| #ifndef Fl_Preferences_H | |||
| # define Fl_Preferences_H | |||
| # include <stdio.h> | |||
| # include "Fl_Export.H" | |||
| /** | |||
| \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 small 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: | |||
| /** | |||
| Define the scope of the preferences. | |||
| */ | |||
| enum Root { | |||
| SYSTEM=0, ///< Preferences are used system-wide | |||
| USER ///< Preferences apply only to the current user | |||
| }; | |||
| /** | |||
| Every Fl_Preferences-Group has a uniqe ID. | |||
| ID's can be retrieved from an Fl_Preferences-Group and can then be used | |||
| to create more Fl_Preference references to the same data set, as long as the | |||
| database remains open. | |||
| */ | |||
| typedef void *ID; | |||
| static const char *newUUID(); | |||
| 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 &parent, const char *group ); | |||
| Fl_Preferences( Fl_Preferences *parent, const char *group ); | |||
| Fl_Preferences( Fl_Preferences &parent, int groupIndex ); | |||
| Fl_Preferences( Fl_Preferences *parent, int groupIndex ); | |||
| Fl_Preferences(const Fl_Preferences&); | |||
| Fl_Preferences( ID id ); | |||
| virtual ~Fl_Preferences(); | |||
| /** Return an ID that can later be reused to open more references to this dataset. | |||
| */ | |||
| ID id() { return (ID)node; } | |||
| /** Remove the group with this ID from a database. | |||
| */ | |||
| static char remove(ID id_) { return ((Node*)id_)->remove(); } | |||
| /** Return the name of this entry. | |||
| */ | |||
| const char *name() { return node->name(); } | |||
| /** Return the the full path to this entry. | |||
| */ | |||
| const char *path() { return node->path(); } | |||
| int groups(); | |||
| const char *group( int num_group ); | |||
| char groupExists( const char *key ); | |||
| char deleteGroup( const char *group ); | |||
| char deleteAllGroups(); | |||
| int entries(); | |||
| const char *entry( int index ); | |||
| char entryExists( const char *key ); | |||
| char deleteEntry( const char *entry ); | |||
| char deleteAllEntries(); | |||
| char clear(); | |||
| char set( const char *entry, int value ); | |||
| char set( const char *entry, float value ); | |||
| char set( const char *entry, float value, int precision ); | |||
| char set( const char *entry, double value ); | |||
| 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, 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 ); | |||
| void flush(); | |||
| // 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; | |||
| }; | |||
| private: | |||
| Fl_Preferences() : node(0), rootNode(0) { } | |||
| Fl_Preferences &operator=(const Fl_Preferences&); | |||
| static char nameBuffer[128]; | |||
| static char uuidBuffer[40]; | |||
| static Fl_Preferences *runtimePrefs; | |||
| class RootNode; | |||
| class FL_EXPORT Node { // a node contains a list to all its entries | |||
| // and all means to manage the tree structure | |||
| Node *child_, *next_; | |||
| union { // these two are mutually exclusive | |||
| Node *parent_; // top_ bit clear | |||
| RootNode *root_; // top_ bit set | |||
| }; | |||
| char *path_; | |||
| Entry *entry_; | |||
| int nEntry_, NEntry_; | |||
| unsigned char dirty_:1; | |||
| unsigned char top_:1; | |||
| unsigned char indexed_:1; | |||
| // indexing routines | |||
| Node **index_; | |||
| int nIndex_, NIndex_; | |||
| void createIndex(); | |||
| void updateIndex(); | |||
| void deleteIndex(); | |||
| public: | |||
| static int lastEntrySet; | |||
| public: | |||
| Node( const char *path ); | |||
| ~Node(); | |||
| // node methods | |||
| int write( FILE *f ); | |||
| const char *name(); | |||
| const char *path() { return path_; } | |||
| Node *find( const char *path ); | |||
| Node *search( const char *path, int offset=0 ); | |||
| Node *childNode( int ix ); | |||
| Node *addChild( const char *path ); | |||
| void setParent( Node *parent ); | |||
| Node *parent() { return top_?0L:parent_; } | |||
| void setRoot(RootNode *r) { root_ = r; top_ = 1; } | |||
| RootNode *findRoot(); | |||
| char remove(); | |||
| char dirty(); | |||
| void deleteAllChildren(); | |||
| // entry methods | |||
| int nChildren(); | |||
| const char *child( int ix ); | |||
| void set( const char *name, const char *value ); | |||
| void set( const char *line ); | |||
| void add( const char *line ); | |||
| const char *get( const char *name ); | |||
| int getEntry( const char *name ); | |||
| char deleteEntry( const char *name ); | |||
| void deleteAllEntries(); | |||
| int nEntry() { return nEntry_; } | |||
| Entry &entry(int i) { return entry_[i]; } | |||
| }; | |||
| friend class Node; | |||
| class FL_EXPORT RootNode { // the root node manages file paths and basic reading and writing | |||
| Fl_Preferences *prefs_; | |||
| char *filename_; | |||
| char *vendor_, *application_; | |||
| public: | |||
| RootNode( Fl_Preferences *, Root root, const char *vendor, const char *application ); | |||
| RootNode( Fl_Preferences *, const char *path, const char *vendor, const char *application ); | |||
| RootNode( Fl_Preferences * ); | |||
| ~RootNode(); | |||
| int read(); | |||
| int write(); | |||
| char getPath( char *path, int pathlen ); | |||
| }; | |||
| friend class RootNode; | |||
| protected: | |||
| Node *node; | |||
| RootNode *rootNode; | |||
| }; | |||
| #endif // !Fl_Preferences_H | |||
| // | |||
| // End of "$Id: Fl_Preferences.H 7949 2010-12-05 00:38:16Z greg.ercolano $". | |||
| // | |||
| @@ -0,0 +1,214 @@ | |||
| // | |||
| // "$Id: Fl_Printer.H 8699 2011-05-20 16:39:06Z manolo $" | |||
| // | |||
| // Printing support for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /** \file Fl_Printer.H | |||
| \brief declaration of classes Fl_Printer, Fl_System_Printer and Fl_PostScript_Printer. | |||
| */ | |||
| #ifndef Fl_Printer_H | |||
| #define Fl_Printer_H | |||
| #include <FL/x.H> | |||
| #include <FL/Fl_Paged_Device.H> | |||
| #include <FL/fl_draw.H> | |||
| #include <FL/Fl_Pixmap.H> | |||
| #include <FL/Fl_RGB_Image.H> | |||
| #include <FL/Fl_Bitmap.H> | |||
| #include <stdio.h> | |||
| #if !(defined(__APPLE__) || defined(WIN32)) | |||
| #include <FL/Fl_PostScript.H> | |||
| #elif defined(WIN32) | |||
| #include <commdlg.h> | |||
| #endif | |||
| #if defined(__APPLE__) || defined(WIN32) || defined(FL_DOXYGEN) | |||
| /** | |||
| Print support under MSWindows and Mac OS. | |||
| Class Fl_System_Printer is implemented only on the MSWindows and Mac OS platforms. | |||
| It has no public constructor. | |||
| Use Fl_Printer instead that is cross-platform and has the same API. | |||
| */ | |||
| class Fl_System_Printer : public Fl_Paged_Device { | |||
| friend class Fl_Printer; | |||
| private: | |||
| /** \brief the printer's graphics context, if there's one, NULL otherwise */ | |||
| void *gc; | |||
| void set_current(void); | |||
| #ifdef __APPLE__ | |||
| float scale_x; | |||
| float scale_y; | |||
| float angle; // rotation angle in radians | |||
| Fl_PMPrintSession printSession; | |||
| Fl_PMPageFormat pageFormat; | |||
| Fl_PMPrintSettings printSettings; | |||
| #elif defined(WIN32) | |||
| int abortPrint; | |||
| PRINTDLG pd; | |||
| HDC hPr; | |||
| int prerr; | |||
| int left_margin; | |||
| int top_margin; | |||
| void absolute_printable_rect(int *x, int *y, int *w, int *h); | |||
| #endif | |||
| protected: | |||
| /** \brief The constructor */ | |||
| Fl_System_Printer(void); | |||
| public: | |||
| static const char *class_id; | |||
| const char *class_name() {return class_id;}; | |||
| int start_job(int pagecount, int *frompage = NULL, int *topage = NULL); | |||
| int start_page (void); | |||
| int printable_rect(int *w, int *h); | |||
| void margins(int *left, int *top, int *right, int *bottom); | |||
| void origin(int *x, int *y); | |||
| void origin(int x, int y); | |||
| void scale (float scale_x, float scale_y = 0.); | |||
| void rotate(float angle); | |||
| void translate(int x, int y); | |||
| void untranslate(void); | |||
| int end_page (void); | |||
| void end_job (void); | |||
| /** \brief The destructor */ | |||
| ~Fl_System_Printer(void); | |||
| }; // class Fl_System_Printer | |||
| #endif | |||
| #if !(defined(__APPLE__) || defined(WIN32) ) | |||
| /** | |||
| Print support under Unix/Linux. | |||
| Class Fl_PostScript_Printer is implemented only on the Unix/Linux platform. | |||
| It has no public constructor. | |||
| Use Fl_Printer instead that is cross-platform and has the same API. | |||
| */ | |||
| class Fl_PostScript_Printer : public Fl_PostScript_File_Device { | |||
| friend class Fl_Printer; | |||
| protected: | |||
| /** The constructor */ | |||
| Fl_PostScript_Printer(void) {}; | |||
| public: | |||
| static const char *class_id; | |||
| const char *class_name() {return class_id;}; | |||
| int start_job(int pages, int *firstpage = NULL, int *lastpage = NULL); | |||
| }; | |||
| #endif | |||
| /** | |||
| * \brief OS-independent print support. | |||
| * | |||
| Fl_Printer allows to use all FLTK drawing, color, text, and clip functions, and to have them operate | |||
| on printed page(s). There are two main, non exclusive, ways to use it. | |||
| <ul><li>Print any widget (standard, custom, Fl_Window, Fl_Gl_Window) as it appears | |||
| on screen, with optional translation, scaling and rotation. This is done by calling print_widget() | |||
| or print_window_part(). | |||
| <li>Use a series of FLTK graphics commands (e.g., font, text, lines, colors, clip, image) to | |||
| compose a page appropriately shaped for printing. | |||
| </ul> | |||
| In both cases, begin by start_job(), start_page(), printable_rect() and origin() calls | |||
| and finish by end_page() and end_job() calls. | |||
| <p><b>Platform specifics</b> | |||
| <ul> | |||
| <li>Unix/Linux platforms: | |||
| Class Fl_RGB_Image prints but loses its transparency if it has one. | |||
| See class Fl_PostScript_Graphics_Driver for a description of how UTF-8 strings appear in print. | |||
| Use the static public attributes of this class to set the print dialog to other languages | |||
| than English. For example, the "Printer:" dialog item Fl_Printer::dialog_printer can be set to French with: | |||
| \code | |||
| Fl_Printer::dialog_printer = "Imprimante:"; | |||
| \endcode | |||
| before creation of the Fl_Printer object. | |||
| Use Fl_PostScript_File_Device::file_chooser_title to customize the title of the file chooser dialog that opens | |||
| when using the "Print To File" option of the print dialog. | |||
| <li>MSWindows platform: Transparent Fl_RGB_Image 's don't print with exact transparency on most printers. | |||
| Fl_RGB_Image 's don't rotate() well. | |||
| A workaround is to use the print_window_part() call. | |||
| <li>Mac OS X platform: all graphics requests print as on display. | |||
| </ul> | |||
| */ | |||
| class FL_EXPORT Fl_Printer : public Fl_Paged_Device { | |||
| public: | |||
| static const char *class_id; | |||
| const char *class_name() {return class_id;}; | |||
| /** \brief The constructor */ | |||
| Fl_Printer(void); | |||
| int start_job(int pagecount, int *frompage = NULL, int *topage = NULL); | |||
| int start_page(void); | |||
| int printable_rect(int *w, int *h); | |||
| void margins(int *left, int *top, int *right, int *bottom); | |||
| void origin(int *x, int *y); | |||
| void origin(int x, int y); | |||
| void scale(float scale_x, float scale_y = 0.); | |||
| void rotate(float angle); | |||
| void translate(int x, int y); | |||
| void untranslate(void); | |||
| int end_page (void); | |||
| void end_job (void); | |||
| void print_widget(Fl_Widget* widget, int delta_x=0, int delta_y=0); | |||
| void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x=0, int delta_y=0); | |||
| void set_current(void); | |||
| Fl_Graphics_Driver* driver(void); | |||
| /** \brief The destructor */ | |||
| ~Fl_Printer(void); | |||
| /** \name These attributes are effective under the Xlib platform only. | |||
| \{ | |||
| */ | |||
| static const char *dialog_title; | |||
| static const char *dialog_printer; | |||
| static const char *dialog_range; | |||
| static const char *dialog_copies; | |||
| static const char *dialog_all; | |||
| static const char *dialog_pages; | |||
| static const char *dialog_from; | |||
| static const char *dialog_to; | |||
| static const char *dialog_properties; | |||
| static const char *dialog_copyNo; | |||
| static const char *dialog_print_button; | |||
| static const char *dialog_cancel_button; | |||
| static const char *dialog_print_to_file; | |||
| static const char *property_title; | |||
| static const char *property_pagesize; | |||
| static const char *property_mode; | |||
| static const char *property_use; | |||
| static const char *property_save; | |||
| static const char *property_cancel; | |||
| /** \} */ | |||
| private: | |||
| #if defined(WIN32) || defined(__APPLE__) | |||
| Fl_System_Printer *printer; | |||
| #else | |||
| Fl_PostScript_Printer *printer; | |||
| #endif | |||
| }; | |||
| #endif // Fl_Printer_H | |||
| // | |||
| // End of "$Id: Fl_Printer.H 8699 2011-05-20 16:39:06Z manolo $" | |||
| // | |||
| @@ -0,0 +1,81 @@ | |||
| // | |||
| // "$Id: Fl_Progress.H 8306 2011-01-24 17:04:22Z matt $" | |||
| // | |||
| // Progress bar widget definitions. | |||
| // | |||
| // Copyright 2000-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Progress widget . */ | |||
| #ifndef _Fl_Progress_H_ | |||
| # define _Fl_Progress_H_ | |||
| // | |||
| // Include necessary headers. | |||
| // | |||
| #include "Fl_Widget.H" | |||
| // | |||
| // Progress class... | |||
| // | |||
| /** | |||
| Displays a progress bar for the user. | |||
| */ | |||
| class FL_EXPORT Fl_Progress : public Fl_Widget { | |||
| float value_, | |||
| minimum_, | |||
| maximum_; | |||
| protected: | |||
| virtual void draw(); | |||
| public: | |||
| 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 8306 2011-01-24 17:04:22Z matt $". | |||
| // | |||
| @@ -0,0 +1,35 @@ | |||
| // | |||
| // "$Id: Fl_RGB_Image.H 7903 2010-11-28 21:06:39Z matt $" | |||
| // | |||
| // RGB Image header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| #ifndef Fl_RGB_Image_H | |||
| # define Fl_RGB_Image_H | |||
| # include "Fl_Image.H" | |||
| #endif // !Fl_RGB_Image_H | |||
| // | |||
| // End of "$Id: Fl_RGB_Image.H 7903 2010-11-28 21:06:39Z matt $". | |||
| // | |||
| @@ -0,0 +1,46 @@ | |||
| // | |||
| // "$Id: Fl_Radio_Button.H 8022 2010-12-12 23:21:03Z AlbrechtS $" | |||
| // | |||
| // Radio button header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Radio_Button widget . */ | |||
| #ifndef Fl_Radio_Button_H | |||
| #define Fl_Radio_Button_H | |||
| #include "Fl_Button.H" | |||
| class FL_EXPORT Fl_Radio_Button : public Fl_Button { | |||
| public: | |||
| Fl_Radio_Button(int x,int y,int w,int h,const char *l=0) | |||
| : Fl_Button(x,y,w,h,l) {type(FL_RADIO_BUTTON);} | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Radio_Button.H 8022 2010-12-12 23:21:03Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,46 @@ | |||
| // | |||
| // "$Id: Fl_Radio_Light_Button.H 8022 2010-12-12 23:21:03Z AlbrechtS $" | |||
| // | |||
| // Radio light button header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Radio_Light_Button widget . */ | |||
| #ifndef Fl_Radio_Light_Button_H | |||
| #define Fl_Radio_Light_Button_H | |||
| #include "Fl_Light_Button.H" | |||
| class FL_EXPORT Fl_Radio_Light_Button : public Fl_Light_Button { | |||
| public: | |||
| Fl_Radio_Light_Button(int X,int Y,int W,int H,const char *l=0) | |||
| : Fl_Light_Button(X,Y,W,H,l) {type(FL_RADIO_BUTTON);} | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Radio_Light_Button.H 8022 2010-12-12 23:21:03Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,46 @@ | |||
| // | |||
| // "$Id: Fl_Radio_Round_Button.H 8022 2010-12-12 23:21:03Z AlbrechtS $" | |||
| // | |||
| // Radio round button header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Radio_Round_Button widget . */ | |||
| #ifndef Fl_Radio_Round_Button_H | |||
| #define Fl_Radio_Round_Button_H | |||
| #include "Fl_Round_Button.H" | |||
| class FL_EXPORT Fl_Radio_Round_Button : public Fl_Round_Button { | |||
| public: | |||
| Fl_Radio_Round_Button(int x,int y,int w,int h,const char *l=0) | |||
| : Fl_Round_Button(x,y,w,h,l) {type(FL_RADIO_BUTTON);} | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Radio_Round_Button.H 8022 2010-12-12 23:21:03Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,63 @@ | |||
| // | |||
| // "$Id: Fl_Repeat_Button.H 7903 2010-11-28 21:06:39Z matt $" | |||
| // | |||
| // Repeat button header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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() { | |||
| Fl::remove_timeout(repeat_callback,this); | |||
| Fl_Button::deactivate(); | |||
| } | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Repeat_Button.H 7903 2010-11-28 21:06:39Z matt $". | |||
| // | |||
| @@ -0,0 +1,60 @@ | |||
| // | |||
| // "$Id: Fl_Return_Button.H 7981 2010-12-08 23:53:04Z greg.ercolano $" | |||
| // | |||
| // Return button header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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.png | |||
| \image latex Fl_Return_Button.png "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) {} | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Return_Button.H 7981 2010-12-08 23:53:04Z greg.ercolano $". | |||
| // | |||
| @@ -0,0 +1,56 @@ | |||
| // | |||
| // "$Id: Fl_Roller.H 7981 2010-12-08 23:53:04Z greg.ercolano $" | |||
| // | |||
| // Roller header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // http://www.fltk.org/str.php | |||
| // | |||
| /* \file | |||
| Fl_Roller widget . */ | |||
| #ifndef Fl_Roller_H | |||
| #define Fl_Roller_H | |||
| #ifndef Fl_Valuator_H | |||
| #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.png | |||
| \image latex Fl_Roller.png "Fl_Roller" width=4cm | |||
| */ | |||
| class FL_EXPORT Fl_Roller : public Fl_Valuator { | |||
| protected: | |||
| void draw(); | |||
| public: | |||
| int handle(int); | |||
| Fl_Roller(int X,int Y,int W,int H,const char* L=0); | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Roller.H 7981 2010-12-08 23:53:04Z greg.ercolano $". | |||
| // | |||
| @@ -0,0 +1,57 @@ | |||
| // | |||
| // "$Id: Fl_Round_Button.H 7981 2010-12-08 23:53:04Z greg.ercolano $" | |||
| // | |||
| // Round button header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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.png</P> | |||
| \image latex Fl_Round_Button.png " 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); | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Round_Button.H 7981 2010-12-08 23:53:04Z greg.ercolano $". | |||
| // | |||
| @@ -0,0 +1,48 @@ | |||
| // | |||
| // "$Id: Fl_Round_Clock.H 8022 2010-12-12 23:21:03Z AlbrechtS $" | |||
| // | |||
| // Round clock header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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_EXPORT 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);} | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Round_Clock.H 8022 2010-12-12 23:21:03Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,199 @@ | |||
| // | |||
| // "$Id: Fl_Scroll.H 7981 2010-12-08 23:53:04Z greg.ercolano $" | |||
| // | |||
| // Scroll header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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: | |||
| \image html Fl_Scroll.png | |||
| \image latex Fl_Scroll.png "Fl_Scroll" width=4cm | |||
| 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 arrangement 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. | |||
| By default you can scroll in both directions, and the scrollbars | |||
| disappear if the data will fit in the area of the scroll. | |||
| 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> | |||
| Use <B> scrollbar.align(int) ( see void Fl_Widget::align(Fl_Align) ) :</B> | |||
| to change what side the scrollbars are drawn on. | |||
| 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. | |||
| 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 its drawing. | |||
| To speed up drawing it should test fl_push_clip(). | |||
| Another very useful child is a single Fl_Pack, which is itself a group | |||
| that packs its 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. | |||
| 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. | |||
| <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_; | |||
| int oldx, oldy; | |||
| int scrollbar_size_; | |||
| static void hscrollbar_cb(Fl_Widget*, void*); | |||
| static void scrollbar_cb(Fl_Widget*, void*); | |||
| void fix_scrollbar_order(); | |||
| static void draw_clip(void*,int,int,int,int); | |||
| private: | |||
| // | |||
| // Structure to manage scrollbar and widget interior sizes. | |||
| // | |||
| // Private for now -- we'd like to expose some of this at | |||
| // some point to solve STR#1895.) | |||
| // | |||
| typedef struct { | |||
| int scrollsize; // the scrollsize (global|local) | |||
| int innerbox_x, innerbox_y, innerbox_w, innerbox_h; // widget's inner box (excludes scrollbars) | |||
| int innerchild_x, innerchild_y, innerchild_w, innerchild_h; // widget's inner box including scrollbars | |||
| int child_l, child_r, child_b, child_t; // child bounding box: left/right/bottom/top | |||
| int hneeded, vneeded; // hor + ver scrollbar visibility | |||
| int hscroll_x, hscroll_y, hscroll_w, hscroll_h; // hor scrollbar size/position | |||
| int vscroll_x, vscroll_y, vscroll_w, vscroll_h; // ver scrollbar size/position | |||
| int hpos, hsize, hfirst, htotal; // hor scrollbar values (pos/size/first/total) | |||
| int vpos, vsize, vfirst, vtotal; // ver scrollbar values (pos/size/first/total) | |||
| } ScrollInfo; | |||
| void recalc_scrollbars(ScrollInfo &si); | |||
| protected: | |||
| void bbox(int&,int&,int&,int&); | |||
| void draw(); | |||
| public: | |||
| Fl_Scrollbar scrollbar; | |||
| Fl_Scrollbar hscrollbar; | |||
| void resize(int,int,int,int); | |||
| int handle(int); | |||
| Fl_Scroll(int X,int Y,int W,int H,const char*l=0); | |||
| enum { // values for type() | |||
| HORIZONTAL = 1, | |||
| VERTICAL = 2, | |||
| BOTH = 3, | |||
| ALWAYS_ON = 4, | |||
| HORIZONTAL_ALWAYS = 5, | |||
| VERTICAL_ALWAYS = 6, | |||
| 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 scroll_to(int, int); | |||
| void clear(); | |||
| /** | |||
| 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) { | |||
| if ( size != scrollbar_size_ ) redraw(); | |||
| scrollbar_size_ = size; | |||
| } | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Scroll.H 7981 2010-12-08 23:53:04Z greg.ercolano $". | |||
| // | |||
| @@ -0,0 +1,120 @@ | |||
| // | |||
| // "$Id: Fl_Scrollbar.H 7981 2010-12-08 23:53:04Z greg.ercolano $" | |||
| // | |||
| // Scroll bar header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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.png | |||
| \image latex scrollbar.png "Fl_Scrollbar" width=4cm | |||
| */ | |||
| class FL_EXPORT Fl_Scrollbar : public Fl_Slider { | |||
| int linesize_; | |||
| int pushed_; | |||
| static void timeout_cb(void*); | |||
| void increment_cb(); | |||
| protected: | |||
| void draw(); | |||
| public: | |||
| Fl_Scrollbar(int X,int Y,int W,int H, const char *L = 0); | |||
| ~Fl_Scrollbar(); | |||
| int handle(int); | |||
| /** | |||
| 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;} | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Scrollbar.H 7981 2010-12-08 23:53:04Z greg.ercolano $". | |||
| // | |||
| @@ -0,0 +1,64 @@ | |||
| // | |||
| // "$Id: Fl_Secret_Input.H 8726 2011-05-23 18:32:47Z AlbrechtS $" | |||
| // | |||
| // Secret input header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2011 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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 placeholders. Depending on the platform this | |||
| placeholder is either the asterisk ('*') or the Unicode bullet | |||
| character (U+2022). | |||
| This subclass is usually used to receive passwords and other "secret" information. | |||
| */ | |||
| class FL_EXPORT Fl_Secret_Input : public Fl_Input { | |||
| public: | |||
| /** | |||
| Creates a new Fl_Secret_Input widget using the given | |||
| position, size, and label string. The default boxtype is FL_DOWN_BOX. | |||
| Inherited destructor destroys the widget and any value associated with it. | |||
| */ | |||
| #if defined(FL_DLL) // implementation in src/Fl_Input.cxx | |||
| Fl_Secret_Input(int X,int Y,int W,int H,const char *l = 0); | |||
| #else | |||
| 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 | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Secret_Input.H 8726 2011-05-23 18:32:47Z AlbrechtS $". | |||
| // | |||
| @@ -0,0 +1,64 @@ | |||
| // | |||
| // "$Id: Fl_Select_Browser.H 8736 2011-05-24 20:00:56Z AlbrechtS $" | |||
| // | |||
| // Select browser header file for the Fast Light Tool Kit (FLTK). | |||
| // | |||
| // Copyright 1998-2010 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 | |||
| // License as published by the Free Software Foundation; either | |||
| // version 2 of the License, or (at your option) any later version. | |||
| // | |||
| // This library is distributed in the hope that it will be useful, | |||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
| // Library General Public License for more details. | |||
| // | |||
| // You should have received a copy of the GNU Library General Public | |||
| // License along with this library; if not, write to the Free Software | |||
| // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |||
| // USA. | |||
| // | |||
| // Please report all bugs and problems on the following page: | |||
| // | |||
| // 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_EXPORT Fl_Select_Browser : public Fl_Browser { | |||
| public: | |||
| /** | |||
| 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. | |||
| */ | |||
| #if defined(FL_DLL) // implementation in src/Fl_Browser.cxx | |||
| Fl_Select_Browser(int X,int Y,int W,int H,const char *L=0); | |||
| #else | |||
| 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 | |||
| }; | |||
| #endif | |||
| // | |||
| // End of "$Id: Fl_Select_Browser.H 8736 2011-05-24 20:00:56Z AlbrechtS $". | |||
| // | |||