NetSurf
Data Structures | Macros | Enumerations | Functions | Variables
treeview.c File Reference

Treeview handling implementation. More...

#include "utils/config.h"
#include <string.h>
#include "utils/utils.h"
#include "utils/log.h"
#include "utils/nsurl.h"
#include "utils/nscolour.h"
#include "utils/nsoption.h"
#include "netsurf/bitmap.h"
#include "netsurf/content.h"
#include "netsurf/plotters.h"
#include "netsurf/clipboard.h"
#include "netsurf/layout.h"
#include "netsurf/keypress.h"
#include "netsurf/core_window.h"
#include "content/hlcache.h"
#include "css/utils.h"
#include "desktop/bitmap.h"
#include "desktop/knockout.h"
#include "desktop/textarea.h"
#include "desktop/treeview.h"
#include "desktop/cw_helper.h"
#include "desktop/gui_internal.h"
#include "desktop/system_colour.h"
Include dependency graph for treeview.c:

Go to the source code of this file.

Data Structures

struct  treeview_globals
 Treeview handling global context. More...
 
struct  treeview_text
 Text within a treeview field or node. More...
 
struct  treeview_field
 a treeview field More...
 
struct  treeview_node
 Treeview node. More...
 
struct  treeview_node_entry
 Node entry. More...
 
struct  treeview_pos
 A mouse position wrt treeview. More...
 
struct  treeview_drag
 Treeview drag state. More...
 
struct  treeview_move
 Treeview node move details. More...
 
struct  treeview_edit
 Treeview node edit details. More...
 
struct  treeview_search
 Treeview search box details. More...
 
struct  treeview
 The treeview context. More...
 
struct  treeview_node_style
 style for a node More...
 
struct  treeview_resource
 Treeview content resource data. More...
 
struct  treeview_search_walk_data
 Data used when doing a treeview walk for search. More...
 
struct  treeview_walk_ctx
 Treewalk iterator context. More...
 
struct  treeview_node_delete
 context for treeview node deletion iterator More...
 
struct  treeview_contract_data
 context for treeview contraction callback More...
 
struct  treeview_expand_data
 context data for treeview expansion More...
 
struct  treeview_selection_walk_data
 context for treeview selection More...
 
struct  treeview_launch_walk_data
 context for treeview launch action More...
 
struct  treeview_nav_state
 context for treeview keyboard action More...
 
struct  treeview_mouse_action
 context for treeview mouse handling More...
 

Macros

#define REDRAW_MAX   8000
 The maximum horizontal size a treeview can possibly be. More...
 

Enumerations

enum  treeview_node_part { TV_NODE_PART_TOGGLE , TV_NODE_PART_ON_NODE , TV_NODE_PART_NONE }
 Section type of a treeview at a point. More...
 
enum  treeview_node_flags {
  TV_NFLAGS_NONE = 0 , TV_NFLAGS_EXPANDED = (1 << 0) , TV_NFLAGS_SELECTED = (1 << 1) , TV_NFLAGS_SPECIAL = (1 << 2) ,
  TV_NFLAGS_MATCHED = (1 << 3)
}
 flags indicating render state of node. More...
 
enum  treeview_target_pos { TV_TARGET_ABOVE , TV_TARGET_INSIDE , TV_TARGET_BELOW , TV_TARGET_NONE }
 Treeview target position. More...
 
enum  treeview_furniture_id { TREE_FURN_EXPAND = 0 , TREE_FURN_CONTRACT , TREE_FURN_LAST }
 Treeview furniture states. More...
 
enum  treeview_resource_id {
  TREE_RES_ARROW = 0 , TREE_RES_CONTENT , TREE_RES_FOLDER , TREE_RES_FOLDER_SPECIAL ,
  TREE_RES_SEARCH , TREE_RES_LAST
}
 treeview resource indexes More...
 
enum  treeview_walk_mode { TREEVIEW_WALK_MODE_LOGICAL_COMPLETE , TREEVIEW_WALK_MODE_LOGICAL_EXPANDED , TREEVIEW_WALK_MODE_DISPLAY }
 The treeview walk mode. More...
 

Functions

static int treeview__get_display_height (const treeview *tree)
 Get the display height of the treeview data component of the display. More...
 
static void treeview__cw_invalidate_area (const struct treeview *tree, const struct rect *r)
 Corewindow callback wrapper: Request a redraw of the window. More...
 
static void treeview__cw_full_redraw (const struct treeview *tree)
 Corewindow callback wrapper: Request a full redraw of the window. More...
 
static unsigned treeview__get_search_height (const treeview *tree)
 Get height used by treeview's search bar (or 0 if not present). More...
 
static void treeview__cw_update_size (const struct treeview *tree, int width, int height)
 Corewindow callback wrapper: Update the limits of the window. More...
 
static void treeview__cw_scroll_top (const struct treeview *tree)
 Corewindow callback_wrapper: Scroll to top of window. More...
 
static void treeview__cw_get_window_dimensions (const struct treeview *tree, int *width, int *height)
 Corewindow callback wrapper: Get window viewport dimensions. More...
 
static void treeview__cw_drag_status (const struct treeview *tree, core_window_drag_status ds)
 Corewindow callback wrapper: Inform corewindow owner of drag status. More...
 
static struct treeview_texttreeview_get_text_for_field (treeview *tree, treeview_node *n, int i)
 Helper function to access the given field of a node. More...
 
static treeview_nodetreeview_node_next (treeview_node *node, bool full)
 Find the next node in depth first tree order. More...
 
static treeview_nodetreeview_y_node (treeview *tree, int target_y)
 Find node at given y-position. More...
 
static int treeview_node_y (const treeview *tree, const treeview_node *node)
 Find y position of the top of a node. More...
 
static void treeview__cw_scroll_to_node (const struct treeview *tree, const struct treeview_node *node)
 Corewindow callback_wrapper: Scroll to make node visible. More...
 
static void treeview__redraw_from_node (const treeview *tree, const treeview_node *node)
 Redraw tree from given node to the bottom. More...
 
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) More...
 
static nserror treeview__search_walk_cb (treeview_node *n, void *ctx, bool *skip_children, bool *end)
 Treewalk node callback for handling search. More...
 
static nserror treeview__search (treeview *tree, const char *text, unsigned int len)
 Search treeview for text. More...
 
static void treeview__search_cancel (treeview *tree, bool drop_focus)
 Cancel a treeview search, optionally droping focus from search widget. More...
 
static core_window_drag_status treeview__get_cw_drag_type (const treeview *tree)
 Convert from treeview drag to core window drag type. More...
 
static void treeview_textarea_search_callback (void *data, struct textarea_msg *msg)
 Callback for textarea_create, in desktop/treeview.h. More...
 
static void treeview__search_update_display (treeview *tree)
 Update the layout for any active search. More...
 
static nserror treeview_create_node_root (treeview_node **root)
 Create treeview's root node. More...
 
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. More...
 
static void treeview_insert_node (treeview *tree, treeview_node *a, treeview_node *b, enum treeview_relationship rel)
 Insert a treeview node into a treeview. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
static nserror treeview_walk_fwd_cb (treeview_node *n, void *ctx, bool *skip_children, bool *end)
 Treewalk node enter callback. More...
 
static nserror treeview_walk_bwd_cb (treeview_node *n, void *ctx, bool *end)
 Treewalk node leave callback. More...
 
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. More...
 
static bool treeview_unlink_node (treeview_node *n)
 Unlink a treeview node. More...
 
static void treeview_edit_cancel (treeview *tree, bool redraw)
 Cancel the editing of a treeview node. More...
 
static void treeview_edit_done (treeview *tree)
 Complete a treeview edit. More...
 
static nserror treeview_delete_node_walk_cb (treeview_node *n, void *ctx, bool *end)
 Treewalk node callback deleting nodes. More...
 
static nserror treeview_delete_node_internal (treeview *tree, treeview_node *n, bool interaction, treeview_node_options_flags flags)
 Delete a treeview node. More...
 
static nserror treeview_delete_empty_nodes (treeview *tree, bool interaction)
 Delete any empty treeview folder nodes. More...
 
nserror treeview_delete_node (treeview *tree, treeview_node *n, treeview_node_options_flags flags)
 Delete a treeview node. More...
 
static struct textareatreeview__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. More...
 
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. More...
 
nserror treeview_cw_attach (treeview *tree, struct core_window *cw)
 Attach a treeview to a corewindow. More...
 
nserror treeview_cw_detach (treeview *tree)
 Detach a treeview from a corewindow. More...
 
nserror treeview_destroy (treeview *tree)
 Destroy a treeview object. More...
 
static nserror treeview_node_expand_internal (treeview *tree, treeview_node *node)
 Expand a treeview's nodes. More...
 
nserror treeview_node_expand (treeview *tree, treeview_node *node)
 Expand a treeview node. More...
 
static nserror treeview_node_contract_cb (treeview_node *n, void *ctx, bool *end)
 Treewalk node callback for handling node contraction. More...
 
static nserror treeview_node_contract_internal (treeview *tree, treeview_node *node)
 Contract a treeview node. More...
 
nserror treeview_node_contract (treeview *tree, treeview_node *node)
 Contract a treeview node. More...
 
nserror treeview_contract (treeview *tree, bool all)
 Contract a treeview's nodes. More...
 
static nserror treeview_expand_cb (treeview_node *n, void *ctx, bool *skip_children, bool *end)
 Treewalk node callback for handling recursive node expansion. More...
 
nserror treeview_expand (treeview *tree, bool only_folders)
 Expand a treeview's nodes. More...
 
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. More...
 
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. More...
 
void treeview_redraw (treeview *tree, const int x, const int y, struct rect *clip, const struct redraw_context *ctx)
 Redraw a treeview object. More...
 
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. More...
 
bool treeview_has_selection (treeview *tree)
 Determine whether treeview has a selection. More...
 
static treeview_nodetreeview_get_first_selected (treeview *tree)
 Get first selected node (in any) More...
 
enum treeview_node_type treeview_get_selection (treeview *tree, void **node_data)
 Get the first selected node. More...
 
static bool treeview_clear_selection (treeview *tree, struct rect *rect)
 Clear any selection in a treeview. More...
 
static bool treeview_select_all (treeview *tree, struct rect *rect)
 Select all in a treeview. More...
 
static void treeview_commit_selection_drag (treeview *tree)
 Commit a current selection drag, modifying the node's selection state. More...
 
static void treeview_move_yank_selection (treeview *tree, treeview_node *fixed)
 Yank a selection to the node move list. More...
 
static void treeview_copy_selection (treeview *tree)
 Copy a selection to the clipboard. More...
 
static bool treeview_delete_selection (treeview *tree, struct rect *rect)
 Delete a selection. More...
 
static bool treeview_propagate_selection (treeview *tree, struct rect *rect)
 Propagate selection to visible descendants of selected nodes. More...
 
static nserror treeview_move_selection (treeview *tree, struct rect *rect)
 Move a selection according to the current move drag. More...
 
static nserror treeview_node_launch_walk_bwd_cb (treeview_node *n, void *ctx, bool *end)
 Treewalk node walk backward callback for tracking folder selection. More...
 
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. More...
 
static nserror treeview_launch_selection (treeview *tree)
 Launch a selection. More...
 
nserror treeview_get_relation (treeview *tree, treeview_node **relation, enum treeview_relationship *rel, bool at_y, int y)
 Find a relation for node creation. More...
 
static nserror treeview_node_nav_cb (treeview_node *node, void *ctx, bool *skip_children, bool *end)
 Treewalk node callback for handling mouse action. More...
 
static bool treeview_keyboard_navigation (treeview *tree, uint32_t key, struct rect *rect)
 Handle keyboard navigation. More...
 
bool treeview_keypress (treeview *tree, uint32_t key)
 Key press handling for treeviews. More...
 
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. More...
 
static void treeview_textarea_callback (void *data, struct textarea_msg *msg)
 Callback for textarea_create, in desktop/treeview.h. More...
 
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. More...
 
void treeview_edit_selection (treeview *tree)
 Edit the first selected node. More...
 
static nserror treeview_node_mouse_action_cb (treeview_node *node, void *ctx, bool *skip_children, bool *end)
 Treewalk node callback for handling mouse action. More...
 
void treeview_mouse_action (treeview *tree, browser_mouse_state mouse, int x, int y)
 Handles all kinds of mouse action. More...
 
int treeview_get_height (treeview *tree)
 Find current height of a treeview. More...
 
nserror treeview_set_search_string (treeview *tree, const char *string)
 Set the search string for a treeview with TREEVIEW_SEARCHABLE. More...
 
