void ChannelChatTab::append(std::string const & msg, int interest) { if (msg.empty()) { text_->append(msg, -1); return; } logFile_.log(msg); text_->append(msg, interest); // make ChatTabs redraw header if (interest >= 0 && !visible() && labelcolor() != FL_RED) { labelcolor(FL_RED); iTabs_.redrawTabs(); } if ((interest == 0 && beep_) || interest > 0) { Sound::beep(); } }
//***************************************************************************** // Vp_Value_Input_Spin::draw() -- Draw widget void Vp_Value_Input_Spin::draw() { int sxx = x(), syy = y(), sww = w(), shh = h(); sxx += sww - buttonssize(); sww = buttonssize(); Fl_Boxtype box1 = FL_BORDER_FRAME; //int border_size=Fl::box_dx(FL_BORDER_FRAME); int border_size=1; if (damage()&~FL_DAMAGE_CHILD) input.clear_damage(FL_DAMAGE_ALL); input.box(box()); input.color(FL_WHITE, selection_color()); Fl_Widget * draw_hack = &input; draw_hack->draw(); input.clear_damage(); sxx+=border_size; syy+=border_size; sww-=border_size*2; shh-=border_size*2; if (!box1) box1 = (Fl_Boxtype)(box()&-2); if((indrag || mouseobj) && deltadir!=0) { if(deltadir>0) { draw_box(down(box1),sxx,syy,sww,shh/2,color()); draw_box(box1,sxx,syy+shh/2,sww,shh/2,color()); } else { draw_box(box1,sxx,syy,sww,shh/2,color()); draw_box(down(box1),sxx,syy+shh/2,sww,shh/2,color()); } } else { draw_box(box1,sxx,syy,sww,shh/2,color()); draw_box(box1,sxx,syy+shh/2,sww,shh/2,color()); } sxx+=border_size; syy+=border_size; sww-=border_size*2; shh-=border_size*2; if (active_r()) { fl_color(labelcolor()); } else { fl_color(labelcolor() | 8); } int w1 = (sww-1)|1; // use odd sizes only int X = sxx+w1/2; int W = w1/3; int h1 = shh/2-border_size-2; int Y= syy; fl_polygon(X, Y, X+W,Y+h1 , X-W, Y+h1); Y=syy+shh/2+border_size+1+h1; fl_polygon(X, Y, X-W, Y-h1, X+W, Y-h1); clear_damage(); }
void Fl_Arc_Dial::draw ( void ) { int X = x(); int Y = y(); int W = w(); int H = h(); draw_box(); draw_label(); X += Fl::box_dx(box()); Y += Fl::box_dy(box()); W -= Fl::box_dw(box()); H -= Fl::box_dh(box()); double angle = ( angle2() - angle1() ) * ( value() - minimum()) / ( maximum() - minimum() ) + angle1(); fl_line_style( FL_SOLID, W / 6 ); X += W / 8; Y += H / 8; W -= W / 4; H -= H / 4; if ( box() == FL_NO_BOX ) { /* draw backgrond arc */ fl_color( fl_color_average( FL_BLACK, selection_color(), 0.80f ) ); fl_arc( X, Y, W, H, 270 - angle1(), 270 - angle2() ); } fl_color( selection_color() ); // fl_color( fl_color_average( FL_RED, selection_color(), ( value() - minimum() ) / ( maximum() - minimum() ) ) ); if ( type() == FL_FILL_DIAL ) fl_arc( X, Y, W, H, 270 - angle1(), 270 - angle ); else { const int d = 6; /* account for edge conditions */ angle = angle < angle1() + d ? angle1() + d : angle; angle = angle > angle2() - d ? angle2() - d : angle; fl_arc( X, Y, W, H, 270 - (angle - d), 270 - (angle + d) ); } fl_line_style( FL_SOLID, 0 ); fl_color( labelcolor() ); char s[10]; fl_font( FL_HELVETICA, 8 ); snprintf( s, sizeof( s ), "%.1f", value() ); fl_draw( s, X, Y, W, H, FL_ALIGN_BOTTOM ); }
PerfTest ( int X, int Y, int W, int H, const char *L=0 ) : Fl_Widget( X, Y, W, H, L ) { align(FL_ALIGN_TOP | FL_ALIGN_RIGHT |FL_ALIGN_INSIDE); box(FL_UP_BOX); labelcolor( FL_WHITE ); use_cairo = false; }
gBox::gBox(int x, int y, int w, int h, const char *L, Fl_Align al) : Fl_Box(x, y, w, h, L) { labelsize(11); box(FL_NO_BOX); labelcolor(COLOR_TEXT_0); if (al != 0) align(al | FL_ALIGN_INSIDE); }
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 ); }
gChoice::gChoice(int x, int y, int w, int h, const char *l, bool ang) : Fl_Choice(x, y, w, h, l), angle(ang) { labelsize(11); labelcolor(COLOR_TEXT_0); box(FL_BORDER_BOX); textsize(11); textcolor(COLOR_TEXT_0); color(COLOR_BG_0); }
gDial::gDial(int x, int y, int w, int h, const char *L) : Fl_Dial(x, y, w, h, L) { labelsize(11); labelcolor(COLOR_TEXT_0); align(FL_ALIGN_LEFT); type(FL_FILL_DIAL); angles(0, 360); color(COLOR_BG_0); // background selection_color(COLOR_BG_1); // selection }
int PrivateChatTab::handle(int event) { switch (event) { case FL_SHOW: labelcolor(FL_FOREGROUND_COLOR); Fl::focus(input_); break; } return Fl_Group::handle(event); }
int ChannelChatTab::handle(int event) { switch (event) { case FL_SHOW: labelcolor(FL_FOREGROUND_COLOR); Fl::focus(input_); break; } return Fl_Tile::handle(event); }
void Fl_ToggleTree::draw_node(int depth, int cy, Fl_Node* node) { Fl_ToggleNode* tnode = (Fl_ToggleNode*)node; if (damage() == FL_DAMAGE_CHILD && !tnode->changed_ && damaged_ == 0) { return; } tnode->changed_ = 0; if (tnode->selected_) { fl_color(selection_color()); fl_rectf(x(), cy + 1, w(), height_(tnode) - 1); } else { fl_color((cy - y()) & 1 ? color() : alternate_color()); fl_rectf(x(), cy + 1, w(), height_(tnode) - 1); } fl_color(trim_color()); fl_line(x(), cy, x() + w(), cy); fl_color(FL_BLACK); if (draw_lines_) { int i; Fl_ToggleNode * n; fl_xyline(x()+depth*16+8, cy+8, x()+(depth+1)*16, cy+8); if (tnode->next_) fl_xyline(x()+depth*16+8, cy, x()+depth*16+8, cy+16); else fl_xyline(x()+depth*16+8, cy, x()+depth*16+8, cy+8); for (i=depth-1, n = (Fl_ToggleNode*)tnode->up_; n; i--, n = (Fl_ToggleNode*)n->up_) if (n->next_) fl_xyline(x()+i*16+8, cy, x()+i*16+8, cy+16); } if (tnode->can_open_) { if (tnode->opened_) opened_pixmap_->draw(x() + depth*16, cy); else closed_pixmap_->draw(x() + depth*16, cy); } if (tnode->selected_) textcolor(selection_label_color()); else textcolor(labelcolor()); if (tnode->label_) { int D = depth * 16 + label_offset_; draw_label(tnode->label_, D, x(), cy, w(), 16); } if (tnode->pixmap_) { tnode->pixmap_->draw(x() + depth*16 + pixmap_offset_, cy + 1); } }
gSlider::gSlider(int x, int y, int w, int h, const char *l) : Fl_Slider(x, y, w, h, l) { type(FL_HOR_FILL_SLIDER); labelsize(11); align(FL_ALIGN_LEFT); labelcolor(COLOR_TEXT_0); box(G_BOX); color(COLOR_BG_0); selection_color(COLOR_BD_0); }
gInput::gInput(int x, int y, int w, int h, const char *L) : Fl_Input(x, y, w, h, L) { //Fl::set_boxtype(G_BOX, gDrawBox, 1, 1, 2, 2); box(G_BOX); labelsize(11); labelcolor(COLOR_TEXT_0); color(COLOR_BG_DARK); textcolor(COLOR_TEXT_0); cursor_color(COLOR_TEXT_0); selection_color(COLOR_BD_0); textsize(11); }
void PrivateChatTab::append(std::string const & msg, int interest) { logFile_.log(msg); // interest can be : // -2 my text // -1 join/leave messages // 0 other part sent text text_->append(msg, interest); // make Tabs redraw header if other part send text if (interest == 0 && !visible() && labelcolor() != FL_RED) { labelcolor(FL_RED); iTabs_.redrawTabs(); } if (interest == 0 && beep_) { Sound::beep(); } }
void TaskButton::draw(void) { Fl_Color col = value() ? selection_color() : color(); draw_box(value() ? (down_box() ? down_box() : fl_down(box())) : box(), col); if(image()) { int X, Y, lw, lh; X = x() + 5; Y = (y() + h() / 2) - (image()->h() / 2); image()->draw(X, Y); X += image()->w() + 5; if(label()) { fl_font(labelfont(), labelsize()); fl_color(labelcolor()); lw = lh = 0; fl_measure(label(), lw, lh, 0); /* use clipping so long labels do not be drawn on the right border, which looks ugly */ fl_push_clip(x() + Fl::box_dx(box()), y() + Fl::box_dy(box()), w() - Fl::box_dw(box()) - 5, h() - Fl::box_dh(box())); Y = (y() + h() / 2) - (lh / 2); fl_draw(label(), X, Y, lw, lh, align(), 0, 0); fl_pop_clip(); } } else { draw_label(); } if(Fl::focus() == this) draw_focus(); }
// modified explicitly from Fl_Return_Button.cpp void Flu_Button :: draw() { if( type() == FL_HIDDEN_BUTTON ) return; if( !active() ) Fl_Button::color( col ); // draw the link text if( linkBtn ) { fl_draw_box( box(), x(), y(), w(), h(), color() ); labelSize[0] = labelSize[1] = labelSize[2] = labelSize[3] = 0; fl_font( labelfont(), labelsize() ); fl_measure( label(), labelSize[2], labelSize[3], 1 ); labelSize[0] += 2; labelSize[1] += h()/2 - labelsize()/2 - 2; fl_color( labelcolor() ); fl_draw( label(), x()+labelSize[0], y()+labelSize[1], labelSize[2], labelSize[3], FL_ALIGN_LEFT ); if( !overLink || ( overLink && hover ) ) { fl_line_style( FL_SOLID ); fl_line( x()+labelSize[0], y()+labelSize[1]+labelSize[3]-2, x()+labelSize[0]+labelSize[2], y()+labelSize[1]+labelSize[3]-2 ); fl_line_style( 0 ); } return; } Fl_Image *tmp = 0; if( active() && image_follows_value() ) { if( !value() ) { tmp = Fl_Button::image(); Fl_Button::image( Fl_Button::deimage() ); } } else if( active() && value() && downImg ) { tmp = Fl_Button::image(); Fl_Button::image( downImg ); } const char *lbl = label(); if( retBtn ) label(""); if( eBox != FL_NO_BOX && Fl::belowmouse() == this && active() ) { Fl_Boxtype oldbox = box(); box( eBox ); Fl_Button::draw(); box( oldbox ); } else Fl_Button::draw(); if( retBtn ) { int W = h(); if (w()/3 < W) W = w()/3; flu_return_arrow(x()+w()-W-4, y(), W, h()); label( lbl ); draw_label(x(), y(), w()-W+4, h()); } if( tmp ) Fl_Button::image( tmp ); }
CFLTKHyperLink::CFLTKHyperLink(int X, int Y, int W, int H, const char *l) : Fl_Box(X, Y, W, H, l) { labelcolor(FL_BLUE); }
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 ); } }
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); } } }
void Fl_DialX::draw ( void ) { int X,Y,S; { int ox, oy, ww, hh, side; ox = x(); oy = y(); ww = w(); hh = h(); if (ww > hh) { side = hh; ox = ox + (ww - side) / 2; } else { side = ww; oy = oy + (hh - side) / 2; } side = w() > h() ? hh : ww; X = ox; Y = oy; S = side; } draw_box(); draw_label(); double angle = ( angle2() - angle1() ) * ( value() - minimum()) / ( maximum() - minimum() ) + angle1(); fl_draw_box( box(), X, Y, S, S, color() ); /* shrink a bit */ int OX = x(); int OY = y(); X += S / 8; Y += S / 8; int OS = S; S -= S / 4; fl_line_style( FL_SOLID, S / 12 ); /* background arc */ fl_color( fl_darker( color() ) ); fl_arc( X, Y, S, S, 270 - angle1(), 270 - angle2() ); /* foreground arc */ fl_color( selection_color() ); fl_arc( X, Y, S, S, 270 - angle1(), 270 - angle ); fl_line_style( FL_SOLID, 0 ); if ( active_r() ) { int W = OS; int H = OS; fl_push_matrix(); fl_translate(OX+W/2, OY+H/2); fl_scale(W, H); fl_rotate(310+angle); fl_color( fl_color_add_alpha( FL_WHITE, 127 )); fl_begin_polygon(); fl_circle(-0.26, 0.26, 0.12); fl_end_polygon(); fl_color( FL_WHITE ); fl_begin_polygon(); fl_circle(-0.26, 0.26, 0.06); fl_end_polygon(); fl_pop_matrix(); } fl_color( fl_contrast( labelcolor(), color() ) ); if ( Fl::belowmouse() == this ) { char s[10]; fl_font( FL_HELVETICA, 10 ); snprintf( s, sizeof( s ), "%.1f", value() ); fl_color( FL_FOREGROUND_COLOR ); fl_draw( s, X, Y, S, S, FL_ALIGN_CENTER ); } }