From efc3ec1b7b54718be4d2f5145342484607b5059e Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Thu, 12 Apr 2018 12:58:10 +0000 Subject: Remove unnecessary dependency on FL/Fl_Rect.H. Fl_Rect.H is no longer included by Fl_Group.H to avoid unnecessary dependencies on Fl_Rect.H. Currently it is only needed to access the array returned by the protected method bounds(). Also clarified documentation. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12827 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Group.cxx | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) (limited to 'src/Fl_Group.cxx') diff --git a/src/Fl_Group.cxx b/src/Fl_Group.cxx index a47eddaf9..9754766d2 100644 --- a/src/Fl_Group.cxx +++ b/src/Fl_Group.cxx @@ -21,13 +21,12 @@ // Fl_Window itself is a subclass of this, and most of the event // handling is designed so windows themselves work correctly. -#include -#include #include -#include #include +#include #include -#include + +#include // malloc etc. Fl_Group* Fl_Group::current_; @@ -35,16 +34,19 @@ Fl_Group* Fl_Group::current_; // multiple children are stored in an allocated array: /** - Returns a pointer to the array of children. This pointer is only - valid until the next time a child is added or removed. + Returns a pointer to the array of children. + + \note This pointer is only valid until the next time a child + is added or removed. */ Fl_Widget*const* Fl_Group::array() const { return children_ <= 1 ? (Fl_Widget**)(&array_) : array_; } /** - Searches the child array for the widget and returns the index. Returns children() - if the widget is NULL or not found. + Searches the child array for the widget and returns the index. + + Returns children() if the widget is NULL or not found. */ int Fl_Group::find(const Fl_Widget* o) const { Fl_Widget*const* a = array(); @@ -92,7 +94,7 @@ extern Fl_Widget* fl_oldfocus; // set by Fl::focus // windows so they are relative to that window. static int send(Fl_Widget* o, int event) { - if (o->type() < FL_WINDOW) return o->handle(event); + if (!o->as_window()) return o->handle(event); switch ( event ) { case FL_DND_ENTER: /* FALLTHROUGH */ @@ -590,20 +592,26 @@ void Fl_Group::init_sizes() { \note You should never need to use this \e protected method directly, unless you have special needs to rearrange the children of a Fl_Group. Fl_Tile uses this to rearrange its widget positions. - - \returns Array of Fl_Rect's with widget positions and sizes. The - returned array is only valid until init_sizes() is called - or widgets are added to or removed from the group. - - \note The returned array should be considered read-only. Do not change + The returned array should be considered read-only. Do not change its contents. If you need to rearrange children in a group, do so by resizing the children and call init_sizes(). + \#include \ if you want to access the bounds() array in + your derived class. Fl_Rect.H is intentionally not included by + Fl_Group.H to avoid unnecessary dependencies. + + \returns Array of Fl_Rect's with widget positions and sizes. The + returned array is only valid until init_sizes() is called + or widgets are added to or removed from the group. + \see init_sizes() \since FLTK 1.4.0 - \internal If you change this be sure to fix Fl_Tile which also uses this array! + \internal Notes to developers: + - If you change this be sure to fix Fl_Tile which also uses this array! + - Do not #include Fl_Rect.H in Fl_Group.H because this would introduce + lots of unnecessary dependencies on Fl_Rect.H. */ Fl_Rect* Fl_Group::bounds() { if (!bounds_) { -- cgit v1.2.3