static nserror treeview_init_plot_styles (int font_pt_size)
 Initialise the plot styles from CSS system colour values. More...
 
static nserror treeview_res_cb (struct hlcache_handle *handle, const hlcache_event *event, void *pw)
 Callback for hlcache retrieving resources. More...
 
static void treeview_init_resources (void)
 Fetch content resources used by treeview. More...
 
static struct bitmaptreeview_generate_triangle_bitmap (colour bg, colour fg, int size)
 Create a right-pointing anti-aliased triangle bitmap. More...
 
static struct bitmaptreeview_generate_copy_bitmap (struct bitmap *orig, int size)
 Create bitmap copy of another bitmap. More...
 
static struct bitmaptreeview_generate_rotate_bitmap (struct bitmap *orig, int size)
 Create bitmap from rotation of another bitmap. More...
 
static nserror treeview_init_furniture (void)
 Measures width of characters used to represent treeview furniture. More...
 
nserror treeview_init (void)
 Prepare treeview module for treeview usage. More...
 
nserror treeview_fini (void)
 Finalise the treeview module (all treeviews must have been destroyed first) More...
 

Variables

struct treeview_globals tree_g
 
struct treeview_node_style plot_style_odd
 Plot style for odd rows. More...
 
struct treeview_node_style plot_style_even
 Plot style for even rows. More...
 
static struct treeview_resource treeview_res [TREE_RES_LAST]
 Treeview content resources. More...
 

Detailed Description

Treeview handling implementation.

Definition in file treeview.c.

Macro Definition Documentation

◆ REDRAW_MAX

#define REDRAW_MAX   8000

The maximum horizontal size a treeview can possibly be.

Todo:
get rid of REDRAW_MAX – need to be able to know window size

Definition at line 57 of file treeview.c.

Enumeration Type Documentation

◆ treeview_furniture_id

Treeview furniture states.

Enumerator
TREE_FURN_EXPAND 
TREE_FURN_CONTRACT 
TREE_FURN_LAST 

Definition at line 258 of file treeview.c.

◆ treeview_node_flags

flags indicating render state of node.

Enumerator
TV_NFLAGS_NONE 

No node flags set.

TV_NFLAGS_EXPANDED 

Whether node is expanded.

TV_NFLAGS_SELECTED 

Whether node is selected.

TV_NFLAGS_SPECIAL 

Render as special node.

TV_NFLAGS_MATCHED 

Whether node matches search.

Definition at line 110 of file treeview.c.

◆ treeview_node_part

Section type of a treeview at a point.

Enumerator
TV_NODE_PART_TOGGLE 

Expansion toggle.

TV_NODE_PART_ON_NODE 

Node content (text, icon)

TV_NODE_PART_NONE 

Empty area.

Definition at line 78 of file treeview.c.

◆ treeview_resource_id

treeview resource indexes

Enumerator
TREE_RES_ARROW 
TREE_RES_CONTENT 
TREE_RES_FOLDER 
TREE_RES_FOLDER_SPECIAL 
TREE_RES_SEARCH 
TREE_RES_LAST 

Definition at line 311 of file treeview.c.

◆ treeview_target_pos

Treeview target position.

Enumerator
TV_TARGET_ABOVE 
TV_TARGET_INSIDE 
TV_TARGET_BELOW 
TV_TARGET_NONE 

Definition at line 122 of file treeview.c.

◆ treeview_walk_mode

The treeview walk mode.

Controls which nodes are visited in a walk.

Enumerator
TREEVIEW_WALK_MODE_LOGICAL_COMPLETE 

Walk to all nodes in the (sub)tree.

TREEVIEW_WALK_MODE_LOGICAL_EXPANDED 

Walk to expanded nodes in the (sub)tree only.

Children of collapsed nodes are not visited.

TREEVIEW_WALK_MODE_DISPLAY 

Walk displayed nodes.

This differs from the TREEVIEW_WALK_MODE_LOGICAL_EXPANDED mode when there is an active search filter display.

Definition at line 639 of file treeview.c.

Function Documentation

◆ treeview__create_textarea()

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 
)
static

Helper to create a textarea.

Parameters
[in]treeThe treeview we're creating the textarea for.
[in]widthThe width of the textarea.
[in]heightThe height of the textarea.
[in]borderThe border colour to use.
[in]backgroundThe background colour to use.
[in]foregroundThe foreground colour to use.
[in]textThe text style to use for the text area.
[in]ta_callbackThe textarea callback function to give the textarea.
Returns
the textarea pointer on success, or NULL on failure.

Definition at line 1986 of file treeview.c.

References plot_font_style::background, plot_font_style::foreground, height, textarea_setup::text, text(), textarea_create(), TEXTAREA_INTERNAL_CARET, and width.

Referenced by treeview_create(), and treeview_edit_node_at_point().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview__cw_drag_status()

static void treeview__cw_drag_status ( const struct treeview tree,
core_window_drag_status  ds 
)
inlinestatic

Corewindow callback wrapper: Inform corewindow owner of drag status.

Parameters
[in]treeThe treeview to report status on.
[in]dsthe current drag status

Definition at line 457 of file treeview.c.

References netsurf_table::corewindow, treeview::cw_h, core_window_table::drag_status, and guit.

Referenced by treeview_mouse_action(), treeview_node_mouse_action_cb(), treeview_textarea_callback(), and treeview_textarea_search_callback().

Here is the caller graph for this function:

◆ treeview__cw_full_redraw()

static void treeview__cw_full_redraw ( const struct treeview tree)
inlinestatic

Corewindow callback wrapper: Request a full redraw of the window.

Parameters
[in]treeThe treeview to request redraw on.

Definition at line 368 of file treeview.c.

References netsurf_table::corewindow, treeview::cw_h, guit, core_window_table::invalidate, REDRAW_MAX, and rect::x0.

Referenced by treeview_set_search_string().

Here is the caller graph for this function:

◆ treeview__cw_get_window_dimensions()

static void treeview__cw_get_window_dimensions ( const struct treeview tree,
int *  width,
int *  height 
)
inlinestatic

Corewindow callback wrapper: Get window viewport dimensions.

Parameters
[in]treeThe treeview to get dimensions for.
[out]widthto be set to viewport width in px
[out]heightto be set to viewport height in px

Definition at line 441 of file treeview.c.

References netsurf_table::corewindow, treeview::cw_h, core_window_table::get_dimensions, guit, height, and width.

Referenced by treeview_edit_node_at_point().

Here is the caller graph for this function:

◆ treeview__cw_invalidate_area()

static void treeview__cw_invalidate_area ( const struct treeview tree,
const struct rect r 
)
inlinestatic

Corewindow callback wrapper: Request a redraw of the window.

Parameters
[in]treeThe treeview to request redraw on.
[in]rrectangle to redraw

Definition at line 353 of file treeview.c.

References netsurf_table::corewindow, treeview::cw_h, guit, and core_window_table::invalidate.

Referenced by treeview__redraw_from_node(), treeview__search(), treeview__search_cancel(), treeview_contract(), treeview_create_node_entry(), treeview_create_node_folder(), treeview_delete_node(), treeview_edit_cancel(), treeview_edit_selection(), treeview_expand(), treeview_keypress(), treeview_mouse_action(), treeview_node_mouse_action_cb(), treeview_textarea_callback(), treeview_textarea_search_callback(), treeview_update_node_entry(), and treeview_update_node_folder().

Here is the caller graph for this function:

◆ treeview__cw_scroll_to_node()

static void treeview__cw_scroll_to_node ( const struct treeview tree,
const struct treeview_node node 
)
inlinestatic

Corewindow callback_wrapper: Scroll to make node visible.

Parameters
[in]treeThe treeview to scroll.
[in]nodeThe treeview node to scroll to visibility.

Definition at line 594 of file treeview.c.

References treeview::cw_h, cw_helper_scroll_visible(), treeview_node::height, treeview_globals::line_height, tree_g, TREE_NODE_ENTRY, treeview_node_y(), treeview_node::type, rect::x0, rect::y0, and rect::y1.

Referenced by treeview_keyboard_navigation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview__cw_scroll_top()

static void treeview__cw_scroll_top ( const struct treeview tree)
inlinestatic

Corewindow callback_wrapper: Scroll to top of window.

Parameters
[in]treeThe treeview to scroll.

Definition at line 421 of file treeview.c.

References treeview::cw_h, cw_helper_scroll_visible(), treeview_globals::line_height, tree_g, treeview_globals::window_padding, and rect::x0.

Referenced by treeview__search().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview__cw_update_size()

static void treeview__cw_update_size ( const struct treeview tree,
int  width,
int  height 
)
inlinestatic

Corewindow callback wrapper: Update the limits of the window.

Parameters
[in]treeThe treeview to update size for.
[in]widththe width in px, or negative if don't care
[in]heightthe height in px, or negative if don't care

Definition at line 404 of file treeview.c.

References netsurf_table::corewindow, treeview::cw_h, guit, height, core_window_table::set_extent, treeview__get_search_height(), and width.

Referenced by treeview__search(), treeview_contract(), treeview_create_node_entry(), treeview_create_node_folder(), treeview_delete_node(), treeview_delete_node_internal(), treeview_get_height(), treeview_keypress(), treeview_move_selection(), treeview_node_contract_internal(), and treeview_node_expand_internal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview__get_cw_drag_type()

static core_window_drag_status treeview__get_cw_drag_type ( const treeview tree)
static

Convert from treeview drag to core window drag type.

Parameters
[in]treeA treeview.
Returns
Core window drag type.

Definition at line 961 of file treeview.c.

References CORE_WINDOW_DRAG_MOVE, CORE_WINDOW_DRAG_NONE, CORE_WINDOW_DRAG_SELECTION, CORE_WINDOW_DRAG_TEXT_SELECTION, treeview::drag, and treeview_drag::type.

Referenced by treeview_textarea_callback(), and treeview_textarea_search_callback().

Here is the caller graph for this function:

◆ treeview__get_display_height()

static int treeview__get_display_height ( const treeview tree)
inlinestatic

Get the display height of the treeview data component of the display.

Parameters
[in]treeTreeview to get the height of.
Returns
the display height in pixels.

Definition at line 339 of file treeview.c.

References treeview_node::height, treeview_search::height, treeview::root, treeview_search::search, and treeview::search.

Referenced by treeview__redraw_from_node(), treeview__search(), treeview_delete_selection(), treeview_get_height(), treeview_keyboard_navigation(), treeview_mouse_action(), treeview_node_contract_internal(), treeview_node_expand_internal(), and treeview_node_mouse_action_cb().

Here is the caller graph for this function:

◆ treeview__get_search_height()

static unsigned treeview__get_search_height ( const treeview tree)
inlinestatic

Get height used by treeview's search bar (or 0 if not present).

Parameters
treeTreeview object to check.
Returns
height used by search bar in pixels.

Definition at line 389 of file treeview.c.

References treeview::flags, treeview_globals::line_height, tree_g, and TREEVIEW_SEARCHABLE.

Referenced by treeview__cw_update_size(), treeview__redraw_from_node(), treeview__search(), treeview_clear_selection(), treeview_commit_selection_drag(), treeview_contract(), treeview_delete_selection(), treeview_get_height(), treeview_keyboard_navigation(), treeview_mouse_action(), treeview_node_y(), treeview_propagate_selection(), treeview_select_all(), and treeview_y_node().

Here is the caller graph for this function:

◆ treeview__redraw_from_node()

static void treeview__redraw_from_node ( const treeview tree,
const treeview_node node 
)
static

Redraw tree from given node to the bottom.

Parameters
[in]treeTree to redraw from node in.
[in]nodeNode to redraw from.

Definition at line 618 of file treeview.c.

References REDRAW_MAX, treeview__cw_invalidate_area(), treeview__get_display_height(), treeview__get_search_height(), treeview_node_y(), and rect::x0.

Referenced by treeview_node_contract(), and treeview_node_expand().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview__search()

static nserror treeview__search ( treeview tree,
const char *  text,
unsigned int  len 
)
static

Search treeview for text.

Parameters
[in]treeTreeview to search.
[in]textUTF-8 string to search for. (NULL-terminated.)
[in]lenByte length of UTF-8 string.
Returns
NSERROR_OK on success, appropriate error otherwise.

Definition at line 866 of file treeview.c.

