mirror of
https://github.com/fltk/fltk.git
synced 2026-06-07 09:13:58 +08:00
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8217 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
The initial FLTK 1.3 is based on the final 1.1.8.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,61 @@
|
||||
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
|
||||
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)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,82 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$".
|
||||
//
|
||||
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$".
|
||||
//
|
||||
@@ -0,0 +1,85 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$".
|
||||
//
|
||||
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$".
|
||||
//
|
||||
@@ -0,0 +1,324 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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 . */
|
||||
|
||||
// Forms-compatable 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$".
|
||||
//
|
||||
@@ -0,0 +1,378 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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 { return 0L; }
|
||||
/**
|
||||
This optional method should be provided by the subclass
|
||||
to efficiently swap browser items \p a and \p b, such as for sorting.
|
||||
\param[in] a,b The two items to be swapped.
|
||||
*/
|
||||
virtual void item_swap(void *a,void *b) { }
|
||||
/**
|
||||
This method must be provided by the subclass
|
||||
to return the item for the specified \p index.
|
||||
\param[in] index The \p index of the item to be returned
|
||||
\returns The item at the specified \p index.
|
||||
*/
|
||||
virtual void *item_at(int index) const { return 0L; }
|
||||
// you don't have to provide these but it may help speed it up:
|
||||
virtual int full_width() const ; // current width of all items
|
||||
virtual int full_height() const ; // current height of all items
|
||||
virtual int incr_height() const ; // average height of an item
|
||||
// These only need to be done by subclass if you want a multi-browser:
|
||||
virtual void item_select(void *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$".
|
||||
//
|
||||
@@ -0,0 +1,180 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$".
|
||||
//
|
||||
@@ -0,0 +1,97 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$" .
|
||||
//
|
||||
@@ -0,0 +1,92 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$" .
|
||||
//
|
||||
@@ -0,0 +1,160 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$".
|
||||
//
|
||||
@@ -0,0 +1,122 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$".
|
||||
//
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$".
|
||||
//
|
||||
@@ -0,0 +1,108 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$".
|
||||
//
|
||||
@@ -0,0 +1,137 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$".
|
||||
//
|
||||
@@ -0,0 +1,199 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$".
|
||||
//
|
||||
@@ -0,0 +1,124 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$".
|
||||
//
|
||||
@@ -0,0 +1,426 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// Definition of classes Fl_Device, Fl_Graphics_Driver, Fl_Surface_Device, Fl_Display_Device
|
||||
// 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_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/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_Display_Device;
|
||||
class Fl_Surface_Device;
|
||||
/** \brief Points to the driver that currently receives all graphics requests */
|
||||
FL_EXPORT extern Fl_Graphics_Driver *fl_graphics_driver;
|
||||
/** \brief Points to the surface that currently receives all graphics requests */
|
||||
FL_EXPORT extern Fl_Surface_Device *fl_surface;
|
||||
/** \brief Points to the platform's display */
|
||||
FL_EXPORT extern Fl_Display_Device *fl_display_device;
|
||||
|
||||
/**
|
||||
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);
|
||||
|
||||
/**
|
||||
\brief All graphical output devices and all graphics systems.
|
||||
*/
|
||||
class FL_EXPORT Fl_Device {
|
||||
private:
|
||||
const char *type_; // pointer to class name
|
||||
protected:
|
||||
/** \brief Sets the class name */
|
||||
inline void class_name(const char *name) { type_ = name;};
|
||||
/** \brief 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;
|
||||
public:
|
||||
/**
|
||||
\brief 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
|
||||
*/
|
||||
inline const char *class_name() {return type_;};
|
||||
};
|
||||
|
||||
/**
|
||||
\brief A virtual class subclassed for each graphics driver FLTK uses.
|
||||
*
|
||||
The protected 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 {
|
||||
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 class Fl_PostScript_Graphics_Driver;
|
||||
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);
|
||||
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_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);
|
||||
|
||||
/** \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) {};
|
||||
/** \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) {};
|
||||
/** \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) {};
|
||||
/** \brief see fl_font(Fl_Font face, Fl_Fontsize size). */
|
||||
virtual void font(Fl_Font face, Fl_Fontsize size) {};
|
||||
/** \brief see fl_color(Fl_Color c). */
|
||||
virtual void color(Fl_Color c) {};
|
||||
/** \brief see fl_color(uchar r, uchar g, uchar b). */
|
||||
virtual void color(uchar r, uchar g, uchar b) {};
|
||||
/** \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();
|
||||
// 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) {};
|
||||
/** \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) {};
|
||||
/** \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) {};
|
||||
/** \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) {};
|
||||
// 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) {};
|
||||
/** \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) {};
|
||||
/** \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) {};
|
||||
|
||||
public:
|
||||
static const char *class_id;
|
||||
/** \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:
|
||||
/** \brief The constructor. */
|
||||
Fl_Quartz_Graphics_Driver() { class_name( class_id); };
|
||||
static const char *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);
|
||||
};
|
||||
#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:
|
||||
/** \brief The constructor. */
|
||||
Fl_GDI_Graphics_Driver() { class_name ( class_id); };
|
||||
static const char *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);
|
||||
};
|
||||
#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:
|
||||
/** \brief The constructor. */
|
||||
Fl_Xlib_Graphics_Driver() { class_name ( class_id); };
|
||||
static const char *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);
|
||||
};
|
||||
#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;
|
||||
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;
|
||||
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 Fl_Surface_Device *surface() {return fl_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 {
|
||||
public:
|
||||
static const char *class_id;
|
||||
/** \brief A constructor that sets the graphics driver used by the display */
|
||||
Fl_Display_Device(Fl_Graphics_Driver *graphics_driver) : Fl_Surface_Device( graphics_driver) { class_name( class_id); };
|
||||
/**
|
||||
@brief Returns the platform's display device.
|
||||
*/
|
||||
static Fl_Display_Device *display_device() { return fl_display_device; };
|
||||
};
|
||||
|
||||
/**
|
||||
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) { return 0; }
|
||||
};
|
||||
|
||||
#endif // Fl_Device_H
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
//
|
||||
@@ -0,0 +1,97 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$".
|
||||
//
|
||||
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$".
|
||||
//
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
*
|
||||
* 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$".
|
||||
*/
|
||||
@@ -0,0 +1,120 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$".
|
||||
//
|
||||
@@ -0,0 +1,235 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// Fl_File_Chooser 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
|
||||
//
|
||||
|
||||
// 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*);
|
||||
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(); };
|
||||
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;
|
||||
/**
|
||||
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_File_Browser *browser(void) {return fileList; };
|
||||
};
|
||||
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$".
|
||||
//
|
||||
@@ -0,0 +1,168 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$".
|
||||
//
|
||||
@@ -0,0 +1,104 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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 that 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 loosing focus (see FL_UNFOCUS) to update its state like its cursor shape.
|
||||
One resulting side effect is that you should call clear_changed() early in your callback
|
||||
to avoid reentrant calls if you plan to show another window or dialog box in the callback.
|
||||
*/
|
||||
class FL_EXPORT Fl_File_Input : public Fl_Input
|
||||
{
|
||||
Fl_Color errorcolor_;
|
||||
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$".
|
||||
//
|
||||
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$".
|
||||
//
|
||||
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$".
|
||||
//
|
||||
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// Floating point 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_Float_Input widget . */
|
||||
|
||||
|
||||
#ifndef Fl_Float_Input_H
|
||||
#define Fl_Float_Input_H
|
||||
|
||||
#include "Fl_Input.H"
|
||||
|
||||
/**
|
||||
The Fl_Float_Input class is a subclass of Fl_Input
|
||||
that only allows the user to type floating point numbers (sign,
|
||||
digits, decimal point, more digits, 'E' or 'e', sign, digits).
|
||||
*/
|
||||
class Fl_Float_Input : public Fl_Input { // don't use FL_EXPORT here !
|
||||
public:
|
||||
/**
|
||||
Creates a new Fl_Float_Input widget using the given position,
|
||||
size, and label string. The default boxtype is FL_DOWN_BOX.
|
||||
<P> Inherited destructor destroys the widget and any value associated with it
|
||||
*/
|
||||
Fl_Float_Input(int X,int Y,int W,int H,const char *l = 0)
|
||||
: Fl_Input(X,Y,W,H,l) {type(FL_FLOAT_INPUT);}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
//
|
||||
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$".
|
||||
//
|
||||
@@ -0,0 +1,63 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$".
|
||||
//
|
||||
@@ -0,0 +1,89 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$".
|
||||
//
|
||||
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$".
|
||||
//
|
||||
@@ -0,0 +1,240 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$".
|
||||
//
|
||||
@@ -0,0 +1,230 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$".
|
||||
//
|
||||
@@ -0,0 +1,95 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$".
|
||||
//
|
||||
@@ -0,0 +1,399 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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_Help_Font_Style {
|
||||
Fl_Font f; ///< Font
|
||||
Fl_Fontsize s; ///< Font Size
|
||||
Fl_Color c; ///< Font Color
|
||||
void get(Fl_Font &afont, Fl_Fontsize &asize, Fl_Color &acolor) {afont=f; asize=s; acolor=c;} ///< Gets current font attributes
|
||||
void set(Fl_Font afont, Fl_Fontsize asize, Fl_Color acolor) {f=afont; s=asize; c=acolor;} ///< Sets current font attributes
|
||||
Fl_Help_Font_Style(Fl_Font afont, Fl_Fontsize asize, Fl_Color acolor) {set(afont, asize, acolor);}
|
||||
Fl_Help_Font_Style(){} // For in table use
|
||||
};
|
||||
|
||||
/** Fl_Help_View font stack definition. */
|
||||
const size_t MAX_FL_HELP_FS_ELTS = 100;
|
||||
|
||||
struct Fl_Help_Font_Stack {
|
||||
/** font stack construction, initialize attributes. */
|
||||
Fl_Help_Font_Stack() {
|
||||
nfonts_ = 0;
|
||||
}
|
||||
|
||||
void init(Fl_Font f, Fl_Fontsize s, Fl_Color c) {
|
||||
nfonts_ = 0;
|
||||
elts_[nfonts_].set(f, s, c);
|
||||
fl_font(f, s);
|
||||
fl_color(c);
|
||||
}
|
||||
/** Gets the top (current) element on the stack. */
|
||||
void top(Fl_Font &f, Fl_Fontsize &s, Fl_Color &c) { elts_[nfonts_].get(f, s, c); }
|
||||
/** Pushes the font style triplet on the stack, also calls fl_font() & fl_color() adequately */
|
||||
void push(Fl_Font f, Fl_Fontsize s, Fl_Color c) {
|
||||
if (nfonts_ < MAX_FL_HELP_FS_ELTS-1) nfonts_ ++;
|
||||
elts_[nfonts_].set(f, s, c);
|
||||
fl_font(f, s); fl_color(c);
|
||||
}
|
||||
/** Pops from the stack the font style triplet and calls fl_font() & fl_color() adequately */
|
||||
void pop(Fl_Font &f, Fl_Fontsize &s, Fl_Color &c) {
|
||||
if (nfonts_ > 0) nfonts_ --;
|
||||
top(f, s, c);
|
||||
fl_font(f, s); fl_color(c);
|
||||
}
|
||||
/** Gets the current count of font style elements in the stack. */
|
||||
size_t count() const {return nfonts_;} // Gets the current number of fonts in the stack
|
||||
|
||||
protected:
|
||||
size_t nfonts_; ///< current number of fonts in stack
|
||||
Fl_Help_Font_Style elts_[100]; ///< font elements
|
||||
};
|
||||
|
||||
/** Fl_Help_Target structure */
|
||||
|
||||
struct Fl_Help_Target
|
||||
{
|
||||
char name[32]; ///< Target name
|
||||
int y; ///< Y offset of target
|
||||
};
|
||||
|
||||
/**
|
||||
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$".
|
||||
//
|
||||
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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.
|
||||
*/
|
||||
Fl_Hold_Browser(int X,int Y,int W,int H,const char *l=0)
|
||||
: Fl_Browser(X,Y,W,H,l) {type(FL_HOLD_BROWSER);}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// End of "$Id$".
|
||||
//
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// "$Id$"
|
||||
//
|
||||
// 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$".
|
||||
//
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user