void Flu_Choice_Group :: draw() { int i; // make sure the selected child is still a child bool found = false; for( i = 1; i < children(); i++ ) if( child(i) == selected ) { found = true; break; } if( !found ) selected = NULL; if( !selected && children() > 1 ) value( child(1) ); int lblW = 0, lblH = 0, X; for( i = 1; i < children(); i++ ) { int W = 0, H; fl_measure( child(i)->label(), W, H ); if( W > lblW ) lblW = W; if( H > lblH ) lblH = H; } lblW += 26; lblH += 6; // align the label if( align() & FL_ALIGN_LEFT ) X = 4; else if( align() & FL_ALIGN_RIGHT ) X = w() - lblW - 8; else X = w()/2 - lblW/2 - 2; // draw the main group box if( damage() & ~FL_DAMAGE_CHILD ) fl_draw_box( box(), x(), y()+lblH/2, w(), h()-lblH/2, color() ); // clip and draw the children choice->resize( choice->x(), choice->y(), 0, 0 ); fl_clip( x()+2, y()+lblH+1, w()-4, h()-lblH-3 ); draw_children(); fl_pop_clip(); // clear behind the button and draw it fl_color( color() ); fl_rectf( x()+X, y(), lblW+4, lblH ); fl_color( labelcolor() ); choice->resize( x()+X+2, y(), lblW, lblH ); draw_child( *choice ); }
void Ca_Canvas::draw(){ uchar damage_= damage(); // int _b=border_/2; // int _x=x()+_b; // int _y=y()+_b; // int _w=w()-2*_b; // int _h=h()-2*_b; int replot=0; Ca_Axis_ *axis = last_axis_; /// something similar will go in the future into the lauout layer... while (axis){ replot |= axis->update(); axis=axis->previous_axis_; } /// if(damage_!=CA_DAMAGE_ADD) draw_box(); if((damage_!=CA_DAMAGE_ADD)||replot){ last_plotted_=0; axis=last_axis_; while(axis){ if(!(axis->grid_visible()&CA_FRONT)&&(axis->visible()||(axis->grid_visible()&CA_ALWAYS_VISIBLE))) axis->draw_grid(); axis=axis->previous_axis_; } } fl_clip(x()+Fl::box_dx(box())+dx_, y()+Fl::box_dy(box())+border_+dy_, w()-Fl::box_dw(box()) - dw_, h()-Fl::box_dh(box()) - dh_); if (last_plotted_) last_plotted_=last_plotted_->next; else last_plotted_=first_object_; while(last_plotted_){ last_plotted_->object->draw(); last_plotted_=last_plotted_->next; } last_plotted_=last_object_; fl_pop_clip(); axis=last_axis_; while(axis){ if((axis->grid_visible()&CA_FRONT)&&(axis->visible()||(axis->grid_visible()&CA_ALWAYS_VISIBLE))) axis->draw_grid(); axis=axis->previous_axis_; } if (damage_&FL_DAMAGE_ALL) draw_label(); };
void Flu_Collapsable_Group :: draw() { int X; FluSimpleString l = open() ? "- " : "+ "; l += label(); button.label( l.c_str() ); // force fit the button if necessary if( _fit ) button.size( w()-12, button.labelsize()+6 ); else { // otherwise make it as big as its label int W = 0, H = 0; fl_font( button.labelfont(), button.labelsize() ); fl_measure( button.label(), W, H ); button.size( W+6, button.h() ); } // align the button if( align() & FL_ALIGN_LEFT ) X = 4; else if( align() & FL_ALIGN_RIGHT ) X = w() - button.w() - 8; else X = w()/2 - button.w()/2 - 2; // draw the main group box if( damage() & ~FL_DAMAGE_CHILD ) fl_draw_box( box(), x(), y()+button.h()/2, w(), h()-button.h()/2, color() ); // clip and draw the internal group fl_clip( x()+2, y()+button.h()+1, w()-4, h()-button.h()-3 ); if( _changing ) { if( !_open ) group.resize( x(), y()-_originalHeight+(int)_currentHeight+_BUTTON_HEIGHT, w(), _originalHeight ); else group.resize( x(), y()-_newHeight+(int)_currentHeight+_BUTTON_HEIGHT, w(), _newHeight ); } draw_child( group ); fl_pop_clip(); // clear behind the button, resize, and draw fl_color( color() ); fl_rectf( x()+X, y(), button.w()+4, button.h() ); button.position( x()+X+2, y() ); draw_child( button ); button.label( 0 ); }
void Flu_Toggle_Group :: draw() { int lblW = 0, lblH, X, i; if( label() == 0 ) lblW = lblH = 0; else if( strlen( label() ) == 0 ) lblW = lblH = 0; else { measure_label( lblW, lblH ); lblW += 18; lblH += 2; } // align the label if( align() & FL_ALIGN_LEFT ) X = 4; else if( align() & FL_ALIGN_RIGHT ) X = w() - lblW - 8; else X = w()/2 - lblW/2 - 2; // draw the main group box if( damage() & ~FL_DAMAGE_CHILD ) fl_draw_box( box(), x(), y()+lblH/2, w(), h()-lblH/2, color() ); unsigned char *active = 0; if( !chkBtn->value() ) { active = (unsigned char*)malloc( children() ); for( i = 1; i < children(); i++ ) { active[i-1] = child(i)->active(); child(i)->deactivate(); } } // clip and draw the children chkBtn->resize( chkBtn->x(), chkBtn->y(), 0, 0 ); fl_clip( x()+2, y()+lblH+1, w()-4, h()-lblH-3 ); draw_children(); fl_pop_clip(); // clear behind the button and draw it fl_color( color() ); fl_rectf( x()+X, y(), lblW+4, lblH ); fl_color( labelcolor() ); chkBtn->label( label() ); chkBtn->resize( x()+X+2, y(), lblW, lblH ); draw_child( *chkBtn ); if( !chkBtn->value() ) { for( i = 1; i < children(); i++ ) { if( active[i-1] ) child(i)->activate(); else child(i)->deactivate(); } free( active ); } }