void PanelButton::draw() { Fl_Boxtype box = up; Fl_Flags flags; Fl_Color color; if (belowmouse()) { // Highlight button when below mouse flags = FL_HIGHLIGHT; color = highlight_color(); if (!color) color = this->color(); // box = down; } else { flags = 0; color = this->color(); } if (value()) box=down; // Push down button when pressed if(!box->fills_rectangle()) { fl_push_clip(0, 0, this->w(), this->h()); parent()->draw_group_box(); fl_pop_clip(); } box->draw(0, 0, this->w(), this->h(), color, flags); int x,y,w,h; x = y = 0; w = this->w(); h = this->h(); box->inset(x,y,w,h); draw_inside_label(x,y,w,h,flags); }
void PanelMenu::draw() { Fl_Boxtype box = up; Fl_Flags flags; Fl_Color color; if (!active_r()) { // Button is disabled flags = FL_INACTIVE; color = this->color(); } else if (m_open) { // Menu is open, make the button pushed and highlighted flags = FL_HIGHLIGHT; color = highlight_color(); if (!color) color = this->color(); box = down; } else if (belowmouse()) { // Menu is not open, but button is below mouse - highlight flags = FL_HIGHLIGHT; color = highlight_color(); if (!color) color = this->color(); } else { // Plain flags = 0; color = this->color(); } if(!box->fills_rectangle()) { fl_push_clip(0, 0, this->w(), this->h()); parent()->draw_group_box(); fl_pop_clip(); } box->draw(0, 0, this->w(), this->h(), color, flags); int x,y,w,h; x = y = 0; w = this->w(); h = this->h(); box->inset(x,y,w,h); draw_inside_label(x,y,w,h,flags); }
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(); } }