Fl_HelpDialog and Fl_HelpView widgets.

"help" demo.

Minor doco updates.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1539 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2001-08-02 19:43:49 +00:00
parent 80247acbc2
commit 9d81d971f7
14 changed files with 3967 additions and 26 deletions

54
FL/Fl_HelpDialog.H Normal file
View File

@ -0,0 +1,54 @@
// generated by Fast Light User Interface Designer (fluid) version 1.0100
#ifndef Fl_HelpDialog_H
#define Fl_HelpDialog_H
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <string.h>
#include <FL/Fl_HelpView.H>
#include <FL/Fl_Button.H>
class Fl_HelpDialog {
int index_;
int max_;
int line_[100];
char file_[100][256];
public:
Fl_HelpDialog();
private:
Fl_Window *window_;
Fl_HelpView *view_;
inline void cb_view__i(Fl_HelpView*, void*);
static void cb_view_(Fl_HelpView*, void*);
inline void cb_Close_i(Fl_Button*, void*);
static void cb_Close(Fl_Button*, void*);
Fl_Button *back_;
inline void cb_back__i(Fl_Button*, void*);
static void cb_back_(Fl_Button*, void*);
Fl_Button *forward_;
inline void cb_forward__i(Fl_Button*, void*);
static void cb_forward_(Fl_Button*, void*);
Fl_Button *smaller_;
inline void cb_smaller__i(Fl_Button*, void*);
static void cb_smaller_(Fl_Button*, void*);
Fl_Button *larger_;
inline void cb_larger__i(Fl_Button*, void*);
static void cb_larger_(Fl_Button*, void*);
public:
~Fl_HelpDialog();
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 textsize(uchar s);
uchar textsize();
void topline(const char *n);
void topline(int n);
int visible();
int w();
int x();
int y();
};
#endif

212
FL/Fl_HelpView.H Normal file
View File