References treeview_node::height, treeview_search::height, height, treeview_search_walk_data::len, NSERROR_OK, REDRAW_MAX, treeview::root, treeview_search::search, treeview::search, text(), treeview_search_walk_data::tree, treeview__cw_invalidate_area(), treeview__cw_scroll_top(), treeview__cw_update_size(), treeview__get_display_height(), treeview__get_search_height(), treeview__search_walk_cb(), treeview_walk_internal(), TREEVIEW_WALK_MODE_LOGICAL_COMPLETE, treeview_search_walk_data::window_height, rect::x0, and rect::y1.

Referenced by treeview__search_update_display(), treeview_set_search_string(), and treeview_textarea_search_callback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview__search_cancel()

static void treeview__search_cancel ( treeview tree,
bool  drop_focus 
)
static

Cancel a treeview search, optionally droping focus from search widget.

Parameters
[in]treeTreeview to cancel search in.
[in]drop_focusIff true, drop input focus from search widget.

Definition at line 924 of file treeview.c.

References treeview_search::active, treeview_globals::icon_size, treeview_globals::line_height, treeview_search::search, treeview::search, treeview_search::textarea, textarea_get_text(), textarea_set_caret(), textarea_set_text(), tree_g, treeview__cw_invalidate_area(), treeview_globals::window_padding, and rect::x0.

Referenced by treeview_cw_detach(), and treeview_keypress().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview__search_update_display()

static void treeview__search_update_display ( treeview tree)
static

Update the layout for any active search.

Parameters
[in]treeThe tree to update.

Definition at line 1042 of file treeview.c.

References treeview_search::search, treeview::search, treeview_search::textarea, textarea_data(), and treeview__search().

Referenced by treeview_create_node_entry(), treeview_delete_node_internal(), and treeview_update_node_entry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview__search_walk_cb()

static nserror treeview__search_walk_cb ( treeview_node n,
void *  ctx,
bool *  skip_children,
bool *  end 
)
static

Treewalk node callback for handling search.

Parameters
[in]nCurrent node.
[in]ctxTreeview search context.
[in,out]skip_childrenFlag to allow children to be skipped.
[in,out]endFlag to allow iteration to be finished early.
Returns
NSERROR_OK on success else error code.

Definition at line 812 of file treeview.c.

References treeview_text::data, treeview_node_entry::fields, treeview::fields, treeview_field::flags, treeview_node::flags, treeview_node::height, treeview_search_walk_data::len, treeview::n_fields, NSERROR_OK, strcasestr(), treeview_node::text, treeview_search_walk_data::text, treeview_search_walk_data::tree, TREE_FLAG_SEARCHABLE, TREE_NODE_ENTRY, TV_NFLAGS_MATCHED, treeview_node::type, treeview_field::value, and treeview_search_walk_data::window_height.

Referenced by treeview__search().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_clear_selection()

static bool treeview_clear_selection ( treeview tree,
struct rect rect 
)
static

Clear any selection in a treeview.

Parameters
treeTreeview object to clear selection in
rectRedraw rectangle (if redraw required)
Returns
true iff redraw required

Definition at line 3389 of file treeview.c.

References treeview_selection_walk_data::current_y, treeview_selection_walk_data::data, treeview_selection_walk_data::purpose, treeview_selection_walk_data::rect, treeview_selection_walk_data::redraw, REDRAW_MAX, treeview_selection_walk_data::required, treeview::root, treeview_selection_walk_data::tree, treeview__get_search_height(), treeview_node_selection_walk_cb(), treeview_selection_walk_data::TREEVIEW_WALK_CLEAR_SELECTION, treeview_walk_internal(), TREEVIEW_WALK_MODE_DISPLAY, rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by treeview_keyboard_navigation(), treeview_keypress(), treeview_mouse_action(), and treeview_node_mouse_action_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_commit_selection_drag()

static void treeview_commit_selection_drag ( treeview tree)
static

Commit a current selection drag, modifying the node's selection state.

Parameters
treeTreeview object to commit drag selection in

Definition at line 3445 of file treeview.c.

References treeview_selection_walk_data::current_y, treeview_selection_walk_data::data, treeview::drag, treeview_selection_walk_data::drag, treeview_drag::prev, treeview_selection_walk_data::purpose, treeview::root, treeview_selection_walk_data::sel_max, treeview_selection_walk_data::sel_min, treeview_drag::start, treeview_selection_walk_data::tree, treeview__get_search_height(), treeview_node_selection_walk_cb(), treeview_selection_walk_data::TREEVIEW_WALK_COMMIT_SELECT_DRAG, treeview_walk_internal(), TREEVIEW_WALK_MODE_DISPLAY, and treeview_pos::y.

Referenced by treeview_mouse_action().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_contract()

nserror treeview_contract ( treeview tree,
bool  all 
)

Contract a treeview's nodes.

Parameters
treeTreeview object to contract nodes in
allIff false, only entries are contracted.
Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 2434 of file treeview.c.

References treeview_node::children, treeview_node::flags, treeview_node::height, treeview_node::next_sib, NSERROR_OK, treeview_contract_data::only_entries, REDRAW_MAX, treeview::root, treeview_contract_data::tree, treeview__cw_invalidate_area(), treeview__cw_update_size(), treeview__get_search_height(), treeview_node_contract_cb(), treeview_walk_internal(), TREEVIEW_WALK_MODE_LOGICAL_EXPANDED, TV_NFLAGS_EXPANDED, TV_NFLAGS_SELECTED, rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by cookie_manager_contract(), global_history_contract(), and hotlist_contract().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_copy_selection()

static void treeview_copy_selection ( treeview tree)
static

Copy a selection to the clipboard.

Parameters
treeTreeview object to yank selection from

Definition at line 3492 of file treeview.c.

References netsurf_table::clipboard, treeview_selection_walk_data::copy, treeview_selection_walk_data::data, guit, treeview_selection_walk_data::len, NSERROR_OK, treeview_selection_walk_data::purpose, treeview::root, gui_clipboard_table::set, treeview_selection_walk_data::text, treeview_selection_walk_data::tree, treeview_node_selection_walk_cb(), treeview_selection_walk_data::TREEVIEW_WALK_COPY_SELECTION, treeview_walk_internal(), and TREEVIEW_WALK_MODE_DISPLAY.

Referenced by treeview_keypress().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_create()

nserror treeview_create ( treeview **  tree,
const struct treeview_callback_table callbacks,
int  n_fields,
struct treeview_field_desc  fields[],
struct core_window *  cw,
treeview_flags  flags 
)

Create a treeview.

The fields array order is as follows (N = n_fields):

fields[0] Main field for entries (shown when not expanded) fields[1]...fields[N-2] Additional fields for entries fields[N-1] Field for folder nodes

So fields[0] and fields[N-1] have TREE_FLAG_DEFAULT set.

Parameters
treeReturns created treeview object
callbacksTreeview client node event callbacks
n_fieldsNumber of treeview fields (see description)
fieldsArray of treeview fields
cw_tCallback table for core_window containing the treeview
cwThe core_window in which the treeview is shown
flagsTreeview behaviour flags
Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 2022 of file treeview.c.

References treeview_search::active, treeview::callbacks, callbacks, treeview::cw_h, treeview_text::data, treeview::drag, treeview::edit, treeview_field::field, treeview::field_width, treeview::fields, textarea::flags, treeview_field::flags, treeview::flags, treeview_field_desc::flags, guit, netsurf_table::layout, treeview_text::len, treeview_globals::line_height, treeview::move, treeview::n_fields, treeview_edit::node, treeview_pos::node_h, treeview_pos::node_y, NSCOLOUR_TEXT_INPUT_BG, NSCOLOUR_TEXT_INPUT_FG, nscolours, NSERROR_NOMEM, NSERROR_OK, plot_style_odd, treeview_drag::prev, treeview_move::root, treeview::root, treeview_search::search, treeview::search, treeview_drag::start, treeview_drag::start_node, treeview_globals::step_width, treeview_move::target, treeview_move::target_pos, treeview_node_style::text, treeview_edit::textarea, treeview_search::textarea, TREE_FLAG_DEFAULT, TREE_FLAG_SHOW_NAME, tree_g, treeview__create_textarea(), treeview_create_node_root(), treeview_destroy(), TREEVIEW_SEARCHABLE, treeview_textarea_search_callback(), TV_TARGET_NONE, treeview_drag::type, treeview_field::value, treeview_text::width, gui_layout_table::width, treeview_pos::x, and treeview_pos::y.

Referenced by cookie_manager_init(), global_history_init(), and hotlist_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_create_node_entry()

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.

Parameters
treeTreeview object in which to create entry
entryReturns created entry node
relationExisting node to insert as relation of, or NULL
relFolder's relationship to relation
fieldsArray of field data
dataClient data for node event callbacks
flagsTreeview node options flags
Returns
NSERROR_OK on success, appropriate error otherwise

Fields array names must match names past in treeview_create fields[0...N-2].

If relation is NULL, will insert as child of root node.

Definition at line 1388 of file treeview.c.

References treeview_node::children, treeview_node::client_data, treeview_text::data, treeview_field::field, treeview_node_entry::fields, treeview::fields, treeview_node::flags, treeview_node::height, treeview_text::len, treeview_globals::line_height, treeview::n_fields, treeview_node::next_sib, NSERROR_NOMEM, NSERROR_OK, treeview_node::parent, treeview_node::prev_sib, REDRAW_MAX, treeview::root, treeview_node::text, tree_g, TREE_NODE_ENTRY, TREE_OPTION_SUPPRESS_REDRAW, TREE_OPTION_SUPPRESS_RESIZE, TREE_REL_FIRST_CHILD, treeview__cw_invalidate_area(), treeview__cw_update_size(), treeview__search_update_display(), treeview_insert_node(), treeview_node_y(), TV_NFLAGS_EXPANDED, TV_NFLAGS_NONE, treeview_node::type, treeview_field::value, treeview_text::width, rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by cookie_manager_create_cookie_node(), global_history_entry_insert(), and hotlist_entry_insert().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_create_node_folder()

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.

Parameters
treeTreeview object in which to create folder
folderReturns created folder node
relationExisting node to insert as relation of, or NULL
relFolder's relationship to relation
fieldField data
dataClient data for node event callbacks
flagsTreeview node options flags
Returns
NSERROR_OK on success, appropriate error otherwise

Field name must match name past in treeview_create fields[N-1].

If relation is NULL, will insert as child of root node.

Definition at line 1198 of file treeview.c.

References treeview_node::children, treeview_node::client_data, treeview_text::data, treeview_node::flags, treeview_node::height, treeview_text::len, treeview_globals::line_height, treeview_node::next_sib, NSERROR_NOMEM, NSERROR_OK, treeview_node::parent, treeview_node::prev_sib, REDRAW_MAX, treeview::root, treeview_node::text, tree_g, TREE_NODE_FOLDER, TREE_OPTION_SPECIAL_DIR, TREE_OPTION_SUPPRESS_REDRAW, TREE_OPTION_SUPPRESS_RESIZE, TREE_REL_FIRST_CHILD, treeview__cw_invalidate_area(), treeview__cw_update_size(), treeview_insert_node(), treeview_node_y(), TV_NFLAGS_EXPANDED, TV_NFLAGS_NONE, TV_NFLAGS_SPECIAL, treeview_node::type, treeview_field_data::value, treeview_field_data::value_len, treeview_text::width, rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by cookie_manager_create_domain_folder(), global_history_create_dir(), and hotlist_add_folder_internal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_create_node_root()

static nserror treeview_create_node_root ( treeview_node **  root)
static

Create treeview's root node.

Parameters
[out]rootReturns root node
Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 1068 of file treeview.c.

References treeview_node::children, treeview_node::client_data, treeview_text::data, treeview_node::flags, treeview_node::height, treeview_node::inset, treeview_text::len, treeview_node::next_sib, NSERROR_NOMEM, NSERROR_OK, treeview_node::parent, treeview_node::prev_sib, root, treeview_globals::step_width, treeview_node::text, tree_g, TREE_NODE_ROOT, TV_NFLAGS_EXPANDED, treeview_node::type, treeview_text::width, and treeview_globals::window_padding.

Referenced by treeview_create().

Here is the caller graph for this function:

◆ treeview_cw_attach()

nserror treeview_cw_attach ( treeview tree,
struct core_window *  cw 
)

Attach a treeview to a corewindow.

Treeview must be detached.

Parameters
treeTreeview object
cw_tCallback table for core_window containing the treeview
cwThe core_window in which the treeview is shown
Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 2132 of file treeview.c.

References treeview::cw_h, NSERROR_OK, NSERROR_UNKNOWN, and NSLOG.

