Add more widgets from the bazaar...

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1571 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2001-08-11 14:49:51 +00:00
parent 90781ce428
commit 64859c22f7
9 changed files with 318 additions and 46 deletions

View File

@ -15,12 +15,12 @@ CHANGES IN FLTK 1.1.0
movement values from Fl::e_dx (horizontal) and
Fl::e_dy (vertical).
- Added the Fl_FileBrowser, Fl_FileChooser, Fl_FileIcon,
Fl_HelpDialog, Fl_HelpView, and Fl_Wizard widgets from
- Added the Fl_Check_Browser, Fl_FileBrowser,
Fl_FileChooser, Fl_FileIcon, Fl_HelpDialog,
Fl_HelpView, Fl_Progress, and Fl_Wizard widgets from
the bazaar.
TODO - Added the Fl_Check_Browser, and Fl_Tree_Browser
widgets from the bazaar.
TODO - Added the Fl_Tree_Browser widgets from the bazaar.
- Added 2.0 Fl_Text_Display and Fl_Text_Editor widgets
based on NEdit.

87
FL/Fl_Check_Browser.H Normal file
View File

@ -0,0 +1,87 @@
//
// "$Id: Fl_Check_Browser.H,v 1.1.2.1 2001/08/11 14:49:51 easysw Exp $"
//
// Fl_Check_Browser header file for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2001 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 to "fltk-bugs@fltk.org".
//
#ifndef Fl_Check_Browser_H
#define Fl_Check_Browser_H
#include "Fl.H"
#include "Fl_Browser_.H"
class Fl_Check_Browser : public Fl_Browser_ {
/* required routines for Fl_Browser_ subclass: */
FL_EXPORT void *item_first() const;
FL_EXPORT void *item_next(void *) const;
FL_EXPORT void *item_prev(void *) const;
FL_EXPORT int item_height(void *) const;
FL_EXPORT int item_width(void *) const;
FL_EXPORT void item_draw(void *, int, int, int, int) const;
FL_EXPORT void item_select(void *, int);
FL_EXPORT int item_selected(void *) const;
/* private data */
struct cb_item {
cb_item *next;
cb_item *prev;
char checked;
char selected;
char *text;
};
cb_item *first;
cb_item *last;
cb_item *cache;
int cached_item;
int nitems_;
int nchecked_;
FL_EXPORT cb_item *find_item(int) const;
FL_EXPORT int lineno(cb_item *) const;
public:
FL_EXPORT Fl_Check_Browser(int x, int y, int w, int h, const char *l = 0);
FL_EXPORT int add(char *s); // add an (unchecked) item
FL_EXPORT int add(char *s, int b); // add an item and set checked
// both return the new nitems()
FL_EXPORT void clear(); // delete all items
int nitems() const { return nitems_; }
int nchecked() const { return nchecked_; }
FL_EXPORT int checked(int item) const;
FL_EXPORT void checked(int item, int b);
void set_checked(int item) { checked(item, 1); }
FL_EXPORT void check_all();
FL_EXPORT void check_none();
FL_EXPORT int value() const; // currently selected item
FL_EXPORT char *text(int item) const; // returns pointer to internal buffer
};
#endif // Fl_Check_Browser_H
//
// End of "$Id: Fl_Check_Browser.H,v 1.1.2.1 2001/08/11 14:49:51 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_FileBrowser.H,v 1.4.2.1 2001/08/02 16:17:04 easysw Exp $"
// "$Id: Fl_FileBrowser.H,v 1.4.2.2 2001/08/11 14:49:51 easysw Exp $"
//
// FileBrowser definitions.
//
@ -51,23 +51,22 @@ class Fl_FileBrowser : public Fl_Browser
int incr_height() const { return (item_height(0)); }
public:
Fl_FileBrowser(int, int, int, int, const char * = 0);
FL_EXPORT Fl_FileBrowser(int, int, int, int, const char * = 0);
uchar iconsize() const { return (iconsize_); };
void iconsize(uchar s) { iconsize_ = s; redraw(); };
uchar iconsize() const { return (iconsize_); };
void iconsize(uchar s) { iconsize_ = s; redraw(); };
void filter(const char *pattern);
const char *filter() const { return (pattern_); };
FL_EXPORT void filter(const char *pattern);
const char *filter() const { return (pattern_); };
int load(const char *directory);
uchar textsize() const { return (Fl_Browser::textsize()); };
void textsize(uchar s) { Fl_Browser::textsize(s); iconsize_ = 3 * s / 2; };
FL_EXPORT int load(const char *directory);
uchar textsize() const { return (Fl_Browser::textsize()); };
void textsize(uchar s) { Fl_Browser::textsize(s); iconsize_ = 3 * s / 2; };
};
#endif // !_Fl_FileBrowser_H_
//
// End of "$Id: Fl_FileBrowser.H,v 1.4.2.1 2001/08/02 16:17:04 easysw Exp $".
// End of "$Id: Fl_FileBrowser.H,v 1.4.2.2 2001/08/11 14:49:51 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_FileIcon.H,v 1.1.2.1 2001/08/02 16:17:04 easysw Exp $"
// "$Id: Fl_FileIcon.H,v 1.1.2.2 2001/08/11 14:49:51 easysw Exp $"
//
// Fl_FileIcon definitions.
//
@ -39,7 +39,7 @@
class Fl_FileIcon //// Icon data
{
static Fl_FileIcon *first_; // Pointer to first icon/filetype
FL_EXPORT static Fl_FileIcon *first_; // Pointer to first icon/filetype
Fl_FileIcon *next_; // Pointer to next icon/filetype
const char *pattern_; // Pattern string
int type_; // Match only if directory or file?
@ -70,36 +70,36 @@ class Fl_FileIcon //// Icon data
VERTEX // Followed by scaled X,Y
};
Fl_FileIcon(const char *p, int t, int nd = 0, short *d = 0);
~Fl_FileIcon();
FL_EXPORT Fl_FileIcon(const char *p, int t, int nd = 0, short *d = 0);
FL_EXPORT ~Fl_FileIcon();
short *add(short d);
short *add_color(short c)
{ short *d = add(COLOR); add(c); return (d); }
short *add_vertex(int x, int y)
{ short *d = add(VERTEX); add(x); add(y); return (d); }
short *add_vertex(float x, float y)
{ short *d = add(VERTEX); add((int)(x * 10000.0));
add((int)(y * 10000.0)); return (d); }
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);
void load_fti(const char *fti);
void load_xpm(const char *xpm);
const char *pattern() { return (pattern_); }
int size() { return (num_data_); }
int type() { return (type_); }
short *value() { return (data_); }
FL_EXPORT short *add(short d);
short *add_color(short c)
{ short *d = add(COLOR); add(c); return (d); }
short *add_vertex(int x, int y)
{ short *d = add(VERTEX); add(x); add(y); return (d); }
short *add_vertex(float x, float y)
{ short *d = add(VERTEX); add((int)(x * 10000.0));
add((int)(y * 10000.0)); return (d); }
void clear() { num_data_ = 0; }
FL_EXPORT void draw(int x, int y, int w, int h, Fl_Color ic, int active = 1);
FL_EXPORT void label(Fl_Widget *w);
FL_EXPORT static void labeltype(const Fl_Label *o, int x, int y, int w, int h, Fl_Align a);
FL_EXPORT void load(const char *f);
FL_EXPORT void load_fti(const char *fti);
FL_EXPORT void load_xpm(const char *xpm);
const char *pattern() { return (pattern_); }
int size() { return (num_data_); }
int type() { return (type_); }
short *value() { return (data_); }
static Fl_FileIcon *find(const char *filename, int filetype = ANY);
FL_EXPORT static Fl_FileIcon *find(const char *filename, int filetype = ANY);
static Fl_FileIcon *first() { return (first_); }
static void load_system_icons(void);
FL_EXPORT static void load_system_icons(void);
};
#endif // !_Fl_Fl_FileIcon_H_
//
// End of "$Id: Fl_FileIcon.H,v 1.1.2.1 2001/08/02 16:17:04 easysw Exp $".
// End of "$Id: Fl_FileIcon.H,v 1.1.2.2 2001/08/11 14:49:51 easysw Exp $".
//