@ -0,0 +1,212 @@
//
// "$Id: Fl_HelpView.H,v 1.1.2.1 2001/08/02 19:43:49 easysw Exp $"
//
// Help Viewer widget definitions.
//
// Copyright 1997-2001 by Easy Software Products.
// Image support donated by Matthias Melcher, Copyright 2000.
//
// 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 to "fltk-bugs@fltk.org".
//
#ifndef _Fl_HelpView_H_
# define _Fl_HelpView_H_
//
// Include necessary header files...
//
# include <stdio.h>
# include <FL/Fl.H>
# include <FL/Fl_Group.H>
# include <FL/Fl_Scrollbar.H>
# include <FL/fl_draw.H>
//
// Fl_HelpFunc type - link callback function for files...
//
typedef const char *(Fl_HelpFunc)(const char *);
//
// Fl_HelpBlock structure...
//
struct Fl_HelpBlock
{
const char *start, // Start of text
*end; // End of text
uchar font, // Text font
size, // Text size
border; // Draw border?
int x, // Indentation/starting X coordinate
y, // Starting Y coordinate
w, // Width
h; // Height
int line[32]; // Left starting position for each line
};
//
// Fl_HelpLink structure...
//
struct Fl_HelpLink
{
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_HelpTarget structure...
//
struct Fl_HelpTarget
{
char name[32]; // Target name
int y; // Y offset of target
};
//
// Fl_HelpImage structure...
//
struct Fl_Pixmap;
struct Fl_Image;
struct Fl_HelpImage
{
char *name, // Path and name of the image
wattr[8], // Width attribute
hattr[8]; // Height attribute
Fl_Image *image; // FLTK image representation
unsigned char *data; // Raw image data
int w, h, d; // Image size & depth
};
//
// Fl_HelpView class...
//
class Fl_HelpView : 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
uchar textfont_, // Default font for text
textsize_; // Default font size
const char *value_; // HTML text value
int nblocks_, // Number of blocks/paragraphs
ablocks_; // Allocated blocks
Fl_HelpBlock *blocks_; // Blocks
int nfonts_; // Number of fonts in stack
uchar fonts_[100][2]; // Font stack
Fl_HelpFunc *link_; // Link transform function
int nlinks_, // Number of links
alinks_; // Allocated links
Fl_HelpLink *links_; // Links
int ntargets_, // Number of targets
atargets_; // Allocated targets
Fl_HelpTarget *targets_; // Targets
char directory_[1024]; // Directory for current file
char filename_[1024]; // Current filename
int topline_, // Top line in document
size_; // Total document length
Fl_Scrollbar scrollbar_; // Vertical scrollbar for document
int nimage_, // Number of images in a page
aimage_; // Allocated blocks
Fl_HelpImage *image_; // list of image descriptors
Fl_HelpImage *add_image(const char *name, const char *wattr,
const char *hattr, int make = 1);
Fl_HelpImage *find_image(const char *name, const char *wattr,
const char *hattr);
int load_gif(Fl_HelpImage *img, FILE *fp);
int load_jpeg(Fl_HelpImage *img, FILE *fp);
int load_png(Fl_HelpImage *img, FILE *fp);
Fl_HelpBlock *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_HelpTarget *t0, const Fl_HelpTarget *t1);
int do_align(Fl_HelpBlock *block, int line, int xx, int a, int &l);
void draw();
void format();
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);
int handle(int);
void initfont(uchar &f, uchar &s) { nfonts_ = 0;
fl_font(f = fonts_[0][0] = textfont_,
s = fonts_[0][1] = textsize_); }
void pushfont(uchar f, uchar s) { if (nfonts_ < 99) nfonts_ ++;
fl_font(fonts_[nfonts_][0] = f,
fonts_[nfonts_][1] = s); }
void popfont(uchar &f, uchar &s) { if (nfonts_ > 0) nfonts_ --;
fl_font(f = fonts_[nfonts_][0],
s = fonts_[nfonts_][1]); }
public:
Fl_HelpView(int xx, int yy, int ww, int hh, const char *l = 0);
~Fl_HelpView();
const char *directory() const { if (directory_[0]) return (directory_);
else return ((const char *)0); }
const char *filename() const { if (filename_[0]) return (filename_);
else return ((const char *)0); }
void link(Fl_HelpFunc *fn) { link_ = fn; }
int load(const char *f);
void resize(int,int,int,int);
int size() const { return (size_); }
void textcolor(Fl_Color c) { if (textcolor_ == defcolor_) textcolor_ = c; defcolor_ = c; }
Fl_Color textcolor() const { return (defcolor_); }
void textfont(uchar f) { textfont_ = f; format(); }
uchar textfont() const { return (textfont_); }
void textsize(uchar s) { textsize_ = s; format(); }
uchar textsize() const { return (textsize_); }
const char *title() { return (title_); }
void topline(const char *n);
void topline(int);
int topline() const { return (topline_); }
void value(const char *v);
const char *value() const { return (value_); }
};
#endif // !_Fl_HelpView_H_
//
// End of "$Id: Fl_HelpView.H,v 1.1.2.1 2001/08/02 19:43:49 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
/* /*
* "$Id: configh.in,v 1.11.2.11 2001/04/30 17:17:01 easysw Exp $" * "$Id: configh.in,v 1.11.2.11.2.1 2001/08/02 19:43:49 easysw Exp $"
* *
* Configuration file for the Fast Light Tool Kit (FLTK). * Configuration file for the Fast Light Tool Kit (FLTK).
* @configure_input@ * @configure_input@
@ -177,5 +177,20 @@
#define USE_POLL 0 #define USE_POLL 0
/* /*
* End of "$Id: configh.in,v 1.11.2.11 2001/04/30 17:17:01 easysw Exp $". * Do we have various image libraries?
*/
#undef HAVE_LIBPNG
#undef HAVE_LIBZ
#undef HAVE_LIBJPEG
/*
* Do we have the png_get_valid() function?
*/
#undef HAVE_PNG_GET_VALID
/*
* End of "$Id: configh.in,v 1.11.2.11.2.1 2001/08/02 19:43:49 easysw Exp $".
*/ */

View File

@ -1,7 +1,7 @@
dnl -*- sh -*- dnl -*- sh -*-
dnl the "configure" script is made from this by running GNU "autoconf" dnl the "configure" script is made from this by running GNU "autoconf"
dnl dnl
dnl "$Id: configure.in,v 1.33.2.31.2.2 2001/08/02 18:15:44 easysw Exp $" dnl "$Id: configure.in,v 1.33.2.31.2.3 2001/08/02 19:43:49 easysw Exp $"
dnl dnl
dnl Configuration script for the Fast Light Tool Kit (FLTK). dnl Configuration script for the Fast Light Tool Kit (FLTK).
dnl dnl
@ -159,6 +159,36 @@ AC_CHECK_FUNCS(vsprintf)
AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H)) AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H))
AC_CHECK_FUNCS(strcasecmp) AC_CHECK_FUNCS(strcasecmp)
dnl Check for image libraries...
SAVELIBS="$LIBS"
IMAGELIBS=""
AC_SUBST(IMAGELIBS)
AC_CHECK_HEADER(jpeglib.h,
AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
AC_DEFINE(HAVE_LIBJPEG)
IMAGELIBS="$IMAGELIBS -ljpeg"))
AC_CHECK_HEADER(zlib.h,
AC_CHECK_LIB(z, gzopen,
AC_DEFINE(HAVE_LIBZ)
IMAGELIBS="$IMAGELIBS -lz"
LIBS="$LIBS -lz"))
dnl PNG library uses math library functions...
AC_CHECK_LIB(m, pow)
AC_CHECK_HEADER(png.h,
AC_CHECK_LIB(png, png_read_rows,
AC_DEFINE(HAVE_LIBPNG)
IMAGELIBS="-lpng -lm$IMAGELIBS"
LIBS="-lpng -lm $LIBS"
AC_CHECK_FUNCS(png_get_valid)))
dnl Restore original LIBS settings...
LIBS="$SAVELIBS"
dnl Check for X11... dnl Check for X11...
AC_PATH_XTRA AC_PATH_XTRA
@ -403,5 +433,5 @@ AC_CONFIG_HEADER(config.h:configh.in)
AC_OUTPUT(makeinclude) AC_OUTPUT(makeinclude)
dnl dnl
dnl End of "$Id: configure.in,v 1.33.2.31.2.2 2001/08/02 18:15:44 easysw Exp $". dnl End of "$Id: configure.in,v 1.33.2.31.2.3 2001/08/02 19:43:49 easysw Exp $".
dnl dnl

