diff --git a/CHANGES b/CHANGES index ff2616da5..5f23080ed 100644 --- a/CHANGES +++ b/CHANGES @@ -8,9 +8,20 @@ TODO - Documentation updates. CHANGES IN FLTK 1.1.0b2 - - Fixed image/text label handling; in b1 the label needed - a non-blank text string to display the image. This bug - also caused all sorts of crashes and display problems. + - Fixed image/text label handling; in b1 the label + needed a non-blank text string to display the image. + This bug also caused all sorts of crashes and display + problems. + - Added new filetype() method to Fl_FileBrowser to allow + for file or directory browsing. + - Fixed the drawing of the focus box around + Fl_Return_Button. + - Fixed menu item measurement bug (wasn't initializing + image pointers to 0...) + - Radio and checkbox menu items now draw with the new + style (round radio buttons with dots and square check + buttons with check marks.) + - Improved the appearance of Fl_Check_Button. CHANGES IN FLTK 1.1.0b1 diff --git a/FL/Fl_FileBrowser.H b/FL/Fl_FileBrowser.H index 2d788580e..9add8e088 100644 --- a/FL/Fl_FileBrowser.H +++ b/FL/Fl_FileBrowser.H @@ -1,5 +1,5 @@ // -// "$Id: Fl_FileBrowser.H,v 1.4.2.2 2001/08/11 14:49:51 easysw Exp $" +// "$Id: Fl_FileBrowser.H,v 1.4.2.3 2001/09/04 13:13:29 easysw Exp $" // // FileBrowser definitions. // @@ -40,6 +40,9 @@ class Fl_FileBrowser : public Fl_Browser { + enum { FILES, DIRECTORIES }; + + int filetype_; const char *directory_; uchar iconsize_; const char *pattern_; @@ -63,10 +66,13 @@ public: uchar textsize() const { return (Fl_Browser::textsize()); }; void textsize(uchar s) { Fl_Browser::textsize(s); iconsize_ = 3 * s / 2; }; + + int filetype() const { return (filetype_); }; + void filetype(int t) { filetype_ = t; load(directory_); }; }; #endif // !_Fl_FileBrowser_H_ // -// End of "$Id: Fl_FileBrowser.H,v 1.4.2.2 2001/08/11 14:49:51 easysw Exp $". +// End of "$Id: Fl_FileBrowser.H,v 1.4.2.3 2001/09/04 13:13:29 easysw Exp $". // diff --git a/documentation/Fl_FileBrowser.html b/documentation/Fl_FileBrowser.html index 4a0203298..2c9e1da00 100644 --- a/documentation/Fl_FileBrowser.html +++ b/documentation/Fl_FileBrowser.html @@ -1,76 +1,73 @@ -
-
-Fl_Browser
+Fl_Browser
|
- +----FileBrowser
+ +----Fl_FileBrowser
-#include "FileBrowser.h" +#include <FL/Fl_FileBrowser.H>
The FileBrowser widget displays a list of filenames,
+
The Fl_FileBrowser widget displays a list of filenames,
optionally with file-specific icons.
The constructor creates the FileBrowser widget at the specified
+
The constructor creates the Fl_FileBrowser widget at the specified
position and size.
-
The destructor destroys the widget and frees all memory that has been allocated. -
Sets or gets the size of the icons. The default size is 20 pixels. -
Sets or gets the filename filter. The pattern matching uses the
filename_match() function in FLTK.
-
Sets or gets the file browser type, FILES or
+DIRECTORIES. When set to FILES, both
+files and directories are shown. Otherwise only directories are
+shown.
+
+
Loads the specified directory into the browser. If icons have been loaded then the correct icon is associated with each file in the list. diff --git a/documentation/Fl_FileChooser.html b/documentation/Fl_FileChooser.html index 6a3010702..13846c34d 100644 --- a/documentation/Fl_FileChooser.html +++ b/documentation/Fl_FileChooser.html @@ -1,72 +1,60 @@ -
-
-Fl_Group
+Fl_Group
|
- +----FileChooser
+ +----Fl_FileChooser
-#include "FileChooser.h" +#include <FL/Fl_FileChooser.H>
The FileChooser widget displays a standard file selection
+
The Fl_FileChooser widget displays a standard file selection
dialog that supports various selection modes.
-


The constructor creates the FileChooser dialog pictured
+
The constructor creates the Fl_FileChooser dialog pictured
above. The pathname argument can be a directory name or a
complete file name (in which case the corresponding file is highlighted
in the list and in the filename input field.)
@@ -84,86 +72,88 @@ in the list and in the filename input field.)
or more existing files.
CREATE - allows the user to select a
single, existing file or specify a new filename.
+ DIRECTORY - allows the user to select a
+ single, existing directory.
The title argument is used to set the title bar text for the
-FileChooser window.
+Fl_FileChooser window.
-
Destroys the widget and frees all memory used by it. -
Sets or gets the background color of the FileBrowser list.
-
Returns the number of selected files. -
Sets or gets the current directory. -
Sets or gets the current filename filter pattern. -
Hides the FileChooser window.
+
Hides the Fl_FileChooser window.
-
Sets or gets the size of the icons in the FileBrowser. By
default the icon size is set to 1.5 times the textsize().
-
Sets or gets the title bar text for the FileChooser.
+
Sets or gets the title bar text for the Fl_FileChooser.
-
Reloads the current directory in the FileBrowser.
-
Shows the FileChooser window.
+
Shows the Fl_FileChooser window.
-
Sets or gets the current FileBrowser text color.
-
Sets or gets the current FileBrowser text font.
-
Sets or gets the current FileBrowser text size.
-
Sets or gets the current type of FileChooser.
+
Sets or gets the current type of Fl_FileChooser.
-
Sets or gets the current value of the selected file. -
Returns 1 if the FileChooser window is visible.
+
Returns 1 if the Fl_FileChooser window is visible.
-FileIcon +Fl_FileIcon
-#include "FileIcon.h" +#include <FL/Fl_FileIcon.H>
The FileIcon class manages icon images that can be
+
The Fl_FileIcon class manages icon images that can be
used as labels in other widgets and as icons in the FileBrowser
widget.
@@ -40,47 +28,47 @@ widget.
The constructor creates a new FileIcon with the specified
+
The constructor creates a new Fl_FileIcon with the specified
information.
-
The destructor destroys the icon and frees all memory that has been allocated for it. -
Adds a keyword value to the icon array, returning a pointer to it. -
Adds a color value to the icon array, returning a pointer to it. -
Adds a vertex value to the icon array, returning a pointer to it. @@ -88,76 +76,76 @@ The integer version accepts coordinates from 0 to 10000, while the floating point version goes from 0.0 to 1.0. The origin (0.0) is in the lower-lefthand corner of the icon. -
Clears all icon data from the icon. -
Draws the icon in the indicated area. -
Finds an icon that matches the given filename and file type. -
Returns a pointer to the first icon in the list. -
Applies the icon to the widget, registering the FileIcon
+
Applies the icon to the widget, registering the Fl_FileIcon
label type as needed.
-
The labeltype function for icons. -
Loads the specified icon image. The format is deduced from the filename. -
Loads an SGI icon file. -
Loads all system-defined icons. This call is useful when using the
FileChooser widget and should be used when the application
starts:
-FileIcon::load_system_icons(); +Fl_FileIcon::load_system_icons();-
Loads an XPM icon file. -
Returns the filename matching pattern for the icon. -
Returns the number of words of data used by the icon. -
Returns the filetype associated with the icon, which can be one of the following:
FileIcon::ANY, any kind of file.
- FileIcon::PLAIN, plain files.
- FileIcon::FIFO, named pipes.
- FileIcon::DEVICE, character and block devices.
- FileIcon::LINK, symbolic links.
- FileIcon::DIRECTORY, directories.
+ Fl_FileIcon::ANY, any kind of file.
+ Fl_FileIcon::PLAIN, plain files.
+ Fl_FileIcon::FIFO, named pipes.
+ Fl_FileIcon::DEVICE, character and block devices.
+ Fl_FileIcon::LINK, symbolic links.
+ Fl_FileIcon::DIRECTORY, directories.
Returns the data array for the icon. diff --git a/src/Fl_FileBrowser.cxx b/src/Fl_FileBrowser.cxx index 7ebbcfcb8..63587bcf4 100644 --- a/src/Fl_FileBrowser.cxx +++ b/src/Fl_FileBrowser.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_FileBrowser.cxx,v 1.13.2.4 2001/08/06 15:19:20 easysw Exp $" +// "$Id: Fl_FileBrowser.cxx,v 1.13.2.5 2001/09/04 13:13:29 easysw Exp $" // // Fl_FileBrowser routines. // @@ -382,6 +382,7 @@ Fl_FileBrowser::Fl_FileBrowser(int x, // I - Upper-lefthand X coordinate pattern_ = "*"; directory_ = ""; iconsize_ = 3 * textsize() / 2; + filetype_ = FILES; } @@ -389,7 +390,7 @@ Fl_FileBrowser::Fl_FileBrowser(int x, // I - Upper-lefthand X coordinate // 'Fl_FileBrowser::load()' - Load a directory into the browser. // -int // O - Number of files loaded +int // O - Number of files loaded Fl_FileBrowser::load(const char *directory)// I - Directory to load { int i; // Looping var @@ -531,7 +532,8 @@ Fl_FileBrowser::load(const char *directory)// I - Directory to load num_dirs ++; insert(num_dirs, name, Fl_FileIcon::find(filename)); } - else if (filename_match(files[i]->d_name, pattern_)) + else if (filetype_ == FILES && + filename_match(files[i]->d_name, pattern_)) add(files[i]->d_name, Fl_FileIcon::find(filename)); } @@ -564,5 +566,5 @@ Fl_FileBrowser::filter(const char *pattern) // I - Pattern string // -// End of "$Id: Fl_FileBrowser.cxx,v 1.13.2.4 2001/08/06 15:19:20 easysw Exp $". +// End of "$Id: Fl_FileBrowser.cxx,v 1.13.2.5 2001/09/04 13:13:29 easysw Exp $". // diff --git a/src/Fl_Light_Button.cxx b/src/Fl_Light_Button.cxx index 3a554ac62..7993ff909 100644 --- a/src/Fl_Light_Button.cxx +++ b/src/Fl_Light_Button.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Light_Button.cxx,v 1.4.2.3.2.2 2001/08/04 20:17:10 easysw Exp $" +// "$Id: Fl_Light_Button.cxx,v 1.4.2.3.2.3 2001/09/04 13:13:29 easysw Exp $" // // Lighted button widget for the Fast Light Tool Kit (FLTK). // @@ -50,9 +50,9 @@ void Fl_Light_Button::draw() { if (value()) { fl_color(col); fl_line_style(FL_SOLID, 2); - fl_line(x() + W - d - 6, y() + d + 4, - x() + W / 2 - 2, y() + W - d - 6, - x() + d + 4, y() + W / 2 - 1); + fl_line(x() + W - d - 7, y() + d + 5, + x() + W / 2 - 1, y() + W - d - 7, + x() + d + 5, y() + W / 2); fl_line_style(FL_SOLID); } break; @@ -105,5 +105,5 @@ Fl_Light_Button::Fl_Light_Button(int x, int y, int w, int h, const char* l) } // -// End of "$Id: Fl_Light_Button.cxx,v 1.4.2.3.2.2 2001/08/04 20:17:10 easysw Exp $". +// End of "$Id: Fl_Light_Button.cxx,v 1.4.2.3.2.3 2001/09/04 13:13:29 easysw Exp $". // diff --git a/src/Fl_Menu.cxx b/src/Fl_Menu.cxx index 2e958dab9..000e7d706 100644 --- a/src/Fl_Menu.cxx +++ b/src/Fl_Menu.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Menu.cxx,v 1.18.2.12.2.2 2001/08/06 03:17:43 easysw Exp $" +// "$Id: Fl_Menu.cxx,v 1.18.2.12.2.3 2001/09/04 13:13:29 easysw Exp $" // // Menu code for the Fast Light Tool Kit (FLTK). // @@ -108,11 +108,13 @@ extern char fl_draw_shortcut; // width of label, including effect of & characters: int Fl_Menu_Item::measure(int* hp, const Fl_Menu_* m) const { Fl_Label l; - l.value = text; - l.type = labeltype_; - l.font = labelsize_ ? labelfont_ : uchar(m ? m->textfont() : FL_HELVETICA); - l.size = labelsize_ ? labelsize_ : m ? m->textsize() : FL_NORMAL_SIZE; - l.color = FL_BLACK; // this makes no difference? + l.value = text; + l.image = 0; + l.deimage = 0; + l.type = labeltype_; + l.font = labelsize_ ? labelfont_ : uchar(m ? m->textfont() : FL_HELVETICA); + l.size = labelsize_ ? labelsize_ : m ? m->textsize() : FL_NORMAL_SIZE; + l.color = FL_BLACK; // this makes no difference? fl_draw_shortcut = 1; int w = 0; int h = 0; l.measure(w, hp ? *hp : h); fl_draw_shortcut = 0; @@ -156,26 +158,33 @@ void Fl_Menu_Item::draw(int x, int y, int w, int h, const Fl_Menu_* m, } if (flags & (FL_MENU_TOGGLE|FL_MENU_RADIO)) { - int y1 = y+(h-14)/2; - fl_color(FL_DARK3); + int size = 12; + int y1 = y + (h - size) / 2; + int x1 = x + 2; + if (flags & FL_MENU_RADIO) { - fl_line(x+2, y1+7, x+8, y1+1, x+14, y1+7); - if (selected) { - fl_color(color); - fl_polygon(x+3, y1+7, x+8, y1+2, x+13, y1+7, x+8, y1+12); - } - fl_color(FL_LIGHT3); fl_line(x+14, y1+7, x+8, y1+13, x+2, y1+7); + fl_color(FL_DARK3); + fl_arc(x1, y1, size, size, 45.0, 225.0); + fl_color(FL_LIGHT3); + fl_arc(x1, y1, size, size, 225.0, 405.0); + if (value()) { - fl_color(FL_BLACK); - fl_polygon(x+4, y1+7, x+8, y1+3, x+12, y1+7, x+8, y1+11); + fl_color(FL_BLACK); + fl_pie(x1 + 3, y1 + 3, size - 7, size - 7, 0.0, 360.0); } } else { - fl_yxline(x+3, y1+11, y1+2, x+12); - if (selected) {fl_color(color); fl_rectf(x+4, y1+3, 9, 9);} - fl_color(FL_LIGHT3); fl_xyline(x+4, y1+12, x+13, y1+3); - if (value()) {fl_color(FL_BLACK); fl_rectf(x+5, y1+4, 7, 7);} + fl_draw_box(FL_THIN_DOWN_FRAME, x1, y1, size, size, color); + if (value()) { + fl_color(FL_BLACK); + fl_line_style(FL_SOLID, 2); + fl_line(x1 + size - 3, y1 + 2, + x1 + size / 2 - 1, y1 + size - 4, + x1 + 3, y1 + size / 2); + fl_line_style(FL_SOLID); + } } - x += 14; w -= 14; + x += size + 3; + w -= size + 3; } if (!fl_draw_shortcut) fl_draw_shortcut = 1; @@ -743,5 +752,5 @@ const Fl_Menu_Item* Fl_Menu_Item::test_shortcut() const { } // -// End of "$Id: Fl_Menu.cxx,v 1.18.2.12.2.2 2001/08/06 03:17:43 easysw Exp $". +// End of "$Id: Fl_Menu.cxx,v 1.18.2.12.2.3 2001/09/04 13:13:29 easysw Exp $". // diff --git a/src/Fl_Return_Button.cxx b/src/Fl_Return_Button.cxx index 55723fcb0..7394a23e3 100644 --- a/src/Fl_Return_Button.cxx +++ b/src/Fl_Return_Button.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Return_Button.cxx,v 1.5.2.3.2.1 2001/08/04 16:43:31 easysw Exp $" +// "$Id: Fl_Return_Button.cxx,v 1.5.2.3.2.2 2001/09/04 13:13:29 easysw Exp $" // // Return button widget for the Fast Light Tool Kit (FLTK). // @@ -53,11 +53,7 @@ void Fl_Return_Button::draw() { if (w()/3 < W) W = w()/3; fl_return_arrow(x()+w()-W-4, y(), W, h()); draw_label(x(), y(), w()-W+4, h()); - if (Fl::focus() == this) { - fl_line_style(FL_DASH); - fl_rect(x() + 4, y() + 4, w() - 8, h() - 8); - fl_line_style(FL_SOLID); - } + if (Fl::focus() == this) draw_focus(); } int Fl_Return_Button::handle(int event) { @@ -70,5 +66,5 @@ int Fl_Return_Button::handle(int event) { } // -// End of "$Id: Fl_Return_Button.cxx,v 1.5.2.3.2.1 2001/08/04 16:43:31 easysw Exp $". +// End of "$Id: Fl_Return_Button.cxx,v 1.5.2.3.2.2 2001/09/04 13:13:29 easysw Exp $". // diff --git a/test/pack.cxx b/test/pack.cxx index af167324d..67f113e0e 100644 --- a/test/pack.cxx +++ b/test/pack.cxx @@ -1,5 +1,5 @@ // -// "$Id: pack.cxx,v 1.4.2.3 2001/01/22 15:13:41 easysw Exp $" +// "$Id: pack.cxx,v 1.4.2.3.2.1 2001/09/04 13:13:29 easysw Exp $" // // Fl_Pack test program for the Fast Light Tool Kit (FLTK). // @@ -56,10 +56,10 @@ void spacing_cb(Fl_Value_Slider*o, long) { int main(int argc, char **argv) { Fl_Window *w; - {Fl_Window* o = new Fl_Window(365, 525); + {Fl_Window* o = new Fl_Window(360, 370); w = o; - scroll = new Fl_Scroll(10,10,345,285); - {Fl_Pack* o = new Fl_Pack(10, 10, 345, 285); + scroll = new Fl_Scroll(10,10,340,285); + {Fl_Pack* o = new Fl_Pack(10, 10, 340, 285); pack = o; o->box(FL_DOWN_FRAME); //o->box(FL_ENGRAVED_FRAME); @@ -91,16 +91,16 @@ int main(int argc, char **argv) { w->resizable(o); } scroll->end(); - {Fl_Light_Button* o = new Fl_Light_Button(10, 325, 175, 25, "HORIZONTAL"); + {Fl_Light_Button* o = new Fl_Light_Button(10, 305, 165, 25, "HORIZONTAL"); o->type(FL_RADIO_BUTTON); o->callback((Fl_Callback*)type_cb, (void*)(Fl_Pack::HORIZONTAL)); } - {Fl_Light_Button* o = new Fl_Light_Button(10, 350, 175, 25, "VERTICAL"); + {Fl_Light_Button* o = new Fl_Light_Button(185, 305, 165, 25, "VERTICAL"); o->type(FL_RADIO_BUTTON); o->value(1); o->callback((Fl_Callback*)type_cb, (void*)(Fl_Pack::VERTICAL)); } - {Fl_Value_Slider* o = new Fl_Value_Slider(50,375, 295,25,"spacing:"); + {Fl_Value_Slider* o = new Fl_Value_Slider(100, 335, 250, 25, "Spacing: "); o->align(FL_ALIGN_LEFT); o->type(FL_HORIZONTAL); o->range(0,30); @@ -114,5 +114,5 @@ int main(int argc, char **argv) { } // -// End of "$Id: pack.cxx,v 1.4.2.3 2001/01/22 15:13:41 easysw Exp $". +// End of "$Id: pack.cxx,v 1.4.2.3.2.1 2001/09/04 13:13:29 easysw Exp $". //