Referenced by hotlist_manager_init().

Here is the caller graph for this function:

◆ treeview_cw_detach()

nserror treeview_cw_detach ( treeview tree)

Detach a treeview from a corewindow.

Parameters
treeTreeview object
Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 2147 of file treeview.c.

References treeview::cw_h, NSERROR_OK, and treeview__search_cancel().

Referenced by hotlist_manager_fini().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_delete_empty_nodes()

static nserror treeview_delete_empty_nodes ( treeview tree,
bool  interaction 
)
static

Delete any empty treeview folder nodes.

Parameters
treeTreeview object to delete empty nodes from
interactionDelete is result of user interaction with treeview
Returns
NSERROR_OK on success, appropriate error otherwise

Note this must not be called within a treeview_walk. It may delete the walker's 'current' node, making it impossible to move on without invalid reads.

Definition at line 1830 of file treeview.c.

References treeview_node::children, treeview_node::flags, treeview_node_delete::h_reduction, treeview_node::height, treeview_node::next_sib, NSERROR_OK, treeview_node::parent, parent, treeview::root, treeview_node_delete::tree, TREE_NODE_FOLDER, treeview_delete_node_walk_cb(), TV_NFLAGS_EXPANDED, and treeview_node::type.

Referenced by treeview_delete_node(), and treeview_keypress().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_delete_node()

nserror treeview_delete_node ( treeview tree,
treeview_node n,
treeview_node_options_flags  flags 
)

Delete a treeview node.

Parameters
treeTreeview object to delete node from
nNode to delete
flagsTreeview node options flags
Returns
NSERROR_OK on success, appropriate error otherwise

Will emit folder or entry deletion msg callback.

Definition at line 1924 of file treeview.c.

References treeview_node::flags, treeview::flags, treeview_node::height, NSERROR_OK, treeview_node::parent, REDRAW_MAX, treeview::root, TREE_OPTION_SUPPRESS_REDRAW, TREE_OPTION_SUPPRESS_RESIZE, treeview__cw_invalidate_area(), treeview__cw_update_size(), TREEVIEW_DEL_EMPTY_DIRS, treeview_delete_empty_nodes(), treeview_delete_node_internal(), treeview_node_y(), TV_NFLAGS_EXPANDED, rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by cookie_manager_remove(), global_history_add_entry(), and hotlist_remove_url_walk_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_delete_node_internal()

static nserror treeview_delete_node_internal ( treeview tree,
treeview_node n,
bool  interaction,
treeview_node_options_flags  flags 
)
static

Delete a treeview node.

Will emit folder or entry deletion msg callback.

Note
this can be called from inside a treeview_walk fwd callback. For example walking the tree and calling this for any node that's selected.

This function does not delete empty nodes, so if TREEVIEW_DEL_EMPTY_DIRS is set, caller must also call treeview_delete_empty.

Parameters
treeTreeview object to delete node from
nNode to delete
interactionDelete is result of user interaction with treeview
flagsTreeview node options flags
Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 1765 of file treeview.c.

References treeview_node::flags, treeview::flags, treeview_node_delete::h_reduction, treeview_node::height, NSERROR_OK, treeview_node::parent, treeview::root, treeview_node_delete::tree, TREE_OPTION_SUPPRESS_RESIZE, treeview__cw_update_size(), treeview__search_update_display(), treeview_delete_node_walk_cb(), TREEVIEW_NO_DELETES, treeview_walk_internal(), TREEVIEW_WALK_MODE_LOGICAL_COMPLETE, and TV_NFLAGS_EXPANDED.

Referenced by treeview_delete_node(), treeview_destroy(), and treeview_node_selection_walk_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_delete_node_walk_cb()

static nserror treeview_delete_node_walk_cb ( treeview_node n,
void *  ctx,
bool *  end 
)
static

Treewalk node callback deleting nodes.

Definition at line 1703 of file treeview.c.

References treeview::callbacks, treeview_node::children, treeview_node::client_data, treeview::edit, treeview_callback_table::entry, treeview_callback_table::folder, treeview_node_delete::h_reduction, treeview_node::height, treeview_globals::line_height, treeview_node_msg::msg, treeview_edit::node, NSERROR_BAD_PARAMETER, NSERROR_OK, treeview_edit::textarea, treeview_node_delete::tree, tree_g, TREE_MSG_NODE_DELETE, TREE_NODE_ENTRY, TREE_NODE_FOLDER, TREE_NODE_ROOT, treeview_edit_cancel(), treeview_unlink_node(), treeview_node::type, and treeview_node_delete::user_interaction.

Referenced by treeview_delete_empty_nodes(), and treeview_delete_node_internal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_delete_selection()

static bool treeview_delete_selection ( treeview tree,
struct rect rect 
)
static

Delete a selection.

Parameters
treeTreeview object to delete selected nodes from
rectUpdated to redraw rectangle
Returns
true iff redraw required.

Definition at line 3524 of file treeview.c.

References treeview_selection_walk_data::current_y, treeview_selection_walk_data::data, treeview_selection_walk_data::purpose, treeview_selection_walk_data::rect, treeview_selection_walk_data::redraw, REDRAW_MAX, treeview_selection_walk_data::required, treeview::root, treeview_selection_walk_data::tree, treeview__get_display_height(), treeview__get_search_height(), treeview_node_selection_walk_cb(), treeview_selection_walk_data::TREEVIEW_WALK_DELETE_SELECTION, treeview_walk_internal(), TREEVIEW_WALK_MODE_DISPLAY, rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by treeview_keypress().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_destroy()

nserror treeview_destroy ( treeview tree)

Destroy a treeview object.

Will emit folder and entry deletion msg callbacks for all nodes in treeview.

Parameters
treeTreeview object to destroy
Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 2158 of file treeview.c.

References treeview_search::active, treeview_field::field, treeview::fields, treeview::n_fields, NSERROR_OK, treeview::root, treeview_search::search, treeview::search, treeview_search::textarea, textarea_destroy(), TREE_OPTION_SUPPRESS_REDRAW, TREE_OPTION_SUPPRESS_RESIZE, and treeview_delete_node_internal().

Referenced by cookie_manager_fini(), global_history_fini(), hotlist_fini(), and treeview_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_edit_cancel()

static void treeview_edit_cancel ( treeview tree,
bool  redraw 
)
static

Cancel the editing of a treeview node.

Parameters
treeTreeview object to cancel node editing in
redrawSet true iff redraw of removed textarea area required

Definition at line 1601 of file treeview.c.

References treeview::drag, treeview::edit, treeview_edit::h, treeview_edit::node, treeview_edit::textarea, textarea_destroy(), treeview__cw_invalidate_area(), treeview_drag::type, treeview_edit::w, treeview_edit::x, rect::x0, rect::x1, treeview_edit::y, rect::y0, and rect::y1.

Referenced by treeview_delete_node_walk_cb(), treeview_edit_done(), treeview_keypress(), and treeview_mouse_action().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_edit_done()

static void treeview_edit_done ( treeview tree)
static

Complete a treeview edit.

Complete edit by informing the client with a change request msg

Parameters
treeTreeview object to complete edit in

Definition at line 1633 of file treeview.c.

References treeview::callbacks, treeview_node::client_data, treeview::edit, treeview_callback_table::entry, treeview_edit::field, treeview_callback_table::folder, treeview_node_msg::msg, treeview_edit::node, treeview_edit::textarea, textarea_get_text(), TREE_MSG_NODE_EDIT, TREE_NODE_ENTRY, TREE_NODE_FOLDER, TREE_NODE_ROOT, treeview_edit_cancel(), and treeview_node::type.

Referenced by treeview_keypress().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_edit_node_at_point()

static bool treeview_edit_node_at_point ( treeview tree,
treeview_node n,
int  node_y,
int  mouse_x,
int  mouse_y,
struct rect rect 
)
static

Start edit of node field, at given y-coord, if editable.

Parameters
treeTreeview object to consider editing in
nThe treeview node to try editing
node_yThe Y coord of the top of n
mouse_xX coord of mouse position
mouse_yY coord of mouse position
rectRedraw rectangle (if redraw required)
Returns
true iff redraw required

Definition at line 4281 of file treeview.c.

References BROWSER_MOUSE_CLICK_1, BROWSER_MOUSE_PRESS_1, treeview_text::data, treeview::edit, treeview_field::field, treeview_edit::field, treeview_node_entry::fields, treeview::fields, treeview_field::flags, treeview_edit::h, treeview_node::height, height, treeview_globals::icon_step, treeview_node::inset, treeview_globals::line_height, mouse_x, mouse_y, treeview::n_fields, treeview_edit::node, plot_style_odd, treeview_globals::step_width, treeview_node::text, treeview_node_style::text, treeview_edit::textarea, textarea_destroy(), textarea_mouse_action(), textarea_set_text(), TREE_FLAG_ALLOW_EDIT, tree_g, TREE_NODE_ENTRY, treeview__create_textarea(), treeview__cw_get_window_dimensions(), treeview_textarea_callback(), treeview_node::type, treeview_field::value, treeview_edit::w, width, treeview_edit::x, rect::x0, rect::x1, treeview_edit::y, rect::y0, and rect::y1.

Referenced by treeview_edit_selection(), and treeview_node_mouse_action_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_edit_selection()

void treeview_edit_selection ( treeview tree)

Edit the first selected node.

Parameters
treeTreeview object to edit selected node in

Definition at line 4389 of file treeview.c.

References treeview_globals::line_height, REDRAW_MAX, treeview::root, tree_g, treeview__cw_invalidate_area(), treeview_edit_node_at_point(), treeview_get_first_selected(), treeview_node_y(), rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by hotlist_edit_selection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_expand()

nserror treeview_expand ( treeview tree,
bool  only_folders 
)

Expand a treeview's nodes.

Parameters
treeTreeview object to expand nodes in
only_foldersIff true, only folders are expanded.
Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 2525 of file treeview.c.

References treeview_node::height, NSERROR_OK, treeview_expand_data::only_folders, REDRAW_MAX, treeview::root, treeview_expand_data::tree, treeview__cw_invalidate_area(), treeview_expand_cb(), treeview_walk_internal(), TREEVIEW_WALK_MODE_LOGICAL_COMPLETE, rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by cookie_manager_expand(), global_history_expand(), and hotlist_expand().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_expand_cb()

static nserror treeview_expand_cb ( treeview_node n,
void *  ctx,
bool *  skip_children,
bool *  end 
)
static

Treewalk node callback for handling recursive node expansion.

Parameters
ncurrent node
ctxnode expansion context
skip_childrenflag to allow children to be skipped
endflag to allow iteration to be finished early.
Returns
NSERROR_OK on success else error code.

Definition at line 2501 of file treeview.c.

References treeview_node::flags, NSERROR_OK, treeview_expand_data::only_folders, treeview_expand_data::tree, TREE_NODE_FOLDER, TREE_NODE_ROOT, treeview_node_expand_internal(), TV_NFLAGS_EXPANDED, and treeview_node::type.

Referenced by treeview_expand().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_fini()

nserror treeview_fini ( void  )

Finalise the treeview module (all treeviews must have been destroyed first)

Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 5384 of file treeview.c.

References netsurf_table::bitmap, treeview_node_style::bmp, gui_bitmap_table::destroy, treeview_node_style::furn, guit, hlcache_handle_release(), treeview_globals::initialised, NSERROR_OK, NSLOG, plot_style_even, plot_style_odd, treeview_node_style::sel, TREE_FURN_CONTRACT, TREE_FURN_EXPAND, tree_g, TREE_RES_LAST, and treeview_res.

Referenced by cookie_manager_fini(), global_history_fini(), and hotlist_fini().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_generate_copy_bitmap()

static struct bitmap * treeview_generate_copy_bitmap ( struct bitmap orig,
int  size 
)
static

Create bitmap copy of another bitmap.

Parameters
origbitmap to copy
sizerequired bitmap size

Definition at line 5174 of file treeview.c.

References netsurf_table::bitmap, BITMAP_OPAQUE, gui_bitmap_table::create, gui_bitmap_table::get_buffer, gui_bitmap_table::get_height, gui_bitmap_table::get_rowstride, gui_bitmap_table::get_width, guit, gui_bitmap_table::modified, and bitmap::size.

Referenced by treeview_init_furniture().

Here is the caller graph for this function:

◆ treeview_generate_rotate_bitmap()

static struct bitmap * treeview_generate_rotate_bitmap ( struct bitmap orig,
int  size 
)
static

Create bitmap from rotation of another bitmap.

