Add background colour to textarea_redraw API. Add source comments.

This commit is contained in:
Michael Drake 2013-01-12 20:59:32 +00:00
parent 5124b8a02a
commit c7a37392e4
3 changed files with 26 additions and 27 deletions

View File

@ -874,7 +874,7 @@ int textarea_get_caret(struct textarea *ta)
/* exported interface, documented in textarea.h */
void textarea_redraw(struct textarea *ta, int x, int y,
void textarea_redraw(struct textarea *ta, int x, int y, colour bg,
const struct rect *clip, const struct redraw_context *ctx)
{
const struct plotter_table *plot = ctx->plot;

View File

@ -37,22 +37,22 @@ typedef enum textarea_flags {
} textarea_flags;
typedef struct textarea_setup {
textarea_flags flags;
textarea_flags flags; /**< Setup flags */
int width;
int height;
int width; /**< Textarea width */
int height; /**< Textarea height */
int pad_top;
int pad_right;
int pad_bottom;
int pad_left;
int pad_top; /**< Textarea top padding */
int pad_right; /**< Textarea right padding */
int pad_bottom; /**< Textarea bottom padding */
int pad_left; /**< Textarea left padding */
int border_width;
colour border_col;
int border_width; /**< Textarea border width */
colour border_col; /**< Textarea border colour */
colour selected_text;
colour selected_bg;
plot_font_style_t text;
colour selected_text; /**< Textarea selected text colour */
colour selected_bg; /**< Textarea selection background colour */
plot_font_style_t text; /**< Font and textarea background colour */
} textarea_setup;
@ -65,13 +65,9 @@ typedef void(*textarea_redraw_request_callback)(void *data, int x, int y,
/**
* Create a text area
*
* \param width width of the text area
* \param height width of the text area
* \param flags text area flags
* \param style font style
* \param redraw_start_callback will be called when textarea wants to redraw
* \param redraw_end_callback will be called when textarea finisjes redrawing
* \param data user specified data which will be passed to redraw callbacks
* \param setup textarea settings and style
* \param redraw_callback will be called when textarea wants to redraw
* \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,
@ -125,14 +121,14 @@ int textarea_get_caret(struct textarea *ta);
/**
* Handle redraw requests for text areas
*
* \param redraw Redraw request block
* \param x0 left X coordinate of redraw area
* \param y0 top Y coordinate of redraw area
* \param x1 right X coordinate of redraw area
* \param y1 bottom Y coordinate of redraw area
* \param ta textarea to render
* \param x x coordinate of textarea top
* \param y y coordinate of textarea left
* \param bg background colour under textarea
* \param clip clip rectangle
* \param ctx current redraw context
*/
void textarea_redraw(struct textarea *ta, int x, int y,
void textarea_redraw(struct textarea *ta, int x, int y, colour bg,
const struct rect *clip, const struct redraw_context *ctx);
/**

View File

@ -2078,7 +2078,10 @@ void tree_draw(struct tree *tree, int x, int y,
y = y + tree->editing->box.y;
if (tree->editing->type == NODE_ELEMENT_TEXT_PLUS_ICON)
x += NODE_INSTEP;
textarea_redraw(tree->textarea, x, y, &clip, &new_ctx);
textarea_redraw(tree->textarea, x, y,
plot_style_fill_tree_background.
fill_colour,
&clip, &new_ctx);
}
}