View File

@ -1,20 +1,21 @@
<HTML> <HTML>
<HEAD><meta name="robots" content="noindex"> <HEAD><meta name="robots" content="noindex">
<TITLE>FLTK 1.0.11 Programming Manual</TITLE> <TITLE>FLTK 1.1.0 Programming Manual</TITLE>
</HEAD> </HEAD>
<BODY> <BODY>
<CENTER><TABLE WIDTH=90% BGCOLOR=#9f9f9f CELLPADDING=8 CELLSPACING=0 SUMMARY="TITLE BAR"> <CENTER><TABLE WIDTH=90% BGCOLOR=#9f9f9f CELLPADDING=8 CELLSPACING=0 SUMMARY="TITLE BAR">
<TR> <TR>
<TD ALIGN=CENTER VALIGN=MIDDLE><IMG SRC="FL.gif" ALIGN="ABSMIDDLE" ALT="FL"></TD> <TD ALIGN=CENTER VALIGN=MIDDLE WIDTH=100><IMG SRC="FL.gif" WIDTH=100 HEIGHT=70 ALIGN="ABSMIDDLE" ALT="FL"></TD>
<TD ALIGN=CENTER VALIGN=MIDDLE> <TD ALIGN=CENTER VALIGN=MIDDLE WIDTH=500>
<H1>FLTK 1.0.11 Programming Manual</H1> <H1>FLTK 1.1.0 Programming Manual</H1>
Revision 18 by Michael Sweet, Craig P. Earls, and Bill Spitzak<BR> Revision 0 by Michael Sweet, Craig P. Earls, and Bill Spitzak<BR>
Copyright 1998-2001 by Bill Spitzak and others.<BR> Copyright 1998-2001 by Bill Spitzak and others.<BR>
</TD> </TD>
</TR> </TR>
<TABLE WIDTH=90% BGCOLOR=#9f9f9f CELLPADDING=8 CELLSPACING=0 SUMMARY="TITLE BAR">
<TR> <TR>
<TD ALIGN=CENTER COLSPAN=2> <TD ALIGN=CENTER WIDTH=600>
This software is provided under the terms of the GNU Library General This software is provided under the terms of the GNU Library General
Public License. Public License.
</TD> </TD>
@ -23,7 +24,7 @@ Public License.
<CENTER><TABLE WIDTH=90% COLS=2 BGCOLOR=#9f9fef CELLPADDING=8 CELLSPACING=0 SUMMARY="Table of Contents"> <CENTER><TABLE WIDTH=90% COLS=2 BGCOLOR=#9f9fef CELLPADDING=8 CELLSPACING=0 SUMMARY="Table of Contents">
<TR> <TR>
<TD ALIGN=LEFT VALIGN=TOP> <TD ALIGN=LEFT VALIGN=TOP WIDTH=300>
<B><A HREF=preface.html#preface>Preface</A></B> <B><A HREF=preface.html#preface>Preface</A></B>
<BR> <BR>
<BR> <BR>
@ -55,7 +56,7 @@ Public License.
<B><A HREF=subclassing.html#subclassing>7 - Adding and Extending <B><A HREF=subclassing.html#subclassing>7 - Adding and Extending
Widgets</A></B> Widgets</A></B>
</TD> </TD>
<TD ALIGN=LEFT VALIGN=TOP> <TD ALIGN=LEFT VALIGN=TOP WIDTH=300>
<B><A HREF=fluid.html#FLUID>8 - Programming with FLUID</A></B> <B><A HREF=fluid.html#FLUID>8 - Programming with FLUID</A></B>
<UL> <UL>
<LI><A HREF=fluid.html#widget_attributes>Widget Attributes</A></LI> <LI><A HREF=fluid.html#widget_attributes>Widget Attributes</A></LI>

