diff options
| author | Bill Spitzak <spitzak@gmail.com> | 2000-10-21 20:01:56 +0000 |
|---|---|---|
| committer | Bill Spitzak <spitzak@gmail.com> | 2000-10-21 20:01:56 +0000 |
| commit | 2cbf4041b3bf742c4ab23402234b956db9d83ce8 (patch) | |
| tree | f728cb1766fd2d6ba25348815bd5a93e6aa3692a /src/Fl_Group.cxx | |
| parent | 710dcef237366e052ef74e68189546db6789e980 (diff) | |
Does not clear Fl::keysym on every event, this makes better back compatability and fixes Win2000
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@1325 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Group.cxx')
| -rw-r--r-- | src/Fl_Group.cxx | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/Fl_Group.cxx b/src/Fl_Group.cxx index ce5f483a7..655110b9d 100644 --- a/src/Fl_Group.cxx +++ b/src/Fl_Group.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Group.cxx,v 1.8.2.6 2000/06/05 21:20:51 mike Exp $" +// "$Id: Fl_Group.cxx,v 1.8.2.7 2000/10/21 20:01:56 spitzak Exp $" // // Group widget for the Fast Light Tool Kit (FLTK). // @@ -277,21 +277,29 @@ void Fl_Group::clear() { Fl_Group::~Fl_Group() {clear();} -void Fl_Group::insert(Fl_Widget &o, int i) { - if (o.parent()) ((Fl_Group*)(o.parent()))->remove(o); +void Fl_Group::insert(Fl_Widget &o, int index) { + if (o.parent()) { + Fl_Group* g = (Fl_Group*)(o.parent()); + int n = g->find(o); + if (g == this) { + if (index > n) index--; + if (index == n) return; + } + g->remove(o); + } o.parent_ = this; if (children_ == 0) { // use array pointer to point at single child array_ = (Fl_Widget**)&o; } else if (children_ == 1) { // go from 1 to 2 children Fl_Widget* t = (Fl_Widget*)array_; array_ = (Fl_Widget**)malloc(2*sizeof(Fl_Widget*)); - if (i) {array_[0] = t; array_[1] = &o;} + if (index) {array_[0] = t; array_[1] = &o;} else {array_[0] = &o; array_[1] = t;} } else { if (!(children_ & (children_-1))) // double number of children array_ = (Fl_Widget**)realloc((void*)array_, 2*children_*sizeof(Fl_Widget*)); - int j; for (j = children_; j > i; j--) array_[j] = array_[j-1]; + int j; for (j = children_; j > index; j--) array_[j] = array_[j-1]; array_[j] = &o; } children_++; @@ -505,5 +513,5 @@ void Fl_Group::draw_outside_label(const Fl_Widget& w) const { } // -// End of "$Id: Fl_Group.cxx,v 1.8.2.6 2000/06/05 21:20:51 mike Exp $". +// End of "$Id: Fl_Group.cxx,v 1.8.2.7 2000/10/21 20:01:56 spitzak Exp $". // |
