summaryrefslogtreecommitdiff
path: root/src/Fl_Tile.cxx
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2017-07-07 19:16:40 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2017-07-07 19:16:40 +0000
commit0c210ae8674b94163f6840bda75e25eedbc0d4d1 (patch)
treeed3302c93aa25f6a69869885813ca045cbd2615d /src/Fl_Tile.cxx
parent27d77364755328874e22bc47b91cc5ef9887e2fe (diff)
Introduce Fl_Group::bounds(), deprecate Fl_Group::sizes().
The new method Fl_Group::bounds() replaces Fl_Group::sizes() whose internal array structure was not documented. Fl_Group::bounds() uses the new and documented class Fl_Rect for its internal structure. src/Fl_Tile.cxx now uses bounds() instead of sizes(). git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12302 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Tile.cxx')
-rw-r--r--src/Fl_Tile.cxx53
1 files changed, 26 insertions, 27 deletions
diff --git a/src/Fl_Tile.cxx b/src/Fl_Tile.cxx
index 1a533cabd..249f83add 100644
--- a/src/Fl_Tile.cxx
+++ b/src/Fl_Tile.cxx
@@ -3,7 +3,7 @@
//
// Tile widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2016 by Bill Spitzak and others.
+// Copyright 1998-2017 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
@@ -87,7 +87,6 @@
#include <FL/Fl.H>
#include <FL/Fl_Tile.H>
#include <FL/Fl_Window.H>
-#include <stdlib.h>
/**
Drags the intersection at (\p oldx,\p oldy) to (\p newx,\p newy).
@@ -97,25 +96,25 @@
*/
void Fl_Tile::position(int oldx, int oldy, int newx, int newy) {
Fl_Widget*const* a = array();
- int *p = sizes();
- p += 8; // skip group & resizable's saved size
- for (int i=children(); i--; p += 4) {
+ Fl_Rect *p = bounds();
+ p += 2; // skip group & resizable's saved size
+ for (int i=children(); i--; p++) {
Fl_Widget* o = *a++;
if (o == resizable()) continue;
int X = o->x();
int R = X+o->w();
if (oldx) {
- int t = p[0];
+ int t = p->x();
if (t == oldx || (t>oldx && X<newx) || (t<oldx && X>newx) ) X = newx;
- t = p[1];
+ t = p->r();
if (t == oldx || (t>oldx && R<newx) || (t<oldx && R>newx) ) R = newx;
}
int Y = o->y();
int B = Y+o->h();
if (oldy) {
- int t = p[2];
+ int t = p->y();
if (t == oldy || (t>oldy && Y<newy) || (t<oldy && Y>newy) ) Y = newy;
- t = p[3];
+ t = p->b();
if (t == oldy || (t>oldy && B<newy) || (t<oldy && B>newy) ) B = newy;
}
o->damage_resize(X,Y,R-X,B-Y);
@@ -146,29 +145,29 @@ void Fl_Tile::resize(int X,int Y,int W,int H) {
int dy = Y-y();
int dw = W-w();
int dh = H-h();
- int *p = sizes();
+ Fl_Rect *p = bounds();
// resize this (skip the Fl_Group resize):
Fl_Widget::resize(X,Y,W,H);
// find bottom-right corner of resizable:
- int OR = p[5]; // old right border
- int NR = X+W-(p[1]-OR); // new right border
- int OB = p[7]; // old bottom border
- int NB = Y+H-(p[3]-OB); // new bottom border
+ int OR = p[1].r(); // old right border
+ int NR = X+W-(p[0].r()-OR); // new right border
+ int OB = p[1].b(); // old bottom border
+ int NB = Y+H-(p[0].b()-OB); // new bottom border
// move everything to be on correct side of new resizable:
Fl_Widget*const* a = array();
- p += 8;
- for (int i=children(); i--;) {
+ p += 2;
+ for (int i=children(); i--; p++) {
Fl_Widget* o = *a++;
int xx = o->x()+dx;
int R = xx+o->w();
- if (*p++ >= OR) xx += dw; else if (xx > NR) xx = NR;
- if (*p++ >= OR) R += dw; else if (R > NR) R = NR;
+ if (p->x() >= OR) xx += dw; else if (xx > NR) xx = NR;
+ if (p->r() >= OR) R += dw; else if (R > NR) R = NR;
int yy = o->y()+dy;
int B = yy+o->h();
- if (*p++ >= OB) yy += dh; else if (yy > NB) yy = NB;
- if (*p++ >= OB) B += dh; else if (B > NB) B = NB;
+ if (p->y() >= OB) yy += dh; else if (yy > NB) yy = NB;
+ if (p->b() >= OB) B += dh; else if (B > NB) B = NB;
o->resize(xx,yy,R-xx,B-yy);
// do *not* call o->redraw() here! If you do, and the tile is inside a
// scroll, it'll set the damage areas wrong for all children!
@@ -216,25 +215,25 @@ int Fl_Tile::handle(int event) {
int oldx = 0;
int oldy = 0;
Fl_Widget*const* a = array();
- int *q = sizes();
- int *p = q+8;
- for (int i=children(); i--; p += 4) {
+ Fl_Rect *q = bounds();
+ Fl_Rect *p = q+2;
+ for (int i=children(); i--; p++) {
Fl_Widget* o = *a++;
if (o == resizable()) continue;
- if (p[1]<q[1] && o->y()<=my+GRABAREA && o->y()+o->h()>=my-GRABAREA) {
+ if (p->r() < q->r() && o->y()<=my+GRABAREA && o->y()+o->h()>=my-GRABAREA) {
int t = mx - (o->x()+o->w());
if (abs(t) < mindx) {
sdx = t;
mindx = abs(t);
- oldx = p[1];
+ oldx = p->r();
}
}
- if (p[3]<q[3] && o->x()<=mx+GRABAREA && o->x()+o->w()>=mx-GRABAREA) {
+ if (p->b() < q->b() && o->x()<=mx+GRABAREA && o->x()+o->w()>=mx-GRABAREA) {
int t = my - (o->y()+o->h());
if (abs(t) < mindy) {
sdy = t;
mindy = abs(t);
- oldy = p[3];
+ oldy = p->b();
}
}
}