25#ifndef NETSURF_DESKTOP_TEXTAREA_H
26#define NETSURF_DESKTOP_TEXTAREA_H
337 int bottom,
int left);
void(* textarea_client_callback)(void *data, struct textarea_msg *msg)
Client callback for the textarea.
bool textarea_scroll(struct textarea *ta, int scrx, int scry)
Scroll a textarea by an amount.
void textarea_redraw(struct textarea *ta, int x, int y, colour bg, float scale, const struct rect *clip, const struct redraw_context *ctx)
Handle redraw requests for text areas.
void textarea_set_dimensions(struct textarea *ta, int width, int height)
Set the dimensions of a textarea.
struct textarea * textarea_create(const textarea_flags flags, const textarea_setup *setup, textarea_client_callback callback, void *data)
Create a text area.
bool textarea_clear_selection(struct textarea *ta)
Clear any selection in the textarea.
void textarea_destroy(struct textarea *ta)
Destroy a text area.
bool textarea_set_caret(struct textarea *ta, int caret)
Set the caret's position.
textarea_flags
Text area flags.
@ TEXTAREA_INTERNAL_CARET
Render own caret.
@ TEXTAREA_PASSWORD
Obscured display.
@ TEXTAREA_DEFAULT
Standard input.
@ TEXTAREA_READONLY
Non-editable.
@ TEXTAREA_MULTILINE
Multiline area.
bool textarea_set_text(struct textarea *ta, const char *text)
Set the text in a text area, discarding any current text.
int textarea_get_text(struct textarea *ta, char *buf, unsigned int len)
Extract the text from a text area.
const char * textarea_data(struct textarea *ta, unsigned int *len)
Access text data in a text area.
textarea_mouse_status
Text area mouse input status flags.
@ TEXTAREA_MOUSE_SCR_UP
Hover: scroll up.
@ TEXTAREA_MOUSE_SCR_PLFT
Hover: scroll page left.
@ TEXTAREA_MOUSE_SCR_USED
Scrollbar action.
@ TEXTAREA_MOUSE_SCR_BOTH
Scrolling both bars.
@ TEXTAREA_MOUSE_SCR_LFT
Hover: scroll left.
@ TEXTAREA_MOUSE_SCR_PUP
Hover: scroll page up.
@ TEXTAREA_MOUSE_SCR_PDWN
Hover: scroll page down.
@ TEXTAREA_MOUSE_USED
Took action with input.
@ TEXTAREA_MOUSE_SCR_RGT
Hover: scroll right.
@ TEXTAREA_MOUSE_SCR_DWN
Hover: scroll down.
@ TEXTAREA_MOUSE_SCR_PRGT
Hover: scroll page right.
@ TEXTAREA_MOUSE_SELECTION
Hover: selection.
@ TEXTAREA_MOUSE_NONE
Not relevant.
@ TEXTAREA_MOUSE_EDITOR
Hover: caret pointer.
@ TEXTAREA_MOUSE_SCR_HRZ
Hover: horiz.
@ TEXTAREA_MOUSE_SCR_VRT
Hover: vert.
textarea_mouse_status textarea_mouse_action(struct textarea *ta, browser_mouse_state mouse, int x, int y)
Handles all kinds of mouse action.
bool textarea_drop_text(struct textarea *ta, const char *text, size_t text_length)
Insert the text in a text area at the caret, replacing any selection.
char * textarea_get_selection(struct textarea *ta)
Get selected text.
textarea_drag_type
Textarea drag status.
@ TEXTAREA_DRAG_SCROLLBAR
@ TEXTAREA_DRAG_SELECTION
textarea_msg_type
textarea message types
@ TEXTAREA_MSG_SELECTION_REPORT
Textarea text selection presence.
@ TEXTAREA_MSG_TEXT_MODIFIED
Textarea text modified.
@ TEXTAREA_MSG_DRAG_REPORT
Textarea drag start/end report.
@ TEXTAREA_MSG_REDRAW_REQUEST
Textarea redraw request.
@ TEXTAREA_MSG_CARET_UPDATE
Textarea caret.
void textarea_get_dimensions(struct textarea *ta, int *width, int *height)
Gets the dimensions of a textarea.
struct textarea_setup textarea_setup
textarea setup parameters
void textarea_set_layout(struct textarea *ta, const plot_font_style_t *fstyle, int width, int height, int top, int right, int bottom, int left)
Set the dimensions and padding of a textarea.
bool textarea_keypress(struct textarea *ta, uint32_t key)
Key press handling for text areas.
Core mouse and pointer states.
browser_mouse_state
Mouse state.
plotter style interfaces, generic styles and style colour helpers.
struct textarea_msg::@79::@81 caret
With _CARET_UPDATE.
unsigned int len
Byte length of text.
struct textarea_msg::@79::@80 selection
With _SELECTION_REPORT.
struct textarea_msg::@79::@81::@84 pos
With _CARET_SET_POS.
bool read_only
Selection can't be cut.
struct textarea * ta
The textarea widget.
const char * text
UTF8 text.
textarea_msg_type type
Indicates message data type.
struct rect redraw
With _REDRAW_REQUEST.
@ TEXTAREA_CARET_HIDE
Hide.
struct textarea_msg::@79::@82 modified
With _TEXT_MODIFIED.
union textarea_msg::@79 data
Depends on msg type.
bool have_selection
Selection exists.
textarea_drag_type drag
With _DRAG_REPORT.
@ TEXTAREA_CARET_SET_POS
Set coord/height.
struct rect * clip
Caret clip rect.
textarea setup parameters
int pad_top
Textarea top padding.
colour border_col
Textarea border colour.
int height
Textarea height.
int border_width
Textarea border width.
int pad_right
Textarea right padding.
int pad_left
Textarea left padding.
plot_font_style_t text
Textarea background colour and font.
int pad_bottom
Textarea bottom padding.
colour selected_text
Textarea selected text colour.
colour selected_bg
Textarea selection background colour.
plot_font_style_t fstyle
Text style, inc.
unsigned int flags
Textarea flags.
textarea_client_callback callback
Callback function for messages to client.
void * data
Client data for callback.
uint32_t colour
Colour type: XBGR.
static nserror text(const struct redraw_context *ctx, const struct plot_font_style *fstyle, int x, int y, const char *text, size_t length)
Text plotting.
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.