mirror of
https://github.com/fltk/fltk.git
synced 2026-05-20 04:31:25 +08:00
Use box function to redraw Fl_Browser_, Fl_Input_, and Fl_Slider.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2580 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -4,9 +4,9 @@ CHANGES IN FLTK 1.1.0rc6
|
||||
- Fl::handle() didn't apply the modal tests for
|
||||
FL_RELEASE events, which caused Fl_Tabs to allow users
|
||||
to change tabs even when a modal window was open.
|
||||
- Fl_Input_ now draws the box function to erase the
|
||||
background. This fixes redraw problems noticed with
|
||||
the plastic scheme.
|
||||
- Fl_Browser_, Fl_Input_, Fl_Slider now use the box
|
||||
function to erase the background. This fixes some
|
||||
long-standing redraw problems.
|
||||
- More snprintf/strlcpy/strlcat changes where needed.
|
||||
- Fl::get_font_name() would leak 128 bytes.
|
||||
- Eliminated most of the "shadowed" variables to avoid
|
||||
|
||||
+5
-4
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Browser_.cxx,v 1.10.2.16.2.14 2002/08/09 01:09:48 easysw Exp $"
|
||||
// "$Id: Fl_Browser_.cxx,v 1.10.2.16.2.15 2002/08/13 15:42:44 easysw Exp $"
|
||||
//
|
||||
// Base Browser widget class for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@@ -356,8 +356,9 @@ J1:
|
||||
fl_color(active_r() ? selection_color() : fl_inactive(selection_color()));
|
||||
fl_rectf(X, yy+Y, W, hh);
|
||||
} else if (!(damage()&FL_DAMAGE_ALL)) {
|
||||
fl_color(color());
|
||||
fl_rectf(X, yy+Y, W, hh);
|
||||
fl_push_clip(X, yy+Y, W, hh);
|
||||
draw_box(box() ? box() : FL_DOWN_BOX, x(), y(), w(), h(), color());
|
||||
fl_pop_clip();
|
||||
}
|
||||
item_draw(l, X-hposition_, yy+Y, W+hposition_, hh);
|
||||
if (l == selection_ && Fl::focus() == this) {
|
||||
@@ -755,5 +756,5 @@ void Fl_Browser_::item_select(void*, int) {}
|
||||
int Fl_Browser_::item_selected(void* l) const {return l==selection_;}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Browser_.cxx,v 1.10.2.16.2.14 2002/08/09 01:09:48 easysw Exp $".
|
||||
// End of "$Id: Fl_Browser_.cxx,v 1.10.2.16.2.15 2002/08/13 15:42:44 easysw Exp $".
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_File_Browser.cxx,v 1.1.2.22 2002/08/09 23:49:52 easysw Exp $"
|
||||
// "$Id: Fl_File_Browser.cxx,v 1.1.2.23 2002/08/13 15:42:44 easysw Exp $"
|
||||
//
|
||||
// Fl_File_Browser routines.
|
||||
//
|
||||
@@ -256,7 +256,7 @@ Fl_File_Browser::item_draw(void *p, // I - List item data
|
||||
int X, // I - Upper-lefthand X coordinate
|
||||
int Y, // I - Upper-lefthand Y coordinate
|
||||
int W, // I - Width of item
|
||||
int H) const// I - Height of item
|
||||
int) const // I - Height of item
|
||||
{
|
||||
int i; // Looping var
|
||||
FL_BLINE *line; // Pointer to line
|
||||
@@ -643,5 +643,5 @@ Fl_File_Browser::filter(const char *pattern) // I - Pattern string
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_File_Browser.cxx,v 1.1.2.22 2002/08/09 23:49:52 easysw Exp $".
|
||||
// End of "$Id: Fl_File_Browser.cxx,v 1.1.2.23 2002/08/13 15:42:44 easysw Exp $".
|
||||
//
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Input_.cxx,v 1.21.2.11.2.22 2002/08/12 19:42:54 easysw Exp $"
|
||||
// "$Id: Fl_Input_.cxx,v 1.21.2.11.2.23 2002/08/13 15:42:44 easysw Exp $"
|
||||
//
|
||||
// Common input widget routines for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@@ -377,7 +377,7 @@ int Fl_Input_::line_start(int i) const {
|
||||
} else return j;
|
||||
}
|
||||
|
||||
void Fl_Input_::handle_mouse(int X, int Y, int W, int /*H*/, int drag) {
|
||||
void Fl_Input_::handle_mouse(int X, int Y, int /*W*/, int /*H*/, int drag) {
|
||||
was_up_down = 0;
|
||||
if (!size()) return;
|
||||
setfont();
|
||||
@@ -850,5 +850,5 @@ Fl_Input_::~Fl_Input_() {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Input_.cxx,v 1.21.2.11.2.22 2002/08/12 19:42:54 easysw Exp $".
|
||||
// End of "$Id: Fl_Input_.cxx,v 1.21.2.11.2.23 2002/08/13 15:42:44 easysw Exp $".
|
||||
//
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Scrollbar.cxx,v 1.7.2.14.2.9 2002/08/09 03:17:30 easysw Exp $"
|
||||
// "$Id: Fl_Scrollbar.cxx,v 1.7.2.14.2.10 2002/08/13 15:42:44 easysw Exp $"
|
||||
//
|
||||
// Scroll bar widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@@ -200,7 +200,7 @@ void Fl_Scrollbar::draw() {
|
||||
draw_box((pushed_==1) ? fl_down(slider()) : slider(),
|
||||
X, Y, H, H, selection_color());
|
||||
draw_box((pushed_==2) ? fl_down(slider()) : slider(),
|
||||
X+W-H, Y, H, H, selection_color());
|
||||
X+W-H, Y, H, H, selection_color());
|
||||
if (active_r())
|
||||
fl_color(labelcolor());
|
||||
else
|
||||
@@ -246,5 +246,5 @@ Fl_Scrollbar::Fl_Scrollbar(int X, int Y, int W, int H, const char* L)
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Scrollbar.cxx,v 1.7.2.14.2.9 2002/08/09 03:17:30 easysw Exp $".
|
||||
// End of "$Id: Fl_Scrollbar.cxx,v 1.7.2.14.2.10 2002/08/13 15:42:44 easysw Exp $".
|
||||
//
|
||||
|
||||
+8
-18
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Slider.cxx,v 1.8.2.10.2.9 2002/08/09 03:17:30 easysw Exp $"
|
||||
// "$Id: Fl_Slider.cxx,v 1.8.2.10.2.10 2002/08/13 15:42:44 easysw Exp $"
|
||||
//
|
||||
// Slider widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@@ -84,8 +84,13 @@ int Fl_Slider::scrollvalue(int p, int W, int t, int l) {
|
||||
|
||||
void Fl_Slider::draw_bg(int X, int Y, int W, int H) {
|
||||
if (!(damage()&FL_DAMAGE_ALL)) { // not a complete redraw
|
||||
fl_push_clip(X, Y, W, H);
|
||||
draw_box();
|
||||
fl_pop_clip();
|
||||
} else {
|
||||
draw_box();
|
||||
}
|
||||
|
||||
Fl_Color black = active_r() ? FL_FOREGROUND_COLOR : FL_INACTIVE_COLOR;
|
||||
if (type() == FL_VERT_NICE_SLIDER) {
|
||||
draw_box(FL_THIN_DOWN_BOX, X+W/2-2, Y, 4, H, black);
|
||||
@@ -131,22 +136,7 @@ void Fl_Slider::draw(int X, int Y, int W, int H) {
|
||||
wsl = W;
|
||||
}
|
||||
|
||||
if (damage()&FL_DAMAGE_ALL) { // complete redraw
|
||||
draw_bg(X, Y, W, H);
|
||||
} else { // partial redraw, clip off new position of slider
|
||||
if (xx > 0) {
|
||||
if (horizontal()) fl_clip(X, ysl, xx, hsl);
|
||||
else fl_clip(xsl, Y, wsl, xx);
|
||||
draw_bg(X, Y, W, H);
|
||||
fl_pop_clip();
|
||||
}
|
||||
if (xx+S < W) {
|
||||
if (horizontal()) fl_clip(xsl+wsl, ysl, X+W-xsl-wsl, hsl);
|
||||
else fl_clip(xsl, ysl+hsl, wsl, Y+H-ysl-hsl);
|
||||
draw_bg(X, Y, W, H);
|
||||
fl_pop_clip();
|
||||
}
|
||||
}
|
||||
draw_bg(X, Y, W, H);
|
||||
|
||||
Fl_Boxtype box1 = slider();
|
||||
if (!box1) {box1 = (Fl_Boxtype)(box()&-2); if (!box1) box1 = FL_UP_BOX;}
|
||||
@@ -295,5 +285,5 @@ int Fl_Slider::handle(int event) {
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Slider.cxx,v 1.8.2.10.2.9 2002/08/09 03:17:30 easysw Exp $".
|
||||
// End of "$Id: Fl_Slider.cxx,v 1.8.2.10.2.10 2002/08/13 15:42:44 easysw Exp $".
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user