Browse Source

Update Fl_Scroll background image fix...

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3389 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
pull/168/head
Michael R Sweet 21 years ago
parent
commit
6bed8ffce8
  1. 5
      FL/Fl_Tiled_Image.H
  2. 6
      documentation/Fl_Tiled_Image.html
  3. 35
      src/Fl_Scroll.cxx

5
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). // 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 desaturate();
virtual void draw(int X, int Y, int W, int H, int cx, int cy); 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); } void draw(int X, int Y) { draw(X, Y, w(), h(), 0, 0); }
Fl_Image *image() { return image_; }
}; };
#endif // !Fl_Tiled_Image_H #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 $"
// //

6
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.~Fl_Tiled_Image">~Fl_Tiled_Image</A></LI>
<LI><A href="#Fl_Tiled_Image.image">image</A></LI>
</UL> </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> <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 <P>The destructor free all memory and server resources that are used by
the tiled image.</P> 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> </BODY>
</HTML> </HTML>

35
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). // Scroll widget for the Fast Light Tool Kit (FLTK).
// //
@ -24,7 +24,7 @@
// //
#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/Fl_Image.H> #include <FL/Fl_Tiled_Image.H>
#include <FL/Fl_Scroll.H> #include <FL/Fl_Scroll.H>
#include <FL/fl_draw.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_UP_FRAME :
case _FL_PLASTIC_DOWN_FRAME : case _FL_PLASTIC_DOWN_FRAME :
if (s->parent() == (Fl_Group *)s->window() && Fl::scheme_bg_) { if (s->parent() == (Fl_Group *)s->window() && Fl::scheme_bg_) {
Fl::scheme_bg_->draw(X-(X%Fl::scheme_bg_->w()), Fl::scheme_bg_->draw(X-(X%((Fl_Tiled_Image *)Fl::scheme_bg_)->image()->w()),
Y-(Y%Fl::scheme_bg_->h()), Y-(Y%((Fl_Tiled_Image *)Fl::scheme_bg_)->image()->h()),
W+Fl::scheme_bg_->w(), W+((Fl_Tiled_Image *)Fl::scheme_bg_)->image()->w(),
H+Fl::scheme_bg_->h()); H+((Fl_Tiled_Image *)Fl::scheme_bg_)->image()->h());
break; break;
} }
@ -115,8 +115,27 @@ void Fl_Scroll::draw() {
draw_box(box(),x(),y(),w(),h(),color()); draw_box(box(),x(),y(),w(),h(),color());
draw_clip(this, X, Y, W, H); draw_clip(this, X, Y, W, H);
} else { } 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); 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 if (d & FL_DAMAGE_CHILD) { // draw damaged children
fl_clip(X, Y, W, H); 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 $".
// //

Loading…
Cancel
Save