View File

@ -2,13 +2,13 @@
<HEAD> <HEAD>
<META CONTENT="Written by Michael Sweet, Craig P. Earls, and Bill Spitzak" NAME="Author"> <META CONTENT="Written by Michael Sweet, Craig P. Earls, and Bill Spitzak" NAME="Author">
<META CONTENT="Copyright 1998-2001 by Bill Spitzak and Others." NAME="Copyright"> <META CONTENT="Copyright 1998-2001 by Bill Spitzak and Others." NAME="Copyright">
<META CONTENT="Revision 18" NAME="DocNumber"> <META CONTENT="Revision 0" NAME="DocNumber">
<TITLE>FLTK 1.0.11 Programming Manual</TITLE> <TITLE>FLTK 1.1.0 Programming Manual</TITLE>
</HEAD> </HEAD>
<BODY> <BODY>
<H1 ALIGN=RIGHT><A NAME=preface>Preface</A></H1> <H1 ALIGN=RIGHT><A NAME=preface>Preface</A></H1>
This manual describes the Fast Light Tool Kit (&quot;FLTK&quot;) This manual describes the Fast Light Tool Kit (&quot;FLTK&quot;)
version 1.0.11, a C++ Graphical User Interface version 1.1.0, a C++ Graphical User Interface
(&quot;GUI&quot;) toolkit for UNIX and Microsoft Windows. Each (&quot;GUI&quot;) toolkit for UNIX and Microsoft Windows. Each
of the chapters in this manual is designed as a tutorial for of the chapters in this manual is designed as a tutorial for
using FLTK, while the appendices provide a convenient reference using FLTK, while the appendices provide a convenient reference
@ -57,7 +57,7 @@ Reference</A></LI>
<DD>The Microsoft Windows 32-bit Application Programmer's Interface.</DD> <DD>The Microsoft Windows 32-bit Application Programmer's Interface.</DD>
</DL> </DL>
<H2>Copyrights and Trademarks</H2> <H2>Copyrights and Trademarks</H2>
FLTK is Copyright 1998-2000 by Bill Spitzak and others. Use and FLTK is Copyright 1998-2001 by Bill Spitzak and others. Use and
distribution of FLTK is governed by the GNU Library General Public distribution of FLTK is governed by the GNU Library General Public
License, located in <A HREF=license.html#license>Appendix G</A>. License, located in <A HREF=license.html#license>Appendix G</A>.
<P>UNIX is a registered trademark of the X Open Group, Inc. Microsoft <P>UNIX is a registered trademark of the X Open Group, Inc. Microsoft

View File

@ -1,5 +1,5 @@
# #
# "$Id: makeinclude.in,v 1.7.2.11.2.2 2001/08/02 18:15:44 easysw Exp $" # "$Id: makeinclude.in,v 1.7.2.11.2.3 2001/08/02 19:43:49 easysw Exp $"
# #
# Make include file for the Fast Light Tool Kit (FLTK). # Make include file for the Fast Light Tool Kit (FLTK).
# @configure_input@ # @configure_input@
@ -61,6 +61,7 @@ LDLIBS =@LDFLAGS@ @LIBS@ -lX11 -lXext @X_EXTRA_LIBS@ -lm
GLDLIBS =@LDFLAGS@ @LIBS@ @GLLIB@ -lX11 -lXext @X_EXTRA_LIBS@ -lm GLDLIBS =@LDFLAGS@ @LIBS@ @GLLIB@ -lX11 -lXext @X_EXTRA_LIBS@ -lm
LINKFLTK =-L../lib @LINKFLTK@ LINKFLTK =-L../lib @LINKFLTK@
LINKFLTKGL =-L../lib @LINKFLTKGL@ LINKFLTKGL =-L../lib @LINKFLTKGL@
IMAGELIBS =@IMAGELIBS@
# Do we build the OpenGL demos? # Do we build the OpenGL demos?
GLDEMOS =@GLDEMOS@ GLDEMOS =@GLDEMOS@
@ -100,5 +101,5 @@ CAT3EXT =@CAT3EXT@
mv t.z $@ mv t.z $@
# #
# End of "$Id: makeinclude.in,v 1.7.2.11.2.2 2001/08/02 18:15:44 easysw Exp $". # End of "$Id: makeinclude.in,v 1.7.2.11.2.3 2001/08/02 19:43:49 easysw Exp $".
# #

223
src/Fl_HelpDialog.cxx Normal file
View File

