ctk_gtksim_draw_string(buttonfont, &ctk_gtksim_draw_color_black, RASTER_X * x + (w->w * RASTER_X) / 2 - width / 2, RASTER_Y * y + MENUBAR_HEIGHT, w->widget.button.text, monospace);
if(w != &w->window->closebutton) { ctk_gtksim_draw_string(buttonfont, &ctk_gtksim_draw_color_black, RASTER_X * x + (w->w * RASTER_X) / 2 - width / 2, RASTER_Y * y + MENUBAR_HEIGHT, w->widget.button.text, monospace); }
draw_widget(struct ctk_widget *w,	    unsigned char winx, unsigned char winy,	    unsigned char clipx,	    unsigned char clipy,	    unsigned char clipy1,	    unsigned char clipy2,	    unsigned char focus){  char text[1000];  unsigned char x, y;  int width, xpos;  int i;  GdkGC *bgcol, *buttoncol;  struct ctk_gtksim_draw_font *buttonfont, *textfont, *textfont_bold;  int monospace;    x = winx + w->x;  y = winy + w->y;  if(focus & CTK_FOCUS_WINDOW) {    bgcol = white;  } else {    bgcol = lightgray;  }  if(focus & CTK_FOCUS_WINDOW) {    buttoncol = lightgray;  } else {    buttoncol = midgray;  }  monospace = w->flags & CTK_WIDGET_FLAG_MONOSPACE;  if(monospace) {    textfont = &ctk_gtksim_draw_font_monospace;    textfont_bold = &ctk_gtksim_draw_font_monospace_bold;  } else {    textfont = &ctk_gtksim_draw_font_normal;    textfont_bold = &ctk_gtksim_draw_font_bold;  }    switch(w->type) {  case CTK_WIDGET_SEPARATOR:    gdk_draw_line(ctk_gtksim_pixmap,		  darkgray,		  x * RASTER_X,		  y * RASTER_Y + RASTER_Y / 2 + MENUBAR_HEIGHT,		  (x + w->w) * RASTER_X,		  y * RASTER_Y + RASTER_Y / 2 + MENUBAR_HEIGHT);    break;  case CTK_WIDGET_LABEL:    gdk_draw_rectangle(ctk_gtksim_pixmap,		       bgcol,		       TRUE,		       x * RASTER_X,		       y * RASTER_Y + MENUBAR_HEIGHT,		       w->w * RASTER_X,		       w->h * RASTER_Y);    for(i = 0; i < w->h; ++i) {      strncpy(text, &w->widget.label.text[i * w->w], w->w);      text[w->w] = 0;      ctk_gtksim_draw_string(textfont,			     &ctk_gtksim_draw_color_black,			     RASTER_X * x,			     RASTER_Y * (y + i) + MENUBAR_HEIGHT,			     text, monospace);    }    break;  case CTK_WIDGET_BUTTON:    if(w == (struct ctk_widget *)&w->window->titlebutton) {      buttonfont = &ctk_gtksim_draw_font_bold;    } else {      buttonfont = textfont;    }    ++x;        width = ctk_gtksim_draw_string_width(buttonfont,					 w->widget.button.text,					 monospace);    if(focus == (CTK_FOCUS_WIDGET|CTK_FOCUS_WINDOW) ||       focus == (CTK_FOCUS_WIDGET|CTK_FOCUS_DIALOG)) {      gdk_draw_rectangle(ctk_gtksim_pixmap,			 black,			 FALSE,			 x * RASTER_X - BUTTON_X_BORDER,			 y * RASTER_Y - BUTTON_Y_BORDER + MENUBAR_HEIGHT,			 w->w * RASTER_X + BUTTON_X_BORDER * 2,			 BUTTON_HEIGHT + BUTTON_Y_BORDER);      /*      gdk_draw_rectangle(ctk_gtksim_pixmap,		    ctk_gtksim_drawing_area->style->black_gc,			 FALSE,			 x * RASTER_X - BUTTON_X_BORDER - 1,			 y * RASTER_Y - BUTTON_Y_BORDER - 1,			 w->w * RASTER_X + BUTTON_X_BORDER * 2 + 1,			 RASTER_Y + BUTTON_Y_BORDER * 2 + 1);*/    } else {      gdk_draw_rectangle(ctk_gtksim_pixmap,			 darkgray,			 FALSE,			 x * RASTER_X - BUTTON_X_BORDER,			 y * RASTER_Y - BUTTON_Y_BORDER + MENUBAR_HEIGHT,			 w->w * RASTER_X + BUTTON_X_BORDER * 2,			 BUTTON_HEIGHT + BUTTON_Y_BORDER);    }    gdk_draw_rectangle(ctk_gtksim_pixmap,		       buttoncol,		       TRUE,		       x * RASTER_X - BUTTON_X_BORDER + 1,		       y * RASTER_Y + MENUBAR_HEIGHT,		       w->w * RASTER_X + BUTTON_X_BORDER * 2 - 2,		       BUTTON_HEIGHT);    gdk_draw_line(ctk_gtksim_pixmap,		  ddarkgray,		  		  x * RASTER_X - BUTTON_X_BORDER + 1,		  y * RASTER_Y + BUTTON_HEIGHT - 1 + MENUBAR_HEIGHT,		  x * RASTER_X + w->w * RASTER_X + BUTTON_X_BORDER - 1,		  y * RASTER_Y + BUTTON_HEIGHT - 1 + MENUBAR_HEIGHT);    gdk_draw_line(ctk_gtksim_pixmap,		  ddarkgray,		  		  		  x * RASTER_X + w->w * RASTER_X + BUTTON_X_BORDER - 1,		  y * RASTER_Y + BUTTON_HEIGHT - 1 + MENUBAR_HEIGHT,		  x * RASTER_X + w->w * RASTER_X + BUTTON_X_BORDER - 1,		  y * RASTER_Y + MENUBAR_HEIGHT);    ctk_gtksim_draw_string(buttonfont,			   &ctk_gtksim_draw_color_black,			   RASTER_X * x +			   (w->w * RASTER_X) / 2 - width / 2,			   RASTER_Y * y + MENUBAR_HEIGHT,			   w->widget.button.text,			   monospace);    break;  case CTK_WIDGET_HYPERLINK:    strncpy(text, w->widget.hyperlink.text, w->w);    text[w->w] = 0;    width = ctk_gtksim_draw_string_width(textfont, text, monospace);    gdk_draw_rectangle(ctk_gtksim_pixmap,		       bgcol,		       TRUE,		       x * RASTER_X,		       y * RASTER_Y + MENUBAR_HEIGHT,		       width,		       RASTER_Y);    if(focus & CTK_FOCUS_WIDGET) {      ctk_gtksim_draw_string(textfont_bold,			     &ctk_gtksim_draw_color_blue,			     RASTER_X * x,			     RASTER_Y * y + MENUBAR_HEIGHT,			     text, monospace);    } else {      ctk_gtksim_draw_string(textfont,			     &ctk_gtksim_draw_color_blue,			     RASTER_X * x,			     RASTER_Y * y + MENUBAR_HEIGHT,			     text, monospace);    }    gdk_draw_line(ctk_gtksim_pixmap,		  blue,		  		  x * RASTER_X,		  y * RASTER_Y + FONT_BASELINE + 1 + MENUBAR_HEIGHT,		  x * RASTER_X + width,		  y * RASTER_Y + FONT_BASELINE + 1 + MENUBAR_HEIGHT);    break;  case CTK_WIDGET_TEXTENTRY:    strncpy(text, w->widget.textentry.text, sizeof(text));    text[w->widget.textentry.xpos] = 0;    width = ctk_gtksim_draw_string_width(textfont, text, monospace);    gdk_draw_rectangle(ctk_gtksim_pixmap,		       darkgray,		       FALSE,		       x * RASTER_X - TEXTENTRY_X_BORDER + RASTER_X,		       y * RASTER_Y - TEXTENTRY_Y_BORDER + MENUBAR_HEIGHT,		       w->w * RASTER_X + TEXTENTRY_X_BORDER * 2 - 1,		       TEXTENTRY_HEIGHT + TEXTENTRY_Y_BORDER);    gdk_draw_rectangle(ctk_gtksim_pixmap,		       bgcol,		       TRUE,		       x * RASTER_X + RASTER_X,		       y * RASTER_Y + MENUBAR_HEIGHT,		       w->w * RASTER_X,		       TEXTENTRY_HEIGHT);    ctk_gtksim_draw_string(textfont,			   &ctk_gtksim_draw_color_black,			   RASTER_X * x + RASTER_X,			   RASTER_Y * y + MENUBAR_HEIGHT,			   w->widget.textentry.text,			   monospace);    if(focus == (CTK_FOCUS_WIDGET|CTK_FOCUS_WINDOW) ||       focus == (CTK_FOCUS_WIDGET|CTK_FOCUS_DIALOG)) {      gdk_draw_line(ctk_gtksim_pixmap,		    black,		    x * RASTER_X + width + RASTER_X,		    y * RASTER_Y + MENUBAR_HEIGHT,		    x * RASTER_X + width + RASTER_X,		    y * RASTER_Y + TEXTENTRY_HEIGHT - 1 + MENUBAR_HEIGHT);    }    break;  case CTK_WIDGET_ICON:    width = ctk_gtksim_draw_string_width(&ctk_gtksim_draw_font_normal,					 w->widget.icon.title, monospace);    if(x * RASTER_X + width >= CTK_GTKSIM_SCREEN_WIDTH - RASTER_X) {      xpos = CTK_GTKSIM_SCREEN_WIDTH - width - RASTER_X;     } else {      xpos = x * RASTER_X;    }    if((focus & CTK_FOCUS_WIDGET) == 0) {      gdk_draw_rectangle(ctk_gtksim_pixmap,			 bgcol,			 TRUE,			 x * RASTER_X,			 y * RASTER_Y + MENUBAR_HEIGHT,			 24, 24);    } else {      gdk_draw_rectangle(ctk_gtksim_pixmap,			 black,			 TRUE,			 x * RASTER_X,			 y * RASTER_Y + MENUBAR_HEIGHT,			 24, 24);    }        /*      gdk_draw_rectangle(ctk_gtksim_pixmap,	    white,	    TRUE,	    xpos,	    RASTER_Y * y + 24 + 1 + MENUBAR_HEIGHT,	    width,	    RASTER_Y);*/        ctk_gtksim_draw_string(textfont,			   &ctk_gtksim_draw_color_black,			   xpos + 1,			   RASTER_Y * y + 24 + 1 + MENUBAR_HEIGHT,			   w->widget.icon.title,			   monospace);    ctk_gtksim_draw_string(textfont,			   &ctk_gtksim_draw_color_white,			   xpos,			   RASTER_Y * y + 24 + MENUBAR_HEIGHT,			   w->widget.icon.title,			   monospace);    break;  default:    break;  }}