summaryrefslogtreecommitdiff
path: root/FL/Fl_Help_View.H
diff options
context:
space:
mode:
Diffstat (limited to 'FL/Fl_Help_View.H')
-rw-r--r--FL/Fl_Help_View.H224
1 files changed, 109 insertions, 115 deletions
diff --git a/FL/Fl_Help_View.H b/FL/Fl_Help_View.H
index 19932cb2e..4df878bf3 100644
--- a/FL/Fl_Help_View.H
+++ b/FL/Fl_Help_View.H
@@ -1,6 +1,4 @@
//
-// "$Id$"
-//
// Help Viewer widget definitions.
//
// Copyright 1997-2010 by Easy Software Products.
@@ -10,11 +8,11 @@
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
-// http://www.fltk.org/COPYING.php
+// https://www.fltk.org/COPYING.php
//
-// Please report all bugs and problems on the following page:
+// Please see the following page on how to report bugs and issues:
//
-// http://www.fltk.org/str.php
+// https://www.fltk.org/bugs.php
//
/* \file
@@ -45,15 +43,15 @@ typedef const char *(Fl_Help_Func)(Fl_Widget *, const char *);
//
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
+ 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
};
//
@@ -61,12 +59,12 @@ struct Fl_Help_Block {
//
/** Definition of a link for the html viewer. */
struct Fl_Help_Link {
- char filename[192], ///< Reference filename
- name[32]; ///< Link target (blank if none)
- int x, ///< X offset of link text
- y, ///< Y offset of link text
- w, ///< Width of link text
- h; ///< Height of link text
+ char filename[192], ///< Reference filename
+ name[32]; ///< Link target (blank if none)
+ int x, ///< X offset of link text
+ y, ///< Y offset of link text
+ w, ///< Width of link text
+ h; ///< Height of link text
};
/*
@@ -93,22 +91,22 @@ struct FL_EXPORT Fl_Help_Font_Stack {
nfonts_ = 0;
}
- void init(Fl_Font f, Fl_Fontsize s, Fl_Color c) {
+ void init(Fl_Font f, Fl_Fontsize s, Fl_Color c) {
nfonts_ = 0;
elts_[nfonts_].set(f, s, c);
- fl_font(f, s);
+ 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) {
+ 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);
+ 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) {
+ 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);
@@ -117,15 +115,15 @@ struct FL_EXPORT Fl_Help_Font_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
+ size_t nfonts_; ///< current number of fonts in stack
Fl_Help_Font_Style elts_[MAX_FL_HELP_FS_ELTS]; ///< font elements
};
/** Fl_Help_Target structure */
struct Fl_Help_Target {
- char name[32]; ///< Target name
- int y; ///< Y offset of target
+ char name[32]; ///< Target name
+ int y; ///< Y offset of target
};
/**
@@ -193,42 +191,42 @@ struct Fl_Help_Target {
- 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
+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;
@@ -251,24 +249,24 @@ class FL_EXPORT Fl_Help_View : public Fl_Group { // Help viewer widget
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);
+ 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);
protected:
- void draw();
+ void draw();
private:
- 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);
+ 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 get_length(const char *l);
public:
- int handle(int);
+ int handle(int);
private:
void hv_draw(const char *t, int x, int y, int entity_extra_length = 0);
@@ -284,72 +282,72 @@ 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); }
+ 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);
+ 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);
+ 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); }
+ 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; }
+ void textcolor(Fl_Color c) { if (textcolor_ == defcolor_) textcolor_ = c; defcolor_ = c; }
/** Returns the current default text color. */
- Fl_Color textcolor() const { return (defcolor_); }
+ Fl_Color textcolor() const { return (defcolor_); }
/** Sets the default text font. */
- void textfont(Fl_Font f) { textfont_ = f; format(); }
+ 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(); }
+ 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);
+ 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);
+ int topline() const { return (topline_); }
+ void leftline(int);
/** Gets the left position in pixels. */
- int leftline() const { return (leftline_); }
- void value(const char *val);
+ int leftline() const { return (leftline_); }
+ void value(const char *val);
/** Returns the current buffer contents. */
- const char *value() const { return (value_); }
+ 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
+ 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)
*/
@@ -360,28 +358,24 @@ public:
Sets the pixel size of the scrollbars' troughs to \p newSize, 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
+ 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 newSize to the special value of 0 causes the widget to
track the global Fl::scrollbar_size(), which is the default.
-
+
\param[in] newSize 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 newSize) {
scrollbar_size_ = newSize;
- }
+ }
};
#endif // !Fl_Help_View_H
-
-//
-// End of "$Id$".
-//