Parameters
origbitmap to create rotation of
sizerequired bitmap size

Definition at line 5219 of file treeview.c.

References netsurf_table::bitmap, BITMAP_OPAQUE, gui_bitmap_table::create, gui_bitmap_table::get_buffer, gui_bitmap_table::get_height, gui_bitmap_table::get_rowstride, gui_bitmap_table::get_width, guit, gui_bitmap_table::modified, and bitmap::size.

Referenced by treeview_init_furniture().

Here is the caller graph for this function:

◆ treeview_generate_triangle_bitmap()

static struct bitmap * treeview_generate_triangle_bitmap ( colour  bg,
colour  fg,
int  size 
)
static

Create a right-pointing anti-aliased triangle bitmap.

Parameters
bgbackground colour
fgforeground colour
sizerequired bitmap size

Definition at line 5063 of file treeview.c.

References netsurf_table::bitmap, BITMAP_OPAQUE, blend_colour, blue_from_colour, gui_bitmap_table::create, gui_bitmap_table::get_buffer, gui_bitmap_table::get_rowstride, green_from_colour, guit, mix_colour, gui_bitmap_table::modified, red_from_colour, and bitmap::size.

Referenced by treeview_init_furniture().

Here is the caller graph for this function:

◆ treeview_get_first_selected()

static treeview_node * treeview_get_first_selected ( treeview tree)
static

Get first selected node (in any)

Parameters
treeTreeview object in which to create folder
Returns
the first selected treeview node, or NULL

Definition at line 3347 of file treeview.c.

References treeview_selection_walk_data::data, treeview_selection_walk_data::first, treeview_selection_walk_data::n, treeview_selection_walk_data::purpose, treeview::root, treeview_selection_walk_data::tree, treeview_node_selection_walk_cb(), treeview_selection_walk_data::TREEVIEW_WALK_GET_FIRST_SELECTED, treeview_walk_internal(), and TREEVIEW_WALK_MODE_DISPLAY.

Referenced by treeview_edit_selection(), treeview_get_relation(), and treeview_get_selection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_get_height()

int treeview_get_height ( treeview tree)

Find current height of a treeview.

Parameters
treeTreeview object to find height of
Returns
height of treeview in px

Definition at line 4908 of file treeview.c.

References height, treeview::root, treeview_mouse_action::search_height, treeview_mouse_action::tree, treeview__cw_update_size(), treeview__get_display_height(), and treeview__get_search_height().

Referenced by cookie_manager_init(), global_history_init(), and hotlist_manager_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_get_relation()

nserror treeview_get_relation ( treeview tree,
treeview_node **  relation,
enum treeview_relationship rel,
bool  at_y,
int  y 
)

Find a relation for node creation.

If at_y is set, we find a relation that will put the created node at that position.

If at_y is unset, we find a relation that would put the node below the first selected node, or at the end of the treeview if no nodes selected.

Parameters
treeTreeview object in which to create folder
relationExisting node to insert as relation of, or NULL
relFolder's relationship to relation
at_yIff true, insert at y-offset
yY-offset in px from top of hotlist. Ignored if (!at_y).
Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 3776 of file treeview.c.

References treeview_node::children, treeview_node::next_sib, NSERROR_OK, treeview_node::parent, treeview_node::prev_sib, treeview::root, treeview_launch_walk_data::tree, TREE_REL_FIRST_CHILD, TREE_REL_NEXT_SIBLING, treeview_get_first_selected(), and treeview_y_node().

Referenced by hotlist_add_entry(), and hotlist_add_folder().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_get_selection()

enum treeview_node_type treeview_get_selection ( treeview tree,
void **  node_data 
)

Get the first selected node.

Parameters
treeTreeview object to get selected node in
node_dataClient data for the selected treeview node, or NULL
Returns
node type of first selected node.

Definition at line 3363 of file treeview.c.

References treeview_node::client_data, treeview_selection_walk_data::n, treeview_selection_walk_data::tree, TREE_NODE_ENTRY, TREE_NODE_FOLDER, TREE_NODE_NONE, treeview_get_first_selected(), and treeview_node::type.

Referenced by global_history_get_selection(), and hotlist_get_selection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_get_text_for_field()

static struct treeview_text * treeview_get_text_for_field ( treeview tree,
treeview_node n,
int  i 
)
inlinestatic

Helper function to access the given field of a node.

Parameters
treeTreeview that node belongs to
nNode to get field from
iIndex of field of interest
Returns
text entry for field or NULL.

Definition at line 476 of file treeview.c.

References treeview_node_entry::fields, treeview_node::text, TREE_NODE_ENTRY, treeview_node::type, and treeview_field::value.

Referenced by treeview_node_selection_walk_cb().

Here is the caller graph for this function:

◆ treeview_has_selection()

bool treeview_has_selection ( treeview tree)

Determine whether treeview has a selection.

Parameters
treeTreeview object to delete node from
Returns
true iff treeview has a selection

Definition at line 3326 of file treeview.c.

References treeview_selection_walk_data::data, treeview_selection_walk_data::has_selection, treeview_selection_walk_data::purpose, treeview::root, treeview_selection_walk_data::tree, treeview_node_selection_walk_cb(), treeview_selection_walk_data::TREEVIEW_WALK_HAS_SELECTION, treeview_walk_internal(), and TREEVIEW_WALK_MODE_DISPLAY.

Referenced by cookie_manager_has_selection(), global_history_has_selection(), and hotlist_has_selection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_init()

nserror treeview_init ( void  )

Prepare treeview module for treeview usage.

Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 5335 of file treeview.c.

References treeview_globals::furniture_width, treeview_globals::icon_size, treeview_globals::icon_step, treeview_globals::initialised, treeview_globals::line_height, treeview_globals::move_offset, nscss_screen_dpi, NSERROR_OK, NSLOG, nsoption_int, PLOT_STYLE_SCALE, treeview_globals::step_width, tree_g, treeview_init_furniture(), treeview_init_plot_styles(), treeview_init_resources(), and treeview_globals::window_padding.

Referenced by cookie_manager_init(), global_history_init(), and hotlist_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_init_furniture()

static nserror treeview_init_furniture ( void  )
static

Measures width of characters used to represent treeview furniture.

Returns
NSERROR_OK on success else error code

Definition at line 5279 of file treeview.c.

References treeview_node_style::bg, treeview_node_style::bmp, plot_style_s::fill_colour, plot_font_style::foreground, treeview_node_style::furn, treeview_globals::furniture_width, treeview_node_style::itext, treeview_globals::line_height, NSERROR_NOMEM, NSERROR_OK, plot_style_even, plot_style_odd, treeview_node_style::sbg, treeview_node_style::sel, treeview_node_style::sitext, treeview_node_style::size, bitmap::size, TREE_FURN_CONTRACT, TREE_FURN_EXPAND, tree_g, treeview_generate_copy_bitmap(), treeview_generate_rotate_bitmap(), and treeview_generate_triangle_bitmap().

Referenced by treeview_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_init_plot_styles()

static nserror treeview_init_plot_styles ( int  font_pt_size)
static

◆ treeview_init_resources()

static void treeview_init_resources ( void  )
static

Fetch content resources used by treeview.

Definition at line 5035 of file treeview.c.

References treeview_resource::c, CONTENT_IMAGE, treeview_resource::height, hlcache_handle_retrieve(), NSERROR_OK, nsurl_create(), nsurl_unref(), treeview_resource::ready, TREE_RES_LAST, treeview_res, treeview_res_cb(), and treeview_resource::url.

Referenced by treeview_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_insert_node()

static void treeview_insert_node ( treeview tree,
treeview_node a,
treeview_node b,
enum treeview_relationship  rel 
)
inlinestatic

Insert a treeview node into a treeview.

Parameters
treethe treeview to insert node into.
aparentless node to insert
btree node to insert a as a relation of
relThe relationship between a and b

Definition at line 1133 of file treeview.c.

References treeview_node::children, treeview_text::data, treeview_node::flags, guit, treeview_node::height, height, treeview_node::inset, netsurf_table::layout, treeview_text::len, treeview_node::next_sib, treeview_node::parent, plot_style_odd, treeview_node::prev_sib, treeview_globals::step_width, treeview_node::text, treeview_node_style::text, tree_g, TREE_NODE_ENTRY, TREE_NODE_ROOT, TREE_REL_FIRST_CHILD, TREE_REL_NEXT_SIBLING, treeview_set_inset_from_parent(), treeview_walk_internal(), TREEVIEW_WALK_MODE_LOGICAL_COMPLETE, TV_NFLAGS_EXPANDED, treeview_node::type, treeview_text::width, and gui_layout_table::width.

Referenced by treeview_create_node_entry(), treeview_create_node_folder(), and treeview_move_selection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_keyboard_navigation()

static bool treeview_keyboard_navigation ( treeview tree,
uint32_t  key,
struct rect rect 
)
static

Handle keyboard navigation.

Note
Selected entries are launched. Entries that are descendants of selected folders are also launched.
Parameters
treeTreeview object to launch selected nodes in
keyThe ucs4 character codepoint
rectUpdated to redraw rectangle
Returns
true if treeview needs redraw, false otherwise

Definition at line 3889 of file treeview.c.

References treeview_node::children, treeview_nav_state::curr, treeview_node::flags, treeview_nav_state::last, treeview_nav_state::next, NS_KEY_DOWN, NS_KEY_LEFT, NS_KEY_RIGHT, NS_KEY_UP, treeview_node::parent, treeview_nav_state::prev, REDRAW_MAX, treeview::root, treeview_search::search, treeview::search, treeview_nav_state::tree, TREE_NODE_ROOT, treeview__cw_scroll_to_node(), treeview__get_display_height(), treeview__get_search_height(), treeview_clear_selection(), treeview_node_contract_internal(), treeview_node_expand_internal(), treeview_node_nav_cb(), treeview_walk_internal(), TREEVIEW_WALK_MODE_DISPLAY, TV_NFLAGS_EXPANDED, TV_NFLAGS_SELECTED, treeview_node::type, rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by treeview_keypress().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_keypress()

bool treeview_keypress ( treeview tree,
uint32_t  key 
)

Key press handling for treeviews.

Parameters
treeThe treeview which got the keypress
keyThe ucs4 character codepoint
Returns
true if the keypress is dealt with, false otherwise.

< Redraw rectangle

Definition at line 4006 of file treeview.c.

References treeview_search::active, treeview::edit, treeview::flags, treeview_node::height, NS_KEY_CLEAR_SELECTION, NS_KEY_COPY_SELECTION, NS_KEY_CR, NS_KEY_DELETE_LEFT, NS_KEY_DELETE_RIGHT, NS_KEY_DOWN, NS_KEY_ESCAPE, NS_KEY_LEFT, NS_KEY_NL, NS_KEY_RIGHT, NS_KEY_SELECT_ALL, NS_KEY_UP, treeview::root, treeview::search, treeview_edit::textarea, treeview_search::textarea, textarea_keypress(), treeview__cw_invalidate_area(), treeview__cw_update_size(), treeview__search_cancel(), treeview_clear_selection(), treeview_copy_selection(), TREEVIEW_DEL_EMPTY_DIRS, treeview_delete_empty_nodes(), treeview_delete_selection(), treeview_edit_cancel(), treeview_edit_done(), treeview_keyboard_navigation(), treeview_launch_selection(), treeview_select_all(), and rect::y0.

Referenced by cookie_manager_keypress(), global_history_keypress(), and hotlist_keypress().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_launch_selection()

static nserror treeview_launch_selection ( treeview tree)
static

Launch a selection.

Note
Selected entries are launched. Entries that are descendants of selected folders are also launched.
Parameters
treeTreeview object to launch selected nodes in
Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 3757 of file treeview.c.

References treeview::root, treeview_launch_walk_data::selected_depth, treeview_launch_walk_data::tree, treeview_node_launch_walk_bwd_cb(), treeview_node_launch_walk_fwd_cb(), treeview_walk_internal(), and TREEVIEW_WALK_MODE_LOGICAL_COMPLETE.

Referenced by treeview_keypress().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_mouse_action()

void treeview_mouse_action ( treeview tree,
browser_mouse_state  mouse,
int  x,
int  y 
)

Handles all kinds of mouse action.

Parameters
treeTreeview object
mouseThe current mouse state
xX coordinate
yY coordinate

Definition at line 4723 of file treeview.c.

