summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/browser.c152
-rw-r--r--desktop/gui.h2
-rw-r--r--render/box.c119
-rw-r--r--render/box.h24
-rw-r--r--riscos/gui.c145
-rw-r--r--riscos/htmlredraw.c34
6 files changed, 195 insertions, 281 deletions
diff --git a/desktop/browser.c b/desktop/browser.c
index 1b0a85d88..cc845d4e5 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -51,6 +51,11 @@ static void browser_window_textarea_click(struct browser_window* bw,
unsigned long x, unsigned long y,
struct box *box);
static void browser_window_textarea_callback(struct browser_window *bw, char key, void *p);
+static void browser_window_input_click(struct browser_window* bw,
+ unsigned long actual_x, unsigned long actual_y,
+ unsigned long x, unsigned long y,
+ struct box *input);
+static void browser_window_input_callback(struct browser_window *bw, char key, void *p);
static void browser_window_place_caret(struct browser_window *bw, int x, int y,
int height, void (*callback)(struct browser_window *bw, char key, void *p), void *p);
@@ -318,14 +323,6 @@ void browser_window_callback(content_msg msg, struct content *c,
if (bw->current_content != NULL)
{
- if (bw->current_content->type == CONTENT_HTML)
- {
- int gc;
- for (gc = 0; gc < bw->current_content->data.html.elements.numGadgets; gc++)
- {
- gui_remove_gadget(bw->current_content->data.html.elements.gadgets[gc]);
- }
- }
if (bw->current_content->status == CONTENT_STATUS_DONE)
content_remove_instance(bw->current_content, bw, 0, 0, 0, &bw->current_content_state);
content_remove_user(bw->current_content, browser_window_callback, bw, 0);
@@ -534,10 +531,14 @@ int browser_window_gadget_click(struct browser_window* bw, unsigned long click_x
click_boxes[i].box);
break;
case GADGET_TEXTBOX:
- gui_edit_textbox(bw, g);
- break;
case GADGET_PASSWORD:
- gui_edit_password(bw, g);
+ browser_window_input_click(bw,
+ click_boxes[i].actual_x,
+ click_boxes[i].actual_y,
+ click_x - click_boxes[i].actual_x,
+ click_y - click_boxes[i].actual_y,
+ click_boxes[i].box);
+ break;
case GADGET_HIDDEN:
break;
case GADGET_IMAGE:
@@ -611,9 +612,9 @@ void browser_window_textarea_click(struct browser_window* bw,
&char_offset, &pixel_offset);
}
}
- textarea->gadget->data.textarea.caret_inline_container = inline_container;
- textarea->gadget->data.textarea.caret_text_box = text_box;
- textarea->gadget->data.textarea.caret_char_offset = char_offset;
+ textarea->gadget->caret_inline_container = inline_container;
+ textarea->gadget->caret_text_box = text_box;
+ textarea->gadget->caret_char_offset = char_offset;
browser_window_place_caret(bw, actual_x + text_box->x + pixel_offset,
actual_y + inline_container->y + text_box->y,
text_box->height,
@@ -628,9 +629,9 @@ void browser_window_textarea_click(struct browser_window* bw,
void browser_window_textarea_callback(struct browser_window *bw, char key, void *p)
{
struct box *textarea = p;
- struct box *inline_container = textarea->gadget->data.textarea.caret_inline_container;
- struct box *text_box = textarea->gadget->data.textarea.caret_text_box;
- int char_offset = textarea->gadget->data.textarea.caret_char_offset;
+ struct box *inline_container = textarea->gadget->caret_inline_container;
+ struct box *text_box = textarea->gadget->caret_text_box;
+ int char_offset = textarea->gadget->caret_char_offset;
int pixel_offset;
unsigned long actual_x, actual_y;
unsigned long width, height;
@@ -798,9 +799,9 @@ void browser_window_textarea_callback(struct browser_window *bw, char key, void
pixel_offset = font_width(text_box->font, text_box->text, char_offset);
- textarea->gadget->data.textarea.caret_inline_container = inline_container;
- textarea->gadget->data.textarea.caret_text_box = text_box;
- textarea->gadget->data.textarea.caret_char_offset = char_offset;
+ textarea->gadget->caret_inline_container = inline_container;
+ textarea->gadget->caret_text_box = text_box;
+ textarea->gadget->caret_char_offset = char_offset;
browser_window_place_caret(bw, actual_x + text_box->x + pixel_offset,
actual_y + inline_container->y + text_box->y,
text_box->height,
@@ -815,6 +816,113 @@ void browser_window_textarea_callback(struct browser_window *bw, char key, void
/**
+ * Handle clicks in a text or password input box by placing the caret.
+ */
+
+void browser_window_input_click(struct browser_window* bw,
+ unsigned long actual_x, unsigned long actual_y,
+ unsigned long x, unsigned long y,
+ struct box *input)
+{
+ int char_offset, pixel_offset;
+ struct box *text_box = input->children->children;
+
+ font_position_in_string(text_box->text, text_box->font,
+ text_box->length, x - text_box->x,
+ &char_offset, &pixel_offset);
+
+ text_box->x = 0;
+ if ((input->width < text_box->width) && (input->width / 2 < pixel_offset)) {
+ text_box->x = input->width / 2 - pixel_offset;
+ if (text_box->x < input->width - text_box->width)
+ text_box->x = input->width - text_box->width;
+ }
+ input->gadget->caret_char_offset = char_offset;
+ browser_window_place_caret(bw, actual_x + text_box->x + pixel_offset,
+ actual_y + text_box->y,
+ text_box->height,
+ browser_window_input_callback, input);
+
+ gui_window_redraw(bw->window,
+ actual_x,
+ actual_y,
+ actual_x + input->width,
+ actual_y + input->height);
+}
+
+
+/**
+ * Key press callback for text or password input boxes.
+ */
+
+void browser_window_input_callback(struct browser_window *bw, char key, void *p)
+{
+ struct box *input = p;
+ struct box *text_box = input->children->children;
+ int char_offset = input->gadget->caret_char_offset;
+ int pixel_offset;
+ unsigned long actual_x, actual_y;
+
+ box_coords(input, &actual_x, &actual_y);
+
+ if ((32 <= key && key != 127) && text_box->length < input->gadget->maxlength) {
+ /* normal character insertion */
+ text_box->text = xrealloc(text_box->text, text_box->length + 2);
+ input->gadget->value = xrealloc(input->gadget->value, text_box->length + 2);
+ memmove(text_box->text + char_offset + 1,
+ text_box->text + char_offset,
+ text_box->length - char_offset);
+ memmove(input->gadget->value + char_offset + 1,
+ input->gadget->value + char_offset,
+ text_box->length - char_offset);
+ if (input->gadget->type == GADGET_PASSWORD)
+ text_box->text[char_offset] = '*';
+ else
+ text_box->text[char_offset] = key == ' ' ? 160 : key;
+ input->gadget->value[char_offset] = key;
+ text_box->length++;
+ text_box->text[text_box->length] = 0;
+ input->gadget->value[text_box->length] = 0;
+ char_offset++;
+ } else if ((key == 8 || key == 127) && char_offset != 0) {
+ /* delete to left */
+ memmove(text_box->text + char_offset - 1,
+ text_box->text + char_offset,
+ text_box->length - char_offset);
+ memmove(input->gadget->value + char_offset - 1,
+ input->gadget->value + char_offset,
+ text_box->length - char_offset);
+ text_box->length--;
+ input->gadget->value[text_box->length] = 0;
+ char_offset--;
+ } else {
+ return;
+ }
+
+ text_box->width = font_width(text_box->font, text_box->text,
+ text_box->length);
+ pixel_offset = font_width(text_box->font, text_box->text, char_offset);
+ text_box->x = 0;
+ if ((input->width < text_box->width) && (input->width / 2 < pixel_offset)) {
+ text_box->x = input->width / 2 - pixel_offset;
+ if (text_box->x < input->width - text_box->width)
+ text_box->x = input->width - text_box->width;
+ }
+ input->gadget->caret_char_offset = char_offset;
+ browser_window_place_caret(bw, actual_x + text_box->x + pixel_offset,
+ actual_y + text_box->y,
+ text_box->height,
+ browser_window_input_callback, input);
+
+ gui_window_redraw(bw->window,
+ actual_x,
+ actual_y,
+ actual_x + input->width,
+ actual_y + input->height);
+}
+
+
+/**
* Position the caret and assign a callback for key presses.
*/
@@ -1333,9 +1441,9 @@ char* browser_form_construct_get(struct page_elements *elements, struct formsubm
case GADGET_HIDDEN: value = elements->gadgets[i]->data.hidden.value;
break;
- case GADGET_TEXTBOX: value = elements->gadgets[i]->data.textbox.text;
+ case GADGET_TEXTBOX: value = elements->gadgets[i]->value;
break;
- case GADGET_PASSWORD: value = elements->gadgets[i]->data.password.text;
+ case GADGET_PASSWORD: value = elements->gadgets[i]->value;
break;
case GADGET_RADIO: if(elements->gadgets[i]->data.radio.selected == -1)
value = elements->gadgets[i]->data.radio.value;
diff --git a/desktop/gui.h b/desktop/gui.h
index c4cb60d85..619ded567 100644
--- a/desktop/gui.h
+++ b/desktop/gui.h
@@ -59,8 +59,6 @@ void gui_window_start_throbber(gui_window* g);
void gui_window_stop_throbber(gui_window* g);
void gui_gadget_combo(struct browser_window* bw, struct gui_gadget* g, unsigned long mx, unsigned long my);
-void gui_edit_textarea(struct browser_window* bw, struct gui_gadget* g);
-void gui_edit_password(struct browser_window* bw, struct gui_gadget* g);
void gui_window_place_caret(gui_window *g, int x, int y, int height);
diff --git a/render/box.c b/render/box.c
index b681b9637..4f76072f0 100644
--- a/render/box.c
+++ b/render/box.c
@@ -67,6 +67,8 @@ static struct result box_select(xmlNode *n, struct status *status,
struct css_style *style);
static struct result box_input(xmlNode *n, struct status *status,
struct css_style *style);
+static struct box *box_input_text(xmlNode *n, struct status *status,
+ struct css_style *style, bool password);
static struct result box_button(xmlNode *n, struct status *status,
struct css_style *style);
static void add_option(xmlNode* n, struct gui_gadget* current_select, char *text);
@@ -812,61 +814,13 @@ struct result box_input(xmlNode *n, struct status *status,
/* the default type is "text" */
if (type == 0 || stricmp(type, "text") == 0)
{
- box = box_create(style, NULL, 0);
- box->font = font_open(status->content->data.html.fonts, style);
- box->gadget = gadget = xcalloc(1, sizeof(struct gui_gadget));
- gadget->type = GADGET_TEXTBOX;
-
- gadget->data.textbox.maxlength = 32;
- if ((s = (char *) xmlGetProp(n, (const xmlChar *) "maxlength"))) {
- gadget->data.textbox.maxlength = atoi(s);
- xmlFree(s);
- }
-
- gadget->data.textbox.size = box->gadget->data.textbox.maxlength;
- if ((s = (char *) xmlGetProp(n, (const xmlChar *) "size"))) {
- gadget->data.textbox.size = atoi(s);
- xmlFree(s);
- }
-
- gadget->data.textbox.text = xcalloc(
- gadget->data.textbox.maxlength + 2, sizeof(char));
-
- if ((s = (char *) xmlGetProp(n, (const xmlChar *) "value"))) {
- strncpy(gadget->data.textbox.text, s,
- gadget->data.textbox.maxlength);
- xmlFree(s);
- }
-
+ box = box_input_text(n, status, style, false);
+ gadget = box->gadget;
}
else if (stricmp(type, "password") == 0)
{
- box = box_create(style, NULL, 0);
- box->font = font_open(status->content->data.html.fonts, style);
- box->gadget = gadget = xcalloc(1, sizeof(struct gui_gadget));
- gadget->type = GADGET_PASSWORD;
-
- gadget->data.password.maxlength = 32;
- if ((s = (char *) xmlGetProp(n, (const xmlChar *) "maxlength"))) {
- gadget->data.password.maxlength = atoi(s);
- xmlFree(s);
- }
-
- gadget->data.password.size = box->gadget->data.password.maxlength;
- if ((s = (char *) xmlGetProp(n, (const xmlChar *) "size"))) {
- gadget->data.password.size = atoi(s);
- xmlFree(s);
- }
-
- gadget->data.password.text = xcalloc(
- gadget->data.password.maxlength + 2, sizeof(char));
-
- if ((s = (char *) xmlGetProp(n, (const xmlChar *) "value"))) {
- strncpy(gadget->data.password.text, s,
- gadget->data.password.maxlength);
- xmlFree(s);
- }
-
+ box = box_input_text(n, status, style, true);
+ gadget = box->gadget;
}
else if (stricmp(type, "hidden") == 0)
{
@@ -958,6 +912,55 @@ struct result box_input(xmlNode *n, struct status *status,
return (struct result) {box, 0};
}
+struct box *box_input_text(xmlNode *n, struct status *status,
+ struct css_style *style, bool password)
+{
+ char *s;
+ unsigned int i;
+ struct box *box = box_create(style, 0, 0);
+ struct box *inline_container, *inline_box;
+ style->display = CSS_DISPLAY_INLINE_BLOCK;
+
+ box->gadget = xcalloc(1, sizeof(struct gui_gadget));
+
+ box->gadget->maxlength = 100;
+ if ((s = (char *) xmlGetProp(n, (const xmlChar *) "maxlength"))) {
+ box->gadget->maxlength = atoi(s);
+ xmlFree(s);
+ }
+
+ s = (char *) xmlGetProp(n, (const xmlChar *) "value");
+ box->gadget->value = s ? tolat1(s) : xstrdup("");
+ box->gadget->initial_value = xstrdup(box->gadget->value);
+ if (s)
+ xmlFree(s);
+
+ inline_container = box_create(0, 0, 0);
+ inline_container->type = BOX_INLINE_CONTAINER;
+ inline_box = box_create(style, 0, 0);
+ inline_box->type = BOX_INLINE;
+ inline_box->style_clone = 1;
+ inline_box->length = strlen(box->gadget->value);
+ if (password) {
+ box->gadget->type = GADGET_PASSWORD;
+ inline_box->text = xcalloc(inline_box->length + 1, 1);
+ for (i = 0; i != inline_box->length; i++)
+ inline_box->text[i] = '*';
+ } else {
+ box->gadget->type = GADGET_TEXTBOX;
+ inline_box->text = xstrdup(box->gadget->value);
+ /* replace spaces with hard spaces to prevent line wrapping */
+ for (i = 0; i != inline_box->length; i++)
+ if (inline_box->text[i] == ' ')
+ inline_box->text[i] = 160;
+ }
+ inline_box->font = font_open(status->content->data.html.fonts, style);
+ box_add_child(inline_container, inline_box);
+ box_add_child(box, inline_container);
+
+ return box;
+}
+
struct result box_button(xmlNode *n, struct status *status,
struct css_style *style)
{
@@ -1459,18 +1462,6 @@ void gadget_free(struct gui_gadget* g)
if (g->data.checkbox.value != 0)
xmlFree(g->data.checkbox.value);
break;
- case GADGET_TEXTAREA:
- break;
- case GADGET_TEXTBOX:
- gui_remove_gadget(g);
- if (g->data.textbox.text != 0)
- xmlFree(g->data.textbox.text);
- break;
- case GADGET_PASSWORD:
- gui_remove_gadget(g);
- if (g->data.password.text != 0)
- xmlFree(g->data.password.text);
- break;
case GADGET_IMAGE:
if (g->data.image.n != 0)
xmlFree(g->data.image.n);
diff --git a/render/box.h b/render/box.h
index 0dad5400d..279463346 100644
--- a/render/box.h
+++ b/render/box.h
@@ -49,21 +49,15 @@ struct gui_gadget {
char *value;
char *initial_value;
struct form* form;
- union {
+ struct box *caret_inline_container;
+ struct box *caret_text_box;
+ int caret_char_offset;
+ unsigned int maxlength;
+ union {
struct {
char* value;
} hidden;
struct {
- unsigned int maxlength;
- char* text;
- int size;
- } textbox;
- struct {
- unsigned int maxlength;
- char* text;
- int size;
- } password;
- struct {
char* name;
char* value;
char* n;
@@ -84,11 +78,6 @@ struct gui_gadget {
int selected;
char* value;
} radio;
- struct {
- struct box *caret_inline_container;
- struct box *caret_text_box;
- int caret_char_offset;
- } textarea;
} data;
};
@@ -122,7 +111,8 @@ struct plugin_params {
struct box {
box_type type;
struct css_style * style;
- unsigned long x, y, width, height;
+ long x, y;
+ unsigned long width, height;
unsigned long min_width, max_width;
char * text;
unsigned int space : 1; /* 1 <=> followed by a space */
diff --git a/riscos/gui.c b/riscos/gui.c
index 3d10ba4f7..0ef0911c9 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -41,8 +41,6 @@ static char password_v[] = "D*";
char *NETSURF_DIR;
gui_window *window_list = 0;
-int gadget_subtract_x;
-int gadget_subtract_y;
const char* HOME_URL = "file:///%3CNetSurf$Dir%3E/Resources/intro";
const char* HELP_URL = "file:///%3CNetSurf$Dir%3E/Docs/en/index";
@@ -66,8 +64,6 @@ void ro_gui_window_click(gui_window* g, wimp_pointer* mouse);
void ro_gui_window_open(gui_window* g, wimp_open* open);
void ro_gui_window_redraw(gui_window* g, wimp_draw* redraw);
//void ro_gui_window_keypress(gui_window* g, wimp_key* key);
-void gui_remove_gadget(struct gui_gadget* g);
-
static int window_x_units(int scr_units, wimp_window_state* win);
@@ -90,7 +86,6 @@ static void ro_gui_poll_queue(wimp_event_no event, wimp_block* block);
static void ro_gui_keypress(wimp_key* key);
static void ro_msg_datasave(wimp_message* block);
static void ro_msg_dataload(wimp_message* block);
-static void gui_set_gadget_extent(struct box* box, int x, int y, os_box* extent, struct gui_gadget* g);
static void ro_gui_screen_size(int *width, int *height);
@@ -1804,146 +1799,6 @@ void ro_msg_dataload(wimp_message* block)
}
-static struct browser_window* current_textbox_bw;
-static struct gui_gadget* current_textbox = 0;
-static wimp_w current_textbox_w;
-static wimp_i current_textbox_i;
-
-void gui_set_gadget_extent(struct box* box, int x, int y, os_box* extent, struct gui_gadget* g)
-{
- struct box* c;
- if (box->gadget == g)
- {
- extent->x0 = x + box->x * 2;
- extent->y0 = y - box->y * 2 - box->height * 2;
- extent->x1 = x + box->x * 2 + box->width * 2;
- extent->y1 = y - box->y * 2;
- return;
- }
- for (c = box->children; c != 0; c = c->next)
- if (c->type != BOX_FLOAT_LEFT && c->type != BOX_FLOAT_RIGHT)
- gui_set_gadget_extent(c, x + box->x * 2, y - box->y * 2, extent, g);
-
- for (c = box->float_children; c != 0; c = c->next_float)
- gui_set_gadget_extent(c, x + box->x * 2, y - box->y * 2, extent, g);
-}
-
-void gui_edit_textbox(struct browser_window* bw, struct gui_gadget* g)
-{
- wimp_icon_create icon;
- wimp_pointer pointer;
- wimp_window_state state;
- int pointer_x;
- int letter_x;
- int textbox_x;
- int offset;
-
- wimp_get_pointer_info(&pointer);
-
- if (current_textbox != 0)
- {
- wimp_delete_icon(current_textbox_w, current_textbox_i);
- gui_redraw_gadget(current_textbox_bw, current_textbox);
- }
-
- current_textbox_bw = bw;
- current_textbox_w = bw->window->data.browser.window;
-
- icon.w = current_textbox_w;
- gui_set_gadget_extent(bw->current_content->data.html.layout->children, 0, 0, &icon.icon.extent, g);
- fprintf(stderr, "ICON EXTENT %d %d %d %d\n", icon.icon.extent.x0, icon.icon.extent.y0, icon.icon.extent.x1, icon.icon.extent.y1);
- icon.icon.flags = wimp_ICON_TEXT | wimp_ICON_BORDER |
- wimp_ICON_VCENTRED | wimp_ICON_FILLED |
- wimp_ICON_INDIRECTED |
- (wimp_COLOUR_BLACK << wimp_ICON_FG_COLOUR_SHIFT) |
- (wimp_COLOUR_WHITE << wimp_ICON_BG_COLOUR_SHIFT) |
- (wimp_BUTTON_WRITABLE << wimp_ICON_BUTTON_TYPE_SHIFT);
- icon.icon.data.indirected_text.text = g->data.textbox.text;
- icon.icon.data.indirected_text.size = g->data.textbox.maxlength + 1;
- icon.icon.data.indirected_text.validation = empty_text;
- current_textbox_i = wimp_create_icon(&icon);
- current_textbox = g;
- gui_redraw_gadget(bw, current_textbox);
-
- state.w = current_textbox_w;
- wimp_get_window_state(&state);
- pointer_x = window_x_units(pointer.pos.x, &state);
- textbox_x = icon.icon.extent.x0;
- offset = strlen(g->data.textbox.text);
- while (offset > 0)
- {
- letter_x = wimptextop_string_width(g->data.textbox.text, offset);
- if (letter_x < pointer_x - textbox_x)
- break;
- offset--;
- }
-
- wimp_set_caret_position(current_textbox_w, current_textbox_i, 0,0,-1, offset);
-}
-
-void gui_edit_password(struct browser_window* bw, struct gui_gadget* g)
-{
- wimp_icon_create icon;
- wimp_pointer pointer;
- wimp_window_state state;
- int pointer_x;
- int letter_x;
- int textbox_x;
- int offset;
-
- wimp_get_pointer_info(&pointer);
-
- if (current_textbox != 0)
- {
- wimp_delete_icon(current_textbox_w, current_textbox_i);
- gui_redraw_gadget(current_textbox_bw, current_textbox);
- }
-
- current_textbox_bw = bw;
- current_textbox_w = bw->window->data.browser.window;
-
- icon.w = current_textbox_w;
- gui_set_gadget_extent(bw->current_content->data.html.layout->children, 0, 0, &icon.icon.extent, g);
- fprintf(stderr, "ICON EXTENT %d %d %d %d\n", icon.icon.extent.x0, icon.icon.extent.y0, icon.icon.extent.x1, icon.icon.extent.y1);
- icon.icon.flags = wimp_ICON_TEXT | wimp_ICON_BORDER |
- wimp_ICON_VCENTRED | wimp_ICON_FILLED |
- wimp_ICON_INDIRECTED |
- (wimp_COLOUR_BLACK << wimp_ICON_FG_COLOUR_SHIFT) |
- (wimp_COLOUR_WHITE << wimp_ICON_BG_COLOUR_SHIFT) |
- (wimp_BUTTON_WRITABLE << wimp_ICON_BUTTON_TYPE_SHIFT);
- icon.icon.data.indirected_text.text = g->data.password.text;
- icon.icon.data.indirected_text.size = g->data.password.maxlength + 1;
- icon.icon.data.indirected_text.validation = password_v;
- current_textbox_i = wimp_create_icon(&icon);
- current_textbox = g;
- gui_redraw_gadget(bw, current_textbox);
-
- state.w = current_textbox_w;
- wimp_get_window_state(&state);
- pointer_x = window_x_units(pointer.pos.x, &state);
- textbox_x = icon.icon.extent.x0;
- offset = strlen(g->data.password.text);
- while (offset > 0)
- {
- letter_x = wimptextop_string_width(g->data.password.text, offset);
- if (letter_x < pointer_x - textbox_x)
- break;
- offset--;
- }
-
- wimp_set_caret_position(current_textbox_w, current_textbox_i, 0,0,-1, offset);
-}
-
-void gui_remove_gadget(struct gui_gadget* g)
-{
- if (g == current_textbox && g != 0)
- {
- wimp_delete_icon(current_textbox_w, current_textbox_i);
- gui_redraw_gadget(current_textbox_bw, current_textbox);
- current_textbox = 0;
- }
-}
-
/**
* Find screen size in OS units.
diff --git a/riscos/htmlredraw.c b/riscos/htmlredraw.c
index fcfd663eb..d0bce76dc 100644
--- a/riscos/htmlredraw.c
+++ b/riscos/htmlredraw.c
@@ -126,11 +126,10 @@ void html_redraw_box(struct content *content, struct box * box,
content_redraw(box->object, x, y, width, height, x0, y0, x1, y1);
} else if (box->gadget &&
- box->gadget->type != GADGET_TEXTAREA &&
- box->gadget->type != GADGET_SUBMIT &&
- box->gadget->type != GADGET_RESET) {
+ (box->gadget->type == GADGET_SELECT ||
+ box->gadget->type == GADGET_CHECKBOX ||
+ box->gadget->type == GADGET_RADIO)) {
wimp_icon icon;
- LOG(("writing GADGET"));
icon.extent.x0 = -gadget_subtract_x + x;
icon.extent.y0 = -gadget_subtract_y + y - height;
@@ -138,28 +137,6 @@ void html_redraw_box(struct content *content, struct box * box,
icon.extent.y1 = -gadget_subtract_y + y;
switch (box->gadget->type) {
- case GADGET_TEXTBOX:
- colourtrans_set_font_colours(box->font->handle, current_background_color << 8,
- box->style->color << 8, 14, 0, 0, 0);
- font_paint(box->font->handle, box->gadget->data.textbox.text,
- font_OS_UNITS | font_GIVEN_FONT | font_KERN,
- x, y - (int) (box->height * 1.5),
- NULL, NULL, 0);
- break;
-
- case GADGET_PASSWORD:
- icon.flags = wimp_ICON_TEXT | wimp_ICON_BORDER |
- wimp_ICON_VCENTRED | wimp_ICON_FILLED |
- wimp_ICON_INDIRECTED |
- (wimp_COLOUR_DARK_GREY << wimp_ICON_FG_COLOUR_SHIFT) |
- (wimp_COLOUR_WHITE << wimp_ICON_BG_COLOUR_SHIFT);
- icon.data.indirected_text.text = box->gadget->data.password.text;
- icon.data.indirected_text.size = box->gadget->data.password.maxlength + 1;
- icon.data.indirected_text.validation = validation_password;
- LOG(("writing GADGET PASSWORD"));
- wimp_plot_icon(&icon);
- break;
-
case GADGET_SELECT:
icon.flags = wimp_ICON_TEXT | wimp_ICON_BORDER |
wimp_ICON_VCENTRED | wimp_ICON_FILLED |
@@ -242,12 +219,7 @@ void html_redraw_box(struct content *content, struct box * box,
LOG(("writing GADGET RADIO"));
wimp_plot_icon(&icon);
break;
-
- case GADGET_HIDDEN:
- case GADGET_IMAGE:
- break;
}
- LOG(("gadgets finished"));
} else if (box->text && box->font) {