68
FL/Fl_Progress.H Normal file
View File

@ -0,0 +1,68 @@
//
// "$Id: Fl_Progress.H,v 1.1.2.1 2001/08/11 14:49:51 easysw Exp $"
//
// Progress bar widget definitions.
//
// Copyright 2000-2001 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 to "fltk-bugs@fltk.org".
//
#ifndef _Fl_Progress_H_
# define _Fl_Progress_H_
//
// Include necessary headers.
//
#include "Fl_Widget.H"
//
// Progress class...
//
class Fl_Progress : public Fl_Widget
{
float value_,
minimum_,
maximum_;
protected:
FL_EXPORT virtual void draw();
public:
FL_EXPORT Fl_Progress(int x, int y, int w, int h, const char *l = 0);
void maximum(float v) { maximum_ = v; redraw(); }
float maximum() const { return (maximum_); }
void minimum(float v) { minimum_ = v; redraw(); }
float minimum() const { return (minimum_); }
void value(float v) { value_ = v; redraw(); }
float value() const { return (value_); }
};
#endif // !_Fl_Progress_H_
//
// End of "$Id: Fl_Progress.H,v 1.1.2.1 2001/08/11 14:49:51 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
#
# "$Id: fltk.list,v 1.1.2.6.2.1 2001/08/02 18:08:36 easysw Exp $"
# "$Id: fltk.list,v 1.1.2.6.2.2 2001/08/11 14:49:51 easysw Exp $"
#
# EPM product list file for the Fast Light Tool Kit (FLTK).
#
@ -88,6 +88,7 @@ l 0000 root sys /usr/include/FL/Fl_Browser.h Fl_Browser.H
l 0000 root sys /usr/include/FL/Fl_Browser_.h Fl_Browser_.H
l 0000 root sys /usr/include/FL/Fl_Button.h Fl_Button.H
l 0000 root sys /usr/include/FL/Fl_Chart.h Fl_Chart.H
l 0000 root sys /usr/include/FL/Fl_Check_Browser.h Fl_Check_Browser.H
l 0000 root sys /usr/include/FL/Fl_Check_Button.h Fl_Check_Button.H
l 0000 root sys /usr/include/FL/Fl_Choice.h Fl_Choice.H
l 0000 root sys /usr/include/FL/Fl_Clock.h Fl_Clock.H
@ -134,6 +135,7 @@ l 0000 root sys /usr/include/FL/Fl_Overlay_Window.h Fl_Overlay_Window.H
l 0000 root sys /usr/include/FL/Fl_Pack.h Fl_Pack.H
l 0000 root sys /usr/include/FL/Fl_Pixmap.h Fl_Pixmap.H
l 0000 root sys /usr/include/FL/Fl_Positioner.h Fl_Positioner.H
l 0000 root sys /usr/include/FL/Fl_Progress.h Fl_Progress.H
l 0000 root sys /usr/include/FL/Fl_Radio_Button.h Fl_Radio_Button.H
l 0000 root sys /usr/include/FL/Fl_Radio_Light_Button.h Fl_Radio_Light_Button.H
l 0000 root sys /usr/include/FL/Fl_Radio_Round_Button.h Fl_Radio_Round_Button.H
@ -183,5 +185,5 @@ f 0444 root sys /usr/share/doc/fltk/COPYING COPYING
f 0444 root sys /usr/share/doc/fltk/CHANGES CHANGES
#
# End of "$Id: fltk.list,v 1.1.2.6.2.1 2001/08/02 18:08:36 easysw Exp $".
# End of "$Id: fltk.list,v 1.1.2.6.2.2 2001/08/11 14:49:51 easysw Exp $".
#

