void RS232Console::render(Dashboard *dash, SDLColor color, SDLColor bg_color, int font_size) { int char_width, char_height, height, width, mid_height; getCharMetrics(dash, char_width, char_height); getMetrics(dash, width, mid_height, height); rectangleColor(dash->screen, x, y, x + width - 1, y + height - 1, color.toUInt32()); lineColor(dash->screen, x, y + mid_height - 1, x + width - 1, y + mid_height - 1, color.toUInt32()); int current_y = y + 2; int to_line = min((int)stored_text.size(), scroll_position + rows); for (int i = scroll_position; i < to_line; i++) { dash->putMonoText(x + 2, current_y, stored_text[i].substr(0, columns), font_size + 2, color); current_y += char_height; } if (scrollbar_persist_frames) { drawScrollbar(dash, color); scrollbar_persist_frames--; } }
void GUIScrollbarGadget::draw() { if (!isVisible_ || isValidated_ || !setupClipping()) return; #if 1 // !TODO! -> call in virtual setPosition/ setRect/ setSize functino updateBarLocation(); #endif GlbRenderSys->draw2DRectangle(Rect_, Color_); if (Flags_ & GUIFLAG_HATCHEDFACE) drawHatchedFace(Rect_); if (!(Flags_ & GUIFLAG_BORDERLESS)) drawFrame(Rect_, 0, false); dim::rect2di BarRect, ButtonARect, ButtonBRect, PageARect, PageBRect; getButtonRects(BarRect, ButtonARect, ButtonBRect, PageARect, PageBRect); drawScrollbar(BarRect); drawScrollbarButton(ButtonARect, dim::rect2df(0, 0, 1, 1), USAGE_FORWARDS); drawScrollbarButton(ButtonBRect, dim::rect2df(0, 1, 1, 0), USAGE_BACKWARDS); if (!isEnabled_) drawHatchedFace(Rect_); }
void StageSelect::draw() { drawWindow(); drawBackground(); drawDodai(); card_.draw(); post_.draw(); exit_.draw(); drawScrollbar(); for (int i = 0;i < stagelavel_.size(); i++) { stagelavel_[i].draw(); } drawMousePointer(); }
Boolean MCNativeTheme::drawwidget(MCDC *dc, const MCWidgetInfo & winfo, const MCRectangle & drect) { GC gc ; MCThemeDrawInfo di ; MCDC * t_dc = dc ; Boolean ret = False; static MCRectangle gtkpixrect = {0,0,0,0}; Display *display = MCdpy; GdkRectangle rect; GdkRectangle cliprect; MCRectangle trect = drect; MCRectangle crect = drect; if (winfo.type == WTHEME_TYPE_TAB) crect.height--; //make sure tab doesn't draw over tab pane rect = MCRectangleToGdkRectangle(trect); cliprect = MCRectangleToGdkRectangle(crect); rect.x = cliprect.x = 0; rect.y = cliprect.y = 0; if (rect.width <= 0 || rect.height <= 0) return False; GtkThemeWidgetType moztype; gint flags = 0; GtkWidgetState state = getpartandstate(winfo, moztype, flags); switch(winfo.type) { case WTHEME_TYPE_TABPANE: state.curpos = 0; if(winfo.attributes & WTHEME_ATT_TABPOSBOTTOM || winfo.attributes & WTHEME_ATT_TABPOSTOP) state.maxpos = rect.width; else if(winfo.attributes & WTHEME_ATT_TABPOSLEFT || winfo.attributes & WTHEME_ATT_TABPOSRIGHT) state.maxpos = rect.height; else state.maxpos = rect.width; // XXX therefore default tabpos is top if(winfo.datatype == WTHEME_DATA_TABPANE) { MCWidgetTabPaneInfo *inf = (MCWidgetTabPaneInfo*)winfo.data; state.curpos = inf->gap_start - 1; state.maxpos = inf->gap_length + 2; } make_theme_info ( di, moztype, gtkpix, &rect, &cliprect, state, flags, crect); t_dc -> drawtheme ( THEME_DRAW_TYPE_GTK, &di ) ; ret = True; break; case WTHEME_TYPE_COMBO: { MCWidgetInfo twinfo = winfo; MCRectangle comboentryrect,combobuttonrect; //draw text box twinfo.part = WTHEME_PART_COMBOTEXT; getwidgetrect(twinfo, WTHEME_METRIC_PARTSIZE,drect,comboentryrect); twinfo.part = WTHEME_PART_COMBOBUTTON; getwidgetrect(twinfo, WTHEME_METRIC_PARTSIZE,drect,combobuttonrect); twinfo.type = WTHEME_TYPE_TEXTFIELD_FRAME; drawwidget(dc, twinfo, comboentryrect); twinfo.type = WTHEME_TYPE_COMBOBUTTON; drawwidget(dc, twinfo, combobuttonrect); return True; } #define B_WIDTH 3 case WTHEME_TYPE_TEXTFIELD_FRAME: { GtkWidgetState t_old_state; t_old_state = state; MCRectangle t_old_clip; t_old_clip = dc -> getclip(); // crect is the target rectangle for the whole control // cliprect and rect are essentially the same GdkRectangle t_bounds; MCRectangle t_dst_bounds; MCRectangle t_clip; // First render the top and bottom borders. We render a control 8 pixels // high, but clipped to the border width. t_bounds . x = 0; t_bounds . y = 0; t_bounds . width = rect . width; t_bounds . height = 8; MCU_set_rect(t_dst_bounds, crect . x, crect . y, crect . width, 8); MCU_set_rect(t_clip, crect . x, crect . y, crect . width, B_WIDTH); make_theme_info(di, moztype, gtkpix, &t_bounds, &t_bounds, state, flags, t_dst_bounds); dc -> setclip(t_clip); dc -> drawtheme(THEME_DRAW_TYPE_GTK, &di); MCU_set_rect(t_dst_bounds, crect . x, crect . y + crect . height - 8, crect . width, 8); MCU_set_rect(t_clip, crect . x, crect . y + crect . height - B_WIDTH, crect . width, B_WIDTH); make_theme_info(di, moztype, gtkpix, &t_bounds, &t_bounds, state, flags, t_dst_bounds); dc -> setclip(t_clip); dc -> drawtheme(THEME_DRAW_TYPE_GTK, &di); // Now render the left and right borders. We render a control 8 pixels // wide, but clipped to the border width t_bounds . x = 0; t_bounds . y = 0; t_bounds . width = 8; t_bounds . height = rect . height; MCU_set_rect(t_dst_bounds, crect . x, crect . y, 8, crect . height); MCU_set_rect(t_clip, crect . x, crect . y + B_WIDTH, B_WIDTH, crect . height - 2 * B_WIDTH); make_theme_info(di, moztype, gtkpix, &t_bounds, &t_bounds, state, flags, t_dst_bounds); dc -> setclip(t_clip); dc -> drawtheme(THEME_DRAW_TYPE_GTK, &di); MCU_set_rect(t_dst_bounds, crect . x + crect . width - 8, crect . y, 8, crect . height); MCU_set_rect(t_clip, crect . x + crect . width - B_WIDTH, crect . y + B_WIDTH, B_WIDTH, crect . height - 2 * B_WIDTH); make_theme_info(di, moztype, gtkpix, &t_bounds, &t_bounds, state, flags, t_dst_bounds); dc -> setclip(t_clip); dc -> drawtheme(THEME_DRAW_TYPE_GTK, &di); dc -> setclip(t_old_clip); } break ; case WTHEME_TYPE_SLIDER: drawSlider(dc, winfo, drect); return True; break; case WTHEME_TYPE_SCROLLBAR: drawScrollbar(dc, winfo, drect); return True; break; case WTHEME_TYPE_PROGRESSBAR: ret = drawprogressbar(dc, winfo, drect); return ret; break; case WTHEME_TYPE_GROUP_FRAME: make_theme_info ( di, moztype, gtkpix, &rect, &cliprect, state, flags, crect); t_dc -> drawtheme ( THEME_DRAW_TYPE_GTK, &di ) ; ret = True; break; default: make_theme_info ( di, moztype, gtkpix, &rect, &cliprect, state, flags, crect); t_dc -> drawtheme ( THEME_DRAW_TYPE_GTK, &di ) ; ret = True; } return ret; }