- case GD_TYPE_TEXT_AREA:
- {
- int i;
- char cursor_letter;
- char cursor_string[2];
- int font_nr = (pressed ? gi->font_active : gi->font);
- int font_width = getFontWidth(font_nr);
- int font_height = getFontHeight(font_nr);
- int border_x = gi->border.xsize;
- int border_y = gi->border.ysize;
- int gd_height = 2 * border_y + font_height;
-
- /* top left part of gadget border */
- BlitBitmapOnBackground(gd->bitmap, drawto, gd->x, gd->y,
- border_x, border_y, gi->x, gi->y);
-
- /* top middle part of gadget border */
- for (i=0; i < gi->textarea.xsize; i++)
- BlitBitmapOnBackground(gd->bitmap, drawto, gd->x + border_x, gd->y,
- font_width, border_y,
- gi->x + border_x + i * font_width, gi->y);
-
- /* top right part of gadget border */
- BlitBitmapOnBackground(gd->bitmap, drawto,
- gd->x + gi->border.width - border_x, gd->y,
- border_x, border_y,
- gi->x + gi->width - border_x, gi->y);
-
- /* left and right part of gadget border for each row */
- for (i=0; i < gi->textarea.ysize; i++)
- {
- BlitBitmapOnBackground(gd->bitmap, drawto, gd->x, gd->y + border_y,
- border_x, font_height,
- gi->x, gi->y + border_y + i * font_height);
- BlitBitmapOnBackground(gd->bitmap, drawto,
- gd->x + gi->border.width - border_x,
- gd->y + border_y,
- border_x, font_height,
- gi->x + gi->width - border_x,
- gi->y + border_y + i * font_height);
- }
-
- /* bottom left part of gadget border */
- BlitBitmapOnBackground(gd->bitmap, drawto,
- gd->x, gd->y + gd_height - border_y,
- border_x, border_y,
- gi->x, gi->y + gi->height - border_y);
-
- /* bottom middle part of gadget border */
- for (i=0; i < gi->textarea.xsize; i++)
- BlitBitmapOnBackground(gd->bitmap, drawto,
- gd->x + border_x,
- gd->y + gd_height - border_y,
- font_width, border_y,
- gi->x + border_x + i * font_width,
- gi->y + gi->height - border_y);
-
- /* bottom right part of gadget border */
- BlitBitmapOnBackground(gd->bitmap, drawto,
- gd->x + gi->border.width - border_x,
- gd->y + gd_height - border_y,
- border_x, border_y,
- gi->x + gi->width - border_x,
- gi->y + gi->height - border_y);
-
- ClearRectangleOnBackground(drawto,
- gi->x + border_x,
- gi->y + border_y,
- gi->width - 2 * border_x,
- gi->height - 2 * border_y);
-
- /* gadget text value */
- DrawTextToTextArea(gi->x + border_x, gi->y + border_y,
- gi->textarea.value, font_nr,
- gi->textarea.xsize, gi->textarea.ysize);
-
- cursor_letter = gi->textarea.value[gi->textarea.cursor_position];
- cursor_string[0] = (cursor_letter != '\0' ? cursor_letter : ' ');
- cursor_string[1] = '\0';
-
- /* draw cursor, if active */
- if (pressed)
- DrawTextExt(drawto,
- gi->x + border_x + gi->textarea.cursor_x * font_width,
- gi->y + border_y + gi->textarea.cursor_y * font_height,
- cursor_string,
- font_nr, BLIT_INVERSE);
- }
- break;
-