108
src/Fl_Progress.cxx Normal file
View File

@ -0,0 +1,108 @@
//
// "$Id: Fl_Progress.cxx,v 1.1.2.1 2001/08/11 14:49:51 easysw Exp $"
//
// Progress bar widget routines.
//
// Copyright 2000-2001 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 to "fltk-bugs@fltk.org".
//
// Contents:
//
// Fl_Progress::draw() - Draw the check button.
// Fl_Progress::Fl_Progress() - Construct a Fl_Progress widget.
//
//
// Include necessary header files...
//
#include <FL/Fl.H>
#include <FL/Fl_Progress.H>
#include <FL/fl_draw.H>
//
// Fl_Progress is a progress bar widget based off Fl_Widget that shows a
// standard progress bar...
//
//
// 'Fl_Progress::draw()' - Draw the check button.
//
void Fl_Progress::draw()
{
int progress; // Size of progress bar...
int bx, by, bw, bh; // Box areas...
// Get the box borders...
bx = Fl::box_dx(box());
by = Fl::box_dy(box());
bw = Fl::box_dw(box());
bh = Fl::box_dh(box());
// Draw the box...
draw_box(box(), x(), y(), w(), h(), color());
// Draw the progress bar...
if (maximum_ > minimum_)
progress = (int)((w() - bw) * (value_ - minimum_) /
(maximum_ - minimum_) + 0.5f);
else
progress = 0;
if (progress > 0)
{
fl_clip(x() + bx, y() + by, w() - bw, h() - bh);
fl_color(active_r() ? color2() : inactive(color2()));
fl_polygon(x() + bx, y() + by,
x() + bx, y() + h() - by,
x() + 3 + progress - h() / 4, y() + h() - by,
x() + 1 + progress + h() / 4, y() + by);
fl_pop_clip();
}
// Finally, the label...
draw_label(x() + bx, y() + by, w() - bw, h() - bh);
}
//
// 'Fl_Progress::Fl_Progress()' - Construct a Fl_Progress widget.
//
Fl_Progress::Fl_Progress(int x, int y, int w, int h, const char* l)
: Fl_Widget(x, y, w, h, l)
{
align(FL_ALIGN_INSIDE);
box(FL_DOWN_BOX);
color(FL_WHITE, FL_YELLOW);
minimum(0.0f);
maximum(100.0f);
value(0.0f);
}
//
// End of "$Id: Fl_Progress.cxx,v 1.1.2.1 2001/08/11 14:49:51 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
#
# "$Id: Makefile,v 1.18.2.14.2.8 2001/08/04 12:21:33 easysw Exp $"
# "$Id: Makefile,v 1.18.2.14.2.9 2001/08/11 14:49:51 easysw Exp $"
#
# Library makefile for the Fast Light Tool Kit (FLTK).
#
@ -33,6 +33,7 @@ CPPFILES = \
Fl_Box.cxx \
Fl_Button.cxx \
Fl_Chart.cxx \
Fl_Check_Browser.cxx \
Fl_Check_Button.cxx \
Fl_Choice.cxx \
Fl_Clock.cxx \
@ -64,6 +65,7 @@ CPPFILES = \
Fl_Pack.cxx \
Fl_Pixmap.cxx \
Fl_Positioner.cxx \
Fl_Progress.cxx \
Fl_Repeat_Button.cxx \
Fl_Return_Button.cxx \
Fl_Roller.cxx \
@ -256,5 +258,5 @@ install: $(LIBNAME) $(DSONAME) $(GLLIBNAME) $(GLDSONAME)
ln -s FL $(includedir)/Fl
#
# End of "$Id: Makefile,v 1.18.2.14.2.8 2001/08/04 12:21:33 easysw Exp $".
# End of "$Id: Makefile,v 1.18.2.14.2.9 2001/08/11 14:49:51 easysw Exp $".
#

