summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Ercolano <erco@seriss.com>2011-10-02 19:56:19 +0000
committerGreg Ercolano <erco@seriss.com>2011-10-02 19:56:19 +0000
commitf86e7e318aeb7cc3d74947c2b4b67cb407ee314b (patch)
tree55ce1496d0bdcb2e6444103e0d8c4232f43b7f98
parentc1caad3e62a5621f03047ffe68d985bba94f3fcf (diff)
Fix drawing problem with Fl_Input as child of Fl_Tree.
(fixes STR#2725) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9117 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--src/Fl_Tree.cxx87
1 files changed, 44 insertions, 43 deletions
diff --git a/src/Fl_Tree.cxx b/src/Fl_Tree.cxx
index 5548bba68..fa78940a1 100644
--- a/src/Fl_Tree.cxx
+++ b/src/Fl_Tree.cxx
@@ -332,53 +332,54 @@ void Fl_Tree::draw() {
// Let group draw box+label but *NOT* children.
// We handle drawing children ourselves by calling each item's draw()
//
- // Handle group's bg
- Fl_Group::draw_box();
- Fl_Group::draw_label();
- // Handle tree
- if ( ! _root ) return;
int cx = x() + Fl::box_dx(box());
int cy = y() + Fl::box_dy(box());
int cw = w() - Fl::box_dw(box());
int ch = h() - Fl::box_dh(box());
- // These values are changed during drawing
- // 'Y' will be the lowest point on the tree
- int X = cx + _prefs.marginleft();
- int Y = cy + _prefs.margintop() - (_vscroll->visible() ? _vscroll->value() : 0);
- int W = cw - _prefs.marginleft(); // - _prefs.marginright();
- int Ysave = Y;
- fl_push_clip(cx,cy,cw,ch);
- {
- fl_font(_prefs.labelfont(), _prefs.labelsize());
- _root->draw(X, Y, W, this,
- (Fl::focus()==this)?_item_focus:0, // show focus item ONLY if Fl_Tree has focus
- _prefs);
- }
- fl_pop_clip();
-
- // Show vertical scrollbar?
- int ydiff = (Y+_prefs.margintop())-Ysave; // ydiff=size of tree
- int ytoofar = (cy+ch) - Y; // ytoofar -- scrolled beyond bottom (e.g. stow)
-
- //printf("ydiff=%d ch=%d Ysave=%d ytoofar=%d value=%d\n",
- //int(ydiff),int(ch),int(Ysave),int(ytoofar), int(_vscroll->value()));
-
- if ( ytoofar > 0 ) ydiff += ytoofar;
- if ( Ysave<cy || ydiff > ch || int(_vscroll->value()) > 1 ) {
- _vscroll->visible();
-
- int scrollsize = _scrollbar_size ? _scrollbar_size : Fl::scrollbar_size();
- int sx = x()+w()-Fl::box_dx(box())-scrollsize;
- int sy = y()+Fl::box_dy(box());
- int sw = scrollsize;
- int sh = h()-Fl::box_dh(box());
- _vscroll->show();
- _vscroll->range(0.0,ydiff-ch);
- _vscroll->resize(sx,sy,sw,sh);
- _vscroll->slider_size(float(ch)/float(ydiff));
- } else {
- _vscroll->Fl_Slider::value(0);
- _vscroll->hide();
+ if (damage() & ~FL_DAMAGE_CHILD) { // redraw entire thing
+ // Handle group's bg
+ Fl_Group::draw_box();
+ Fl_Group::draw_label();
+ if ( ! _root ) return;
+ // These values are changed during drawing
+ // 'Y' will be the lowest point on the tree
+ int X = cx + _prefs.marginleft();
+ int Y = cy + _prefs.margintop() - (_vscroll->visible() ? _vscroll->value() : 0);
+ int W = cw - _prefs.marginleft(); // - _prefs.marginright();
+ int Ysave = Y;
+ fl_push_clip(cx,cy,cw,ch);
+ {
+ fl_font(_prefs.labelfont(), _prefs.labelsize());
+ _root->draw(X, Y, W, this,
+ (Fl::focus()==this)?_item_focus:0, // show focus item ONLY if Fl_Tree has focus
+ _prefs);
+ }
+ fl_pop_clip();
+
+ // Show vertical scrollbar?
+ int ydiff = (Y+_prefs.margintop())-Ysave; // ydiff=size of tree
+ int ytoofar = (cy+ch) - Y; // ytoofar -- scrolled beyond bottom (e.g. stow)
+
+ //printf("ydiff=%d ch=%d Ysave=%d ytoofar=%d value=%d\n",
+ //int(ydiff),int(ch),int(Ysave),int(ytoofar), int(_vscroll->value()));
+
+ if ( ytoofar > 0 ) ydiff += ytoofar;
+ if ( Ysave<cy || ydiff > ch || int(_vscroll->value()) > 1 ) {
+ _vscroll->visible();
+
+ int scrollsize = _scrollbar_size ? _scrollbar_size : Fl::scrollbar_size();
+ int sx = x()+w()-Fl::box_dx(box())-scrollsize;
+ int sy = y()+Fl::box_dy(box());
+ int sw = scrollsize;
+ int sh = h()-Fl::box_dh(box());
+ _vscroll->show();
+ _vscroll->range(0.0,ydiff-ch);
+ _vscroll->resize(sx,sy,sw,sh);
+ _vscroll->slider_size(float(ch)/float(ydiff));
+ } else {
+ _vscroll->Fl_Slider::value(0);
+ _vscroll->hide();
+ }
}
fl_push_clip(cx,cy,cw,ch);
Fl_Group::draw_children(); // draws any FLTK children set via Fl_Tree::widget()