+ case GD_TYPE_NORMAL_BUTTON:
+ case GD_TYPE_CHECK_BUTTON:
+ case GD_TYPE_RADIO_BUTTON:
+ XCopyArea(display, gd->pixmap, drawto, gc,
+ gd->x, gd->y, gi->width, gi->height, gi->x, gi->y);
+ if (gi->deco.design.pixmap)
+ XCopyArea(display, gi->deco.design.pixmap, drawto, gc,
+ gi->deco.design.x, gi->deco.design.y,
+ gi->deco.width, gi->deco.height,
+ gi->x + gi->deco.x + (pressed ? gi->deco.xshift : 0),
+ gi->y + gi->deco.y + (pressed ? gi->deco.yshift : 0));
+ break;
+
+ case GD_TYPE_TEXTINPUT_ALPHANUMERIC:
+ case GD_TYPE_TEXTINPUT_NUMERIC:
+ {
+ int i;
+ char cursor_letter;
+ char cursor_string[3];
+ char text[MAX_GADGET_TEXTSIZE + 1];
+ int font_color = FC_YELLOW;
+ int border = gi->design_border;
+ strcpy(text, gi->text.value);
+ strcat(text, " ");
+
+ /* left part of gadget */
+ XCopyArea(display, gd->pixmap, drawto, gc,
+ gd->x, gd->y, border, gi->height, gi->x, gi->y);
+
+ /* middle part of gadget */
+ for (i=0; i<=gi->text.size; i++)
+ XCopyArea(display, gd->pixmap, drawto, gc,
+ gd->x + border, gd->y, FONT2_XSIZE, gi->height,
+ gi->x + border + i * FONT2_XSIZE, gi->y);
+
+ /* right part of gadget */
+ XCopyArea(display, gd->pixmap, drawto, gc,
+ gd->x + ED_WIN_COUNT_XSIZE - border, gd->y,
+ border, gi->height, gi->x + gi->width - border, gi->y);
+
+ /* gadget text value */
+ DrawText(gi->x + border, gi->y + border, text, FS_SMALL, font_color);
+
+ cursor_letter = gi->text.value[gi->text.cursor_position];
+ cursor_string[0] = '~';
+ cursor_string[1] = (cursor_letter != '\0' ? cursor_letter : ' ');
+ cursor_string[2] = '\0';
+
+ /* draw cursor, if active */
+ if (pressed)
+ DrawText(gi->x + border + gi->text.cursor_position * FONT2_XSIZE,
+ gi->y + border, cursor_string, FS_SMALL, font_color);
+ }
+ break;
+
+ case GD_TYPE_SCROLLBAR_VERTICAL:
+ {
+ int i;
+ int xpos = gi->x;
+ int ypos = gi->y + gi->scrollbar.position;
+ int design_full = gi->width;
+ int design_body = design_full - 2 * gi->design_border;
+ int size_full = gi->scrollbar.size;
+ int size_body = size_full - 2 * gi->design_border;
+ int num_steps = size_body / design_body;
+ int step_size_remain = size_body - num_steps * design_body;
+
+ /* clear scrollbar area */
+ XFillRectangle(display, backbuffer, gc,
+ gi->x, gi->y, gi->width, gi->height);
+
+ /* upper part of gadget */
+ XCopyArea(display, gd->pixmap, drawto, gc,
+ gd->x, gd->y,
+ gi->width, gi->design_border,
+ xpos, ypos);
+
+ /* middle part of gadget */
+ for (i=0; i<num_steps; i++)
+ XCopyArea(display, gd->pixmap, drawto, gc,
+ gd->x, gd->y + gi->design_border,
+ gi->width, design_body,
+ xpos, ypos + gi->design_border + i * design_body);
+
+ /* remaining middle part of gadget */
+ if (step_size_remain > 0)
+ XCopyArea(display, gd->pixmap, drawto, gc,
+ gd->x, gd->y + gi->design_border,
+ gi->width, step_size_remain,
+ xpos, ypos + gi->design_border + num_steps * design_body);
+
+ /* lower part of gadget */
+ XCopyArea(display, gd->pixmap, drawto, gc,
+ gd->x, gd->y + design_full - gi->design_border,
+ gi->width, gi->design_border,
+ xpos, ypos + size_full - gi->design_border);
+ }
+ break;
+
+ case GD_TYPE_SCROLLBAR_HORIZONTAL:
+ {
+ int i;
+ int xpos = gi->x + gi->scrollbar.position;
+ int ypos = gi->y;
+ int design_full = gi->height;
+ int design_body = design_full - 2 * gi->design_border;
+ int size_full = gi->scrollbar.size;
+ int size_body = size_full - 2 * gi->design_border;
+ int num_steps = size_body / design_body;
+ int step_size_remain = size_body - num_steps * design_body;
+
+ /* clear scrollbar area */
+ XFillRectangle(display, backbuffer, gc,
+ gi->x, gi->y, gi->width, gi->height);
+
+ /* left part of gadget */
+ XCopyArea(display, gd->pixmap, drawto, gc,
+ gd->x, gd->y,
+ gi->design_border, gi->height,
+ xpos, ypos);
+
+ /* middle part of gadget */
+ for (i=0; i<num_steps; i++)
+ XCopyArea(display, gd->pixmap, drawto, gc,
+ gd->x + gi->design_border, gd->y,
+ design_body, gi->height,
+ xpos + gi->design_border + i * design_body, ypos);
+
+ /* remaining middle part of gadget */
+ if (step_size_remain > 0)
+ XCopyArea(display, gd->pixmap, drawto, gc,
+ gd->x + gi->design_border, gd->y,
+ step_size_remain, gi->height,
+ xpos + gi->design_border + num_steps * design_body, ypos);
+
+ /* right part of gadget */
+ XCopyArea(display, gd->pixmap, drawto, gc,
+ gd->x + design_full - gi->design_border, gd->y,
+ gi->design_border, gi->height,
+ xpos + size_full - gi->design_border, ypos);
+ }
+ break;
+
+ default:
+ return;
+ }
+
+ if (direct)
+ XCopyArea(display, drawto, window, gc,
+ gi->x, gi->y, gi->width, gi->height, gi->x, gi->y);
+ else
+ redraw_mask |= (gi->x < SX + SXSIZE ? REDRAW_FIELD :
+ gi->y < DY + DYSIZE ? REDRAW_DOOR_1 :
+ gi->y > VY ? REDRAW_DOOR_2 : REDRAW_DOOR_3);
+}