diff options
| -rw-r--r-- | FL/Fl_Pack.H | 52 | ||||
| -rw-r--r-- | FL/Fl_Widget.H | 10 | ||||
| -rw-r--r-- | src/Fl_File_Chooser2.cxx | 65 | ||||
| -rw-r--r-- | src/Fl_Pack.cxx | 38 |
4 files changed, 108 insertions, 57 deletions
diff --git a/FL/Fl_Pack.H b/FL/Fl_Pack.H index 6a7e2be0d..26c5a33a7 100644 --- a/FL/Fl_Pack.H +++ b/FL/Fl_Pack.H @@ -3,17 +3,17 @@ // // Pack header file for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2020 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // 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: // -// http://www.fltk.org/str.php +// https://www.fltk.org/str.php // /* \file @@ -27,18 +27,31 @@ /** This widget was designed to add the functionality of compressing and aligning widgets. - <P>If type() is Fl_Pack::HORIZONTAL all the children are + + If type() is Fl_Pack::HORIZONTAL all the children are resized to the height of the Fl_Pack, and are moved next to each other horizontally. If type() is not Fl_Pack::HORIZONTAL then the children are resized to the width and are stacked below each - other. Then the Fl_Pack resizes itself to surround the child - widgets. - <P>This widget is needed for the Fl_Tabs. - In addition you may want to put the Fl_Pack inside an - Fl_Scroll. - - <P>The resizable for Fl_Pack is set to NULL by default.</p> - <P>See also: Fl_Group::resizable() + other. Then the Fl_Pack resizes itself to surround the child widgets. + + You may want to put the Fl_Pack inside an Fl_Scroll. + + The \p 'resizable()' for Fl_Pack is set to NULL by default. Its behavior + is slightly different than in a normal Fl_Group widget: only if the + resizable() widget is the last widget in the group it is extended to take + the full available width or height, respectively, of the Fl_Pack group. + + \note You can nest Fl_Pack widgets or put them inside Fl_Scroll widgets + or inside other group widgets but their behavior can sometimes be + <i>"surprising"</i>. This is partly due to the fact that Fl_Pack widgets + resize themselves during their draw() operation, trying to react on + their child widgets resizing themselves during \b their draw() operations + which can be confusing. If you want to achieve special resize behavior + of nested group widgets it can sometimes be easier to derive your own + specialized group widget than to try to make nested Fl_Pack widgets + behave as expected. + + \see Fl_Group::resizable() */ class FL_EXPORT Fl_Pack : public Fl_Group { int spacing_; @@ -53,7 +66,7 @@ protected: void draw(); public: - Fl_Pack(int x,int y,int w ,int h,const char *l = 0); + Fl_Pack(int X, int Y, int W, int H, const char *L = 0); /** Gets the number of extra pixels of blank space that are added between the children. @@ -64,7 +77,18 @@ public: between the children. */ void spacing(int i) {spacing_ = i;} - /** Same as Fl_Group::type() */ + /** Returns non-zero if Fl_Pack alignment is horizontal. + + \returns non-zero if Fl_Pack alignment is horizontal (Fl_Pack::HORIZONTAL) + + \note Currently the return value is the same as Fl_Group::type(), but + this may change in the future. Do not set any other values than the + following with Fl_Pack::type(): + - Fl_Pack::VERTICAL (Default) + - Fl_Pack::HORIZONTAL + + See class Fl_Pack documentation for details. + */ uchar horizontal() const {return type();} }; diff --git a/FL/Fl_Widget.H b/FL/Fl_Widget.H index cefe4e632..200a086bb 100644 --- a/FL/Fl_Widget.H +++ b/FL/Fl_Widget.H @@ -3,17 +3,17 @@ // // Widget header file for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2016 by Bill Spitzak and others. +// Copyright 1998-2020 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // 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: // -// http://www.fltk.org/str.php +// https://www.fltk.org/str.php // /** \file @@ -201,8 +201,8 @@ public: (because draw() is virtual) like this: \code - Fl_Widget *s = &scroll; // scroll is an embedded Fl_Scrollbar - s->draw(); // calls Fl_Scrollbar::draw() + Fl_Widget *s = &scrollbar; // scrollbar is an embedded Fl_Scrollbar + s->draw(); // calls Fl_Scrollbar::draw() \endcode */ virtual void draw() = 0; diff --git a/src/Fl_File_Chooser2.cxx b/src/Fl_File_Chooser2.cxx index 4b5292a8d..5ff8ac24e 100644 --- a/src/Fl_File_Chooser2.cxx +++ b/src/Fl_File_Chooser2.cxx @@ -3,20 +3,26 @@ // // More Fl_File_Chooser routines. // -// Copyright 1999-2018 by Michael Sweet. +// Copyright 1999-2007 by Michael Sweet. +// Copyright 2008-2020 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // 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: // -// http://www.fltk.org/str.php +// https://www.fltk.org/str.php // -// fabien: ATTENTION: Only Out Of Source Gen. because cxx/H files are autogenerated by fluid. +// The following documentation is placed here because the implementation and +// header files FL/Fl_File_Chooser.H and src/Fl_File_Chooser.cxx are generated +// by fluid from src/Fl_File_Chooser.fl. + +// *** BEGIN OUT OF SOURCE DOCUMENTATION *** + /** \defgroup group_comdlg Common Dialogs classes and functions @{ */ @@ -111,8 +117,7 @@ The Fl_File_Chooser class also exports the Fl_File_Chooser::newButton and Fl_File_Chooser::previewButton widgets so that application developers - can control their appearance and use. For more complex customization, - consider copying the FLTK file chooser code and changing it accordingly. + can control their appearance and use. */ /** @} */ @@ -250,28 +255,45 @@ /** \fn int Fl_File_Chooser::visible() Returns 1 if the Fl_File_Chooser window is visible.*/ -/** \fn Fl_Widget* Fl_File_Chooser::add_extra(Fl_Widget*) - Adds extra widget at the bottom of Fl_File_Chooser window. - Returns pointer for previous extra widget or NULL if not set previously. - If argument is NULL only remove previous extra widget. +/** \fn Fl_Widget *Fl_File_Chooser::add_extra(Fl_Widget *extra) + Adds an extra widget at the bottom of the Fl_File_Chooser window. + + You can use any Fl_Widget or Fl_Group. If you use an Fl_Group, set its (x, y) + coordinates to (0, 0) and position its children relative to (0, 0) inside + the Fl_Group container widget. Make sure that all child widgets of the + Fl_Group are entirely included inside the bounding box of their parents, + i.e. the Fl_Group widget, and the Fl_File_Chooser window, respectively. + + \note The width of the Fl_File_Chooser window is an undocumented + implementation detail and may change in the future. - \note Fl_File_Chooser does \b not delete extra widget in destructor! - To prevent memory leakage, don't forget to delete unused extra widgets + If \p extra is NULL any previous extra widget is removed. + + \param[in] extra Custom widget or group to be added to the Fl_File_Chooser window. + + \returns Pointer to previous extra widget or NULL if not set previously. + + \note Fl_File_Chooser does \b not delete the extra widget in its destructor! + The extra widget is removed from the Fl_File_Chooser window before the + Fl_File_Chooser widget gets destroyed. To prevent memory leakage, don't + forget to delete unused extra widgets. */ /** \fn int Fl_File_Chooser::shown() - Returns non-zero if the file chooser main window show() has been called (but not hide() - see Fl_Window::shown() + Returns non-zero if the file chooser main window show() has been called, + but not hide(). + \see Fl_Window::shown() */ /** \fn void Fl_File_Chooser::callback(void (*cb)(Fl_File_Chooser *, void *), void *d = 0) - Sets the file chooser callback cb and associated data d */ + Sets the file chooser callback cb and associated data \p d */ /** \fn void Fl_File_Chooser::user_data(void *d) - Sets the file chooser user data d */ + Sets the file chooser user data \p d */ /** \fn void * Fl_File_Chooser::user_data() const - Gets the file chooser user data */ -// *** END OF OUT OF SOURCE DOC *** + Gets the file chooser user data. */ + +// *** END OF OUT OF SOURCE DOCUMENTATION *** // Contents: // @@ -290,12 +312,7 @@ // quote_pathname() - Quote a pathname for a menu. // unquote_pathname() - Unquote a pathname from a menu. // -// Fl_File_Chooser::add_extra() - add extra widget at the bottom, return pointer -// to previous extra widget or NULL if none, -// If argument is NULL extra widget removed. -// NOTE! file chooser does't delete extra widget in -// destructor! To prevent memory leakage don't forget -// delete unused extra widgets by yourself. +// Fl_File_Chooser::add_extra() - add custom extra widget or group // // diff --git a/src/Fl_Pack.cxx b/src/Fl_Pack.cxx index 55ad2c385..2907effee 100644 --- a/src/Fl_Pack.cxx +++ b/src/Fl_Pack.cxx @@ -3,17 +3,17 @@ // // Packing widget for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2020 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // 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: // -// http://www.fltk.org/str.php +// https://www.fltk.org/str.php // // Based on code by Curtis Edwards @@ -27,16 +27,26 @@ /** Creates a new Fl_Pack widget using the given position, size, - and label string. The default boxtype is FL_NO_BOX. - <P>The destructor <I>also deletes all the children</I>. This allows a + and label string. + + The default boxtype is FL_NO_BOX. + + The default type() is Fl_Pack::VERTICAL. + + The destructor <I>also deletes all the children</I>. This allows a whole tree to be deleted at once, without having to keep a pointer to - all the children in the user code. A kludge has been done so the - Fl_Pack and all of it's children can be automatic (local) - variables, but you must declare the Fl_Pack<I>first</I>, so + all the children in the user code. A kludge has been done so the + Fl_Pack and all of its children can be automatic (local) + variables, but you must declare the Fl_Pack <I>first</I>, so that it is destroyed last. + + \param[in] X,Y X and Y coordinates (position) + \param[in] W,H width and height, respectively + \param[in] L label (optional) + */ -Fl_Pack::Fl_Pack(int X, int Y, int W, int H,const char *l) -: Fl_Group(X, Y, W, H, l) { +Fl_Pack::Fl_Pack(int X, int Y, int W, int H, const char *L) +: Fl_Group(X, Y, W, H, L) { resizable(0); spacing_ = 0; // type(VERTICAL); // already set like this @@ -55,7 +65,7 @@ void Fl_Pack::draw() { if (horizontal()) { rw = -spacing_; rh = th; - + for (int i = children(); i--;) if (child(i)->visible()) { if (child(i) != this->resizable()) rw += child(i)->w(); @@ -64,7 +74,7 @@ void Fl_Pack::draw() { } else { rw = tw; rh = -spacing_; - + for (int i = children(); i--;) if (child(i)->visible()) { if (child(i) != this->resizable()) rh += child(i)->h(); @@ -116,7 +126,7 @@ void Fl_Pack::draw() { current_position += spacing_; } } - + if (horizontal()) { if (maximum_position < tx+tw && box()) { fl_color(color()); @@ -130,7 +140,7 @@ void Fl_Pack::draw() { } th = maximum_position-ty; } - + tw += Fl::box_dw(box()); if (tw <= 0) tw = 1; th += Fl::box_dh(box()); if (th <= 0) th = 1; if (tw != w() || th != h()) { |
