Beispiel #1
0
void roc_box_draw(int x, int y, int w, int h, Fl_Color bgcolor) {

  fl_color(draw_it_active ? FL_BLACK : fl_inactive(FL_BLACK));
  fl_rect(x, y, w, h);
  fl_color(draw_it_active ? bgcolor : fl_inactive(bgcolor));
  fl_rectf(x + 1, y + 1, w - 2, h - 2);
  fl_color(draw_it_active ? FL_BLACK : fl_inactive(FL_BLACK));
  fl_line(x, y, x + w - 1, y + h - 1);
  fl_line(x, y + h - 1, x + w - 1, y);

}
void Flu_Spinner::draw()
{
  int W = w()*15/100;
  if( W < h()/2 )
    W = h()/2;
  int X = x()+w()-W, Y = y();

  // fltk 2.0 behavior
  bool refresh;
  if( step() >= 1.0 )
    {
      refresh = ( _input.type() != FL_INT_INPUT );
      _input.type( FL_INT_INPUT );
    }
  else
    {
      refresh = ( _input.type() != FL_FLOAT_INPUT );
      _input.type( FL_FLOAT_INPUT );
    }
  if( refresh )
    value_damage();

  // draw the up/down arrow buttons
  fl_draw_box( (Fl_Boxtype)_valbox[0], X, Y, W, h()/2, color() );
  fl_draw_box( (Fl_Boxtype)_valbox[1], X, Y+h()/2, W, h()/2, color() );
  fl_color( active_r() ? FL_FOREGROUND_COLOR : fl_inactive(FL_FOREGROUND_COLOR) );
  fl_polygon( X+4, Y+h()/2-4, X+W/2, Y+4, X+W-4, Y+h()/2-4 );
  Y += h()/2;
  fl_polygon( X+4, Y+4, X+W/2, Y+h()/2-4, X+W-4, Y+4 );

  _input.resize( x(), y(), w()-h()/2-1, h() );
  _input.redraw();
}
Beispiel #3
0
void TaskBar::update_active(Window active)
{
    for(int n=0; n<children(); n++)
    {
        Fl_Widget *w = child(n);
        Window win = w->argument();

        if(GetState(win) == IconicState)
            w->label_color(fl_inactive(FL_BLACK));
        else
            w->label_color(Fl_Button::default_style->label_color);

        if(active==win) {
            TaskBar::active = win;
            w->set_value();
            w->color(fl_lighter(Fl_Button::default_style->color));
            w->highlight_color(fl_lighter(Fl_Button::default_style->color));
        } else {
            w->clear_value();
            w->color(Fl_Button::default_style->color);
            w->highlight_color(Fl_Button::default_style->highlight_color);
        }
    }
    redraw();
}
void GroupBankRoundButton::draw()
{
    Fl_Round_Button::draw();
    if ( !active() )
    {
        int o = 5;
        fl_color( fl_inactive( selection_color() ) );
        fl_line( x() + o, y() + o, x() + w() - o, y() + h() - o );
        fl_line( x() + o, y() + h() - o, x() + w() - o, y() + o );
    }
}
Beispiel #5
0
void Fl_Labeltype_::draw(const char* label,
	int X, int Y, int W, int H,
	Fl_Color color, Fl_Flags flags) const
{
	if (flags & FL_INACTIVE)
	{
		fl_color(FL_LIGHT2);
		fl_draw(label, X+1, Y+1, W, H, flags);
		color = fl_inactive(color);
	}
	fl_color(color);
	fl_draw(label, X, Y, W, H, flags);
}
Beispiel #6
0
void Fl_Shadow_Box::draw(
    int x, int y, int w, int h, Fl_Color color, Fl_Flags f) const
{
    w-=BW;
    h-=BW;
    if (!(f & FL_INVISIBLE))
    {
        fl_color(color);
        fl_rectf(x+1,y+1,w-2,h-2);
    }
    fl_color(FL_DARK3);
    fl_rectf(x+BW, y+h,  w, BW);
    fl_rectf(x+w,  y+BW, BW,  h);
    fl_color(fl_inactive(FL_BLACK,f));
    fl_rect(x,y,w,h);
}
void Flu_Combo_Box :: draw()
{
  int W = 18, H = h()-4;
  int X = x()+w()-W-2, Y = y()+2;

  fl_draw_box( box(), x(), y(), w(), h(), color() );

  // draw the arrow button
  fl_draw_box( (Fl_Boxtype)_valbox, X, Y, W, H, color() );
  fl_color( active_r() ? FL_FOREGROUND_COLOR : fl_inactive(FL_FOREGROUND_COLOR) );
  fl_polygon( X+W/2-5, Y+H/2-2, X+W/2+3, Y+H/2-2, X+W/2-1, Y+H/2+2 );

  draw_child( input );
  if( Fl::focus() == this )
    draw_focus( FL_NO_BOX, input.x(), input.y(), input.w(), input.h() );
}
Beispiel #8
0
void TaskBar::add_new_task(Window w)
{
    // Add to Fl_WM module handled windows.
    Fl_WM::handle_window(w);

    TaskButton *b;
    char *name = 0;
    Fl_Image *icon = 0;

    if (!w) return;

    begin();

    b = new TaskButton(w);

    bool ret = Fl_WM::get_window_icontitle(w, name);
    if(!ret || !name) ret = Fl_WM::get_window_title(w, name);

    if(ret && name) {
        b->label(name);
        b->tooltip(name);
        free(name);
    } else {
        b->label("...");
        b->tooltip("...");
    }

    if(Fl_WM::get_window_icon(w, icon, 16, 16)) {
        b->image(icon);
    } else {
        b->image(default_icon);
    }

    b->accept_focus(false);
    b->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE | FL_ALIGN_CLIP);

    if(Fl_WM::get_active_window()==w) {
        b->value(1);
        active = w;
    }

    if(GetState(w) == IconicState)
        b->label_color(fl_inactive(FL_BLACK));

    end();
}
Beispiel #9
0
static void default_glyph(const Fl_Widget* widget, int glyph,
    int x,int y,int w,int h, Fl_Flags flags)
{
    // h = (h+1)&(~1); // even only
    Fl_Boxtype box = widget->button_box();
    box->draw(x, y, w, h, widget->button_color(), flags);
    box->inset(x, y, w, h);
    if (flags & FL_VALUE)
    {
        Fl_Color color = (box == FL_NO_BOX && (flags&FL_SELECTED)) ?
            widget->selection_text_color() : widget->text_color();
        fl_color(fl_inactive(color, flags));
        int d = h/6;
        fl_ellipse(x+d, y+d, h-d-d-1, h-d-d-1);
        fl_fill();
    }
}
Beispiel #10
0
Datei: Module.C Projekt: 0mk/non
void
Module::draw_box ( int tx, int ty, int tw, int th )
{
    fl_color( fl_contrast( FL_FOREGROUND_COLOR, color() ) );

    fl_push_clip( tx, ty, tw, th );

    Fl_Color c = color();

    if ( ! active_r() )
        c = fl_inactive( c );

    int spacing = w() / instances();
    for ( int i = instances(); i--; )
    {
        fl_draw_box( box(), tx + (spacing * i), ty, tw / instances(), th, c );
    }


    if ( audio_input.size() && audio_output.size() )
    {
        /* maybe draw control indicators */
        if ( control_input.size() )
        {
            fl_draw_box( FL_ROUNDED_BOX, tx + 4, ty + 4, 5, 5, is_being_controlled() ? FL_YELLOW : fl_inactive( FL_YELLOW ) );

            /* fl_draw_box( FL_ROUNDED_BOX, tx + 4, ty + th - 8, 5, 5, is_being_controlled_osc() ? FL_YELLOW : fl_inactive( FL_YELLOW ) ); */
        }

        if ( control_output.size() )
            fl_draw_box( FL_ROUNDED_BOX, tx + tw - 8, ty + 4, 5, 5, is_controlling() ? FL_YELLOW : fl_inactive( FL_YELLOW ) );
    }

    fl_push_clip( tx + Fl::box_dx(box()), ty + Fl::box_dy(box()), tw - Fl::box_dw(box()), th - Fl::box_dh(box()) );

    Fl_Group::draw_children();

    fl_pop_clip();

    if ( focused_r( this ) )
        draw_focus_frame( tx,ty,tw,th, selection_color() );

    fl_pop_clip();
}
Beispiel #11
0
void
Module::draw_box ( void )
{
    fl_color( fl_contrast( FL_FOREGROUND_COLOR, color() ) );

    int tw, th, tx, ty;

    tw = w();
    th = h();
    ty = y();
    tx = x();

    fl_push_clip( tx, ty, tw, th );

    Fl_Color c = is_default() ? FL_BLACK : color();

    c = active() && ! bypass() ? c : fl_inactive( c );

    int spacing = w() / instances();
    for ( int i = instances(); i--; )
    {
        fl_draw_box( box(), tx + (spacing * i), ty, tw / instances(), th, Fl::belowmouse() == this ? fl_lighter( c ) : c );
    }

    if ( this == Fl::focus() )
    {
        fl_draw_box( FL_UP_FRAME, x(), y(), w(), h(), selection_color() );
    }

    if ( audio_input.size() && audio_output.size() )
    {
        /* maybe draw control indicators */
        if ( control_input.size() )
            fl_draw_box( FL_ROUNDED_BOX, tx + 4, ty + 4, 5, 5, is_being_controlled() ? FL_YELLOW : fl_inactive( FL_YELLOW ) );
        if ( control_output.size() )
            fl_draw_box( FL_ROUNDED_BOX, tx + tw - 8, ty + 4, 5, 5, is_controlling() ? FL_YELLOW : fl_inactive( FL_YELLOW ) );
    }

    Fl_Group::draw_children();

    fl_pop_clip();
}
Beispiel #12
0
void myscroll::draw() {
	draw_box();

	int X = x()+Fl::box_dx(box());
	int Y = y()+Fl::box_dy(box());
	int W = w()-Fl::box_dw(box());
	int H = h()-Fl::box_dh(box());

	if (horizontal()) {
		if (W < 3*H) {Fl_Slider::draw(X,Y,W,H); return;}
		Fl_Slider::draw(X+H,Y,W-2*H,H);

		// Buttons
		draw_box(button1 ? fl_down(slider()) : slider(),
			 X, Y, H, H, selection_color());
		draw_box(button2 ? fl_down(slider()) : slider(),
			 X+W-H, Y, H, H, selection_color());
		if (active_r())
			fl_color(labelcolor());
		else
			fl_color(fl_inactive(labelcolor()));
		int w1 = (H-4)/3; if (w1 < 1) w1 = 1;
		int x1 = X+(H-w1-1)/2;
		int yy1 = Y+(H-2*w1-1)/2;
		if (Fl::scheme_ && !strcmp(Fl::scheme_, "gtk+")) {
			fl_polygon(x1, yy1+w1, x1+w1, yy1+2*w1, x1+w1-1, yy1+w1,
					x1+w1, yy1);
			x1 += (W-H);
			fl_polygon(x1, yy1, x1+1, yy1+w1, x1, yy1+2*w1, x1+w1,
					yy1+w1);
		} else {
			fl_polygon(x1, yy1+w1, x1+w1, yy1+2*w1, x1+w1, yy1);
			x1 += (W-H);
			fl_polygon(x1, yy1, x1, yy1+2*w1, x1+w1, yy1+w1);
		}
	} else { // vertical
		if (H < 3*W) {Fl_Slider::draw(X,Y,W,H); return;}
		Fl_Slider::draw(X,Y+W,W,H-2*W);

		// Buttons
		draw_box(button1 ? fl_down(slider()) : slider(),
			 X, Y, W, W, selection_color());
		draw_box(button2 ? fl_down(slider()) : slider(),
			 X, Y+H-W, W, W, selection_color());
		if (active_r())
			fl_color(labelcolor());
		else
			fl_color(fl_inactive(labelcolor()));
		int w1 = (W-4)/3; if (w1 < 1) w1 = 1;
		int x1 = X+(W-2*w1-1)/2;
		int yy1 = Y+(W-w1-1)/2;
		if (Fl::scheme_ && !strcmp(Fl::scheme_, "gtk+")) {
			fl_polygon(x1, yy1+w1, x1+w1, yy1+w1-1, x1+2*w1, yy1+w1, x1+w1,
					yy1);
			yy1 += H-W;
			fl_polygon(x1, yy1, x1+w1, yy1+1, x1+w1, yy1+w1);
			fl_polygon(x1+w1, yy1+1, x1+2*w1, yy1, x1+w1, yy1+w1);
		} else {
			fl_polygon(x1, yy1+w1, x1+2*w1, yy1+w1, x1+w1, yy1);
			yy1 += H-W;
			fl_polygon(x1, yy1, x1+w1, yy1+w1, x1+2*w1, yy1);
		}
	}
}
Beispiel #13
0
// Anybody can call this to force the label to draw anywhere, this is
// used by Fl_Group and Fl_Tabs to draw outside labels:
void Fl_Widget::draw_label(int X, int Y, int W, int H, Fl_Flags flags) const
{
	fl_font(label_font(), float(label_size()));
	if (!active_r()) flags.set(FL_INACTIVE);

	Fl_Color color;
    // Figure out if alignment puts the label inside the widget:
	if (!(this->flags()&15) || (this->flags() & FL_ALIGN_INSIDE))
	{
        // yes, inside label is affected by selection or highlight:
		if (flags&FL_SELECTED)
			color = selection_text_color();
		else if (flags&FL_HIGHLIGHT && highlight_label_color())
		    color = highlight_label_color();
		else
			color = label_color();
		if (focused()) flags.set(FL_SELECTED);
	}
	else
	{
		color = label_color();
	}

	if (flags & FL_ALIGN_CLIP) fl_push_clip(X, Y, W, H);

	if (image_)
	{
		fl_color(fl_inactive(color, flags));

		if(flags & FL_ALIGN_TILED || flags & FL_ALIGN_SCALE) {
			image_->draw(X, Y, W, H, flags);
		} else {

			int w = W;
			int h = H;
			image_->measure(w, h);

            // If all the flags are off, draw the image and label centered "nicely"
            // by measuring their total size and centering that rectangle:
			if (!(flags & (FL_ALIGN_LEFT|FL_ALIGN_RIGHT|FL_ALIGN_TOP|FL_ALIGN_BOTTOM|
						FL_ALIGN_INSIDE)) && !label_.empty())
			{
				int d = (H-int(h+fl_height()))>>1;
				if (d >= 0)
				{
                    // put the image atop the text
                                    Y += d;
                                    H -= d;
                                    flags.set(FL_ALIGN_TOP);
				}
				else
				{
                    // put image to left
					int text_w = W; int text_h = H;
					fl_measure(label_.c_str(), text_w, text_h, flags);
					int d = (W-(h+text_w))>>1;
					if (d > 0) {X += d; W -= d;}
					flags.set(FL_ALIGN_LEFT);
				}
			}

			int cx,cy;               // point in image to put at X,Y

			if (flags & FL_ALIGN_RIGHT) {
				cx = w-W;
				if (flags & FL_ALIGN_LEFT && cx < 0) cx = 0;
			}
			else if (flags & FL_ALIGN_LEFT) cx = 0;
			else cx = w/2-W/2;

			if (flags & FL_ALIGN_BOTTOM) {
				cy = h-H;
				if (flags & FL_ALIGN_TOP && cy < 0) cy = 0;
			}
			else if (flags & FL_ALIGN_TOP) cy = 0;
			else cy = h/2-H/2;

			image_->draw(X-cx, Y-cy, W, H, 0,0,0,0,flags);

            // figure out the rectangle that remains for text:
			if (flags & FL_ALIGN_LEFT) { X += (w+2); W -= (w+4); }
			else if (flags & FL_ALIGN_RIGHT) W -= (w+4);
			else if (flags & FL_ALIGN_TOP) {Y += h; H -= h;}
			else if (flags & FL_ALIGN_BOTTOM) H -= h;
			else { /*flags |= FL_ALIGN_TOP;*/
				Y += (h-cy); H -= (h-cy);
			}
		}
	}
Beispiel #14
0
void Fl_Rounded_Box::draw(
    int x, int y, int w, int h, Fl_Color color, Fl_Flags f) const
{
    rbox(x, y, w, h, color, fl_inactive(FL_BLACK,f));
}
Beispiel #15
0
 FL_EXPORT_C(Fl_Color, fl_inactiveC)(Fl_Color c) { return fl_inactive(c);};
Beispiel #16
0
Datei: Module.C Projekt: 0mk/non
void
Module::draw_label ( int tx, int ty, int tw, int th )
{
    bbox( tx, ty, tw, th );

    if ( ! label() )
        return;

    char *lab = strdup( label() );

    Fl_Color c = fl_contrast( FL_FOREGROUND_COLOR, color() );

    fl_color( active_r() && ! bypass() ? c : fl_inactive(c) );

    fl_font( FL_HELVETICA, labelsize() );

    char *di = strstr( lab, " -" );
    
    if ( ! di )
        di = strstr( lab, "  " );

    if ( di )
        *di = '\0';

    int LW = fl_width( lab );
    char *s = NULL;

    bool initial = true;
    if ( LW > tw )
    {
        s = new char[strlen(lab) + 1];
        char *sp = s;
        const char *lp = lab;

        for ( ; *lp; ++lp )
        {
            bool skip = false;

            switch ( *lp )
            {
                case ' ':
                    initial = true;
                    skip = false;
                    break;
                case 'i': case 'e': case 'o': case 'u': case 'a':
                    skip = ! initial;
                    initial = false;
                    break;
                default:
                    skip = false;
                    initial = false;
                    break;
            }
            
            if ( ! skip )
                *(sp++) = *lp;
        }
     
        *sp = '\0';
   
    }

    fl_draw( s ? s : lab, tx, ty, tw, th, align() | FL_ALIGN_CLIP );
    
    if ( bypass() )
    {
        fl_color( fl_color_add_alpha( fl_color(), 127 )  );
        fl_line_style( FL_SOLID, 2 );
        fl_line( tx, ty + th * 0.5, tx + tw, ty + th * 0.5 );
        fl_line_style( FL_SOLID, 0 );
    }


    free(lab);

    if ( s )
        delete[] s;
}
Beispiel #17
0
void Fl_Slider::draw()
{
    // figure out the inner size of the box:
    Fl_Boxtype box = this->box();
    int ix = 0, iy = 0, iw = w(), ih = h();
    box->inset(ix,iy,iw,ih);

    // figure out where to draw the slider, leaving room for tick marks:
    int sx = ix, sy = iy, sw = iw, sh = ih;
    if (tick_size_ && (type()&TICK_BOTH))
    {
        if (horizontal())
        {
            sh -= tick_size_;
            switch (type()&TICK_BOTH)
            {
                case TICK_BOTH: sy += tick_size_/2; break;
                case TICK_ABOVE: sy += tick_size_; break;
            }
        }
        else
        {
            sw -= tick_size_;
            switch (type()&TICK_BOTH)
            {
                case TICK_BOTH: sx += tick_size_/2; break;
                case TICK_ABOVE: sx += tick_size_; break;
            }
        }
    }

    Fl_Flags flags = 0;
    if (!active_r())
    {
        flags.set(FL_INACTIVE);
    }
    else
    {
        if (Fl::pushed() == this) flags.set(FL_VALUE);
        if (belowmouse()) flags.set(FL_HIGHLIGHT);
    }

    if(!(fl_current_dev->capabilities() & Fl_Device::CAN_CLIPOUT)) {
        // draw the box or the visible parts of the window
        if (!box->fills_rectangle()) parent()->draw_group_box();
        box->draw(0, 0, w(), h(), color(), flags);
    }

    // minimal-update the slider, if it indicates the background needs
    // to be drawn, draw that. We draw the slot if the current box type
    // has no border:
    if (draw(sx, sy, sw, sh, flags, iy==0))
    {

        if(fl_current_dev->capabilities() & Fl_Device::CAN_CLIPOUT) {
            // draw the box or the visible parts of the window
            if (!box->fills_rectangle()) parent()->draw_group_box();
            box->draw(0, 0, w(), h(), color(), flags);
        }

        // draw the focus indicator inside the box:
        if (focused())
        {
            focus_box()->draw(ix+1, iy+1, iw-2, ih-2, label_color(), FL_INVISIBLE);
        }

        if (type() & TICK_BOTH)
        {
            if (horizontal())
            {
                switch (type()&TICK_BOTH)
                {
                    case TICK_ABOVE: ih = sy+sh/2-iy; break;
                    case TICK_BELOW: ih += iy; iy = sy+sh/2+(iy?0:3); ih -= iy; break;
                }
            }
            else
            {
                switch (type()&TICK_BOTH)
                {
                    case TICK_ABOVE: iw = sx+sw/2-ix; break;
                    case TICK_BELOW: iw += ix; ix = sx+sw/2+(iy?0:3); iw -= ix; break;
                }
            }
            Fl_Color color = text_color();
            if (!active_r()) color = fl_inactive(color);
            fl_color(color);
            draw_ticks(ix, iy, iw, ih, (slider_size_+1)/2);
        }

        fl_pop_clip();
    }
}
Beispiel #18
0
void Fl_Dial::draw()
{
    int X = 0; int Y = 0; int W = w(); int H = h();
    if (!(type() == FILL && box() == FL_OVAL_BOX))
    {
        if (damage()&FL_DAMAGE_ALL) draw_box();
        box()->inset(X,Y,W,H);
    }
    Fl_Color fillcolor = selection_color();
    Fl_Color linecolor = highlight_color();
    if (!active_r())
    {
        fillcolor = fl_inactive(fillcolor);
        linecolor = fl_inactive(linecolor);
    }
    double angle = (a2-a1)*(value()-minimum())/(maximum()-minimum()) + a1;
    if (type() == FILL)
    {
        if (damage()&FL_DAMAGE_EXPOSE && box() == FL_OVAL_BOX)
        {
            fl_push_clip(0, 0, w(), h());
            parent()->draw_group_box();
            fl_pop_clip();
        }
        fl_color(color());
        fl_pie(X, Y, W-1, H-1, 270-a1, angle > a1 ? 360+270-angle : 270-360-angle);
        fl_color(fillcolor);
        fl_pie(X, Y, W-1, H-1, 270-angle, 270-a1);
        if (box() == FL_OVAL_BOX)
        {
            fl_ellipse(X, Y, W-1, H-1);
            fl_color(linecolor); fl_stroke();
        }
    }
    else
    {
        if (!(damage()&FL_DAMAGE_ALL))
        {
            fl_ellipse(X+1, Y+1, W-2, H-2);
            fl_color(color()); fl_fill();
        }
        fl_push_matrix();
        fl_translate(X+W/2-.5, Y+H/2-.5);
        fl_scale(W-1, H-1);
        fl_rotate(45-angle);
        if (type() == LINE)
        {
            fl_vertex(0.0,   0.0);
            fl_vertex(-0.04, 0.0);
            fl_vertex(-0.25, 0.25);
            fl_vertex(0.0,   0.04);
        }
        else
        {
            fl_circle(-0.20, 0.20, 0.07);
        }
        fl_color(fillcolor); fl_fill_stroke(linecolor);
        fl_pop_matrix();
    }
    if (focused())
    {
        fl_ellipse(X+2, Y+2, W-5, H-5);
        fl_color(linecolor);
        fl_line_style(FL_DASH);
        fl_stroke();
        fl_line_style(0);
    }
}
Beispiel #19
0
/// Draw this item and its children.
void Fl_Tree_Item::draw(int X, int &Y, int W, Fl_Widget *tree, 
                        const Fl_Tree_Prefs &prefs, int lastchild) {
    if ( ! _visible ) return; 
    fl_font(_labelfont, _labelsize);
    int H = _labelsize + fl_descent() + prefs.linespacing();
    // Colors, fonts
    Fl_Color fg = _selected ? prefs.bgcolor()     : _labelfgcolor;
    Fl_Color bg = _selected ? prefs.selectcolor() : _labelbgcolor;
    if ( ! _active ) {
	fg = fl_inactive(fg);
	if ( _selected ) bg = fl_inactive(bg);
    }
    // Update the xywh of this item
    _xywh[0] = X;
    _xywh[1] = Y;
    _xywh[2] = W;
    _xywh[3] = H;
    // Text size
    int textw=0, texth=0;
    fl_measure(_label, textw, texth, 0);
    int textycenter = Y+(H/2);
    int &icon_x = _collapse_xywh[0] = X-1;
    int &icon_y = _collapse_xywh[1] = textycenter - (prefs.openicon()->h()/2);
    int &icon_w = _collapse_xywh[2] = prefs.openicon()->w();
    _collapse_xywh[3] = prefs.openicon()->h();
    // Horizontal connector values
    int hstartx  = X+icon_w/2-1;
    int hendx    = hstartx + prefs.connectorwidth();
    int hcenterx = X + icon_w + ((hendx - (X + icon_w)) / 2);

    // See if we should draw this item
    //    If this item is root, and showroot() is disabled, don't draw.
    //
    char drawthis = ( is_root() && prefs.showroot() == 0 ) ? 0 : 1;
    if ( drawthis ) {
	// Draw connectors
	if ( prefs.connectorstyle() != FL_TREE_CONNECTOR_NONE ) {
	    // Horiz connector between center of icon and text
	    draw_horizontal_connector(hstartx, hendx, textycenter, prefs);
	    if ( has_children() && is_open() ) {
		// Small vertical line down to children
		draw_vertical_connector(hcenterx, textycenter, Y+H, prefs);
	    }
	    // Connectors for last child
	    if ( ! is_root() ) {
		if ( lastchild ) {
		    draw_vertical_connector(hstartx, Y, textycenter, prefs);
		} else {
		    draw_vertical_connector(hstartx, Y, Y+H, prefs);
		}
	    }
	} 
	// Draw collapse icon
	if ( has_children() && prefs.showcollapse() ) {
	    // Draw icon image
	    if ( is_open() ) {
		prefs.closeicon()->draw(icon_x,icon_y);
	    } else {
		prefs.openicon()->draw(icon_x,icon_y);
	    }
	}
	// Background for this item
	int &bx = _label_xywh[0] = X+(icon_w/2-1+prefs.connectorwidth());
	int &by = _label_xywh[1] = Y;
	int &bw = _label_xywh[2] = W-(icon_w/2-1+prefs.connectorwidth());
	int &bh = _label_xywh[3] = texth;
	// Draw bg only if different from tree's bg
	if ( bg != tree->color() || is_selected() ) {
	    if ( is_selected() ) {
		// Selected? Use selectbox() style
		fl_draw_box(prefs.selectbox(), bx, by, bw, bh, bg);
	    } else {
		// Not Selected? use plain filled rectangle
		fl_color(bg);
		fl_rectf(bx, by, bw, bh);
	    }
	}
	// Draw user icon (if any)
	int useroff = (icon_w/2-1+prefs.connectorwidth());
	if ( usericon() ) {
	    // Item has user icon? Use it
	    useroff += prefs.usericonmarginleft();
	    usericon()->draw(X+useroff,icon_y);
	    useroff += usericon()->w();
	} else if ( prefs.usericon() ) {
	    // Prefs has user icon? Use it
	    useroff += prefs.usericonmarginleft();
	    prefs.usericon()->draw(X+useroff,icon_y);
	    useroff += prefs.usericon()->w();
	}
	useroff += prefs.labelmarginleft();
	// Draw label
	if ( widget() ) {
	    // Widget? Draw it
	    int lx = X+useroff;
	    int ly = by;
	    int lw = widget()->w();
	    int lh = bh;
	    if ( widget()->x() != lx || widget()->y() != ly ||
		 widget()->w() != lw || widget()->h() != lh ) {
		widget()->resize(lx, ly, lw, lh);		// fltk will handle drawing this
	    }
	} else {
	    // No label widget? Draw text label
	    if ( _label ) {
		fl_color(fg);
		fl_draw(_label, X+useroff, Y+H-fl_descent()-1);
	    }
	}
	Y += H;
    }			// end drawthis
    // Draw children
    if ( has_children() && is_open() ) {
	int child_x = drawthis ? 			// offset children to right,
	              (hcenterx - (icon_w/2) + 1) : X;	// unless didn't drawthis
	int child_w = W - (child_x-X);
	int child_y_start = Y;
	for ( int t=0; t<children(); t++ ) {
	    int lchild = ((t+1)==children()) ? 1 : 0;
	    _children[t]->draw(child_x, Y, child_w, tree, prefs, lchild);
	}
	if ( has_children() && is_open() ) {
	    Y += prefs.openchild_marginbottom();	// offset below open child tree
	}
	if ( ! lastchild ) {
	    draw_vertical_connector(hstartx, child_y_start, Y, prefs);
	}
    }
}