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(); }
static int but_draw(BUTTON *b, struct gfx_ds *ds, int x, int y, WIDGET *origin) { int tx = b->bd->tx, ty = b->bd->ty; int w = b->wd->w, h = b->wd->h; /* we hit the origin, acknowledge visibility request */ if (origin == b) return 1; /* only draw if no origin is specified */ if (origin) return 0; x += b->wd->x; y += b->wd->y; gfx->push_clipping(ds, x, y, w, h); x += b->bd->pad_x; y += b->bd->pad_y; w -= b->bd->pad_x*2; h -= b->bd->pad_y*2; /* draw keyboard focus frame if button is currently selected */ if (b->wd->flags & WID_FLAGS_KFOCUS) draw_kfocus_frame(ds, x - 1, y - 1, w + 2, h + 2); if (b->wd->flags & WID_FLAGS_MFOCUS) { gfx->draw_img(ds, x, y, w, h, focus_img, 255); if (!(b->wd->flags & WID_FLAGS_STATE)) { gfx->draw_img(ds, x, y, w, h, focus_img, 255); draw_focus_frame(ds, x, y, w, h); } } else { if (b->bd->style == 2) { gfx->draw_img(ds, x, y, w, h, actwin_img, 255); } else { gfx->draw_img(ds, x, y, w, h, normal_img, 255); } } if (b->wd->flags & WID_FLAGS_STATE) { draw_pressed_frame(ds, x, y, w, h); } else { if (!(b->wd->flags & WID_FLAGS_MFOCUS)) { draw_raised_frame(ds, x, y, w, h); } } tx += x; ty += y; if (b->wd->flags & WID_FLAGS_MFOCUS) { tx += 1; ty += 1; } if (b->wd->flags & WID_FLAGS_STATE) { tx += 2; ty += 2; } gfx->push_clipping(ds, x + 2, y + 2, w - 4, h - 4); if (b->bd->text) gfx->draw_string(ds, tx, ty, GFX_RGB(200, 200, 200), 0, b->bd->font_id, b->bd->text); gfx->pop_clipping(ds); gfx->pop_clipping(ds); return 1; }