Doxygen documentation WP11 Done!

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6255 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Fabien Costantini 2008-09-15 16:39:05 +00:00
parent 09f3094aef
commit b8955a9ced
15 changed files with 1701 additions and 1418 deletions

View File

@ -40,10 +40,11 @@
# include <stdlib.h>
//
// Fl_Spinner widget class...
//
/**
This widget is a combination of the input
widget and repeat buttons. The user can either type into the
input area or use the buttons to change the value.
*/
class Fl_Spinner : public Fl_Group
{
double value_; // Current value
@ -114,6 +115,11 @@ class Fl_Spinner : public Fl_Group
public:
/**
Creates a new Fl_Spinner widget using the given position, size,
and label string.
<P>Inherited destructor Destroys the widget and any value associated with it.
*/
Fl_Spinner(int X, int Y, int W, int H, const char *L = 0)
: Fl_Group(X, Y, W, H, L),
input_(X, Y, W - H / 2 - 2, H),
@ -140,7 +146,9 @@ class Fl_Spinner : public Fl_Group
down_button_.callback((Fl_Callback *)sb_cb, this);
}
/** Sets or returns the format string for the value. */
const char *format() { return (format_); }
/** Sets or returns the format string for the value. */
void format(const char *f) { format_ = f; update(); }
int handle(int event) {
@ -163,13 +171,19 @@ class Fl_Spinner : public Fl_Group
return Fl_Group::handle(event);
}
// Speling mistaks retained for source compatibility...
/** Speling mistakes retained for source compatibility \deprecated */
double maxinum() const { return (maximum_); }
/** Sets or returns the maximum value of the widget. */
double maximum() const { return (maximum_); }
/** Sets or returns the maximum value of the widget. */
void maximum(double m) { maximum_ = m; }
/** Speling mistakes retained for source compatibility \deprecated */
double mininum() const { return (minimum_); }
/** Sets or returns the minimum value of the widget. */
double minimum() const { return (minimum_); }
/** Sets or returns the minimum value of the widget. */
void minimum(double m) { minimum_ = m; }
/** Sets the minimum and maximum values for the widget. */
void range(double a, double b) { minimum_ = a; maximum_ = b; }
void resize(int X, int Y, int W, int H) {
Fl_Group::resize(X,Y,W,H);
@ -179,32 +193,51 @@ class Fl_Spinner : public Fl_Group
down_button_.resize(X + W - H / 2 - 2, Y + H - H / 2,
H / 2 + 2, H / 2);
}
/**
Sets or returns the amount to change the value when the user clicks a button.
Before setting step to a non-integer value, the spinner
type() should be changed to floating point.
*/
double step() const { return (step_); }
/** See double Fl_Spinner::step() const */
void step(double s) {
step_ = s;
if (step_ != (int)step_) input_.type(FL_FLOAT_INPUT);
else input_.type(FL_INT_INPUT);
update();
}
/** Sets or Gets the color of the text in the input field. */
Fl_Color textcolor() const {
return (input_.textcolor());
}
/** Sets or Gets the color of the text in the input field. */
void textcolor(Fl_Color c) {
input_.textcolor(c);
}
/** Sets or Gets the font of the text in the input field. */
Fl_Font textfont() const {
return (input_.textfont());
}
/** Sets or Gets the font of the text in the input field. */
void textfont(Fl_Font f) {
input_.textfont(f);
}
/** Sets or Gets the size of the text in the input field. */
Fl_Fontsize textsize() const {
return (input_.textsize());
}
/** Sets or Gets the size of the text in the input field. */
void textsize(Fl_Fontsize s) {
input_.textsize(s);
}
/** Sets or returns the numeric representation in the input field.
Valid values are FL_INT_INPUT and FL_FLOAT_INPUT.
The first form also changes the format() template.
Setting a new spinner type via a superclass pointer will not work.
\note type is not a virtual function.
*/
uchar type() const { return (input_.type()); }
/** See uchar Fl_Spinner::type() const */
void type(uchar v) {
if (v==FL_FLOAT_INPUT) {
format("%.*f");
@ -213,7 +246,13 @@ class Fl_Spinner : public Fl_Group
}
input_.type(v);
}
/**
Sets or returns the current value of the widget.
Before setting value to a non-integer value, the spinner
type() should be changed to floating point.
*/
double value() const { return (value_); }
/** See double Fl_Spinner::value() const */
void value(double v) { value_ = v; update(); }
};

View File