@ -0,0 +1,223 @@
// generated by Fast Light User Interface Designer (fluid) version 1.0100
#include "../FL/Fl_HelpDialog.H"
inline void Fl_HelpDialog::cb_view__i(Fl_HelpView*, void*) {
if (view_->changed())
{
index_ ++;
if (index_ >= 100)
{
memcpy(line_, line_ + 10, sizeof(line_[0]) * 90);
memcpy(file_, file_ + 10, sizeof(file_[0]) * 90);
index_ -= 10;
}
max_ = index_;
strcpy(file_[index_], view_->filename());
line_[index_] = view_->topline();
if (index_ > 0)
back_->activate();
else
back_->deactivate();
forward_->deactivate();
window_->label(view_->title());
}
else if (view_->filename())
{
strncpy(file_[index_], view_->filename(), 255);
file_[index_][255] = '\0';
line_[index_] = view_->topline();
};
}
void Fl_HelpDialog::cb_view_(Fl_HelpView* o, void* v) {
((Fl_HelpDialog*)(o->parent()->user_data()))->cb_view__i(o,v);
}
inline void Fl_HelpDialog::cb_Close_i(Fl_Button*, void*) {
window_->hide();
}
void Fl_HelpDialog::cb_Close(Fl_Button* o, void* v) {
((Fl_HelpDialog*)(o->parent()->user_data()))->cb_Close_i(o,v);
}
inline void Fl_HelpDialog::cb_back__i(Fl_Button*, void*) {
if (index_ > 0)
index_ --;
if (index_ == 0)
back_->deactivate();
forward_->activate();
if (strcmp(view_->filename(), file_[index_]) != 0)
view_->load(file_[index_]);
view_->topline(line_[index_]);
}
void Fl_HelpDialog::cb_back_(Fl_Button* o, void* v) {
((Fl_HelpDialog*)(o->parent()->user_data()))->cb_back__i(o,v);
}
inline void Fl_HelpDialog::cb_forward__i(Fl_Button*, void*) {
if (index_ < max_)
index_ ++;
if (index_ >= max_)
forward_->deactivate();
back_->activate();
if (strcmp(view_->filename(), file_[index_]) != 0)
view_->load(file_[index_]);
view_->topline(line_[index_]);
}
void Fl_HelpDialog::cb_forward_(Fl_Button* o, void* v) {
((Fl_HelpDialog*)(o->parent()->user_data()))->cb_forward__i(o,v);
}
inline void Fl_HelpDialog::cb_smaller__i(Fl_Button*, void*) {
if (view_->textsize() > 8)
view_->textsize(view_->textsize() - 2);
if (view_->textsize() <= 8)
smaller_->deactivate();
larger_->activate();
}
void Fl_HelpDialog::cb_smaller_(Fl_Button* o, void* v) {
((Fl_HelpDialog*)(o->parent()->user_data()))->cb_smaller__i(o,v);
}
inline void Fl_HelpDialog::cb_larger__i(Fl_Button*, void*) {
if (view_->textsize() < 18)
view_->textsize(view_->textsize() + 2);
if (view_->textsize() >= 18)
larger_->deactivate();
smaller_->activate();
}
void Fl_HelpDialog::cb_larger_(Fl_Button* o, void* v) {
((Fl_HelpDialog*)(o->parent()->user_data()))->cb_larger__i(o,v);
}
Fl_HelpDialog::Fl_HelpDialog() {
Fl_Window* w;
{ Fl_Window* o = window_ = new Fl_Window(530, 385, "Help Dialog");
w = o;
o->user_data((void*)(this));
{ Fl_HelpView* o = view_ = new Fl_HelpView(10, 10, 510, 330);
o->box(FL_DOWN_BOX);
o->callback((Fl_Callback*)cb_view_);
o->end();
Fl_Group::current()->resizable(o);
}
{ Fl_Button* o = new Fl_Button(425, 350, 95, 25, "Close");
o->callback((Fl_Callback*)cb_Close);
}
{ Fl_Button* o = back_ = new Fl_Button(365, 350, 25, 25, "@<-");
o->shortcut(0xff51);
o->labeltype(FL_SYMBOL_LABEL);
o->labelcolor(2);
o->callback((Fl_Callback*)cb_back_);
}
{ Fl_Button* o = forward_ = new Fl_Button(395, 350, 25, 25, "@->");
o->shortcut(0xff53);
o->labeltype(FL_SYMBOL_LABEL);
o->labelcolor(2);
o->callback((Fl_Callback*)cb_forward_);
}
{ Fl_Button* o = smaller_ = new Fl_Button(305, 350, 25, 25, "F");
o->labelfont(1);
o->labelsize(10);
o->callback((Fl_Callback*)cb_smaller_);
}
{ Fl_Button* o = larger_ = new Fl_Button(335, 350, 25, 25, "F");
o->labelfont(1);
o->labelsize(16);
o->callback((Fl_Callback*)cb_larger_);
}
o->end();
}
back_->deactivate();
forward_->deactivate();
index_ = -1;
max_ = 0;
}
Fl_HelpDialog::~Fl_HelpDialog() {
delete window_;
}
int Fl_HelpDialog::h() {
return (window_->h());
}
void Fl_HelpDialog::hide() {
window_->hide();
}
void Fl_HelpDialog::load(const char *f) {
view_->set_changed();
view_->load(f);
window_->label(view_->title());
}
void Fl_HelpDialog::position(int xx, int yy) {
window_->position(xx, yy);
}
void Fl_HelpDialog::resize(int xx, int yy, int ww, int hh) {
window_->resize(xx, yy, ww, hh);
}
void Fl_HelpDialog::show() {
window_->show();
}
void Fl_HelpDialog::textsize(uchar s) {
view_->textsize(s);
if (s <= 8)
smaller_->deactivate();
else
smaller_->activate();
if (s >= 18)
larger_->deactivate();
else
larger_->activate();
}
uchar Fl_HelpDialog::textsize() {
return (view_->textsize());
}
void Fl_HelpDialog::topline(const char *n) {
view_->topline(n);
}
void Fl_HelpDialog::topline(int n) {
view_->topline(n);
}
int Fl_HelpDialog::visible() {
return (window_->visible());
}
int Fl_HelpDialog::w() {
return (window_->w());
}
int Fl_HelpDialog::x() {
return (window_->x());
}
int Fl_HelpDialog::y() {
return (window_->y());
}

