Pull flags out of textarea_setup.
This commit is contained in:
parent
97bc1d0189
commit
442218cb80
|
@ -322,8 +322,8 @@ struct s_toolbar *toolbar_create(struct s_gui_win_root *owner)
|
|||
toolbar_get_grect(t, TOOLBAR_AREA_URL, &url_area);
|
||||
url_area.g_h -= (TOOLBAR_URL_MARGIN_TOP + TOOLBAR_URL_MARGIN_BOTTOM);
|
||||
|
||||
textarea_flags ta_flags = TEXTAREA_INTERNAL_CARET;
|
||||
textarea_setup ta_setup;
|
||||
ta_setup.flags = TEXTAREA_INTERNAL_CARET;
|
||||
ta_setup.width = 300;
|
||||
ta_setup.height = url_area.g_h;
|
||||
ta_setup.pad_top = 0;
|
||||
|
@ -337,7 +337,8 @@ struct s_toolbar *toolbar_create(struct s_gui_win_root *owner)
|
|||
ta_setup.text = font_style_url;
|
||||
ta_setup.text.foreground = 0x000000;
|
||||
ta_setup.text.background = 0xffffff;
|
||||
t->url.textarea = textarea_create(&ta_setup, tb_txt_callback, t);
|
||||
t->url.textarea = textarea_create(ta_flags, &ta_setup,
|
||||
tb_txt_callback, t);
|
||||
|
||||
/* create the throbber widget: */
|
||||
t->throbber.index = THROBBER_INACTIVE_INDEX;
|
||||
|
|
|
@ -948,14 +948,15 @@ static bool textarea_drag_end(struct textarea *ta, browser_mouse_state mouse,
|
|||
|
||||
|
||||
/* exported interface, documented in textarea.h */
|
||||
struct textarea *textarea_create(const textarea_setup *setup,
|
||||
struct textarea *textarea_create(const textarea_flags flags,
|
||||
const textarea_setup *setup,
|
||||
textarea_client_callback callback, void *data)
|
||||
{
|
||||
struct textarea *ret;
|
||||
|
||||
/* Sanity check flags */
|
||||
assert(!(setup->flags & TEXTAREA_MULTILINE &&
|
||||
setup->flags & TEXTAREA_PASSWORD));
|
||||
assert(!(flags & TEXTAREA_MULTILINE &&
|
||||
flags & TEXTAREA_PASSWORD));
|
||||
|
||||
if (callback == NULL) {
|
||||
LOG(("no callback provided"));
|
||||
|
@ -971,7 +972,7 @@ struct textarea *textarea_create(const textarea_setup *setup,
|
|||
ret->callback = callback;
|
||||
ret->data = data;
|
||||
|
||||
ret->flags = setup->flags;
|
||||
ret->flags = flags;
|
||||
ret->vis_width = setup->width;
|
||||
ret->vis_height = setup->height;
|
||||
|
||||
|
@ -1008,7 +1009,7 @@ struct textarea *textarea_create(const textarea_setup *setup,
|
|||
ret->text.len = 1;
|
||||
ret->text.utf8_len = 0;
|
||||
|
||||
if (setup->flags & TEXTAREA_PASSWORD) {
|
||||
if (flags & TEXTAREA_PASSWORD) {
|
||||
ret->password.data = malloc(64);
|
||||
if (ret->password.data == NULL) {
|
||||
LOG(("malloc failed"));
|
||||
|
|
|
@ -70,8 +70,6 @@ struct textarea_msg {
|
|||
};
|
||||
|
||||
typedef struct textarea_setup {
|
||||
textarea_flags flags; /**< Setup flags */
|
||||
|
||||
int width; /**< Textarea width */
|
||||
int height; /**< Textarea height */
|
||||
|
||||
|
@ -105,7 +103,8 @@ typedef void(*textarea_client_callback)(void *data, struct textarea_msg *msg);
|
|||
* \param data user specified data which will be passed to callbacks
|
||||
* \return Opaque handle for textarea or 0 on error
|
||||
*/
|
||||
struct textarea *textarea_create(const textarea_setup *setup,
|
||||
struct textarea *textarea_create(const textarea_flags flags,
|
||||
const textarea_setup *setup,
|
||||
textarea_client_callback callback, void *data);
|
||||
|
||||
/**
|
||||
|
|
|
@ -2946,6 +2946,7 @@ void tree_start_edit(struct tree *tree, struct node_element *element)
|
|||
struct node *parent;
|
||||
int width, height;
|
||||
textarea_setup ta_setup;
|
||||
textarea_flags ta_flags;
|
||||
|
||||
assert(tree != NULL);
|
||||
assert(element != NULL);
|
||||
|
@ -2972,7 +2973,8 @@ void tree_start_edit(struct tree *tree, struct node_element *element)
|
|||
|
||||
tree->ta_height = height;
|
||||
|
||||
ta_setup.flags = TEXTAREA_INTERNAL_CARET;
|
||||
ta_flags = TEXTAREA_INTERNAL_CARET;
|
||||
|
||||
ta_setup.width = width;
|
||||
ta_setup.height = tree->ta_height;
|
||||
ta_setup.pad_top = 0;
|
||||
|
@ -2987,7 +2989,7 @@ void tree_start_edit(struct tree *tree, struct node_element *element)
|
|||
ta_setup.text.foreground = 0x000000;
|
||||
ta_setup.text.background = 0xffffff;
|
||||
|
||||
tree->textarea = textarea_create(&ta_setup,
|
||||
tree->textarea = textarea_create(ta_flags, &ta_setup,
|
||||
tree_textarea_callback, tree);
|
||||
if (tree->textarea == NULL) {
|
||||
tree_stop_edit(tree, false);
|
||||
|
|
Loading…
Reference in New Issue