@ -48,6 +48,10 @@ class FL_EXPORT Fl_Text_Selection {
int end() { return mEnd; }
int rect_start() { return mRectStart; }
int rect_end() { return mRectEnd; }
/**
Returns a non-zero number if any text has been selected, or 0
if no text is selected.
*/
char selected() { return mSelected; }
void selected(char b) { mSelected = b; }
int includes(int pos, int lineStartPos, int dispIndex);
@ -69,11 +73,26 @@ typedef void (*Fl_Text_Modify_Cb)(int pos, int nInserted, int nDeleted,
void* cbArg);
typedef void (*Fl_Text_Predelete_Cb)(int pos, int nDeleted, void* cbArg);
/**
The Fl_Text_Buffer class is used by the Fl_Text_Display
and Fl_Text_Editor to manage complex text data and is based upon the
excellent NEdit text editor engine - see http://www.nedit.org/.
*/
/**
The Fl_Text_Buffer class is used by the
Fl_Text_Display
and
Fl_Text_Editor
to manage complex text data and is based upon the
excellent NEdit text editor engine - see
http://www.nedit.org/.
*/
class FL_EXPORT Fl_Text_Buffer {
public:
Fl_Text_Buffer(int requestedSize = 0);
~Fl_Text_Buffer();
/** Returns the number of characters in the buffer. */
int length() { return mLength; }
char* text();
void text(const char* text);
@ -81,6 +100,7 @@ class FL_EXPORT Fl_Text_Buffer {
char character(int pos);
char* text_in_rectangle(int start, int end, int rectStart, int rectEnd);
void insert(int pos, const char* text);
/** Appends the text string to the end of the buffer. */
void append(const char* t) { insert(length(), t); }
void remove(int start, int end);
void replace(int start, int end, const char *text);
@ -88,11 +108,19 @@ class FL_EXPORT Fl_Text_Buffer {
int undo(int *cp=0);
void canUndo(char flag=1);
int insertfile(const char *file, int pos, int buflen = 128*1024);
/**
Appends the named file to the end of the buffer. Returns 0 on
success, non-zero on error (strerror() contains reason). 1 indicates
open for read failed (no data loaded). 2 indicates error occurred
while reading data (data was partially loaded).
*/
int appendfile(const char *file, int buflen = 128*1024)
{ return insertfile(file, length(), buflen); }
/** Loads a text file into the buffer */
int loadfile(const char *file, int buflen = 128*1024)
{ select(0, length()); remove_selection(); return appendfile(file, buflen); }
int outputfile(const char *file, int start, int end, int buflen = 128*1024);
/** Saves a text file from the current buffer */
int savefile(const char *file, int buflen = 128*1024)
{ return outputfile(file, 0, length(), buflen); }
@ -108,9 +136,11 @@ class FL_EXPORT Fl_Text_Buffer {
void remove_rectangular(int start, int end, int rectStart, int rectEnd);
void clear_rectangular(int start, int end, int rectStart, int rectEnd);
/** Gets the tab width. */
int tab_distance() { return mTabDist; }
void tab_distance(int tabDist);
void select(int start, int end);
/** Returns a non 0 value if text has been selected, 0 otherwise */
int selected() { return mPrimary.selected(); }
void unselect();
void select_rectangular(int start, int end, int rectStart, int rectEnd);
@ -123,7 +153,10 @@ class FL_EXPORT Fl_Text_Buffer {
void remove_selection();
void replace_selection(const char* text);
void secondary_select(int start, int end);
/** Returns a non 0 value if text has been selected in the secondary
text selection, 0 otherwise */
int secondary_selected() { return mSecondary.selected(); }
/** Clears any selection in the secondary text selection object. */
void secondary_unselect();
void secondary_select_rectangular(int start, int end, int rectStart,
@ -137,6 +170,10 @@ class FL_EXPORT Fl_Text_Buffer {
void remove_secondary_selection();
void replace_secondary_selection(const char* text);
void highlight(int start, int end);
/**
Returns the highlighted text. When you are done with the
text, free it using the free() function.
*/
int highlight() { return mHighlight.selected(); }
void unhighlight();
void highlight_rectangular(int start, int end, int rectStart, int rectEnd);
@ -149,12 +186,21 @@ class FL_EXPORT Fl_Text_Buffer {
void add_modify_callback(Fl_Text_Modify_Cb bufModifiedCB, void* cbArg);
void remove_modify_callback(Fl_Text_Modify_Cb bufModifiedCB, void* cbArg);
/**
Calls all modify callbacks that have been registered using
the add_modify_callback()
method.
*/
void call_modify_callbacks() { call_modify_callbacks(0, 0, 0, 0, 0); }
void add_predelete_callback(Fl_Text_Predelete_Cb bufPredelCB, void* cbArg);
void remove_predelete_callback(Fl_Text_Predelete_Cb predelCB, void* cbArg);
void call_predelete_callbacks() { call_predelete_callbacks(0, 0); }
/**
Calls the stored pre-delete callback procedure(s) for this buffer to update
the changed area(s) on the screen and any other listeners.
*/
void call_predelete_callbacks() { call_predelete_callbacks(0, 0); }
char* line_text(int pos);
int line_start(int pos);
@ -185,9 +231,13 @@ class FL_EXPORT Fl_Text_Buffer {
int substitute_null_characters(char* string, int length);
void unsubstitute_null_characters(char* string);
/** Returns the current nul substitution character. */
char null_substitution_character() { return mNullSubsChar; }
/** Returns the primary selection. */
Fl_Text_Selection* primary_selection() { return &mPrimary; }
/** Returns the secondary selection. */
Fl_Text_Selection* secondary_selection() { return &mSecondary; }
/** Returns the current highlight selection. */
Fl_Text_Selection* highlight_selection() { return &mHighlight; }
protected:

View File

@ -36,6 +36,13 @@
#include "Fl_Scrollbar.H"
#include "Fl_Text_Buffer.H"
/**
This is the FLTK text display widget. It allows the user to
view multiple lines of text and supports highlighting and
scrolling. The buffer that is displayed in the widget is managed
by the Fl_Text_Buffer
class.
*/
class FL_EXPORT Fl_Text_Display: public Fl_Group {
public:
enum {
@ -76,13 +83,22 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
virtual int handle(int e);
void buffer(Fl_Text_Buffer* buf);
/**
Sets or gets the current text buffer associated with the text widget.
Multiple text widgets can be associated with the same text buffer.
*/
void buffer(Fl_Text_Buffer& buf) { buffer(&buf); }
/**
Gets the current text buffer associated with the text widget.
Multiple text widgets can be associated with the same text buffer.
*/
Fl_Text_Buffer* buffer() { return mBuffer; }
void redisplay_range(int start, int end);
void scroll(int topLineNum, int horizOffset);
void insert(const char* text);
void overstrike(const char* text);
void insert_position(int newPos);
/** Gets the position of the text insertion cursor for text display */
int insert_position() { return mCursorPos; }
int in_selection(int x, int y);
void show_insert_position();
@ -98,15 +114,24 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
void next_word(void);
void previous_word(void);
void show_cursor(int b = 1);
/** Hides the text cursor */
void hide_cursor() { show_cursor(0); }
void cursor_style(int style);
/** Sets or gets the text cursor color. */
Fl_Color cursor_color() const {return mCursor_color;}
/** Sets or gets the text cursor color. */
void cursor_color(Fl_Color n) {mCursor_color = n;}
/** Sets or gets the width/height of the scrollbars. */
int scrollbar_width() { return scrollbar_width_; }
Fl_Align scrollbar_align() { return scrollbar_align_; }
/** Sets or gets the width/height of the scrollbars. */
void scrollbar_width(int W) { scrollbar_width_ = W; }
/** Gets the scrollbar alignment type */
Fl_Align scrollbar_align() { return scrollbar_align_; }
/** Sets the scrollbar alignment type */
void scrollbar_align(Fl_Align a) { scrollbar_align_ = a; }
/** Moves the insert position to the beginning of the current word. */
int word_start(int pos) { return buffer()->word_start(pos); }
/** Moves the insert position to the end of the current word. */
int word_end(int pos) { return buffer()->word_end(pos); }
@ -118,15 +143,24 @@ class FL_EXPORT Fl_Text_Display: public Fl_Group {
int position_style(int lineStartPos, int lineLen, int lineIndex,
int dispIndex);
/** \todo FIXME : get set methods pointing on shortcut_
have no effects as shortcut_ is unused in this class and derived! */
int shortcut() const {return shortcut_;}
/** \todo FIXME : get set methods pointing on shortcut_
have no effects as shortcut_ is unused in this class and derived! */
void shortcut(int s) {shortcut_ = s;}
/** Gets the default font used when drawing text in the widget. */
Fl_Font textfont() const {return textfont_;}
/** Sets the default font used when drawing text in the widget. */
void textfont(Fl_Font s) {textfont_ = s;}
/** Gets the default size of text in the widget. */
Fl_Fontsize textsize() const {return textsize_;}
/** Sets the default size of text in the widget. */
void textsize(Fl_Fontsize s) {textsize_ = s;}
/** Gets the default color of text in the widget. */
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
/** Sets the default color of text in the widget. */
void textcolor(unsigned n) {textcolor_ = n;}
int wrapped_column(int row, int column);

View File

@ -36,6 +36,13 @@
// key will match in any state
#define FL_TEXT_EDITOR_ANY_STATE (-1L)
/**
This is the FLTK text editor widget. It allows the user to
edit multiple lines of text and supports highlighting and
scrolling. The buffer that is displayed in the widget is managed
by the Fl_Text_Buffer
class.
*/
class FL_EXPORT Fl_Text_Editor : public Fl_Text_Display {
public:
typedef int (*Key_Func)(int key, Fl_Text_Editor* editor);
@ -50,21 +57,36 @@ class FL_EXPORT Fl_Text_Editor : public Fl_Text_Display {
Fl_Text_Editor(int X, int Y, int W, int H, const char* l = 0);
~Fl_Text_Editor() { remove_all_key_bindings(); }
virtual int handle(int e);
/**
Sets the current insert mode; if non-zero, new text
is inserted before the current cursor position. Otherwise, new
text replaces text at the current cursor position.
*/
void insert_mode(int b) { insert_mode_ = b; }
/**
Gets the current insert mode; if non-zero, new text
is inserted before the current cursor position. Otherwise, new
text replaces text at the current cursor position.
*/
int insert_mode() { return insert_mode_; }
void add_key_binding(int key, int state, Key_Func f, Key_Binding** list);
/** Adds a key of state "state" with the function "function" */
void add_key_binding(int key, int state, Key_Func f)
{ add_key_binding(key, state, f, &key_bindings); }
void remove_key_binding(int key, int state, Key_Binding** list);
/** Removes the key binding associated with the key "key" of state "state". */
void remove_key_binding(int key, int state)
{ remove_key_binding(key, state, &key_bindings); }
void remove_all_key_bindings(Key_Binding** list);
/** Removes all of the key bindings associated with the text editor or list. */
void remove_all_key_bindings() { remove_all_key_bindings(&key_bindings); }
void add_default_key_bindings(Key_Binding** list);
Key_Func bound_key_function(int key, int state, Key_Binding* list);
/** Returns the function associated with a key binding. */
Key_Func bound_key_function(int key, int state)
{ return bound_key_function(key, state, key_bindings); }
/** Sets the default key function for unassigned keys. */
void default_key_function(Key_Func f) { default_key_function_ = f; }
// functions for the built in default bindings

View File

@ -31,7 +31,14 @@
# include "Fl_Image.H"
// Tiled image class.
/**
This class supports tiling of images
over a specified area. The source (tile) image is <B>not</B>
copied unless you call the color_average(),
desaturate(),
or inactive()
methods.
*/
class FL_EXPORT Fl_Tiled_Image : public Fl_Image {
protected:
@ -49,6 +56,7 @@ class FL_EXPORT Fl_Tiled_Image : public Fl_Image {
virtual void desaturate();
virtual void draw(int X, int Y, int W, int H, int cx, int cy);
void draw(int X, int Y) { draw(X, Y, w(), h(), 0, 0); }
/** Gets The image that is shared */
Fl_Image *image() { return image_; }
};

View File

@ -30,8 +30,22 @@
#include "Fl_Button.H"
/**
The toggle button is a push button that needs to be clicked once
to toggle on, and one more time to toggle off.
The Fl_Toggle_Button subclass displays the &quot;on&quot; state by
drawing a pushed-in button.</P>
<P>Buttons generate callbacks when they are clicked by the user. You
control exactly when and how by changing the values for type()
and when().
*/
class Fl_Toggle_Button : public Fl_Button {
public:
/**
Creates a new Fl_Toggle_Button widget using the given
position, size, and label string.
<P>The inherited destructor deletes the toggle button.
*/
Fl_Toggle_Button(int X,int Y,int W,int H,const char *l=0)
: Fl_Button(X,Y,W,H,l) {type(FL_TOGGLE_BUTTON);}
};

View File

@ -31,29 +31,55 @@
#include <FL/Fl.H>
#include <FL/Fl_Widget.H>
/**
The Fl_Tooltip class provides tooltip support for
all FLTK widgets.
*/
class FL_EXPORT Fl_Tooltip {
public:
static float delay() { return delay_; }
/** Gets the tooltip delay. The default delay is 1.0 seconds. */
static float delay() { return delay_; }
/** Sets the tooltip delay. The default delay is 1.0 seconds. */
static void delay(float f) { delay_ = f; }
/**
Gets or sets the tooltip hover delay, the delay between tooltips.
The default delay is 0.2 seconds.
*/
static float hoverdelay() { return hoverdelay_; }
/**
Gets or sets the tooltip hover delay, the delay between tooltips.
The default delay is 0.2 seconds.
*/
static void hoverdelay(float f) { hoverdelay_ = f; }
/** Returns non-zero if tooltips are enabled. */
static int enabled() { return enabled_; }
/** Enables tooltips on all widgets (or disables if <i>b</i> is false). */
static void enable(int b = 1) { enabled_ = b;}
/** Same as enable(0), disables tooltips on all widgets. */
static void disable() { enabled_ = 0; }
static void (*enter)(Fl_Widget* w);
static void enter_area(Fl_Widget* w, int X, int Y, int W, int H, const char* tip);
static void (*exit)(Fl_Widget *w);
/** Gets the current widget target */
static Fl_Widget* current() {return widget_;}
static void current(Fl_Widget*);
/** Gets the typeface for the tooltip text. */
static Fl_Font font() { return font_; }
static Fl_Fontsize size() { return size_; }
/** Sets the typeface for the tooltip text. */
static void font(Fl_Font i) { font_ = i; }
/** Gets the size of the tooltip text. */
static Fl_Fontsize size() { return size_; }
/** Sets the size of the tooltip text. */
static void size(Fl_Fontsize s) { size_ = s; }
static void color(unsigned c) { color_ = c; }
/** Gets the background color for tooltips. The default background color is a pale yellow. */
static Fl_Color color() { return (Fl_Color)color_; }
static void textcolor(unsigned c) { textcolor_ = c; }
/** Sets the background color for tooltips. The default background color is a pale yellow. */
static void color(unsigned c) { color_ = c; }
/** Gets the color of the text in the tooltip. The default is black. */
static Fl_Color textcolor() { return (Fl_Color)textcolor_; }
/** Sets the color of the text in the tooltip. The default is black. */
static void textcolor(unsigned c) { textcolor_ = c; }
// These should not be public, but Fl_Widget::tooltip() needs them...
static void enter_(Fl_Widget* w);

View File

@ -35,10 +35,15 @@
# include <FL/Fl_Group.H>
//
// Fl_Wizard class...
//
/**
This widget is based off the Fl_Tabs
widget, but instead of displaying tabs it only changes "tabs" under
program control. Its primary purpose is to support "wizards" that
step a user through configuration or troubleshooting tasks.
<P>As with Fl_Tabs, wizard panes are composed of child (usually
Fl_Group) widgets. Navigation buttons must be added separately.
*/
class FL_EXPORT Fl_Wizard : public Fl_Group
{
Fl_Widget *value_;

View File

@ -19,7 +19,7 @@ In Progress Work List (add your WP and name here):
- WP8 (Fabien) DONE
- WP9 (Fabien) DONE
- WP10 (Fabien) DONE
- WP11 (Fabien)
- WP11 (Fabien) DONE
- WP12 (Albrecht) work in progress
- WP13 (Albrecht) work in progress
@ -191,29 +191,13 @@ Fl_Radio_Light_Button.H
Fl_Radio_Round_Button.H
Fl_Round_Clock.H
Fl_Simple_Counter.H
Fl_Spinner.H
Fl_Sys_Menu_Bar.H
Fl_Sys_Menu_Bar.cxx
Fl_Tabs.H
Fl_Tabs.cxx
Fl_Text_Buffer.H
Fl_Text_Buffer.cxx
Fl_Text_Display.H
Fl_Text_Display.cxx
Fl_Text_Editor.H
Fl_Text_Editor.cxx
Fl_Tiled_Image.H
Fl_Tiled_Image.cxx
Fl_Toggle_Button.H
Fl_Toggle_Light_Button.H
Fl_Toggle_Round_Button.H
Fl_Tooltip.H
Fl_Tooltip.cxx
Fl_Window_fullscreen.cxx
Fl_Window_hotspot.cxx
Fl_Window_iconize.cxx
Fl_Wizard.H
Fl_Wizard.cxx
Fl_XColor.H
Fl_abort.cxx
Fl_get_key.cxx

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -55,6 +55,7 @@ static int utf_len(char c)
return 0;
}
/** The constructor creates a new text editor widget.*/
Fl_Text_Editor::Fl_Text_Editor(int X, int Y, int W, int H, const char* l)
: Fl_Text_Display(X, Y, W, H, l) {
mCursorOn = 1;
@ -137,6 +138,7 @@ static struct {
{ 0, 0, 0 }
};
/** Adds all of the default editor key bindings to the specified key binding list.*/
void Fl_Text_Editor::add_default_key_bindings(Key_Binding** list) {
for (int i = 0; default_key_bindings[i].key; i++) {
add_key_binding(default_key_bindings[i].key,
@ -146,8 +148,8 @@ void Fl_Text_Editor::add_default_key_bindings(Key_Binding** list) {
}
}
Fl_Text_Editor::Key_Func
Fl_Text_Editor::bound_key_function(int key, int state, Key_Binding* list) {
/** Returns the function associated with a key binding.*/
Fl_Text_Editor::Key_Func Fl_Text_Editor::bound_key_function(int key, int state, Key_Binding* list) {
Key_Binding* cur;
for (cur = list; cur; cur = cur->next)
if (cur->key == key)
@ -157,8 +159,8 @@ Fl_Text_Editor::bound_key_function(int key, int state, Key_Binding* list) {
return cur->function;
}
void
Fl_Text_Editor::remove_all_key_bindings(Key_Binding** list) {
/** Removes all of the key bindings associated with the text editor or list.*/
void Fl_Text_Editor::remove_all_key_bindings(Key_Binding** list) {
Key_Binding *cur, *next;
for (cur = *list; cur; cur = next) {
next = cur->next;
@ -167,8 +169,8 @@ Fl_Text_Editor::remove_all_key_bindings(Key_Binding** list) {
*list = 0;
}
void
Fl_Text_Editor::remove_key_binding(int key, int state, Key_Binding** list) {
/** Removes the key binding associated with the key "key" of state "state" */
void Fl_Text_Editor::remove_key_binding(int key, int state, Key_Binding** list) {
Key_Binding *cur, *last = 0;
for (cur = *list; cur; last = cur, cur = cur->next)
if (cur->key == key && cur->state == state) break;
@ -177,9 +179,8 @@ Fl_Text_Editor::remove_key_binding(int key, int state, Key_Binding** list) {
else *list = cur->next;
delete cur;
}
void
Fl_Text_Editor::add_key_binding(int key, int state, Key_Func function,
/** Adds a key of state "state" with the function "function" */
void Fl_Text_Editor::add_key_binding(int key, int state, Key_Func function,
Key_Binding** list) {
Key_Binding* kb = new Key_Binding;
kb->key = key;
@ -200,6 +201,7 @@ static void kill_selection(Fl_Text_Editor* e) {
}
}
/** Inserts the text associated with the key */
int Fl_Text_Editor::kf_default(int c, Fl_Text_Editor* e) {
if (!c || (!isprint(c) && c != '\t')) return 0;
char s[2] = "\0";
@ -213,10 +215,11 @@ int Fl_Text_Editor::kf_default(int c, Fl_Text_Editor* e) {
return 1;
}
/** Ignores the keypress */
int Fl_Text_Editor::kf_ignore(int, Fl_Text_Editor*) {
return 0; // don't handle
}
/** Does a backspace in the current buffer.*/
int Fl_Text_Editor::kf_backspace(int, Fl_Text_Editor* e) {
if (!e->buffer()->selected() && e->move_left()) {
int l = 1;
@ -233,6 +236,7 @@ int Fl_Text_Editor::kf_backspace(int, Fl_Text_Editor* e) {
return 1;
}
/** Inserts a newline at the current cursor position */
int Fl_Text_Editor::kf_enter(int, Fl_Text_Editor* e) {
kill_selection(e);
e->insert("\n");
@ -243,7 +247,7 @@ int Fl_Text_Editor::kf_enter(int, Fl_Text_Editor* e) {
}
extern void fl_text_drag_me(int pos, Fl_Text_Display* d);
/** Moves the text cursor in the direction indicated by key c.*/
int Fl_Text_Editor::kf_move(int c, Fl_Text_Editor* e) {
int i;
int selected = e->buffer()->selected();
@ -280,12 +284,13 @@ int Fl_Text_Editor::kf_move(int c, Fl_Text_Editor* e) {
return 1;
}
/** Extends the current selection in the direction of key c.*/
int Fl_Text_Editor::kf_shift_move(int c, Fl_Text_Editor* e) {
kf_move(c, e);
fl_text_drag_me(e->insert_position(), e);
return 1;
}
/** Moves the current text cursor in the direction indicated by control key */
int Fl_Text_Editor::kf_ctrl_move(int c, Fl_Text_Editor* e) {
if (!e->buffer()->selected())
e->dragPos = e->insert_position();
@ -324,50 +329,58 @@ int Fl_Text_Editor::kf_ctrl_move(int c, Fl_Text_Editor* e) {
return 1;
}
/** Extends the current selection in the direction indicated by control key c. */
int Fl_Text_Editor::kf_c_s_move(int c, Fl_Text_Editor* e) {
kf_ctrl_move(c, e);
fl_text_drag_me(e->insert_position(), e);
return 1;
}
/** Moves the text cursor to the beginning of the current line.*/
int Fl_Text_Editor::kf_home(int, Fl_Text_Editor* e) {
return kf_move(FL_Home, e);
}
/** Moves the text cursor to the end of the current line.*/
int Fl_Text_Editor::kf_end(int, Fl_Text_Editor* e) {
return kf_move(FL_End, e);
}
/** Moves the text cursor one character to the left.*/
int Fl_Text_Editor::kf_left(int, Fl_Text_Editor* e) {
return kf_move(FL_Left, e);
}
/** Moves the text cursor one line up.*/
int Fl_Text_Editor::kf_up(int, Fl_Text_Editor* e) {
return kf_move(FL_Up, e);
}
/** Moves the text cursor one character to the right.*/
int Fl_Text_Editor::kf_right(int, Fl_Text_Editor* e) {
return kf_move(FL_Right, e);
}
/** Moves the text cursor one line down.*/
int Fl_Text_Editor::kf_down(int, Fl_Text_Editor* e) {
return kf_move(FL_Down, e);
}
/** Moves the text cursor up one page.*/
int Fl_Text_Editor::kf_page_up(int, Fl_Text_Editor* e) {
return kf_move(FL_Page_Up, e);
}
/** Moves the text cursor down one page.*/
int Fl_Text_Editor::kf_page_down(int, Fl_Text_Editor* e) {
return kf_move(FL_Page_Down, e);
}
/** Toggles the insert mode in the text editor.*/
int Fl_Text_Editor::kf_insert(int, Fl_Text_Editor* e) {
e->insert_mode(e->insert_mode() ? 0 : 1);
return 1;
}
/** Does a delete of selected text or the current character in the current buffer.*/
int Fl_Text_Editor::kf_delete(int, Fl_Text_Editor* e) {
if (!e->buffer()->selected()) {
int l = 1;
@ -385,6 +398,7 @@ int Fl_Text_Editor::kf_delete(int, Fl_Text_Editor* e) {
return 1;
}
/** Does a copy of selected text or the current character in the current buffer.*/
int Fl_Text_Editor::kf_copy(int, Fl_Text_Editor* e) {
if (!e->buffer()->selected()) return 1;
const char *copy = e->buffer()->selection_text();
@ -394,6 +408,7 @@ int Fl_Text_Editor::kf_copy(int, Fl_Text_Editor* e) {
return 1;
}
/** Does a cut of selected text in the current buffer.*/
int Fl_Text_Editor::kf_cut(int c, Fl_Text_Editor* e) {
kf_copy(c, e);
kill_selection(e);
@ -402,6 +417,7 @@ int Fl_Text_Editor::kf_cut(int c, Fl_Text_Editor* e) {
return 1;
}
/** Does a paste of selected text in the current buffer.*/
int Fl_Text_Editor::kf_paste(int, Fl_Text_Editor* e) {
kill_selection(e);
Fl::paste(*e, 1);
@ -411,11 +427,12 @@ int Fl_Text_Editor::kf_paste(int, Fl_Text_Editor* e) {
return 1;
}
/** Selects all text in the current buffer.*/
int Fl_Text_Editor::kf_select_all(int, Fl_Text_Editor* e) {
e->buffer()->select(0, e->buffer()->length());
return 1;
}
/** Undo last edit in the current buffer. Also deselect previous selection. */
int Fl_Text_Editor::kf_undo(int , Fl_Text_Editor* e) {
e->buffer()->unselect();
int crsr;
@ -427,6 +444,7 @@ int Fl_Text_Editor::kf_undo(int , Fl_Text_Editor* e) {
return ret;
}
/** Handles a key press in the editor */
int Fl_Text_Editor::handle_key() {
// Call FLTK's rules to try to turn this into a printing character.
// This uses the right-hand ctrl key as a "compose prefix" and returns
@ -456,6 +474,7 @@ int Fl_Text_Editor::handle_key() {
return 0;
}
/** does or does not a callback according to changed() and when() settings */
void Fl_Text_Editor::maybe_do_callback() {
// printf("Fl_Text_Editor::maybe_do_callback()\n");
// printf("changed()=%d, when()=%x\n", changed(), when());

View File

@ -25,17 +25,15 @@
// http://www.fltk.org/str.php
//
#include <FL/Fl.H>
#include <FL/Fl_Tiled_Image.H>
#include <FL/fl_draw.H>
//
// 'Fl_Tiled_Image::Fl_Tiled_Image()' - Constructor.
//
// Use a width and height of 0 to tile the whole window/widget.
//
/**
The constructors create a new tiled image containing the specified image.
Use a width and height of 0 to tile the whole window/widget.
*/
Fl_Tiled_Image::Fl_Tiled_Image(Fl_Image *i, // I - Image to tile
int W, // I - Width of tiled area
int H) : // I - Height of tiled area
@ -46,13 +44,11 @@ Fl_Tiled_Image::Fl_Tiled_Image(Fl_Image *i, // I - Image to tile
if (W == 0) w(Fl::w());
if (H == 0) h(Fl::h());
}
//
// 'Fl_Tiled_Image::~Fl_Tiled_Image()' - Destructor.
//
Fl_Tiled_Image::~Fl_Tiled_Image() {
/**
The destructor frees all memory and server resources that are used by
the tiled image.
*/
Fl_Tiled_Image::~Fl_Tiled_Image() {
if (alloc_image_) delete image_;
}

View File

@ -135,14 +135,16 @@ static void tooltip_timeout(void*) {
recursion = 0;
}
// If this widget or one of it's parents has a tooltip, enter it. This
// will do nothing if this is the current widget (even if the mouse moved
// out so an exit() was done and then moved back in). If no tooltip can
// be found do Fl_Tooltip::exit_(). If you don't want this behavior (for instance
// if you want the tooltip to reappear when the mouse moves back in)
// call the fancier enter_area() below.
void
Fl_Tooltip::enter_(Fl_Widget* w) {
/**
This method is called when the mouse pointer enters a widget.
<P>If this widget or one of it's parents has a tooltip, enter it. This
will do nothing if this is the current widget (even if the mouse moved
out so an exit() was done and then moved back in). If no tooltip can
be found do Fl_Tooltip::exit_(). If you don't want this behavior (for instance
if you want the tooltip to reappear when the mouse moves back in)
call the fancier enter_area() below.
*/
void Fl_Tooltip::enter_(Fl_Widget* w) {
#ifdef DEBUG
printf("Fl_Tooltip::enter_(w=%p)\n", w);
printf(" window=%p\n", window);
@ -158,11 +160,13 @@ Fl_Tooltip::enter_(Fl_Widget* w) {
}
enter_area(w, 0, 0, w->w(), w->h(), tw->tooltip());
}
// Acts as though enter(widget) was done but does not pop up a
// tooltip. This is useful to prevent a tooltip from reappearing when
// a modal overlapping window is deleted. FLTK does this automatically
// when you click the mouse button.
/**
Sets the current widget target.
Acts as though enter(widget) was done but does not pop up a
tooltip. This is useful to prevent a tooltip from reappearing when
a modal overlapping window is deleted. FLTK does this automatically
when you click the mouse button.
*/
void Fl_Tooltip::current(Fl_Widget* w) {
#ifdef DEBUG
printf("Fl_Tooltip::current(w=%p)\n", w);
@ -181,8 +185,8 @@ void Fl_Tooltip::current(Fl_Widget* w) {
}
// Hide any visible tooltip.
void
Fl_Tooltip::exit_(Fl_Widget *w) {
/** This method is called when the mouse pointer leaves a widget. */
void Fl_Tooltip::exit_(Fl_Widget *w) {
#ifdef DEBUG
printf("Fl_Tooltip::exit_(w=%p)\n", w);
printf(" widget=%p, window=%p\n", widget_, window);
@ -203,8 +207,18 @@ Fl_Tooltip::exit_(Fl_Widget *w) {
// it define an area the tooltip is for, this along with the current
// mouse position places the tooltip (the mouse is assummed to point
// inside or near the box).
void
Fl_Tooltip::enter_area(Fl_Widget* wid, int x,int y,int w,int h, const char* t)
/**
You may be able to use this to provide tooltips for internal pieces
of your widget. Call this after setting Fl::belowmouse() to
your widget (because that calls the above enter() method). Then figure
out what thing the mouse is pointing at, and call this with the widget
(this pointer is used to remove the tooltip if the widget is deleted
or hidden, and to locate the tooltip), the rectangle surrounding the
area, relative to the top-left corner of the widget (used to calculate
where to put the tooltip), and the text of the tooltip (which must be
a pointer to static data as it is not copied).
*/
void Fl_Tooltip::enter_area(Fl_Widget* wid, int x,int y,int w,int h, const char* t)
{
(void)x;
(void)w;

View File

@ -25,6 +25,7 @@
// http://www.fltk.org/str.php
//
// Contents:
//
// Fl_Wizard::Fl_Wizard() - Create an Fl_Wizard widget.
// Fl_Wizard::draw() - Draw the wizard border and visible child.
@ -47,6 +48,11 @@
// 'Fl_Wizard::Fl_Wizard()' - Create an Fl_Wizard widget.
//
/**
The constructor creates the Fl_Wizard widget at the specified
position and size.
<P>The inherited destructor destroys the widget and its children.
*/
Fl_Wizard::Fl_Wizard(int xx, // I - Lefthand position
int yy, // I - Upper position
int ww, // I - Width
@ -61,12 +67,8 @@ Fl_Wizard::Fl_Wizard(int xx, // I - Lefthand position
//
// 'Fl_Wizard::draw()' - Draw the wizard border and visible child.
//
void
Fl_Wizard::draw()
{
/** Draws the wizard border and visible child. */
void Fl_Wizard::draw() {
Fl_Widget *kid; // Visible child
@ -89,13 +91,11 @@ Fl_Wizard::draw()
}
//
// 'Fl_Wizard::next()' - Show the next child.
//
void
Fl_Wizard::next()
{
/**
This method shows the next child of the wizard. If the last child
is already visible, this function does nothing.
*/
void Fl_Wizard::next() {
int num_kids;
Fl_Widget * const *kids;
@ -111,14 +111,8 @@ Fl_Wizard::next()
value(kids[1]);
}
//
// 'Fl_Wizard::prev()' - Show the previous child.
//
void
Fl_Wizard::prev()
/** Shows the previous child.*/
void Fl_Wizard::prev()
{
int num_kids;
Fl_Widget * const *kids;
@ -135,13 +129,8 @@ Fl_Wizard::prev()
value(kids[-1]);
}
//
// 'Fl_Wizard::value()' - Return the current visible child.
//
Fl_Widget *
Fl_Wizard::value()
/** Gets the current visible child widget. */
Fl_Widget* Fl_Wizard::value()
{
int num_kids;
Fl_Widget * const *kids;
@ -172,13 +161,8 @@ Fl_Wizard::value()
return (kid);
}
//
// 'Fl_Wizard::value()' - Set the visible child.
//
void
Fl_Wizard::value(Fl_Widget *kid)
/** Sets the child widget that is visible.*/
void Fl_Wizard::value(Fl_Widget *kid)
{
int num_kids;
Fl_Widget * const *kids;
@ -205,6 +189,7 @@ Fl_Wizard::value(Fl_Widget *kid)
}
//
// End of "$Id$".
//