View File

@ -29,6 +29,10 @@ Fl_Button.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Button.o: ../FL/Fl_Button.H ../FL/Fl_Widget.H ../FL/Fl_Group.H
Fl_Chart.o: ../FL/math.h ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Chart.o: ../FL/Fl_Chart.H ../FL/Fl_Widget.H ../FL/fl_draw.H
Fl_Check_Browser.o: ../FL/fl_draw.H ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Check_Browser.o: ../FL/Fl_Check_Browser.H ../FL/Fl.H ../FL/Fl_Browser_.H
Fl_Check_Browser.o: ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/Fl_Scrollbar.H
Fl_Check_Browser.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H
Fl_Check_Button.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Check_Button.o: ../FL/Fl_Check_Button.H ../FL/Fl_Light_Button.H
Fl_Check_Button.o: ../FL/Fl_Button.H ../FL/Fl_Widget.H
@ -57,7 +61,7 @@ Fl_FileBrowser.o: ../FL/Fl_FileBrowser.H ../FL/Fl_Browser.H
Fl_FileBrowser.o: ../FL/Fl_Browser_.H ../FL/Fl_Group.H ../FL/Fl_Widget.H
Fl_FileBrowser.o: ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/Fl_Scrollbar.H
Fl_FileBrowser.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/Fl_FileIcon.H
Fl_FileBrowser.o: ../FL/Fl.H ../FL/fl_draw.H ../FL/filename.H
Fl_FileBrowser.o: ../FL/Fl.H ../FL/fl_draw.H ../FL/filename.H ../config.h
Fl_FileChooser.o: ../FL/Fl_FileChooser.H ../FL/Fl.H ../FL/Enumerations.H
Fl_FileChooser.o: ../FL/Fl_Export.H ../FL/Fl_Window.H ../FL/Fl_Group.H
Fl_FileChooser.o: ../FL/Fl_Widget.H ../FL/Fl_FileBrowser.H ../FL/Fl_Browser.H
@ -141,6 +145,8 @@ Fl_Pixmap.o: ../FL/Fl_Menu_Item.H ../FL/Fl_Widget.H ../FL/Fl_Pixmap.H
Fl_Pixmap.o: ../FL/Fl_Image.H
Fl_Positioner.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Positioner.o: ../FL/Fl_Positioner.H ../FL/Fl_Widget.H ../FL/fl_draw.H
Fl_Progress.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Progress.o: ../FL/Fl_Progress.H ../FL/Fl_Widget.H ../FL/fl_draw.H
Fl_Repeat_Button.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H
Fl_Repeat_Button.o: ../FL/Fl_Repeat_Button.H ../FL/Fl.H ../FL/Fl_Button.H
Fl_Repeat_Button.o: ../FL/Fl_Widget.H