/* * select_item - select menu item (after deselecting current item) */ static void select_item(char *title, int curr_item, size_t item_i) { int x, y, w, h; /* get size of title, use that as height ofr all lines */ getstringsize(title, &w, &h); h += MENU_ITEM_PAD * 2; /* calc x and width */ x = MENU_X + MENU_ITEM_PAD; w = MENU_WIDTH - 2 * MENU_ITEM_PAD; /* if there is a current item, then deselect it */ if (curr_item >= 0) { /* deselect old item */ y = MENU_Y + h + MENU_ITEM_PAD * 2; /* account for title */ y += h * curr_item; drawrect(x, y, w, h,0x00); } /* select new item */ curr_item = item_i; /* select new item */ y = MENU_Y + h + MENU_ITEM_PAD * 2; /* account for title */ y += h * curr_item; drawrect(x, y, w, h,0xf9); }
void ClockChip::render(int aChipId) { // Display nag here instead of ctor so tooltip won't show it if (mNagOnce) { okcancel("Note:\n" "\n" "Atanua's current simulation clock rate\n" "is too low for this clock chip.\n" "\n" "Edit atanua.xml and set the PhysicsKHz\n" "higher if you wish to use this part.\n" "\n" "Currently the part will only run at the\n" "maximum simulated clock.\n" "\n" "The simulation clock must be twice as\n" "fast as the desired clock chip rate."); mNagOnce = 0; } drawtexturedrect(mTexture,mX,mY,mW,mH-0.25,0xffffffff); fn.drawstring("Clock",mX+0.5,mY+0.4,0x7f000000,0.3); char temp[64]; sprintf(temp, "%3.1fHz", mReqFreq); fn.drawstring(temp,mX+0.5,mY+0.7,0x7f000000,0.25); float timepos = mMsBucket / mMsPerEvent; drawrect(mX+0.4+(mW-0.85)*timepos,mY+1,0.05,0.2,0x7f000000); drawrect(mX+0.4,mY+1,mW-0.8,0.2,(!mLastState)?0x3f000000:0x3fffffff); }
static void drawcursor(GRect *clip, int insert, int x, int y, int w) { if (insert) drawrect(clip, x, y, 2, font->height, GXBlack); else drawrect(clip, x, y, w, font->height, GXBlack); }
static void drawitembox(ITEM *i, int y) { if(selected_item == i) { drawrect(ROSTER_BOX_LEFT, y + 1, SIDEBAR_WIDTH, y + ROSTER_BOX_HEIGHT, COLOR_BACKGROUND_MAIN); //drawrectw(ROSTER_BOX_LEFT + UTOX_SCALE(5 ) / 2, y + UTOX_SCALE(5 ) / 2, 40, 40, COLOR_BACKGROUND_LIST); } else if(mouseover_item == i) { drawrect(ROSTER_BOX_LEFT, y + 1, SIDEBAR_WIDTH, y + ROSTER_BOX_HEIGHT, COLOR_BACKGROUND_LIST_HOVER); } }
void Box::render(int aChipId) { drawrect(mX + 0.25, mY+0.25, mW - 0.5, mH - 0.5, 0xff1f1f1f); drawrect(mX + 0.35, mY+0.35, mW - 0.7, mH - 0.7, 0xff3f3f3f); float w,h,lln; fn.stringmetrics(mDisplayString,w,h,lln,0.75); fn.drawstring(mDisplayString,mX + (mW-w)/2,mY+0.6,0x6fffffff,0.75); }
static void drawitembox(ITEM *i, int y) { if(selected_item == i) { drawrect(LIST_X + 1, y + 1, LIST_RIGHT + 1, y + ITEM_HEIGHT, COLOR_MAIN_BACKGROUND); //drawrectw(LIST_X + 5 * SCALE / 2, y + 5 * SCALE / 2, 40, 40, COLOR_LIST_BACKGROUND); } else if(mouseover_item == i) { drawrect(LIST_X + 1, y + 1, LIST_RIGHT, y + ITEM_HEIGHT, COLOR_LIST_HOVER_BACKGROUND); } }
void drawmenu(void) { int curpos; Item *item; dc->x = 0; dc->y = 0; dc->h = bh; drawrect(dc, 0, 0, mw, mh, True, BG(dc, normcol)); if(prompt && *prompt) { dc->w = promptw; drawtext(dc, prompt, selcol); dc->x = dc->w; } /* draw input field */ dc->w = (lines > 0 || !matches) ? mw - dc->x : inputw; drawtext(dc, text, normcol); if((curpos = textnw(dc, text, cursor) + dc->h/2 - 2) < dc->w) drawrect(dc, curpos, 2, 1, dc->h - 4, True, FG(dc, normcol)); /* // Draw hits */ dc->w = textw(dc, hitstxt); dc->x = mw - dc->w; drawtext(dc, hitstxt, selcol); dc->x = 0; if(lines > 0) { /* draw vertical list */ dc->w = mw - dc->x; for(item = curr; item != next; item = item->right) { dc->y += dc->h; drawtext(dc, item->text, (item == sel) ? selcol : (item->out) ? outcol : normcol); } } else if(matches) { /* draw horizontal list */ dc->x += inputw; dc->w = textw(dc, "<"); if(curr->left) drawtext(dc, "<", normcol); for(item = curr; item != next; item = item->right) { dc->x += dc->w; dc->w = MIN(textw(dc, item->text), mw - dc->x - textw(dc, ">")); drawtext(dc, item->text, (item == sel) ? selcol : (item->out) ? outcol : normcol); } dc->w = textw(dc, ">"); dc->x = mw - dc->w; if(next) drawtext(dc, ">", normcol); } mapdc(dc, win, mw, mh); }
void NameEntryScreen::activate(){ Coordinate keyboard_origin(90,100); OnScreenKeyboard keyboard(keyboard_origin); NameEntryBox nameBox(keyboard_origin,3,20); stroke(65,65,65); fill(196,207,161); drawrect(0,0, 320,240); text("Congratulations!", 90, 30); text("HI SCORE: ", 90,45); text(player_score_, 160, 45); text("Enter your name:", 90, 60); keyboard.draw(); nameBox.draw(); long curr_time = millis(); bool enter_pressed = false; //read in the user's name while (!nameBox.isNameComplete()) { input_shield_->readInputShield(&input_state_); if(millis() - curr_time > (1000/10)){ keyboard.updateCursorPosition(input_state_); if(input_state_.ButtonA){ if(!enter_pressed){ nameBox.enterChar(keyboard.click()); nameBox.draw(); enter_pressed = true; } }else{ enter_pressed = false; } keyboard.draw(); curr_time = millis(); } } char* player_name = nameBox.getName(); hi_score_->setNewHiScore(player_name, player_score_); stroke(65,65,65); fill(196,207,161); drawrect(55,80,240,60); text("(Press A to start a new game)",80,110); pressAToContinue(); }
static void decorate(GRect *clip, int dirty, GColor c) { int boxh; boxh = VMargin + font->height; drawrect(clip, HMargin-3, 0, 1, clip->h, c); drawrect(clip, 0, boxh, HMargin-3, 1, c); if (dirty) drawrect(clip, 2, 2, HMargin-7, boxh-4, c); }
static void draw_checkbox(control c, rect r) { int w; rect box, textrect; char *name; int style = (AlignLeft | AlignTop); font f; rgb old = currentcolour(); /* Calculate rectangles. */ f = gettextfont(c); setfont(f); w = strwidth(f,"W"); if (w > r.width) w = r.width; if (w > r.height) w = r.height; box = rect(r.x,r.y+1,w,w); if (w < getheight(f) - getdescent(f)) box.y += getheight(f) - getdescent(f) - w; textrect = rect(r.x+w+w/2,r.y,r.width-(w+w/2),r.height); /* Clear check area. */ setlinewidth(1); setcolour(White); fillrect(insetr(box,1)); /* Draw check area */ if (isenabled(c)) setcolour(Black); else setcolour(Grey); drawrect(box); /* 'Pressed button' effect by black border in box. */ if (ishighlighted(c)) drawrect(insetr(box,1)); /* Put tick in box if checked. */ if (ischecked(c)) draw_checkmark(insetr(box,1)); name = getname(c); if (isenabled(c)) { /* if (hasfocus(c)) { style |= Underline; setlinewidth(2); } */ setcolour(getforeground(c)); } drawtext(textrect, style, name); setcolour(old); }
void drawmenu(void) { int curpos; Item *item; dc->x = 0; dc->y = 0; dc->h = bh; drawrect(dc, 0, 0, mw, mh, True, normcol->BG); if(prompt && *prompt) { dc->w = promptw; drawtext(dc, prompt, selcol); dc->x = dc->w; } /* draw input field */ dc->w = (lines > 0 || !matches) ? mw - dc->x : inputw; drawtext(dc, text, normcol); if((curpos = textnw(dc, text, cursor) + dc->font.height/2) < dc->w) drawrect(dc, curpos, (dc->h - dc->font.height)/2 + 1, 1, dc->font.height -1, True, normcol->FG); if(!quiet || strlen(text) > 0) { if(lines > 0) { /* draw vertical list */ dc->w = mw - dc->x; for(item = curr; item != next; item = item->right) { dc->y += dc->h; drawtext(dc, item->text, (item == sel) ? selcol : normcol); } } else if(matches) { /* draw horizontal list */ dc->x += inputw; dc->w = textw(dc, "<"); if(curr->left) drawtext(dc, "<", normcol); for(item = curr; item != next; item = item->right) { dc->x += dc->w; dc->w = MIN(textw(dc, item->text), mw - dc->x - textw(dc, ">")); drawtext(dc, item->text, (item == sel) ? selcol : normcol); } dc->w = textw(dc, ">"); dc->x = mw - dc->w; if(next) drawtext(dc, ">", normcol); } } mapdc(dc, win, mw, mh); }
value caml_drawtext(value string, value pos, value matches, value colors) { CAMLparam4(string, pos, matches, colors); size_t size = textw(dc, String_val (string)); int x = Int_val(Field(pos, 0)); if (bottom) /* magic formula */ dc->y = mh - (bh - dc->font.ascent - 1 + Int_val(Field(pos, 1)) * bh); else dc->y = dc->font.ascent+1 + Int_val(Field(pos, 1)) * bh; drawrect(dc, x, dc->y-dc->font.ascent-1, size, bh, True, getcolor(dc, String_val(Field(colors, 2)))); int start, stop; unsigned long fg; int xoff = x + dc->font.height/2; const char *str = String_val (string); value head; while (matches != Val_int(0)) { head = Field (matches, 0); matches = Field (matches, 1); dc->x = xoff; fg = getcolor(dc, String_val(Int_val(Field(head, 0)) == 0 ? Field(colors, 0) : Field(colors, 1))); start = Int_val(Field (head, 1)); stop = Int_val(Field (head, 2)); xoff += drawtext(dc, str, start, stop, fg); } CAMLreturn(Val_int(x + size)); }
value caml_clear(value bg) { CAMLparam1(bg); drawrect(dc, 0, 0, mw, mh, True, getcolor(dc, String_val (bg))); CAMLreturn(Val_unit); }
void CheckButton::OnRender(suic::DrawingContext * drawing) { if (GetStyle()) { // // 先绘制背景 // suic::Rect drawrect(0, 0, RenderSize().cx, RenderSize().cy); suic::ImageBrushPtr bkgnd(suic::Render::GetProperty(this, GetStyle().get(), InternalBackgrount())); if (bkgnd) { suic::Rect rectBk = bkgnd->GetContentBrounds(); drawrect.right = drawrect.left + rectBk.Width(); drawrect.top += (drawrect.Height() - rectBk.Height()) / 2; drawrect.bottom = drawrect.top + rectBk.Height(); bkgnd->Draw(drawing, &drawrect); } // // 绘制文字 // drawrect.top = 0; drawrect.bottom = RenderSize().cy; drawrect.left = drawrect.right + GetPadding().left; drawrect.right = RenderSize().cx; suic::Render::RenderText(drawing, this, GetText(), &drawrect, true); } }
void myDisplay(void) { // 清除。GL_COLOR_BUFFER_BIT表示清除颜色 /* 在RGB模式下,使用glClearColor来指定“空”的颜色,它需要四个参数,其参数的意义跟glColor4f相似。 在索引颜色模式下,使用glClearIndex来指定“空”的颜色所在的索引,它需要一个参数,其意义跟glIndexi相似。 */ glClearColor(0.5f, 0.5f, 0.5f, 0.5f); glClear(GL_COLOR_BUFFER_BIT); drawrect(); drawpoint(); drawline(); drawpolygon(); draw5star(); drawsin(); drawtriangle(); //保证前面的OpenGL命令立即执行(而不是让它们在缓冲区中等待)。其作用跟fflush(stdout)类似。 glFlush(); }
void ComboBox::OnRender(suic::DrawingContext * drawing) { suic::StylePtr styleArrow = FindResource(_T("ComboBox.Down")); suic::Point pt; suic::Rect drawrect(pt.x, pt.y, RenderSize().cx, RenderSize().cy); // // 先绘制背景 // if (GetBackground()) { GetBackground()->Draw(drawing, &drawrect); } // 获取下拉箭头的设置 if (styleArrow.get()) { suic::BrushPtr bkgnd(suic::Render::GetProperty(this, styleArrow.get(), _T("Background"))); if (bkgnd) { suic::Rect downRect = drawrect; downRect.Deflate(GetBorderThickness()); downRect.left = downRect.right - 16; bkgnd->Draw(drawing, &downRect); } } suic::Render::RenderBorder(drawing, this, &drawrect); }
void ExtPin::render(int aChipId) { drawrect(mInputPin.mX+mX-0.1, mInputPin.mY+mY-0.1, 0.7, 0.7, 0x7f40ffff); mX += 0.75; Label::render(aChipId); mX -= 0.75; }
void draw(void *_prms) { param_set *p = (param_set *) _prms; int i; double psc = 2 * R / Hmax, vdistmax; gclr(*p->win); copylayer(*p->win, 2, 1); for (i = 0; i < DN; i++) { putimg24m(*p->win, x[i] - 4, y[i] - 4, 8, 8, Xpm_image_stone4); } copylayer(*p->win, 1, 0); gclr(*p->win2); vdistmax = vdist[0]; for (i = 0; i < Hmax; i++) { if (vdistmax < vdist[i]) vdistmax = vdist[i]; } newcolor(*p->win2, "steelblue4"); for (i = 0; i < Hmax; i++) { fillrect(*p->win2, psc * i, 0, psc, vdist[i] / vdistmax * R); } newcolor(*p->win2, "steelblue"); for (i = 0; i < Hmax; i++) { drawrect(*p->win2, psc * i, 0, psc, vdist[i] / vdistmax * R); } copylayer(*p->win2, 1, 0); }
void PluginChip::render(int aChipId) { if (!dllcreate) return; int ch = 0; if (gUIState.kbditem == aChipId) ch = gUIState.keyentered; int plugin_did_rendering = 0; glPushMatrix(); glTranslatef((mX + mW / 2), (mY + mH / 2), 0); glColor4f(1,1,1,1); if (mTexture) { glBindTexture(GL_TEXTURE_2D, mTexture); glEnable(GL_TEXTURE_2D); } do { mChipInfo.mAsyncCall = ATANUA_ASYNC_CALL_NONE; plugin_did_rendering = dllrender(&mChipInfo, ch); handle_async_call(mChipInfo); } while (mChipInfo.mAsyncCall != ATANUA_ASYNC_CALL_NONE); glPopMatrix(); if (mTexture) glDisable(GL_TEXTURE_2D); if (plugin_did_rendering == 0) { // Render the chip if (mTexture) { drawtexturedrect(mTexture,mX,mY,mW,mH,0xffffffff); } else { drawrect(mX+0.25, mY+0.25, mW-0.5, mH-0.5, 0xff3f3f3f); drawrect(mX+0.35, mY+0.35, mW-0.7, mH-0.7, 0xff5f5f5f); } float w,h,l; fn.stringmetrics(mChipInfo.mChipName,w,h,l,0.75); fn.drawstring(mChipInfo.mChipName,mX+(mW-w)/2,mY+(mH-h)/2,0x5fffffff,0.75); } }
void vis_draw_background(int maxd) { RECT rct; int i, c; GetClientRect(window_vis, &rct); /* change font sizes */ vis_lyrics_font_size = MulDiv(max(min(rct.bottom / 20, 18), 8), GetDeviceCaps(hdc_vis, LOGPIXELSY), 72); DeleteObject(vis_lyric_font); DeleteObject(vis_lyric_font_b); vis_lyric_font = CreateFont(-vis_lyrics_font_size, 0, 0, 0, FW_BOLD, 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, skin_settings.font_display); vis_lyric_font_b = CreateFont(-vis_lyrics_font_size, 0, 0, 0, FW_BOLD, 0, 0, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, skin_settings.font_display); /* maximized mode won't need a border */ if(maxd) { //SetWindowRgn(window_vis, 0, 1); drawrect(hdc_vis, 0, 0, rct.right, rct.bottom, 0); skin.shared->call_function(call_visualizations_refresh, v_fennec_refresh_force_less, 0, 0); return; }else{ drawrect(hdc_vis, 0, 0, rct.right, rct.bottom, 0); skin.shared->call_function(call_visualizations_refresh, v_fennec_refresh_force_less, 0, 0); } skin.shared->call_function(call_visualizations_refresh, v_fennec_refresh_force_less, 0, 0); vis_lyric_current_action = vis_lyric_current_laction; vis_lyrics_draw(hdc_vis); }
static void background_draw(PANEL *UNUSED(p), int UNUSED(x), int UNUSED(y), int width, int height) { drawrect(0, 0, LIST_RIGHT, LIST_Y - 1, LIST_DARK); drawhline(0, LIST_Y - 1, LIST_RIGHT, LIST_EDGE); drawrect(0, LIST_Y, LIST_RIGHT, height + LIST_BOTTOM, LIST_MAIN); drawrect(0, height + LIST_BOTTOM, LIST_RIGHT, height, LIST_DARK); drawself(); drawrect(LIST_RIGHT, 0, width, height, WHITE); drawvline(LIST_RIGHT, 1, LIST_Y - 1, LIST_EDGE3); drawpixel(LIST_RIGHT, LIST_Y - 1, LIST_EDGE2); drawvline(LIST_RIGHT, LIST_Y, height - SCALE * 15, LIST_EDGE4); drawpixel(LIST_RIGHT, height - SCALE * 15, LIST_EDGE5); drawhline(LIST_RIGHT + 1, LIST_Y - 1, width, C_GRAY); }
void draw_box(struct canvas_t* cvs, int x, int y, int w, int h, unsigned long outln, unsigned long fill) { if (PIXA(fill) != 0) { fillrect(cvs, x, y, w, h, UNPACK_RGBA(fill)); } if (PIXA(outln) != 0) { drawrect(cvs, x, y, w, h, UNPACK_RGBA(outln)); } }
void draw_grid(struct canvas_t* cvs, const struct blockmap_t* bm, int x, int y, int sz, unsigned long color) { int i, j; for (i = 0; i != bm->w; ++i) { for (j = 0; j != bm->h; ++j) { drawrect(cvs, x+i*sz, y+j*sz, sz, sz, UNPACK_RGBA(color)); } } }
static void draw_image_button(button obj, rect r) { image img; bitmap store = NULL; rect ir; rgb up, down; rgb old = currentcolour(); img = obj->img; if (has_transparent_pixels(img)) { store = newbitmap(r.width, r.height, 0); drawto(store); setcolour(getbackground(obj)); fillrect(r); } if (img) { ir = insetr(r,2); if (ishighlighted(obj)) /* button is pressed */ ir.x += 1, ir.y += 1; /* Draw the button image. */ if (ischecked(obj)) drawdarker(img, ir, getrect(img)); else if (isenabled(obj)) drawimage(img, ir, getrect(img)); else drawgreyscale(img, ir, getrect(img)); if (ishighlighted(obj)) { /* fill the gap */ ir.x -= 1, ir.y -= 1; setcolour(getbackground(obj)); drawline(topleft(ir),topright(ir)); drawline(topleft(ir),bottomleft(ir)); } } /* Draw button border. */ setcolour(getforeground(obj)); setlinewidth(1); drawrect(r); /* Draw button shadow. */ up = White, down = Grey; if (ishighlighted(obj)) up = Grey, down = LightGrey; draw_shadow(insetr(r,1), up, down, 1); if (store != NULL) { drawto(obj); copyrect(store, pt(0,0), getrect(store)); del(store); } setcolour(old); }
static void draw_button(control c, rect r) { rect textrect; rgb up, down; font f; rgb old = currentcolour(); clear(c); /* Draw the button name. */ if (isenabled(c)) setcolour(getforeground(c)); else setcolour(Grey); f = gettextfont(c); setfont(f); textrect = r; if (ishighlighted(c)) textrect.x += 1, textrect.y += 1; drawtext(textrect, Center|VCenter, getname(c)); /* Draw button border. */ setlinewidth(1); drawrect(r); r = insetr(r,1); /* Draw button shadow. */ up = White, down = Grey; if (ishighlighted(c)) up = Grey, down = LightGrey; else if (hasfocus(c)) { setcolour(Black); drawrect(r); r = insetr(r,1); } draw_shadow(r, up, down, SHADOW_WIDTH); setcolour(old); }
value caml_clear_line(value cline, value bg) { CAMLparam2(cline, bg); int line = Int_val(cline) ; if (bottom) /* magic formula */ dc->y = mh - (bh - dc->font.ascent - 1 + line * bh); else dc->y = dc->font.ascent+1 + line * bh; drawrect(dc, 0, dc->y - dc->font.ascent - 1, mw, bh, True, getcolor(dc, String_val (bg))); CAMLreturn(Val_unit); }
static PyObject* emb_draw_rect(PyObject *self, PyObject *args) { int x,y,w,h,r,g,b,a; a=255; if (!PyArg_ParseTuple(args, "IIIIIII|I:draw_rect",&x,&y,&w,&h,&r,&g,&b,&a)) return NULL; if (vid_buf!=NULL) { drawrect(vid_buf,x,y,w,h,r,g,b,a); //fillrect return Py_BuildValue("i",1); } return Py_BuildValue("i",-1); }
void drawtext(DC *dc, int scrnum, const char *text, ColorSet *col) { char buf[BUFSIZ]; size_t mn, n = strlen(text); DM *m = &dc->menus[scrnum]; /* shorten text if necessary */ for(mn = MIN(n, sizeof buf); textnw(dc, text, mn) + dc->font.height/2 > m->cw; mn--) if(mn == 0) return; memcpy(buf, text, mn); if(mn < n) for(n = MAX(mn-3, 0); n < mn; buf[n++] = '.'); drawrect(dc, scrnum, 0, 0, m->cw, m->ch, True, col->BG); drawtextn(dc, scrnum, buf, mn, col); }
void LCDST7565::drawOffsetBar(control_type_e control) { int fillw; float value = 1.f;//midi->offset( CT_PITCH ); int y; if( control == CT_PITCH ) { value = 0.77f; y = 12; } else { value = -0.2f; y = 34; } drawrect(GUI_VALBAR_X-2, y, GUI_VALBAR_WIDTH+3, GUI_VALBAR_HEIGHT, BLACK); if(value >= 0) { fillw = (int) ((GUI_VALBAR_WIDTH * value) / 2.f) + 1; float x = GUI_VALBAR_X + GUI_VALBAR_WIDTH / 2.f - 1; fillrect((int)x, y, fillw, GUI_VALBAR_HEIGHT, BLACK); } else { value *= -1; fillw = (int) ((GUI_VALBAR_WIDTH * value) / 2.f) + 1; float x = GUI_VALBAR_X + GUI_VALBAR_WIDTH / 2.f - fillw; fillrect((int)x, y, fillw, GUI_VALBAR_HEIGHT, BLACK); //fillrect(GUI_VALBAR_X-1, y, GUI_VALBAR_WIDTH+2, GUI_VALBAR_HEIGHT, BLACK); } for(int x = GUI_VALBAR_X + 4; x < GUI_VALBAR_X+GUI_VALBAR_WIDTH-1; x += 5) { setpixel(x, y-1, BLACK); setpixel(x, y + GUI_VALBAR_HEIGHT, BLACK); } //draw left marker drawline(GUI_VALBAR_X-2, y-2, GUI_VALBAR_X-2, y + GUI_VALBAR_HEIGHT+1, BLACK); //draw right marker drawline(GUI_VALBAR_X + GUI_VALBAR_WIDTH, y-2, GUI_VALBAR_X + GUI_VALBAR_WIDTH, y + GUI_VALBAR_HEIGHT+1, BLACK); //draw middle marker //setpixel(GUI_VALBAR_HALF, y-1,BLACK); setpixel(GUI_VALBAR_HALF+1, y-1, BLACK); setpixel(GUI_VALBAR_HALF+1, y + GUI_VALBAR_HEIGHT, BLACK); }
void edit_draw(EDIT *edit, int x, int y, int width, int height) { if((width - 4 * SCALE - SCROLL_WIDTH) < 0) { return; } if(utox_window_baseline && y > utox_window_baseline - font_small_lineheight - 4 * SCALE) { y = utox_window_baseline - font_small_lineheight - 4 * SCALE; } edit->width = width -4 * SCALE - (edit->multiline ? SCROLL_WIDTH : 0); edit->height = height - 4 * SCALE; if(!edit->noborder) { framerect(x, y, x + width, y + height, (edit == active_edit) ? BLUE : (edit->mouseover ? C_GRAY2 : C_GRAY)); } drawrect(x + 1, y + 1, x + width - 1, y + height - 1, WHITE); setfont(FONT_TEXT); setcolor(COLOR_TEXT); int yy = y; if(edit->multiline) { pushclip(x + 1, y + 1, width - 2, height - 2); SCROLLABLE *scroll = edit->scroll; scroll->content_height = text_height(width - 4 * SCALE - SCROLL_WIDTH, font_small_lineheight, edit->data, edit->length) + 4 * SCALE; scroll_draw(scroll, x, y, width, height); yy -= scroll_gety(scroll, height); } if(!edit->length && maybe_i18nal_string_is_valid(&edit->empty_str)) { STRING* empty_str_text = maybe_i18nal_string_get(&edit->empty_str); setcolor(C_GRAY2); drawtext(x + 2 * SCALE, yy + 2 * SCALE, empty_str_text->str, empty_str_text->length); } _Bool a = (edit == active_edit); drawtextmultiline(x + 2 * SCALE, x + width - 2 * SCALE - (edit->multiline ? SCROLL_WIDTH : 0), yy + 2 * SCALE, y, y + height, font_small_lineheight, edit->data, edit->length, a ? edit_sel.start : STRING_IDX_MAX, a ? edit_sel.length : STRING_IDX_MAX, edit->multiline); if(edit->multiline) { popclip(); } }