References treeview_search::active, BROWSER_MOUSE_DRAG_1, BROWSER_MOUSE_DRAG_2, BROWSER_MOUSE_HOVER, BROWSER_MOUSE_LEAVE, BROWSER_MOUSE_PRESS_1, BROWSER_MOUSE_PRESS_2, CORE_WINDOW_DRAG_NONE, CORE_WINDOW_DRAG_SELECTION, treeview::drag, treeview::edit, treeview_node::flags, treeview_node::height, treeview_globals::icon_size, treeview_globals::line_height, treeview_mouse_action::mouse, treeview::move, treeview_pos::node_h, treeview_pos::node_y, treeview_drag::part, treeview_drag::prev, REDRAW_MAX, treeview::root, treeview::search, treeview_mouse_action::search_height, treeview_drag::selected, treeview_drag::start, treeview_drag::start_node, treeview_move::target, treeview_move::target_pos, treeview_edit::textarea, treeview_search::textarea, textarea_mouse_action(), textarea_set_caret(), treeview_mouse_action::tree, tree_g, treeview__cw_drag_status(), treeview__cw_invalidate_area(), treeview__get_display_height(), treeview__get_search_height(), treeview_clear_selection(), treeview_commit_selection_drag(), treeview_edit_cancel(), treeview_move_selection(), treeview_node_mouse_action_cb(), treeview_walk_internal(), TREEVIEW_WALK_MODE_DISPLAY, TV_NFLAGS_SELECTED, TV_NODE_PART_NONE, TV_TARGET_NONE, treeview_drag::type, treeview_globals::window_padding, treeview_pos::x, treeview_edit::x, treeview_mouse_action::x, rect::x0, rect::x1, treeview_pos::y, treeview_edit::y, treeview_mouse_action::y, rect::y0, and rect::y1.

Referenced by cookie_manager_mouse_action(), global_history_mouse_action(), and hotlist_mouse_action().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_move_selection()

static nserror treeview_move_selection ( treeview tree,
struct rect rect 
)
static

Move a selection according to the current move drag.

Parameters
treeTreeview object to move selected nodes in
rectRedraw rectangle
Returns
NSERROR_OK on success else appropriate error code

Definition at line 3590 of file treeview.c.

References treeview_node::children, treeview_node::flags, treeview_node::height, height, treeview::move, treeview_node::next_sib, NSERROR_BAD_PARAMETER, NSERROR_OK, NSLOG, treeview_node::parent, parent, treeview_node::prev_sib, REDRAW_MAX, treeview_move::root, treeview::root, treeview_move::target, treeview_move::target_pos, treeview_selection_walk_data::tree, TREE_REL_FIRST_CHILD, TREE_REL_NEXT_SIBLING, treeview__cw_update_size(), treeview_insert_node(), treeview_move_yank_selection(), treeview_node_contract_internal(), TV_NFLAGS_EXPANDED, TV_TARGET_ABOVE, TV_TARGET_BELOW, TV_TARGET_INSIDE, TV_TARGET_NONE, rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by treeview_mouse_action().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_move_yank_selection()

static void treeview_move_yank_selection ( treeview tree,
treeview_node fixed 
)
static

Yank a selection to the node move list.

Parameters
treeTreeview object to yank selection from
fixedTreeview node that should not be yanked

Definition at line 3472 of file treeview.c.

References treeview_selection_walk_data::data, treeview_selection_walk_data::fixed, treeview_selection_walk_data::prev, treeview_selection_walk_data::purpose, treeview::root, treeview_selection_walk_data::tree, treeview_node_selection_walk_cb(), treeview_walk_internal(), TREEVIEW_WALK_MODE_DISPLAY, treeview_selection_walk_data::TREEVIEW_WALK_YANK_SELECTION, and treeview_selection_walk_data::yank.

Referenced by treeview_move_selection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_node_contract()

nserror treeview_node_contract ( treeview tree,
treeview_node node 
)

Contract a treeview node.

Parameters
treeTreeview object to contract node in
nodeNode to contract
Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 2415 of file treeview.c.

References NSERROR_OK, NSLOG, treeview_contract_data::tree, treeview__redraw_from_node(), and treeview_node_contract_internal().

Here is the call graph for this function:

◆ treeview_node_contract_cb()

static nserror treeview_node_contract_cb ( treeview_node n,
void *  ctx,
bool *  end 
)
static

Treewalk node callback for handling node contraction.

Parameters
nnode
ctxcontract iterator context
endflag to end iteration now
Returns
NSERROR_OK on success else appropriate error code

Definition at line 2324 of file treeview.c.

References treeview_node::flags, treeview_node::height, treeview_search::height, treeview_globals::line_height, NSERROR_OK, treeview_contract_data::only_entries, treeview_node::parent, treeview_search::search, treeview::search, treeview_contract_data::tree, tree_g, TREE_NODE_ENTRY, TREE_NODE_FOLDER, TREE_NODE_ROOT, TV_NFLAGS_EXPANDED, and treeview_node::type.

Referenced by treeview_contract(), and treeview_node_contract_internal().

Here is the caller graph for this function:

◆ treeview_node_contract_internal()

static nserror treeview_node_contract_internal ( treeview tree,
treeview_node node 
)
static

Contract a treeview node.

Parameters
treeTreeview object to contract node in
nodeNode to contract
Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 2381 of file treeview.c.

References treeview_node::flags, NSERROR_OK, NSLOG, treeview_contract_data::only_entries, treeview_contract_data::tree, treeview__cw_update_size(), treeview__get_display_height(), treeview_node_contract_cb(), treeview_walk_internal(), TREEVIEW_WALK_MODE_LOGICAL_EXPANDED, TV_NFLAGS_EXPANDED, and TV_NFLAGS_SELECTED.

Referenced by treeview_keyboard_navigation(), treeview_move_selection(), treeview_node_contract(), and treeview_node_mouse_action_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_node_expand()

nserror treeview_node_expand ( treeview tree,
treeview_node node 
)

Expand a treeview node.

Parameters
treeTreeview object to expand node in
nodeNode to expand
Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 2291 of file treeview.c.

References NSERROR_OK, NSLOG, treeview__redraw_from_node(), and treeview_node_expand_internal().

Referenced by global_history_init(), and hotlist_add_url().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_node_expand_internal()

static nserror treeview_node_expand_internal ( treeview tree,
treeview_node node 
)
static

Expand a treeview's nodes.

Parameters
treeTreeview object to expand nodes in
nodeThe node to expand.
Returns
NSERROR_OK on success, appropriate error otherwise.

Definition at line 2196 of file treeview.c.

References treeview_node::children, treeview_text::data, treeview_node_entry::fields, treeview_node::flags, guit, treeview_node::height, treeview_search::height, netsurf_table::layout, treeview_text::len, treeview_globals::line_height, treeview::n_fields, treeview_node::next_sib, NSERROR_OK, NSLOG, treeview_node::parent, plot_style_odd, treeview_search::search, treeview::search, treeview_node::text, treeview_node_style::text, tree_g, TREE_NODE_ENTRY, TREE_NODE_FOLDER, TREE_NODE_NONE, TREE_NODE_ROOT, treeview__cw_update_size(), treeview__get_display_height(), TV_NFLAGS_EXPANDED, TV_NFLAGS_MATCHED, treeview_node::type, treeview_field::value, treeview_text::width, and gui_layout_table::width.

Referenced by treeview_expand_cb(), treeview_keyboard_navigation(), treeview_node_expand(), and treeview_node_mouse_action_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_node_launch_walk_bwd_cb()

static nserror treeview_node_launch_walk_bwd_cb ( treeview_node n,
void *  ctx,
bool *  end 
)
static

Treewalk node walk backward callback for tracking folder selection.

Definition at line 3702 of file treeview.c.

References treeview_node::flags, NSERROR_OK, treeview_launch_walk_data::selected_depth, TREE_NODE_FOLDER, TV_NFLAGS_SELECTED, and treeview_node::type.

Referenced by treeview_launch_selection().

Here is the caller graph for this function:

◆ treeview_node_launch_walk_fwd_cb()

static nserror treeview_node_launch_walk_fwd_cb ( treeview_node n,
void *  ctx,
bool *  skip_children,
bool *  end 
)
static

Treewalk node walk forward callback for launching nodes.

Parameters
ncurrent node
ctxnode launch context
skip_childrenflag to allow children to be skipped
endflag to allow iteration to be finished early.
Returns
NSERROR_OK on success else error code.

Definition at line 3724 of file treeview.c.

References BROWSER_MOUSE_HOVER, treeview::callbacks, treeview_node::client_data, treeview_callback_table::entry, treeview_node::flags, treeview_node_msg::msg, NSERROR_OK, treeview_launch_walk_data::selected_depth, treeview_launch_walk_data::tree, TREE_MSG_NODE_LAUNCH, TREE_NODE_ENTRY, TREE_NODE_FOLDER, TV_NFLAGS_SELECTED, and treeview_node::type.

Referenced by treeview_launch_selection().

Here is the caller graph for this function:

◆ treeview_node_mouse_action_cb()

static nserror treeview_node_mouse_action_cb ( treeview_node node,
void *  ctx,
bool *  skip_children,
bool *  end 
)
static

Treewalk node callback for handling mouse action.

Parameters
nodecurrent node
ctxnode context
skip_childrenflag to allow children to be skipped
endflag to allow iteration to be finished early.
Returns
NSERROR_OK on success else error code.

Definition at line 4447 of file treeview.c.

References BROWSER_MOUSE_CLICK_1, BROWSER_MOUSE_CLICK_2, BROWSER_MOUSE_DOUBLE_CLICK, BROWSER_MOUSE_DRAG_1, BROWSER_MOUSE_DRAG_2, BROWSER_MOUSE_MOD_1, BROWSER_MOUSE_MOD_2, BROWSER_MOUSE_MOD_3, BROWSER_MOUSE_PRESS_1, BROWSER_MOUSE_PRESS_2, treeview::callbacks, treeview_node::client_data, CORE_WINDOW_DRAG_MOVE, CORE_WINDOW_DRAG_SELECTION, treeview_mouse_action::current_y, treeview::drag, treeview_callback_table::entry, treeview::field_width, treeview_node_entry::fields, treeview::fields, treeview_field::flags, treeview_node::flags, treeview::flags, treeview_node::height, height, treeview_globals::icon_step, treeview_node::inset, treeview_globals::line_height, treeview_mouse_action::mouse, treeview_node_msg::msg, treeview::n_fields, treeview_pos::node_h, treeview_pos::node_y, NSERROR_OK, treeview_drag::part, treeview_drag::prev, REDRAW_MAX, treeview_search::search, treeview::search, treeview_mouse_action::search_height, treeview_drag::selected, treeview_drag::start, treeview_drag::start_node, treeview_globals::step_width, treeview_node::text, treeview_mouse_action::tree, TREE_FLAG_SHOW_NAME, tree_g, TREE_MSG_NODE_LAUNCH, TREE_NODE_ENTRY, TREE_NODE_FOLDER, treeview__cw_drag_status(), treeview__cw_invalidate_area(), treeview__get_display_height(), treeview_clear_selection(), treeview_edit_node_at_point(), TREEVIEW_NO_MOVES, treeview_node_contract_internal(), treeview_node_expand_internal(), treeview_propagate_selection(), treeview_set_move_indicator(), TV_NFLAGS_EXPANDED, TV_NFLAGS_SELECTED, TV_NODE_PART_NONE, TV_NODE_PART_ON_NODE, TV_NODE_PART_TOGGLE, treeview_node::type, treeview_drag::type, treeview_field::value, treeview_text::width, treeview_globals::window_padding, treeview_pos::x, treeview_mouse_action::x, rect::x0, rect::x1, treeview_pos::y, treeview_mouse_action::y, rect::y0, and rect::y1.

Referenced by treeview_mouse_action().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_node_nav_cb()

static nserror treeview_node_nav_cb ( treeview_node node,
void *  ctx,
bool *  skip_children,
bool *  end 
)
static

Treewalk node callback for handling mouse action.

Parameters
nodecurrent node
ctxnode context
skip_childrenflag to allow children to be skipped
endflag to allow iteration to be finished early.
Returns
NSERROR_OK on success else error code.

Definition at line 3846 of file treeview.c.

References treeview_nav_state::curr, treeview_node::flags, treeview_nav_state::last, treeview_nav_state::n_selected, treeview_nav_state::next, NSERROR_OK, treeview_nav_state::prev, treeview_nav_state::prev_n_selected, treeview::root, treeview_nav_state::tree, and TV_NFLAGS_SELECTED.

Referenced by treeview_keyboard_navigation().

Here is the caller graph for this function:

◆ treeview_node_next()

