57#define REDRAW_MAX 8000
325 {
"resource:icons/arrow-l.png", NULL, 0,
false },
326 {
"resource:icons/content.png", NULL, 0,
false },
327 {
"resource:icons/directory.png", NULL, 0,
false },
328 {
"resource:icons/directory2.png", NULL, 0,
false },
329 {
"resource:icons/search.png", NULL, 0,
false }
355 const struct rect *r)
357 if (tree->
cw_h != NULL) {
371 if (tree->
cw_h != NULL) {
372 static const struct rect r = {
408 if (tree->
cw_h != NULL) {
445 if (tree->
cw_h != NULL) {
461 if (tree->
cw_h != NULL) {
486 assert(0 &&
"Bad field index for node");
500 assert(node != NULL);
539 assert(tree != NULL);
540 assert(tree->
root != NULL);
547 if (target_y >= y && target_y < y + h)
572 assert(tree != NULL);
573 assert(tree->
root != NULL);
577 while (n != NULL && n != node) {
630 assert(tree != NULL);
691 bool skip_children =
false;
697 assert(
root != NULL);
710 while (node != NULL) {
712 if (child != NULL && !skip_children) {
720 while (node !=
root && next_sibling == NULL) {
722 if (callback_bwd != NULL &&
723 (entry || !walking_search)) {
725 err = callback_bwd(node, ctx, &abort);
744 if (callback_bwd != NULL) {
746 err = callback_bwd(node, ctx, &abort);
760 assert(node != NULL);
761 assert(node !=
root);
770 if (walking_search && (!entry ||
775 if (callback_fwd != NULL) {
777 err = callback_fwd(node, ctx, &skip_children, &abort);
825 n->
flags &= ~TV_NFLAGS_MATCHED;
829 bool matched =
false;
850 n->
flags &= ~TV_NFLAGS_MATCHED;
887 assert(
text[len] ==
'\0');
889 if (tree->
root == NULL) {
909 r.
y1 = ((
height > prev_height) ?
height : prev_height) + search_height;
964 assert(tree != NULL);
970 case TV_DRAG_SELECTION:
973 case TV_DRAG_TEXTAREA:
1000 switch (msg->
type) {
1054 if (
string == NULL || len == 0) {
1113 bool *skip_children,
1119 *skip_children =
false;
1140 assert(a->
parent == NULL);
1168 assert(a->
parent != NULL);
1191 }
while (a->
parent != NULL);
1208 assert(data != NULL);
1209 assert(tree != NULL);
1210 assert(tree->
root != NULL);
1212 if (relation == NULL) {
1213 relation = tree->
root;
1273 assert(data != NULL);
1274 assert(tree != NULL);
1275 assert(folder != NULL);
1277 assert(folder->
parent != NULL);
1279 assert(field != NULL);
1281 field->
field, &match) == lwc_error_ok &&
1323 assert(data != NULL);
1324 assert(tree != NULL);
1325 assert(entry != NULL);
1327 assert(entry->
parent != NULL);
1330 assert(
fields[0].field != NULL);
1349 for (i = 1; i < tree->
n_fields; i++) {
1350 assert(
fields[i].field != NULL);
1401 assert(data != NULL);
1402 assert(tree != NULL);
1403 assert(tree->
root != NULL);
1405 if (relation == NULL) {
1406 relation = tree->
root;
1425 assert(
fields[0].field != NULL);
1440 for (i = 1; i < tree->
n_fields; i++) {
1441 assert(
fields[i].field != NULL);
1500 bool *skip_children,
1548 assert(tree != NULL);
1549 assert(tree->
root != NULL);
1586 if ((n->
parent != NULL) &&
1613 if (tree->
drag.
type == TV_DRAG_TEXTAREA)
1650 new_text = malloc(len);
1651 if (new_text == NULL) {
1666 msg.data.node_edit.text = new_text;
1775 .user_interaction = interaction
1838 .user_interaction = interaction
1841 assert(
tree != NULL);
1849 while (node != NULL) {
1851 if (child != NULL) {
1859 while (node->
parent != NULL &&
1860 next_sibling == NULL) {
1885 if (node->
parent == NULL)
1906 node = next_sibling;
1909 assert(node != NULL);
1910 assert(node->
parent != NULL);
1932 assert(tree != NULL);
1934 assert(n->
parent != NULL);
2008 .selected_bg = foreground,
2009 .selected_text = background,
2026 struct core_window *cw,
2035 assert(fields != NULL);
2038 assert(n_fields >= 2);
2040 tree = malloc(
sizeof(
struct treeview));
2046 if (tree->
fields == NULL) {
2059 for (fldidx = 0; fldidx < n_fields; fldidx++) {
2063 f->
field = lwc_string_ref(fields[fldidx].
field);
2136 if (tree->
cw_h != NULL) {
2137 NSLOG(netsurf, INFO,
"Treeview already attached.");
2162 assert(tree != NULL);
2176 for (f = 0; f <= tree->
n_fields; f++) {
2200 int additional_height_folders = 0;
2201 int additional_height_entries = 0;
2204 assert(tree != NULL);
2205 assert(node != NULL);
2209 NSLOG(netsurf, INFO,
"Tried to expand an expanded node.");
2213 switch (node->
type) {
2216 if (child == NULL) {
2229 additional_height_folders += child->
height;
2232 }
while (child != NULL);
2241 for (i = 0; i < tree->
n_fields - 1; i++) {
2270 n->
height += additional_height_entries +
2271 additional_height_folders;
2281 if (additional_height_entries + additional_height_folders != 0) {
2296 NSLOG(netsurf, INFO,
"Expanding!");
2300 NSLOG(netsurf, INFO,
"Expanded!");
2327 int h_reduction_folder = 0;
2328 int h_reduction_entry = 0;
2333 n->
flags &= ~TV_NFLAGS_SELECTED;
2356 assert(h_reduction_folder + h_reduction_entry >= 0);
2360 node->height -= h_reduction_folder + h_reduction_entry;
2385 assert(node != NULL);
2389 NSLOG(netsurf, INFO,
"Tried to contract a contracted node.");
2419 assert(
tree != NULL);
2422 NSLOG(netsurf, INFO,
"Contracting!");
2426 NSLOG(netsurf, INFO,
"Contracted!");
2442 assert(tree != NULL);
2443 assert(tree->
root != NULL);
2503 bool *skip_children,
2531 assert(tree != NULL);
2532 assert(tree->
root != NULL);
2569 int *render_y_in_out,
2570 const struct rect *r,
2580 int render_y = *render_y_in_out;
2583 int sel_min, sel_max;
2597 while (node != NULL) {
2599 struct bitmap *furniture;
2600 bool invert_selection;
2616 while (node !=
root &&
2627 assert(node != NULL);
2628 assert(node !=
root);
2633 inset = x + node->
inset;
2644 if (tree->
drag.
type == TV_DRAG_SELECTION &&
2645 (render_y +
height >= sel_min &&
2646 render_y < sel_max)) {
2647 invert_selection =
true;
2649 invert_selection =
false;
2653 invert_selection)) {
2654 bg_style = &style->
sbg;
2655 text_style = &style->
stext;
2656 infotext_style = &style->
sitext;
2661 bg_style = &style->
bg;
2662 text_style = &style->
text;
2663 infotext_style = &style->
itext;
2709 x0, render_y + baseline,
2715 if (render_y > r->
y1) {
2729 for (i = 0; i < tree->
n_fields - 1; i++) {
2738 render_y + baseline,
2745 render_y + baseline,
2751 x0, render_y + baseline,
2762 if (render_y > r->
y1) {
2769 *render_y_in_out = render_y;
2788 int *render_y_in_out,
2789 const struct rect *r,
2799 int render_y = *render_y_in_out;
2802 int sel_min, sel_max;
2816 while (node != NULL) {
2818 struct bitmap *furniture;
2819 bool invert_selection;
2834 while (node !=
root &&
2845 assert(node != NULL);
2846 assert(node !=
root);
2866 if (tree->
drag.
type == TV_DRAG_SELECTION &&
2867 (render_y +
height >= sel_min &&
2868 render_y < sel_max)) {
2869 invert_selection =
true;
2871 invert_selection =
false;
2875 invert_selection)) {
2876 bg_style = &style->
sbg;
2877 text_style = &style->
stext;
2878 infotext_style = &style->
sitext;
2883 bg_style = &style->
bg;
2884 text_style = &style->
text;
2885 infotext_style = &style->
itext;
2931 x0, render_y + baseline,
2937 if (render_y > r->
y1) {
2951 for (i = 0; i < tree->
n_fields - 1; i++) {
2960 render_y + baseline,
2967 render_y + baseline,
2973 x0, render_y + baseline,
2984 if (render_y > r->
y1) {
2991 *render_y_in_out = render_y;
3009 assert(tree != NULL);
3010 assert(tree->
root != NULL);
3033 if (render_y < r.
y1) {
3054 &data, &r, &new_ctx);
3069 &render_y, &r, &data, &new_ctx);
3072 &render_y, &r, &data, &new_ctx);
3075 if (render_y < r.
y1) {
3163 bool *skip_children,
3168 bool changed =
false;
3198 *skip_children =
true;
3264 *skip_children =
true;
3368 assert(
tree != NULL);
3528 assert(
tree != NULL);
3561 assert(
tree != NULL);
3597 assert(
tree != NULL);
3610 while (relation->
next_sib != NULL) {
3641 NSLOG(netsurf, INFO,
"Bad drop target for move.");
3655 for (node =
tree->
move.
root; node != NULL; node = next) {
3658 if (node == relation) {
3665 node->
flags &= ~TV_NFLAGS_SELECTED;
3726 bool *skip_children,
3761 assert(
tree != NULL);
3784 assert(
tree != NULL);
3793 if (n != NULL && n->
parent != NULL) {
3848 bool *skip_children,
3858 if (ns->
curr == NULL) {
3898 .prev_n_selected = 0
3902 bool redraw =
false;
3911 scroll_to_node = ns.
curr;
3914 if (ns.
next == NULL)
3916 if (ns.
prev == NULL)
3928 if (ns.
curr != NULL &&
3943 if (ns.
curr != NULL) {
3963 }
else if (ns.
curr != NULL) {
3970 if (ns.
prev != NULL) {
3973 scroll_to_node = ns.
prev;
3978 if (ns.
next != NULL) {
3981 scroll_to_node = ns.
next;
4009 bool redraw =
false;
4011 assert(tree != NULL);
4113 int mouse_pos =
mouse_y - node_y;
4116 assert(tree != NULL);
4117 assert(tree->
root != NULL);
4119 assert(target != NULL);
4135 }
else switch (target->
type) {
4137 if (mouse_pos <= node_height / 4) {
4139 }
else if (mouse_pos <= (3 * node_height) / 4 ||
4148 if (mouse_pos <= node_height / 2) {
4185 if (target != orig) {
4239 switch (msg->
type) {
4246 tree->
drag.
type = TV_DRAG_TEXTAREA;
4291 int field_y = node_y;
4302 field_data = &n->
text;
4312 for (i = 0; i < tree->
n_fields - 1; i++) {
4316 ef = &(tree->
fields[i + 1]);
4327 if (field_data == NULL || field_desc == NULL) {
4369 tree->
edit.
x = field_x;
4370 tree->
edit.
y = field_y;
4396 assert(tree != NULL);
4397 assert(tree->
root != NULL);
4412 if (redraw ==
false)
4449 bool *skip_children,
4454 bool redraw =
false;
4458 TV_NODE_ACTION_NONE = 0,
4459 TV_NODE_ACTION_SELECTION = (1 << 0)
4460 } action = TV_NODE_ACTION_NONE;
4478 int inset = node->
inset;
4482 if (ma->
x >= inset - 1 &&
4514 ma->
x < x + max_width -
4519 }
else if (ma->
x >= x + max_width &&
4520 ma->
x < x + max_width +
4526 if (ma->
x >= x && ma->
x < x +
4587 case TV_DRAG_SELECTION:
4595 r.
y1 = (curr_y1 > prev_y1) ? curr_y1 : prev_y1;
4653 msg.data.node_launch.mouse = ma->
mouse;
4665 action |= TV_NODE_ACTION_SELECTION;
4689 action |= TV_NODE_ACTION_SELECTION;
4693 if (action & TV_NODE_ACTION_SELECTION) {
4726 bool redraw =
false;
4729 assert(tree != NULL);
4730 assert(tree->
root != NULL);
4738 if (tree->
drag.
type == TV_DRAG_TEXTAREA) {
4742 }
else if (tree->
drag.
type == TV_DRAG_SEARCH) {
4754 y < search_height && tree->search.active ==
false) {
4777 int ta_x = x - tree->
edit.
x;
4778 int ta_y = y - tree->
edit.
y;
4780 if (ta_x > 0 && ta_x < tree->edit.w &&
4781 ta_y > 0 && ta_y < tree->edit.h) {
4796 case TV_DRAG_SELECTION:
4844 if (tree->
drag.
type == TV_DRAG_NONE) {
4848 tree->
drag.
type = TV_DRAG_SELECTION;
4852 tree->
drag.
type = TV_DRAG_SELECTION;
4858 tree->
drag.
type == TV_DRAG_SELECTION) {
4865 if (tree->
drag.
type == TV_DRAG_SELECTION) {
4871 r.
y1 = (curr_y1 > prev_y1) ? curr_y1 : prev_y1;
4913 assert(
tree != NULL);
4930 if (
string == NULL || strlen(
string) == 0) {
5017 switch (event->
type) {
5067 unsigned char *rpos;
5087 for (y = 0; y <
size; y++) {
5092 for (x = 0; x < y * 2; x++) {
5109 for (x = y * 2 + 2; x <
size ; x++) {
5116 }
else if ((y ==
size / 2) && (
size & 0x1)) {
5118 for (x = 0; x <
size - 1; x++) {
5132 for (x = 0; x < (
size - y - 1) * 2; x++) {
5149 for (x = (
size - y) * 2; x <
size ; x++) {
5177 unsigned char *data;
5178 unsigned char *orig_data;
5199 memcpy(data, orig_data, stride *
size);
5223 unsigned char *rpos;
5225 unsigned char *orig_data;
5226 unsigned char *orig_pos;
5247 for (y = 0; y <
size; y++) {
5250 for (x = 0; x <
size; x++) {
5251 orig_pos = orig_data + x * stride + y * 4;
5252 *(pos++) = *(orig_pos++);
5253 *(pos++) = *(orig_pos++);
5254 *(pos++) = *(orig_pos);
5337 long long font_px_size;
5338 long long font_pt_size;
5346 NSLOG(netsurf, INFO,
"Initialising treeview module");
5349 if (font_pt_size <= 0) {
5350 font_pt_size = 11 * 10;
5377 NSLOG(netsurf, INFO,
"Initialised treeview module");
5393 NSLOG(netsurf, INFO,
5394 "Warning: tried to finalise uninitialised treeview module");
5398 NSLOG(netsurf, INFO,
"Finalising treeview module");
5415 NSLOG(netsurf, INFO,
"Finalised treeview module");
static os_mode mode
The current sprite mode.
static uint32_t count(const http_directive *list, lwc_string *key)
char * strcasestr(const char *haystack, const char *needle)
Case insensitive strstr implementation.
@ CONTENT_IMAGE
All images.
@ CONTENT_MSG_DONE
content has finished processing
@ CONTENT_MSG_READY
may be displayed
Interface to core window handling.
core_window_drag_status
drag status passed to drag_status callback
@ CORE_WINDOW_DRAG_TEXT_SELECTION
@ CORE_WINDOW_DRAG_SELECTION
css_fixed nscss_screen_dpi
Screen DPI in fixed point units: defaults to 90, which RISC OS uses.
nserror cw_helper_scroll_visible(struct core_window *cw_h, const struct rect *r)
Scroll a core window to make the given rectangle visible.
Helpers to simplify core use of corewindow.
Internal core bitmap interface.
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.
struct textarea * textarea_create(const textarea_flags flags, const textarea_setup *setup, textarea_client_callback callback, void *data)
Create a text area.
void textarea_destroy(struct textarea *ta)
Destroy a text area.
bool textarea_set_caret(struct textarea *ta, int caret)
Set the caret's position.
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 textarea_mouse_action(struct textarea *ta, browser_mouse_state mouse, int x, int y)
Handles all kinds of mouse action.
bool textarea_keypress(struct textarea *ta, uint32_t key)
Key press handling for text areas.
Single/Multi-line UTF-8 text area interface.
void(* textarea_client_callback)(void *data, struct textarea_msg *msg)
Client callback for the textarea.
textarea_flags
Text area flags.
@ TEXTAREA_INTERNAL_CARET
Render own caret.
@ TEXTAREA_MSG_TEXT_MODIFIED
Textarea text modified.
@ TEXTAREA_MSG_DRAG_REPORT
Textarea drag start/end report.
@ TEXTAREA_MSG_REDRAW_REQUEST
Textarea redraw request.
static nserror treeview_node_mouse_action_cb(treeview_node *node, void *ctx, bool *skip_children, bool *end)
Treewalk node callback for handling mouse action.
nserror treeview_create(treeview **treeout, const struct treeview_callback_table *callbacks, int n_fields, struct treeview_field_desc fields[], struct core_window *cw, treeview_flags flags)
Create a treeview.
static nserror treeview_node_contract_internal(treeview *tree, treeview_node *node)
Contract a treeview node.
nserror treeview_cw_detach(treeview *tree)
Detach a treeview from a corewindow.
nserror treeview_cw_attach(treeview *tree, struct core_window *cw)
Attach a treeview to a corewindow.
static unsigned treeview__get_search_height(const treeview *tree)
Get height used by treeview's search bar (or 0 if not present).
static void treeview_insert_node(treeview *tree, treeview_node *a, treeview_node *b, enum treeview_relationship rel)
Insert a treeview node into a treeview.
static bool treeview_select_all(treeview *tree, struct rect *rect)
Select all in a treeview.
static void treeview_init_resources(void)
Fetch content resources used by treeview.
static void treeview_textarea_search_callback(void *data, struct textarea_msg *msg)
Callback for textarea_create, in desktop/treeview.h.
static nserror treeview_node_selection_walk_cb(treeview_node *n, void *ctx, bool *skip_children, bool *end)
Treewalk node callback for handling selection related actions.
#define REDRAW_MAX
The maximum horizontal size a treeview can possibly be.
nserror treeview_node_contract(treeview *tree, treeview_node *node)
Contract a treeview node.
static void treeview__cw_get_window_dimensions(const struct treeview *tree, int *width, int *height)
Corewindow callback wrapper: Get window viewport dimensions.
static nserror treeview_delete_node_internal(treeview *tree, treeview_node *n, bool interaction, treeview_node_options_flags flags)
Delete a treeview node.
static nserror treeview_walk_fwd_cb(treeview_node *n, void *ctx, bool *skip_children, bool *end)
Treewalk node enter callback.
void treeview_mouse_action(treeview *tree, browser_mouse_state mouse, int x, int y)
Handles all kinds of mouse action.
static nserror treeview_launch_selection(treeview *tree)
Launch a selection.
static bool treeview_set_move_indicator(treeview *tree, bool need_redraw, treeview_node *target, int node_height, int node_y, int mouse_y, struct rect *rect)
Set the drag&drop drop indicator.
static void treeview__cw_update_size(const struct treeview *tree, int width, int height)
Corewindow callback wrapper: Update the limits of the window.
static bool treeview_keyboard_navigation(treeview *tree, uint32_t key, struct rect *rect)
Handle keyboard navigation.
static void treeview_move_yank_selection(treeview *tree, treeview_node *fixed)
Yank a selection to the node move list.
static struct bitmap * treeview_generate_rotate_bitmap(struct bitmap *orig, int size)
Create bitmap from rotation of another bitmap.
nserror treeview_contract(treeview *tree, bool all)
Contract a treeview's nodes.
static bool treeview_unlink_node(treeview_node *n)
Unlink a treeview node.
nserror treeview_delete_node(treeview *tree, treeview_node *n, treeview_node_options_flags flags)
Delete a treeview node.
static nserror treeview__search(treeview *tree, const char *text, unsigned int len)
Search treeview for text.
enum treeview_node_type treeview_get_selection(treeview *tree, void **node_data)
Get the first selected node.
nserror treeview_fini(void)
Finalise the treeview module (all treeviews must have been destroyed first)
static nserror treeview_expand_cb(treeview_node *n, void *ctx, bool *skip_children, bool *end)
Treewalk node callback for handling recursive node expansion.
treeview_walk_mode
The treeview walk mode.
@ TREEVIEW_WALK_MODE_LOGICAL_EXPANDED
Walk to expanded nodes in the (sub)tree only.
@ TREEVIEW_WALK_MODE_DISPLAY
Walk displayed nodes.
@ TREEVIEW_WALK_MODE_LOGICAL_COMPLETE
Walk to all nodes in the (sub)tree.
static void treeview__redraw_from_node(const treeview *tree, const treeview_node *node)
Redraw tree from given node to the bottom.
static nserror treeview_init_plot_styles(int font_pt_size)
Initialise the plot styles from CSS system colour values.
void treeview_edit_selection(treeview *tree)
Edit the first selected node.
struct treeview_globals tree_g
static void treeview__search_update_display(treeview *tree)
Update the layout for any active search.
bool treeview_has_selection(treeview *tree)
Determine whether treeview has a selection.
static nserror treeview_node_launch_walk_fwd_cb(treeview_node *n, void *ctx, bool *skip_children, bool *end)
Treewalk node walk forward callback for launching nodes.
static treeview_node * treeview_get_first_selected(treeview *tree)
Get first selected node (in any)
treeview_target_pos
Treeview target position.
static int treeview__get_display_height(const treeview *tree)
Get the display height of the treeview data component of the display.
bool treeview_keypress(treeview *tree, uint32_t key)
Key press handling for treeviews.
static struct textarea * treeview__create_textarea(treeview *tree, int width, int height, colour border, colour background, colour foreground, plot_font_style_t text, textarea_client_callback ta_callback)
Helper to create a textarea.
static struct treeview_resource treeview_res[TREE_RES_LAST]
Treeview content resources.
nserror treeview_update_node_entry(treeview *tree, treeview_node *entry, const struct treeview_field_data fields[], void *data)
Update an entry node in given treeview.
static bool treeview_clear_selection(treeview *tree, struct rect *rect)
Clear any selection in a treeview.
static int treeview_node_y(const treeview *tree, const treeview_node *node)
Find y position of the top of a node.
nserror treeview_get_relation(treeview *tree, treeview_node **relation, enum treeview_relationship *rel, bool at_y, int y)
Find a relation for node creation.
nserror treeview_create_node_folder(treeview *tree, treeview_node **folder, treeview_node *relation, enum treeview_relationship rel, const struct treeview_field_data *field, void *data, treeview_node_options_flags flags)
Create a folder node in given treeview.
nserror treeview_destroy(treeview *tree)
Destroy a treeview object.
static void treeview_redraw_search(treeview *tree, const int x, const int y, int *render_y_in_out, const struct rect *r, struct content_redraw_data *data, const struct redraw_context *ctx)
Draw a treeview normally, in tree mode.
static void treeview_copy_selection(treeview *tree)
Copy a selection to the clipboard.
static nserror treeview_node_nav_cb(treeview_node *node, void *ctx, bool *skip_children, bool *end)
Treewalk node callback for handling mouse action.
static void treeview__cw_scroll_to_node(const struct treeview *tree, const struct treeview_node *node)
Corewindow callback_wrapper: Scroll to make node visible.
static nserror treeview_walk_internal(treeview *tree, treeview_node *root, enum treeview_walk_mode mode, nserror(*callback_bwd)(treeview_node *n, void *ctx, bool *end), nserror(*callback_fwd)(treeview_node *n, void *ctx, bool *skip_children, bool *end), void *ctx)
Walk a treeview subtree, calling a callback at each node (depth first)
static nserror treeview__search_walk_cb(treeview_node *n, void *ctx, bool *skip_children, bool *end)
Treewalk node callback for handling search.
nserror treeview_walk(treeview *tree, treeview_node *root, treeview_walk_cb enter_cb, treeview_walk_cb leave_cb, void *ctx, enum treeview_node_type type)
Walk (depth first) a treeview subtree, calling a callback at each node of required type.
static bool treeview_edit_node_at_point(treeview *tree, treeview_node *n, int node_y, int mouse_x, int mouse_y, struct rect *rect)
Start edit of node field, at given y-coord, if editable.
static void treeview__cw_invalidate_area(const struct treeview *tree, const struct rect *r)
Corewindow callback wrapper: Request a redraw of the window.
int treeview_get_height(treeview *tree)
Find current height of a treeview.
static void treeview__search_cancel(treeview *tree, bool drop_focus)
Cancel a treeview search, optionally droping focus from search widget.
struct treeview_node_style plot_style_even
Plot style for even rows.
void treeview_redraw(treeview *tree, const int x, const int y, struct rect *clip, const struct redraw_context *ctx)
Redraw a treeview object.
treeview_resource_id
treeview resource indexes
@ TREE_RES_FOLDER_SPECIAL
static void treeview__cw_drag_status(const struct treeview *tree, core_window_drag_status ds)
Corewindow callback wrapper: Inform corewindow owner of drag status.
treeview_node_flags
flags indicating render state of node.
@ TV_NFLAGS_SELECTED
Whether node is selected.
@ TV_NFLAGS_NONE
No node flags set.
@ TV_NFLAGS_SPECIAL
Render as special node.
@ TV_NFLAGS_MATCHED
Whether node matches search.
@ TV_NFLAGS_EXPANDED
Whether node is expanded.
static void treeview_edit_cancel(treeview *tree, bool redraw)
Cancel the editing of a treeview node.
static void treeview_redraw_tree(treeview *tree, const int x, const int y, int *render_y_in_out, const struct rect *r, struct content_redraw_data *data, const struct redraw_context *ctx)
Draw a treeview normally, in tree mode.
nserror treeview_node_expand(treeview *tree, treeview_node *node)
Expand a treeview node.
static nserror treeview_move_selection(treeview *tree, struct rect *rect)
Move a selection according to the current move drag.
static nserror treeview_node_launch_walk_bwd_cb(treeview_node *n, void *ctx, bool *end)
Treewalk node walk backward callback for tracking folder selection.
static struct bitmap * treeview_generate_copy_bitmap(struct bitmap *orig, int size)
Create bitmap copy of another bitmap.
static nserror treeview_node_expand_internal(treeview *tree, treeview_node *node)
Expand a treeview's nodes.
nserror treeview_init(void)
Prepare treeview module for treeview usage.
static struct treeview_text * treeview_get_text_for_field(treeview *tree, treeview_node *n, int i)
Helper function to access the given field of a node.
static nserror treeview_delete_empty_nodes(treeview *tree, bool interaction)
Delete any empty treeview folder nodes.
static treeview_node * treeview_y_node(treeview *tree, int target_y)
Find node at given y-position.
nserror treeview_create_node_entry(treeview *tree, treeview_node **entry, treeview_node *relation, enum treeview_relationship rel, const struct treeview_field_data fields[], void *data, treeview_node_options_flags flags)
Create an entry node in given treeview.
static core_window_drag_status treeview__get_cw_drag_type(const treeview *tree)
Convert from treeview drag to core window drag type.
static void treeview_edit_done(treeview *tree)
Complete a treeview edit.
nserror treeview_expand(treeview *tree, bool only_folders)
Expand a treeview's nodes.
static nserror treeview_res_cb(struct hlcache_handle *handle, const hlcache_event *event, void *pw)
Callback for hlcache retrieving resources.
static nserror treeview_create_node_root(treeview_node **root)
Create treeview's root node.
static void treeview__cw_full_redraw(const struct treeview *tree)
Corewindow callback wrapper: Request a full redraw of the window.
nserror treeview_set_search_string(treeview *tree, const char *string)
Set the search string for a treeview with TREEVIEW_SEARCHABLE.
treeview_node_part
Section type of a treeview at a point.
@ TV_NODE_PART_TOGGLE
Expansion toggle.
@ TV_NODE_PART_NONE
Empty area.
@ TV_NODE_PART_ON_NODE
Node content (text, icon)
static nserror treeview_init_furniture(void)
Measures width of characters used to represent treeview furniture.
treeview_furniture_id
Treeview furniture states.
static bool treeview_delete_selection(treeview *tree, struct rect *rect)
Delete a selection.
static void treeview_textarea_callback(void *data, struct textarea_msg *msg)
Callback for textarea_create, in desktop/treeview.h.
static void treeview_commit_selection_drag(treeview *tree)
Commit a current selection drag, modifying the node's selection state.
struct treeview_node_style plot_style_odd
Plot style for odd rows.
static bool treeview_propagate_selection(treeview *tree, struct rect *rect)
Propagate selection to visible descendants of selected nodes.
static nserror treeview_walk_bwd_cb(treeview_node *n, void *ctx, bool *end)
Treewalk node leave callback.
static nserror treeview_delete_node_walk_cb(treeview_node *n, void *ctx, bool *end)
Treewalk node callback deleting nodes.
static void treeview__cw_scroll_top(const struct treeview *tree)
Corewindow callback_wrapper: Scroll to top of window.
static nserror treeview_node_contract_cb(treeview_node *n, void *ctx, bool *end)
Treewalk node callback for handling node contraction.
nserror treeview_update_node_folder(treeview *tree, treeview_node *folder, const struct treeview_field_data *field, void *data)
Update an folder node in given treeview.
static struct bitmap * treeview_generate_triangle_bitmap(colour bg, colour fg, int size)
Create a right-pointing anti-aliased triangle bitmap.
static treeview_node * treeview_node_next(treeview_node *node, bool full)
Find the next node in depth first tree order.
static nserror treeview_set_inset_from_parent(treeview_node *n, void *ctx, bool *skip_children, bool *end)
Set a node's inset from its parent.
Treeview handling interface.
nserror(* treeview_walk_cb)(void *ctx, void *node_data, enum treeview_node_type type, bool *abort)
Client callback for treeview_walk.
@ TREE_MSG_NODE_EDIT
Node to be edited.
@ TREE_MSG_NODE_LAUNCH
Node to be launched.
@ TREE_MSG_NODE_DELETE
Node to be deleted.
treeview_node_type
treeview node type
@ TREE_NODE_ENTRY
Node is an entry.
@ TREE_NODE_FOLDER
Node is folder.
@ TREE_NODE_ROOT
Node is treeview's root.
treeview_node_options_flags
Node change handling options.
@ TREE_OPTION_SUPPRESS_RESIZE
@ TREE_OPTION_SPECIAL_DIR
@ TREE_OPTION_SUPPRESS_REDRAW
treeview_field_flags
treeview field flags
@ TREE_FLAG_SEARCHABLE
Whether field is searchable.
@ TREE_FLAG_SHOW_NAME
Whether field name shown.
@ TREE_FLAG_COPY_TEXT
Whether to copy to clipb.
@ TREE_FLAG_ALLOW_EDIT
Whether allow edit field.
@ TREE_FLAG_DEFAULT
Whether field is default.
treeview_relationship
Relationship between nodes.
treeview_flags
treeview control flags
@ TREEVIEW_NO_DELETES
No node deletes.
@ TREEVIEW_DEL_EMPTY_DIRS
Delete dirs on empty.
@ TREEVIEW_SEARCHABLE
Treeview has search bar.
@ TREEVIEW_NO_MOVES
No node drags.
nserror
Enumeration of error codes.
@ NSERROR_BAD_PARAMETER
Bad Parameter.
@ NSERROR_UNKNOWN
Unknown error - DO NOT USE.
@ NSERROR_NOMEM
Memory exhaustion.
static struct directory * root
struct netsurf_table * guit
The global interface table.
Interface to core interface table.
nserror hlcache_handle_release(hlcache_handle *handle)
Release a high-level cache handle.
nserror hlcache_handle_retrieve(nsurl *url, uint32_t flags, nsurl *referer, llcache_post_data *post, hlcache_handle_callback cb, void *pw, hlcache_child_context *child, content_type accepted_types, hlcache_handle **result)
Retrieve a high-level cache handle for an object.
High-level resource cache interface.
Generic bitmap handling interface.
@ BITMAP_OPAQUE
image is opaque
bitmap_layout
NetSurf bitmap pixel layout.
Interface to platform-specific clipboard operations.
Public content interface.
bool content_redraw(struct hlcache_handle *h, struct content_redraw_data *data, const struct rect *clip, const struct redraw_context *ctx)
Display content on screen with optional tiling.
int content_get_height(struct hlcache_handle *h)
Retrieve height of content.
Interface to platform-specific layout operation table.
browser_mouse_state
Mouse state.
@ BROWSER_MOUSE_PRESS_1
button 1 pressed
@ BROWSER_MOUSE_CLICK_2
button 2 clicked.
@ BROWSER_MOUSE_PRESS_2
button 2 pressed
@ BROWSER_MOUSE_HOVER
No mouse buttons pressed, May be used to indicate hover or end of drag.
@ BROWSER_MOUSE_CLICK_1
button 1 clicked.
@ BROWSER_MOUSE_MOD_2
2nd modifier key pressed (eg.
@ BROWSER_MOUSE_DOUBLE_CLICK
button double clicked
@ BROWSER_MOUSE_MOD_3
3rd modifier key pressed (eg.
@ BROWSER_MOUSE_MOD_1
1st modifier key pressed (eg.
@ BROWSER_MOUSE_DRAG_1
start of button 1 drag
@ BROWSER_MOUSE_LEAVE
pointer leaving window
@ BROWSER_MOUSE_DRAG_2
start of button 2 drag
Target independent plotting interface.
Interface to key press operations.
bool knockout_plot_end(const struct redraw_context *ctx)
End a knockout plotting session.
bool knockout_plot_start(const struct redraw_context *ctx, struct redraw_context *knk_ctx)
Start a knockout plotting session.
Knockout rendering (interface).
#define NSLOG(catname, level, logmsg, args...)
colour nscolours[NSCOLOUR__COUNT]
NetSurf UI colour table.
NetSurf UI colours (interface).
@ NSCOLOUR_WIN_EVEN_FG_FADED
NetSurf URL handling (interface).
nserror nsurl_create(const char *const url_s, nsurl **url)
Create a NetSurf URL object from a URL string.
void nsurl_unref(nsurl *url)
Drop a reference to a NetSurf URL object.
struct nsurl nsurl
NetSurf URL object.
#define blend_colour(c0, c1)
#define red_from_colour(c)
@ PLOT_OP_TYPE_NONE
No operation.
@ PLOT_OP_TYPE_SOLID
Solid colour.
#define mix_colour(c0, c1, p)
@ PLOT_FONT_FAMILY_SANS_SERIF
#define blue_from_colour(c)
#define green_from_colour(c)
#define PLOT_STYLE_SCALE
Scaling factor for plot styles.
static BList * callbacks
List of all callbacks.
Interface to utility string handling.
RISC OS wimp toolkit bitmap.
Container for border values during table border calculations.
parameters to content redraw
int height
vertical dimension
bool repeat_y
whether content is tiled in y direction
bool repeat_x
whether content is tiled in x direction
int y
coordinate for top-left of redraw
int x
coordinate for top-left of redraw
colour background_colour
The background colour.
int width
dimensions to render content at (for scaling contents with intrinsic dimensions)
float scale
Scale for redraw (for scaling contents without intrinsic dimensions)
nserror(* set_extent)(struct core_window *cw, int width, int height)
Update the logical extent of the window.
nserror(* get_dimensions)(const struct core_window *cw, int *width, int *height)
Get window viewport dimensions.
nserror(* drag_status)(struct core_window *cw, core_window_drag_status ds)
Inform corewindow owner of drag status.
nserror(* invalidate)(struct core_window *cw, const struct rect *rect)
Invalidate an area of a window.
int(* get_height)(void *bitmap)
Get the bitmap height.
void(* destroy)(void *bitmap)
Destroy a bitmap.
void *(* create)(int width, int height, enum gui_bitmap_flags flags)
Create a new bitmap.
int(* get_width)(void *bitmap)
Get the bitmap width.
size_t(* get_rowstride)(void *bitmap)
Get the number of bytes per row of the image.
void(* modified)(void *bitmap)
Marks a bitmap as modified.
unsigned char *(* get_buffer)(void *bitmap)
Get the image buffer from a bitmap.
void(* set)(const char *buffer, size_t length, nsclipboard_styles styles[], int n_styles)
Core tells front end to put given text in clipboard.
nserror(* width)(const struct plot_font_style *fstyle, const char *string, size_t length, int *width)
Measure the width of a string.
content_msg type
Event type.
struct gui_clipboard_table * clipboard
Clipboard table.
struct core_window_table * corewindow
Core window table.
struct gui_bitmap_table * bitmap
Bitmap table.
struct gui_layout_table * layout
Layout table.
plot_font_generic_family_t family
Generic family to plot with.
colour foreground
Colour of text.
plot_font_flags_t flags
Font flags.
plot_style_fixed size
Font size, in pt.
colour background
Background colour to blend to, if appropriate.
int weight
Font weight: value in range [100,900] as per CSS.
Plot style for stroke/fill plotters.
colour fill_colour
Colour of fill.
plot_style_fixed stroke_width
Width of stroke, in pixels.
plot_operation_type_t fill_type
Fill plot type.
colour stroke_colour
Colour of stroke.
plot_operation_type_t stroke_type
Stroke plot type.
bool option_knockout
flag to enable knockout rendering.
nserror(* text)(const struct redraw_context *ctx, const plot_font_style_t *fstyle, int x, int y, const char *text, size_t length)
Text plotting.
nserror(* rectangle)(const struct redraw_context *ctx, const plot_style_t *pstyle, const struct rect *rectangle)
Plots a rectangle.
nserror(* clip)(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.
nserror(* bitmap)(const struct redraw_context *ctx, struct bitmap *bitmap, int x, int y, int width, int height, colour bg, bitmap_flags_t flags)
Plot a bitmap.
const struct plotter_table * plot
Current plot operation table.
unsigned int len
Byte length of text.
const char * text
UTF8 text.
textarea_msg_type type
Indicates message data type.
struct rect redraw
With _REDRAW_REQUEST.
struct textarea_msg::@79::@82 modified
With _TEXT_MODIFIED.
union textarea_msg::@79 data
Depends on msg type.
textarea_drag_type drag
With _DRAG_REPORT.
textarea setup parameters
plot_font_style_t text
Textarea background colour and font.
unsigned int flags
Textarea flags.
Client callbacks for events concerning nodes.
nserror(* folder)(struct treeview_node_msg msg, void *data)
nserror(* entry)(struct treeview_node_msg msg, void *data)
context for treeview contraction callback
struct treeview_pos start
Start pos.
treeview_node * start_node
Start node.
struct treeview_pos prev
Previous pos.
bool selected
Start node is selected.
enum treeview_drag::@85 type
Drag type.
enum treeview_node_part part
Node part at start.
Treeview node edit details.
struct textarea * textarea
Textarea for edit, or NULL.
treeview_node * node
Node being edited, or NULL.
lwc_string * field
The field being edited, or NULL.
int y
Textarea y position.
int x
Textarea x position.
context data for treeview expansion
const char * value
Field value.
lwc_string * field
Field name.
size_t value_len
Field value length (bytes)
Treeview field description.
enum treeview_field_flags flags
Flags for field.
struct treeview_text value
field text
enum treeview_field_flags flags
flags controlling how field is interpreted
lwc_string * field
field contents
Treeview handling global context.
context for treeview launch action
context for treeview mouse handling
browser_mouse_state mouse
Treeview node move details.
enum treeview_target_pos target_pos
Pos wrt render node.
treeview_node * target
Move target.
struct rect target_area
Pos/size of target indicator.
treeview_node * root
Head of yanked node list.
context for treeview keyboard action
context for treeview node deletion iterator
treeview_node base
Entry class inherits node base class.
struct treeview_field fields[FLEX_ARRAY_LEN_DECL]
browser_mouse_state mouse
enum treeview_msg msg
The message type.
plot_font_style_t sitext
Selected entry field text.
struct treeview_node_style::@86 furn[TREE_FURN_LAST]
plot_style_t bg
Background.
plot_font_style_t itext
Entry field text.
plot_font_style_t text
Text.
plot_style_t sbg
Selected background.
plot_font_style_t stext
Selected text.
enum treeview_node_type type
Node type.
treeview_node * prev_sib
previous sibling node
treeview_node * next_sib
next sibling node
struct treeview_text text
treeview_node * parent
parent node
enum treeview_node_flags flags
Node flags.
treeview_node * children
first child node
int inset
Node's inset depending on tree depth (pixels)
void * client_data
Passed to client on node event msg callback.
int height
Includes height of any descendants (pixels)
A mouse position wrt treeview.
int node_h
Height of node at y.
int node_y
Top of node at y.
Treeview content resource data.
struct hlcache_handle * c
Data used when doing a treeview walk for search.
const char * text
The string being searched for.
const unsigned int len
Length of string being searched for.
treeview * tree
The treeview to search.
int window_height
Accumulate height for matching entries.
Treeview search box details.
struct textarea * textarea
Search box.
int height
Current search display height.
bool active
Whether the search box has focus.
bool search
Whether we have a search term.
context for treeview selection
union treeview_selection_walk_data::@88 data
@ TREEVIEW_WALK_GET_FIRST_SELECTED
@ TREEVIEW_WALK_YANK_SELECTION
@ TREEVIEW_WALK_SELECT_ALL
@ TREEVIEW_WALK_CLEAR_SELECTION
@ TREEVIEW_WALK_COPY_SELECTION
@ TREEVIEW_WALK_HAS_SELECTION
@ TREEVIEW_WALK_DELETE_SELECTION
@ TREEVIEW_WALK_PROPAGATE_SELECTION
@ TREEVIEW_WALK_COMMIT_SELECT_DRAG
enum treeview_selection_walk_data::@87 purpose
struct treeview_selection_walk_data::@88::@92 first
struct treeview_selection_walk_data::@88::@93 copy
struct treeview_selection_walk_data::@88::@91 yank
struct treeview_selection_walk_data::@88::@90 drag
struct treeview_selection_walk_data::@88::@89 redraw
Text within a treeview field or node.
uint32_t len
Length of string in bytes.
const char * data
Text string.
int width
Width of text in px.
Treewalk iterator context.
treeview_walk_cb enter_cb
enum treeview_node_type type
treeview_walk_cb leave_cb
int n_fields
fields[n_fields] is folder, lower are entry fields
struct treeview_search search
Treeview search box.
treeview_flags flags
Treeview behaviour settings.
const struct treeview_callback_table * callbacks
For node events.
treeview_node * root
Root node.
int field_width
Max width of shown field names.
struct treeview_move move
Move drag details.
struct treeview_drag drag
Drag state.
struct treeview_edit edit
Edit details.
uint32_t view_width
Viewport horizontal size.
struct core_window * cw_h
Core window handle.
struct treeview_field * fields
Array of fields.
Interface to system colour values.
uint32_t colour
Colour type: XBGR.
struct rect rect
Rectangle coordinates.
Option reading and saving interface.
#define nsoption_int(OPTION)
Get the value of an integer option.
Interface to a number of general purpose functionality.
#define FLEX_ARRAY_LEN_DECL
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.