192
src/Fl_HelpDialog.fl Normal file
View File

@ -0,0 +1,192 @@
# data file for the Fltk User Interface Designer (fluid)
version 1.0100
header_name {../FL/Fl_HelpDialog.H}
code_name {.cxx}
gridx 5
gridy 5
snap 3
class Fl_HelpDialog {open
} {
decl {int index_;} {}
decl {int max_;} {}
decl {int line_[100];} {}
decl {char file_[100][256];} {}
Function {Fl_HelpDialog()} {open
} {
Fl_Window window_ {
label {Help Dialog} open
private xywh {470 402 530 385} resizable
code0 {\#include <string.h>} visible
} {
Fl_Group view_ {
callback {if (view_->changed())
{
index_ ++;
if (index_ >= 100)
{
memcpy(line_, line_ + 10, sizeof(line_[0]) * 90);
memcpy(file_, file_ + 10, sizeof(file_[0]) * 90);
index_ -= 10;
}
max_ = index_;
strcpy(file_[index_], view_->filename());
line_[index_] = view_->topline();
if (index_ > 0)
back_->activate();
else
back_->deactivate();
forward_->deactivate();
window_->label(view_->title());
}
else if (view_->filename())
{
strncpy(file_[index_], view_->filename(), 255);
file_[index_][255] = '\\0';
line_[index_] = view_->topline();
}} open
private xywh {10 10 510 330} box DOWN_BOX resizable
code0 {\#include <FL/Fl_HelpView.H>}
class Fl_HelpView
} {}
Fl_Button {} {
label Close
callback {window_->hide();}
xywh {425 350 95 25}
}
Fl_Button back_ {
label {@<-}
callback {if (index_ > 0)
index_ --;
if (index_ == 0)
back_->deactivate();
forward_->activate();
if (strcmp(view_->filename(), file_[index_]) != 0)
view_->load(file_[index_]);
view_->topline(line_[index_]);}
private xywh {365 350 25 25} shortcut 0xff51 labeltype SYMBOL_LABEL labelcolor 2
}
Fl_Button forward_ {
label {@->}
callback {if (index_ < max_)
index_ ++;
if (index_ >= max_)
forward_->deactivate();
back_->activate();
if (strcmp(view_->filename(), file_[index_]) != 0)
view_->load(file_[index_]);
view_->topline(line_[index_]);}
private xywh {395 350 25 25} shortcut 0xff53 labeltype SYMBOL_LABEL labelcolor 2
}
Fl_Button smaller_ {
label F
callback {if (view_->textsize() > 8)
view_->textsize(view_->textsize() - 2);
if (view_->textsize() <= 8)
smaller_->deactivate();
larger_->activate();}
private xywh {305 350 25 25} labelfont 1 labelsize 10
}
Fl_Button larger_ {
label F
callback {if (view_->textsize() < 18)
view_->textsize(view_->textsize() + 2);
if (view_->textsize() >= 18)
larger_->deactivate();
smaller_->activate();}
private xywh {335 350 25 25} labelfont 1 labelsize 16
}
}
code {back_->deactivate();
forward_->deactivate();
index_ = -1;
max_ = 0;} {}
}
Function {~Fl_HelpDialog()} {selected
} {
code {delete window_;} {}
}
Function {h()} {return_type int
} {
code {return (window_->h());} {}
}
Function {hide()} {return_type void
} {
code {window_->hide();} {}
}
Function {load(const char *f)} {return_type void
} {
code {view_->set_changed();
view_->load(f);
window_->label(view_->title());} {}
}
Function {position(int xx, int yy)} {return_type void
} {
code {window_->position(xx, yy);} {}
}
Function {resize(int xx, int yy, int ww, int hh)} {return_type void
} {
code {window_->resize(xx, yy, ww, hh);} {}
}
Function {show()} {return_type void
} {
code {window_->show();} {}
}
Function {textsize(uchar s)} {return_type void
} {
code {view_->textsize(s);
if (s <= 8)
smaller_->deactivate();
else
smaller_->activate();
if (s >= 18)
larger_->deactivate();
else
larger_->activate();} {}
}
Function {textsize()} {return_type uchar
} {
code {return (view_->textsize());} {}
}
Function {topline(const char *n)} {return_type void
} {
code {view_->topline(n);} {}
}
Function {topline(int n)} {return_type void
} {
code {view_->topline(n);} {}
}
Function {visible()} {return_type int
} {
code {return (window_->visible());} {}
}
Function {w()} {return_type int
} {
code {return (window_->w());} {}
}
Function {x()} {return_type int
} {
code {return (window_->x());} {}
}
Function {y()} {return_type int
} {
code {return (window_->y());} {}
}
}

3139
src/Fl_HelpView.cxx Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
# #
# "$Id: Makefile,v 1.18.2.14.2.6 2001/08/02 18:39:01 easysw Exp $" # "$Id: Makefile,v 1.18.2.14.2.7 2001/08/02 19:43:49 easysw Exp $"
# #
# Library makefile for the Fast Light Tool Kit (FLTK). # Library makefile for the Fast Light Tool Kit (FLTK).
# #
@ -45,6 +45,8 @@ CPPFILES = \
Fl_FileChooser2.cxx \ Fl_FileChooser2.cxx \
Fl_FileIcon.cxx \ Fl_FileIcon.cxx \
Fl_Group.cxx \ Fl_Group.cxx \
Fl_HelpDialog.cxx \
Fl_HelpView.cxx \
Fl_Image.cxx \ Fl_Image.cxx \
Fl_Input.cxx \ Fl_Input.cxx \
Fl_Input_.cxx \ Fl_Input_.cxx \
@ -168,11 +170,11 @@ $(LIBNAME): $(OBJECTS)
libfltk.so.1.1 libfltk.sl.1.1: $(OBJECTS) libfltk.so.1.1 libfltk.sl.1.1: $(OBJECTS)
echo $(DSOCOMMAND) $@ ... echo $(DSOCOMMAND) $@ ...
$(DSOCOMMAND) $@ $(OBJECTS) $(DSOCOMMAND) $@ $(OBJECTS) $(IMAGELIBS)
libfltk_s.a: $(OBJECTS) libfltk_s.a: $(OBJECTS)
echo $(DSOCOMMAND) libfltk_s.o ... echo $(DSOCOMMAND) libfltk_s.o ...
$(DSOCOMMAND) libfltk_s.o $(OBJECTS) $(DSOCOMMAND) libfltk_s.o $(OBJECTS) $(IMAGELIBS)
echo $(LIBCOMMAND) libfltk_s.a libfltk_s.o echo $(LIBCOMMAND) libfltk_s.a libfltk_s.o
$(LIBCOMMAND) libfltk_s.a libfltk_s.o $(LIBCOMMAND) libfltk_s.a libfltk_s.o
chmod +x libfltk_s.a chmod +x libfltk_s.a
@ -251,5 +253,5 @@ install: $(LIBNAME) $(DSONAME) $(GLLIBNAME) $(GLDSONAME)
ln -s FL $(includedir)/Fl ln -s FL $(includedir)/Fl
# #
# End of "$Id: Makefile,v 1.18.2.14.2.6 2001/08/02 18:39:01 easysw Exp $". # End of "$Id: Makefile,v 1.18.2.14.2.7 2001/08/02 19:43:49 easysw Exp $".
# #

View File

@ -1,5 +1,5 @@
# #
# "$Id: Makefile,v 1.19.2.7.2.3 2001/08/02 18:15:44 easysw Exp $" # "$Id: Makefile,v 1.19.2.7.2.4 2001/08/02 19:43:49 easysw Exp $"
# #
# Test/example program makefile for the Fast Light Tool Kit (FLTK). # Test/example program makefile for the Fast Light Tool Kit (FLTK).
# #
@ -30,7 +30,7 @@ CPPFILES =\
color_chooser.cxx cube.cxx cursor.cxx curve.cxx demo.cxx \ color_chooser.cxx cube.cxx cursor.cxx curve.cxx demo.cxx \
doublebuffer.cxx editor.cxx file_chooser.cxx fonts.cxx \ doublebuffer.cxx editor.cxx file_chooser.cxx fonts.cxx \
forms.cxx fractals.cxx fullscreen.cxx gl_overlay.cxx \ forms.cxx fractals.cxx fullscreen.cxx gl_overlay.cxx \
glpuzzle.cxx hello.cxx iconize.cxx image.cxx input.cxx \ glpuzzle.cxx hello.cxx help.cxx iconize.cxx image.cxx input.cxx \
keyboard.cxx label.cxx list_visuals.cxx mandelbrot.cxx \ keyboard.cxx label.cxx list_visuals.cxx mandelbrot.cxx \
menubar.cxx message.cxx minimum.cxx navigation.cxx \ menubar.cxx message.cxx minimum.cxx navigation.cxx \
output.cxx overlay.cxx pixmap.cxx pixmap_browser.cxx \ output.cxx overlay.cxx pixmap.cxx pixmap_browser.cxx \
@ -42,7 +42,7 @@ CPPFILES =\
ALL = adjuster arc ask bitmap boxtype browser button buttons \ ALL = adjuster arc ask bitmap boxtype browser button buttons \
checkers clock colbrowser color_chooser cursor curve \ checkers clock colbrowser color_chooser cursor curve \
demo doublebuffer editor file_chooser fonts forms hello \ demo doublebuffer editor file_chooser fonts forms hello \
iconize image input keyboard label list_visuals \ help iconize image input keyboard label list_visuals \
mandelbrot menubar message minimum navigation output \ mandelbrot menubar message minimum navigation output \
overlay pixmap pixmap_browser radio resizebox scroll \ overlay pixmap pixmap_browser radio resizebox scroll \
subwindow symbols tabs tile valuators fast_slow resize \ subwindow symbols tabs tile valuators fast_slow resize \
@ -70,6 +70,10 @@ include ../makeinclude
$(ALL): ../lib/$(LIBNAME) $(ALL): ../lib/$(LIBNAME)
# Programs needing special instructions... # Programs needing special instructions...
help: help.cxx
echo Compiling and linking $@...
echo $(CXX) -I.. $(CXXFLAGS) help.cxx -o $@ $(LINKFLTK) $(LDLIBS) $(IMAGELIBS)
$(CXX) -I.. $(CXXFLAGS) help.cxx -o $@ $(LINKFLTK) $(LDLIBS) $(IMAGELIBS)
keyboard: keyboard.cxx keyboard_ui.cxx keyboard: keyboard.cxx keyboard_ui.cxx
echo Compiling and linking $@... echo Compiling and linking $@...
$(CXX) -I.. $(CXXFLAGS) keyboard.cxx $(LINKFLTK) $(LDLIBS) -o $@ $(CXX) -I.. $(CXXFLAGS) keyboard.cxx $(LINKFLTK) $(LDLIBS) -o $@
@ -124,5 +128,5 @@ install:
@echo Nothing to install in test directory. @echo Nothing to install in test directory.
# #
# End of "$Id: Makefile,v 1.19.2.7.2.3 2001/08/02 18:15:44 easysw Exp $". # End of "$Id: Makefile,v 1.19.2.7.2.4 2001/08/02 19:43:49 easysw Exp $".
# #

View File

@ -64,6 +64,7 @@
@o:file chooser:file_chooser @o:file chooser:file_chooser
@o:XForms Emulation:forms @o:XForms Emulation:forms
@o:fonts:fonts @o:fonts:fonts
@o:HelpDialog:help
@main:Tutorial\nfrom\nManual:@j @main:Tutorial\nfrom\nManual:@j
@j:ask\n(modified):ask @j:ask\n(modified):ask

67
test/help.cxx Normal file
View File

@ -0,0 +1,67 @@
//
// "$Id: help.cxx,v 1.1.2.1 2001/08/02 19:43:49 easysw Exp $"
//
// Fl_HelpDialog test program.
//
// Copyright 1999-2001 by Easy Software Products.
//
// 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 to "fltk-bugs@fltk.org".
//
// Contents:
//
// main() - Display the help GUI...
//
//
// Include necessary headers...
//
#include <FL/Fl_HelpDialog.H>
//
// 'main()' - Display the help GUI...
//
int // O - Exit status
main(int argc, // I - Number of command-line arguments
char *argv[]) // I - Command-line arguments
{
Fl_HelpDialog *help; // Help dialog
help = new Fl_HelpDialog;
if (argc < 2)
help->load("../documentation/index.html");
else
help->load(argv[1]);
help->show();
Fl::run();
delete help;
return (0);
}
//
// End of "$Id: help.cxx,v 1.1.2.1 2001/08/02 19:43:49 easysw Exp $".
//