diff options
| -rw-r--r-- | FL/Fl_Tiled_Image.H | 5 | ||||
| -rw-r--r-- | documentation/Fl_Tiled_Image.html | 6 | ||||
| -rw-r--r-- | src/Fl_Scroll.cxx | 35 |
3 files changed, 36 insertions, 10 deletions
diff --git a/FL/Fl_Tiled_Image.H b/FL/Fl_Tiled_Image.H index 66cdecb81..e653033ad 100644 --- a/FL/Fl_Tiled_Image.H +++ b/FL/Fl_Tiled_Image.H @@ -1,5 +1,5 @@ // -// "$Id: Fl_Tiled_Image.H,v 1.1.2.4 2003/01/30 21:40:24 easysw Exp $" +// "$Id: Fl_Tiled_Image.H,v 1.1.2.5 2004/04/11 03:50:37 easysw Exp $" // // Tiled image header file for the Fast Light Tool Kit (FLTK). // @@ -47,10 +47,11 @@ class FL_EXPORT Fl_Tiled_Image : public Fl_Image { virtual void desaturate(); virtual void draw(int X, int Y, int W, int H, int cx, int cy); void draw(int X, int Y) { draw(X, Y, w(), h(), 0, 0); } + Fl_Image *image() { return image_; } }; #endif // !Fl_Tiled_Image_H // -// End of "$Id: Fl_Tiled_Image.H,v 1.1.2.4 2003/01/30 21:40:24 easysw Exp $" +// End of "$Id: Fl_Tiled_Image.H,v 1.1.2.5 2004/04/11 03:50:37 easysw Exp $" // diff --git a/documentation/Fl_Tiled_Image.html b/documentation/Fl_Tiled_Image.html index 2d04e4e68..96ee5cb18 100644 --- a/documentation/Fl_Tiled_Image.html +++ b/documentation/Fl_Tiled_Image.html @@ -40,6 +40,8 @@ methods.</P> <LI><A href="#Fl_Tiled_Image.~Fl_Tiled_Image">~Fl_Tiled_Image</A></LI> + <LI><A href="#Fl_Tiled_Image.image">image</A></LI> + </UL> <H4><A name="Fl_Tiled_Image.Fl_Tiled_Image">Fl_Tiled_Image::Fl_Tiled_Image(Fl_Image *img, int W, int H);</A></H4> @@ -51,5 +53,9 @@ methods.</P> <P>The destructor free all memory and server resources that are used by the tiled image.</P> +<H4><A name="Fl_Tiled_Image.image">Fl_Image *Fl_Tiled_Image::image();</A></H4> + +<P>Returns the image that will be tiled.</P> + </BODY> </HTML> diff --git a/src/Fl_Scroll.cxx b/src/Fl_Scroll.cxx index 2df87e793..172d45d78 100644 --- a/src/Fl_Scroll.cxx +++ b/src/Fl_Scroll.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Scroll.cxx,v 1.7.2.6.2.9 2004/04/11 01:39:57 easysw Exp $" +// "$Id: Fl_Scroll.cxx,v 1.7.2.6.2.10 2004/04/11 03:50:38 easysw Exp $" // // Scroll widget for the Fast Light Tool Kit (FLTK). // @@ -24,7 +24,7 @@ // #include <FL/Fl.H> -#include <FL/Fl_Image.H> +#include <FL/Fl_Tiled_Image.H> #include <FL/Fl_Scroll.H> #include <FL/fl_draw.H> @@ -69,10 +69,10 @@ void Fl_Scroll::draw_clip(void* v,int X, int Y, int W, int H) { case _FL_PLASTIC_UP_FRAME : case _FL_PLASTIC_DOWN_FRAME : if (s->parent() == (Fl_Group *)s->window() && Fl::scheme_bg_) { - Fl::scheme_bg_->draw(X-(X%Fl::scheme_bg_->w()), - Y-(Y%Fl::scheme_bg_->h()), - W+Fl::scheme_bg_->w(), - H+Fl::scheme_bg_->h()); + Fl::scheme_bg_->draw(X-(X%((Fl_Tiled_Image *)Fl::scheme_bg_)->image()->w()), + Y-(Y%((Fl_Tiled_Image *)Fl::scheme_bg_)->image()->h()), + W+((Fl_Tiled_Image *)Fl::scheme_bg_)->image()->w(), + H+((Fl_Tiled_Image *)Fl::scheme_bg_)->image()->h()); break; } @@ -115,8 +115,27 @@ void Fl_Scroll::draw() { draw_box(box(),x(),y(),w(),h(),color()); draw_clip(this, X, Y, W, H); } else { - if (d & FL_DAMAGE_SCROLL) { // scroll the contents: + if (d & FL_DAMAGE_SCROLL) { + // scroll the contents: fl_scroll(X, Y, W, H, oldx-xposition_, oldy-yposition_, draw_clip, this); + + // Erase the background as needed... + Fl_Widget*const* a = array(); + int L, R, T, B; + L = 999999; + R = 0; + T = 999999; + B = 0; + for (int i=children()-2; i--; a++) { + if ((*a)->x() < L) L = (*a)->x(); + if (((*a)->x() + (*a)->w()) > R) R = (*a)->x() + (*a)->w(); + if ((*a)->y() < T) T = (*a)->y(); + if (((*a)->y() + (*a)->h()) > B) B = (*a)->y() + (*a)->h(); + } + if (L > X) draw_clip(this, X, Y, L - X, H); + if (R < (X + W)) draw_clip(this, R, Y, X + W - R, H); + if (T > Y) draw_clip(this, X, Y, W, T - Y); + if (B < (Y + H)) draw_clip(this, X, B, W, Y + H - B); } if (d & FL_DAMAGE_CHILD) { // draw damaged children fl_clip(X, Y, W, H); @@ -271,5 +290,5 @@ int Fl_Scroll::handle(int event) { } // -// End of "$Id: Fl_Scroll.cxx,v 1.7.2.6.2.9 2004/04/11 01:39:57 easysw Exp $". +// End of "$Id: Fl_Scroll.cxx,v 1.7.2.6.2.10 2004/04/11 03:50:38 easysw Exp $". // |