static treeview_node * treeview_node_next ( treeview_node node,
bool  full 
)
inlinestatic

Find the next node in depth first tree order.

Parameters
nodeStart node
fullIff true, visit children of collapsed nodes
Returns
next node, or NULL if node is last node

Definition at line 498 of file treeview.c.

References treeview_node::children, treeview_node::flags, treeview_node::next_sib, treeview_node::parent, TREE_NODE_ROOT, TV_NFLAGS_EXPANDED, and treeview_node::type.

Referenced by treeview_node_y(), and treeview_y_node().

Here is the caller graph for this function:

◆ treeview_node_selection_walk_cb()

static nserror treeview_node_selection_walk_cb ( treeview_node n,
void *  ctx,
bool *  skip_children,
bool *  end 
)
static

Treewalk node callback for handling selection related actions.

Parameters
ncurrent node
ctxnode selection context
skip_childrenflag to allow children to be skipped
endflag to allow iteration to be finished early.
Returns
NSERROR_OK on success else error code.

Definition at line 3161 of file treeview.c.

References treeview_selection_walk_data::copy, treeview_selection_walk_data::current_y, treeview_text::data, treeview_selection_walk_data::data, treeview_selection_walk_data::drag, treeview::fields, treeview_selection_walk_data::first, treeview_selection_walk_data::fixed, treeview_field::flags, treeview_node::flags, treeview_selection_walk_data::has_selection, treeview_node::height, height, treeview_text::len, treeview_selection_walk_data::len, treeview_globals::line_height, treeview::move, treeview_selection_walk_data::n, treeview::n_fields, treeview_node::next_sib, NSERROR_NOMEM, NSERROR_OK, treeview_node::parent, treeview_selection_walk_data::prev, treeview_node::prev_sib, treeview_selection_walk_data::purpose, treeview_selection_walk_data::rect, treeview_selection_walk_data::redraw, treeview_selection_walk_data::required, treeview_move::root, treeview_selection_walk_data::sel_max, treeview_selection_walk_data::sel_min, treeview_selection_walk_data::text, text(), treeview_selection_walk_data::tree, TREE_FLAG_COPY_TEXT, tree_g, TREE_NODE_ENTRY, TREE_OPTION_NONE, treeview_delete_node_internal(), treeview_get_text_for_field(), treeview_unlink_node(), treeview_selection_walk_data::TREEVIEW_WALK_CLEAR_SELECTION, treeview_selection_walk_data::TREEVIEW_WALK_COMMIT_SELECT_DRAG, treeview_selection_walk_data::TREEVIEW_WALK_COPY_SELECTION, treeview_selection_walk_data::TREEVIEW_WALK_DELETE_SELECTION, treeview_selection_walk_data::TREEVIEW_WALK_GET_FIRST_SELECTED, treeview_selection_walk_data::TREEVIEW_WALK_HAS_SELECTION, treeview_selection_walk_data::TREEVIEW_WALK_PROPAGATE_SELECTION, treeview_selection_walk_data::TREEVIEW_WALK_SELECT_ALL, treeview_selection_walk_data::TREEVIEW_WALK_YANK_SELECTION, TV_NFLAGS_EXPANDED, TV_NFLAGS_SELECTED, treeview_node::type, rect::y0, rect::y1, and treeview_selection_walk_data::yank.

Referenced by treeview_clear_selection(), treeview_commit_selection_drag(), treeview_copy_selection(), treeview_delete_selection(), treeview_get_first_selected(), treeview_has_selection(), treeview_move_yank_selection(), treeview_propagate_selection(), and treeview_select_all().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_node_y()

static int treeview_node_y ( const treeview tree,
const treeview_node node 
)
static

Find y position of the top of a node.

Parameters
treeTreeview object to delete node from
nodeNode to get position of
Returns
node's y position

Definition at line 565 of file treeview.c.

References treeview_node::height, treeview_globals::line_height, treeview::root, tree_g, TREE_NODE_ENTRY, treeview__get_search_height(), treeview_node_next(), and treeview_node::type.

Referenced by treeview__cw_scroll_to_node(), treeview__redraw_from_node(), treeview_create_node_entry(), treeview_create_node_folder(), treeview_delete_node(), treeview_edit_selection(), treeview_set_move_indicator(), treeview_update_node_entry(), and treeview_update_node_folder().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_propagate_selection()

static bool treeview_propagate_selection ( treeview tree,
struct rect rect 
)
static

Propagate selection to visible descendants of selected nodes.

Parameters
treeTreeview object to propagate selection in
rectRedraw rectangle (if redraw required)
Returns
true iff redraw required

Definition at line 3557 of file treeview.c.

References treeview_selection_walk_data::current_y, treeview_selection_walk_data::data, treeview_selection_walk_data::purpose, treeview_selection_walk_data::rect, treeview_selection_walk_data::redraw, REDRAW_MAX, treeview_selection_walk_data::required, treeview::root, treeview_selection_walk_data::tree, treeview__get_search_height(), treeview_node_selection_walk_cb(), treeview_walk_internal(), TREEVIEW_WALK_MODE_DISPLAY, treeview_selection_walk_data::TREEVIEW_WALK_PROPAGATE_SELECTION, rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by treeview_node_mouse_action_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_redraw()

void treeview_redraw ( treeview tree,
int  x,
int  y,
struct rect clip,
const struct redraw_context ctx 
)

Redraw a treeview object.

Parameters
treeTreeview object to render
xX coordinate to render treeview at
yY coordinate to render treeview at
clipCurrent clip rectangle (wrt tree origin)
ctxCurrent redraw context

Definition at line 2997 of file treeview.c.

References content_redraw_data::background_colour, treeview_node_style::bg, clip(), plotter_table::clip, content_redraw(), treeview::edit, plot_style_s::fill_colour, treeview_node::flags, treeview::flags, treeview_resource::height, content_redraw_data::height, treeview_globals::icon_size, treeview_globals::icon_step, knockout_plot_end(), knockout_plot_start(), treeview_globals::line_height, treeview::move, plotter_table::option_knockout, redraw_context::plot, plot_style_even, treeview_resource::ready, plotter_table::rectangle, content_redraw_data::repeat_x, content_redraw_data::repeat_y, treeview::root, content_redraw_data::scale, treeview_search::search, treeview::search, treeview_move::target_area, treeview_move::target_pos, treeview_edit::textarea, treeview_search::textarea, textarea_redraw(), tree_g, TREE_RES_ARROW, TREE_RES_SEARCH, treeview_redraw_search(), treeview_redraw_tree(), treeview_res, TREEVIEW_SEARCHABLE, TV_NFLAGS_EXPANDED, TV_TARGET_NONE, content_redraw_data::width, treeview_globals::window_padding, treeview_edit::x, content_redraw_data::x, rect::x0, rect::x1, treeview_edit::y, content_redraw_data::y, rect::y0, and rect::y1.

Referenced by cookie_manager_redraw(), global_history_redraw(), and hotlist_redraw().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_redraw_search()

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 
)
static

Draw a treeview normally, in tree mode.

Parameters
[in]treeThe treeview we're rendering.
[in]xX coordinate we're rendering the treeview at.
[in]yY coordinate we're rendering the treeview at.
[in,out]render_yCurrent vertical position in tree, updated on exit.
[in]rClip rectangle.
[in]dataRedraw data for rendering contents.
[in]ctxCurrent render context.

Definition at line 2784 of file treeview.c.

References content_redraw_data::background_colour, treeview_node_style::bg, plotter_table::bitmap, BITMAPF_NONE, treeview_node_style::bmp, treeview_node::children, content_redraw(), count(), treeview_text::data, treeview::drag, treeview::field_width, treeview_node_entry::fields, treeview::fields, plot_style_s::fill_colour, treeview_field::flags, treeview_node::flags, treeview_node_style::furn, treeview_node::height, treeview_resource::height, height, treeview_globals::icon_step, treeview_node_style::itext, treeview_text::len, treeview_globals::line_height, treeview::n_fields, treeview_node::next_sib, treeview_node::parent, redraw_context::plot, plot_style_even, plot_style_odd, treeview_drag::prev, plotter_table::rectangle, treeview::root, root, treeview_node_style::sbg, treeview_node_style::sel, treeview_node_style::sitext, treeview_node_style::size, treeview_drag::start, treeview_globals::step_width, treeview_node_style::stext, treeview_node::text, treeview_node_style::text, plotter_table::text, TREE_FLAG_SHOW_NAME, TREE_FURN_CONTRACT, TREE_FURN_EXPAND, tree_g, TREE_NODE_ENTRY, TREE_NODE_FOLDER, TREE_RES_CONTENT, TREE_RES_FOLDER, TREE_RES_FOLDER_SPECIAL, treeview_res, TV_NFLAGS_EXPANDED, TV_NFLAGS_MATCHED, TV_NFLAGS_SELECTED, TV_NFLAGS_SPECIAL, treeview_node::type, treeview_drag::type, treeview_field::value, treeview_text::width, treeview_globals::window_padding, content_redraw_data::x, rect::x0, rect::x1, treeview_pos::y, content_redraw_data::y, rect::y0, and rect::y1.

Referenced by treeview_redraw().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_redraw_tree()

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 
)
static

Draw a treeview normally, in tree mode.

Parameters
[in]treeThe treeview we're rendering.
[in]xX coordinate we're rendering the treeview at.
[in]yY coordinate we're rendering the treeview at.
[in,out]render_yCurrent vertical position in tree, updated on exit.
[in]rClip rectangle.
[in]dataRedraw data for rendering contents.
[in]ctxCurrent render context.

Definition at line 2565 of file treeview.c.

References content_redraw_data::background_colour, treeview_node_style::bg, plotter_table::bitmap, BITMAPF_NONE, treeview_node_style::bmp, treeview_node::children, content_redraw(), count(), treeview_text::data, treeview::drag, treeview::field_width, treeview_node_entry::fields, treeview::fields, plot_style_s::fill_colour, treeview_field::flags, treeview_node::flags, treeview_node_style::furn, treeview_node::height, treeview_resource::height, height, treeview_globals::icon_step, treeview_node::inset, treeview_node_style::itext, treeview_text::len, treeview_globals::line_height, treeview::n_fields, treeview_node::next_sib, treeview_node::parent, redraw_context::plot, plot_style_even, plot_style_odd, treeview_drag::prev, plotter_table::rectangle, treeview::root, root, treeview_node_style::sbg, treeview_node_style::sel, treeview_node_style::sitext, treeview_node_style::size, treeview_drag::start, treeview_globals::step_width, treeview_node_style::stext, treeview_node::text, treeview_node_style::text, plotter_table::text, TREE_FLAG_SHOW_NAME, TREE_FURN_CONTRACT, TREE_FURN_EXPAND, tree_g, TREE_NODE_ENTRY, TREE_NODE_FOLDER, TREE_RES_CONTENT, TREE_RES_FOLDER, TREE_RES_FOLDER_SPECIAL, treeview_res, TV_NFLAGS_EXPANDED, TV_NFLAGS_SELECTED, TV_NFLAGS_SPECIAL, treeview_node::type, treeview_drag::type, treeview_field::value, treeview_text::width, content_redraw_data::x, rect::x0, rect::x1, treeview_pos::y, content_redraw_data::y, rect::y0, and rect::y1.

Referenced by treeview_redraw().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_res_cb()

static nserror treeview_res_cb ( struct hlcache_handle handle,
const hlcache_event event,
void *  pw 
)
static

Callback for hlcache retrieving resources.

Parameters
handlecontent hlcache handle
eventThe event that occurred on the content
pwtreeview resource context

Definition at line 5011 of file treeview.c.

References content_get_height(), CONTENT_MSG_DONE, CONTENT_MSG_READY, treeview_resource::height, NSERROR_OK, treeview_resource::ready, and hlcache_event::type.

Referenced by treeview_init_resources().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_select_all()

static bool treeview_select_all ( treeview tree,
struct rect rect 
)
static

Select all in a treeview.

Parameters
treeTreeview object to select all in
rectRedraw rectangle (if redraw required)
Returns
true iff redraw required

Definition at line 3418 of file treeview.c.

References treeview_selection_walk_data::current_y, treeview_selection_walk_data::data, treeview_selection_walk_data::purpose, treeview_selection_walk_data::rect, treeview_selection_walk_data::redraw, REDRAW_MAX, treeview_selection_walk_data::required, treeview::root, treeview_selection_walk_data::tree, treeview__get_search_height(), treeview_node_selection_walk_cb(), treeview_walk_internal(), TREEVIEW_WALK_MODE_DISPLAY, treeview_selection_walk_data::TREEVIEW_WALK_SELECT_ALL, rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by treeview_keypress().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_set_inset_from_parent()

static nserror treeview_set_inset_from_parent ( treeview_node n,
void *  ctx,
bool *  skip_children,
bool *  end 
)
static

Set a node's inset from its parent.

This may be used as treeview walk callback

Parameters
[in]nnode to set inset on
[in]ctxcontext unused
[out]skip_childrenset to false so child nodes are not skipped.
[out]endunused flag so treewalk in not terminated early.

Definition at line 1111 of file treeview.c.

References treeview_node::inset, NSERROR_OK, treeview_node::parent, treeview_globals::step_width, and tree_g.

Referenced by treeview_insert_node().

Here is the caller graph for this function:

◆ treeview_set_move_indicator()

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 
)
static

Set the drag&drop drop indicator.

Parameters
treeTreeview object to set node indicator in
need_redrawTrue iff we already have a redraw region
targetThe treeview node with mouse pointer over it
node_heightThe height of node
node_yThe Y coord of the top of target node
mouse_yY coord of mouse position
rectRedraw rectangle (if redraw required)
Returns
true iff redraw required

Definition at line 4103 of file treeview.c.

References treeview_node::children, treeview_node::flags, treeview_resource::height, treeview_globals::icon_size, treeview_node::inset, treeview_globals::line_height, mouse_y, treeview::move, treeview_globals::move_offset, treeview_node::parent, treeview_node::prev_sib, treeview::root, treeview_move::target, treeview_move::target_area, treeview_move::target_pos, tree_g, TREE_NODE_ENTRY, TREE_NODE_FOLDER, TREE_NODE_ROOT, TREE_RES_ARROW, treeview_node_y(), treeview_res, TV_NFLAGS_EXPANDED, TV_NFLAGS_SELECTED, TV_TARGET_ABOVE, TV_TARGET_BELOW, TV_TARGET_INSIDE, TV_TARGET_NONE, treeview_node::type, rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by treeview_node_mouse_action_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_set_search_string()

nserror treeview_set_search_string ( treeview tree,
const char *  string 
)

Set the search string for a treeview with TREEVIEW_SEARCHABLE.

Parameters
treeTree to set the search string for.
Returns
NSERROR_OK on success, appropriate error otherwise

Definition at line 4922 of file treeview.c.

References treeview_search::active, treeview::flags, NSERROR_BAD_PARAMETER, NSERROR_OK, NSERROR_UNKNOWN, treeview_search::search, treeview::search, treeview_search::textarea, textarea_set_text(), treeview_mouse_action::tree, treeview__cw_full_redraw(), treeview__search(), and TREEVIEW_SEARCHABLE.

Referenced by cookie_manager_set_search_string().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_textarea_callback()

static void treeview_textarea_callback ( void *  data,
struct textarea_msg msg 
)
static

Callback for textarea_create, in desktop/treeview.h.

Parameters
datatreeview context
msgtextarea message

Definition at line 4234 of file treeview.c.

References textarea_msg::data, textarea_msg::drag, treeview::drag, treeview::edit, textarea_msg::redraw, TEXTAREA_DRAG_NONE, TEXTAREA_MSG_DRAG_REPORT, TEXTAREA_MSG_REDRAW_REQUEST, treeview__cw_drag_status(), treeview__cw_invalidate_area(), treeview__get_cw_drag_type(), textarea_msg::type, treeview_drag::type, treeview_edit::x, rect::x0, rect::x1, treeview_edit::y, rect::y0, and rect::y1.

Referenced by treeview_edit_node_at_point().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_textarea_search_callback()

static void treeview_textarea_search_callback ( void *  data,
struct textarea_msg msg 
)
static

Callback for textarea_create, in desktop/treeview.h.

Parameters
datatreeview context
msgtextarea message

Definition at line 990 of file treeview.c.

References treeview_search::active, textarea_msg::data, textarea_msg::drag, treeview::drag, treeview_globals::icon_size, textarea_msg::len, treeview_globals::line_height, textarea_msg::modified, textarea_msg::redraw, treeview::root, treeview::search, textarea_msg::text, TEXTAREA_DRAG_NONE, TEXTAREA_MSG_DRAG_REPORT, TEXTAREA_MSG_REDRAW_REQUEST, TEXTAREA_MSG_TEXT_MODIFIED, tree_g, treeview__cw_drag_status(), treeview__cw_invalidate_area(), treeview__get_cw_drag_type(), treeview__search(), textarea_msg::type, treeview_drag::type, treeview_globals::window_padding, rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by treeview_create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_unlink_node()

static bool treeview_unlink_node ( treeview_node n)
inlinestatic

Unlink a treeview node.

Parameters
nNode to unlink
Returns
true iff ancestor heights need to be reduced

Definition at line 1568 of file treeview.c.

References treeview_node::children, treeview_node::flags, treeview_node::next_sib, treeview_node::parent, treeview_node::prev_sib, and TV_NFLAGS_EXPANDED.

Referenced by treeview_delete_node_walk_cb(), and treeview_node_selection_walk_cb().

Here is the caller graph for this function:

◆ treeview_update_node_entry()

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.

Parameters
treeTreeview object in which to create entry
entryEntry node to update
fieldsArray of new field data
dataClient data for node event callbacks
Returns
NSERROR_OK on success, appropriate error otherwise

Fields array names must match names past in treeview_create fields[0...N-2].

Definition at line 1314 of file treeview.c.

References treeview_node::client_data, treeview_text::data, treeview_field::field, treeview_node_entry::fields, treeview::fields, treeview_node::flags, guit, treeview_node::height, netsurf_table::layout, treeview_text::len, treeview::n_fields, NSERROR_OK, treeview_node::parent, plot_style_odd, REDRAW_MAX, treeview_node::text, treeview_node_style::text, treeview__cw_invalidate_area(), treeview__search_update_display(), treeview_node_y(), TV_NFLAGS_EXPANDED, treeview_field::value, treeview_text::width, gui_layout_table::width, rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by cookie_manager_update_cookie_node(), hotlist_tree_node_entry_cb(), and hotlist_update_url_walk_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_update_node_folder()

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.

Parameters
treeTreeview object in which to create entry
folderFolder node to update
fieldNew field data
dataClient data for node event callbacks
Returns
NSERROR_OK on success, appropriate error otherwise

Field name must match name past in treeview_create fields[N-1].

Definition at line 1266 of file treeview.c.

References treeview_node::client_data, treeview_text::data, treeview_field::field, treeview_field_data::field, treeview::fields, treeview_node::flags, guit, netsurf_table::layout, treeview_text::len, treeview_globals::line_height, treeview::n_fields, NSERROR_OK, treeview_node::parent, plot_style_odd, REDRAW_MAX, treeview_node::text, treeview_node_style::text, tree_g, treeview__cw_invalidate_area(), treeview_node_y(), TV_NFLAGS_EXPANDED, treeview_field_data::value, treeview_field_data::value_len, treeview_text::width, gui_layout_table::width, rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by hotlist_tree_node_folder_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_walk()

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.

Example usage: To export a treeview as XML, XML elements can be opened in enter_cb, and closed in leave_cb.

Note, if deleting returned node in enter_cb, the walk must be terminated by setting abort to true.

Parameters
treeTreeview object to walk
rootRoot node to walk tree from (or NULL for tree root)
enter_cbFunction to call on entering nodes, or NULL
leave_cbFunction to call on leaving nodes, or NULL
ctxClient context, passed back to callback function
typeThe node type(s) of interest
Returns
NSERROR_OK on success, or appropriate error otherwise

Definition at line 1534 of file treeview.c.

References treeview_walk_ctx::ctx, treeview_walk_ctx::enter_cb, treeview_walk_ctx::leave_cb, treeview::root, root, treeview_walk_bwd_cb(), treeview_walk_fwd_cb(), treeview_walk_internal(), TREEVIEW_WALK_MODE_LOGICAL_COMPLETE, and type.

Referenced by cookie_manager_find_entry(), cookie_manager_find_folder(), global_history_export(), hotlist_export(), hotlist_has_url(), hotlist_iterate(), hotlist_remove_url(), and hotlist_update_url().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ treeview_walk_bwd_cb()

static nserror treeview_walk_bwd_cb ( treeview_node n,
void *  ctx,
bool *  end 
)
static

Treewalk node leave callback.

Parameters
ncurrent node
ctxtreewalk context
endset if iteration should end early

Definition at line 1520 of file treeview.c.

References treeview_node::client_data, treeview_walk_ctx::ctx, treeview_walk_ctx::leave_cb, NSERROR_OK, treeview_node::type, and treeview_walk_ctx::type.

Referenced by treeview_walk().

Here is the caller graph for this function:

◆ treeview_walk_fwd_cb()

static nserror treeview_walk_fwd_cb ( treeview_node n,
void *  ctx,
bool *  skip_children,
bool *  end 
)
static

Treewalk node enter callback.

Parameters
ncurrent node
ctxtreewalk context
skip_childrenset if child nodes should be skipped
endset if iteration should end early

Definition at line 1498 of file treeview.c.

References treeview_node::client_data, treeview_walk_ctx::ctx, treeview_walk_ctx::enter_cb, NSERROR_OK, treeview_node::type, and treeview_walk_ctx::type.

Referenced by treeview_walk().

Here is the caller graph for this function:

◆ treeview_walk_internal()

static nserror treeview_walk_internal ( treeview tree,
treeview_node root,
enum treeview_walk_mode  mode,
nserror(*)(treeview_node *n, void *ctx, bool *end)  callback_bwd,
nserror(*)(treeview_node *n, void *ctx, bool *skip_children, bool *end)  callback_fwd,
void *  ctx 
)
static

Walk a treeview subtree, calling a callback at each node (depth first)

Parameters
treeTreeview being walked.
rootRoot to walk tree from (doesn't get a callback call)
modeThe treeview walk mode to use.
callback_bwdFunction to call on each node in backwards order
callback_fwdFunction to call on each node in forwards order
ctxContext to pass to callback
Returns
NSERROR_OK on success, or appropriate error otherwise
Note
Any node deletion must happen in callback_bwd.

Definition at line 673 of file treeview.c.

References treeview_node::children, treeview_node::flags, mode, treeview_node::next_sib, NSERROR_OK, treeview_node::parent, parent, root, treeview_search::search, treeview::search, TREE_NODE_ENTRY, TREEVIEW_WALK_MODE_DISPLAY, TREEVIEW_WALK_MODE_LOGICAL_COMPLETE, TV_NFLAGS_EXPANDED, TV_NFLAGS_MATCHED, and treeview_node::type.

Referenced by treeview__search(), treeview_clear_selection(), treeview_commit_selection_drag(), treeview_contract(), treeview_copy_selection(), treeview_delete_node_internal(), treeview_delete_selection(), treeview_expand(), treeview_get_first_selected(), treeview_has_selection(), treeview_insert_node(), treeview_keyboard_navigation(), treeview_launch_selection(), treeview_mouse_action(), treeview_move_yank_selection(), treeview_node_contract_internal(), treeview_propagate_selection(), treeview_select_all(), and treeview_walk().

Here is the caller graph for this function:

◆ treeview_y_node()

static treeview_node * treeview_y_node ( treeview tree,
int  target_y 
)
static

Find node at given y-position.

Parameters
treeTreeview object to delete node from
target_yTarget y-position
Returns
node at y_target

Definition at line 534 of file treeview.c.

References treeview_node::height, treeview_globals::line_height, treeview::root, tree_g, TREE_NODE_ENTRY, treeview__get_search_height(), treeview_node_next(), and treeview_node::type.

Referenced by treeview_get_relation().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ plot_style_even

struct treeview_node_style plot_style_even

◆ plot_style_odd

struct treeview_node_style plot_style_odd

◆ tree_g

struct treeview_globals tree_g

◆ treeview_res

struct treeview_resource treeview_res[TREE_RES_LAST]
static
Initial value:
= {
{ "resource:icons/arrow-l.png", NULL, 0, false },
{ "resource:icons/content.png", NULL, 0, false },
{ "resource:icons/directory.png", NULL, 0, false },
{ "resource:icons/directory2.png", NULL, 0, false },
{ "resource:icons/search.png", NULL, 0, false }
}

Treeview content resources.

Definition at line 324 of file treeview.c.

Referenced by treeview_fini(), treeview_init_resources(), treeview_redraw(), treeview_redraw_search(), treeview_redraw_tree(), and treeview_set_move_indicator().