NetSurf
Data Structures | Typedefs | Enumerations | Functions
treeview.h File Reference

Treeview handling interface. More...

#include <stdbool.h>
#include <stdint.h>
#include <libwapcaplet/libwapcaplet.h>
#include "netsurf/mouse.h"
Include dependency graph for treeview.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  treeview_node_msg
 treeview message More...
 
struct  treeview_field_desc
 Treeview field description. More...
 
struct  treeview_field_data
 Treeview field data. More...
 
struct  treeview_callback_table
 Client callbacks for events concerning nodes. More...
 

Typedefs

typedef struct treeview treeview
 
typedef struct treeview_node treeview_node
 
typedef nserror(* treeview_walk_cb) (void *ctx, void *node_data, enum treeview_node_type type, bool *abort)
 Client callback for treeview_walk. More...
 

Enumerations

enum  treeview_node_type { TREE_NODE_NONE = 0 , TREE_NODE_ROOT = (1 << 0) , TREE_NODE_FOLDER = (1 << 1) , TREE_NODE_ENTRY = (1 << 2) }
 treeview node type More...
 
enum  treeview_relationship { TREE_REL_FIRST_CHILD , TREE_REL_NEXT_SIBLING }
 Relationship between nodes. More...
 
enum  treeview_node_options_flags { TREE_OPTION_NONE = (0) , TREE_OPTION_SPECIAL_DIR = (1 << 0) , TREE_OPTION_SUPPRESS_RESIZE = (1 << 1) , TREE_OPTION_SUPPRESS_REDRAW = (1 << 2) }
 Node change handling options. More...
 
enum  treeview_flags {
  TREEVIEW_NO_FLAGS = (0) , TREEVIEW_NO_MOVES = (1 << 0) , TREEVIEW_NO_DELETES = (1 << 1) , TREEVIEW_READ_ONLY = TREEVIEW_NO_MOVES | TREEVIEW_NO_DELETES ,
  TREEVIEW_DEL_EMPTY_DIRS = (1 << 2) , TREEVIEW_SEARCHABLE = (1 << 3)
}
 treeview control flags More...
 
enum  treeview_msg { TREE_MSG_NODE_DELETE , TREE_MSG_NODE_EDIT , TREE_MSG_NODE_LAUNCH }
 treeview message types More...
 
enum  treeview_field_flags {
  TREE_FLAG_NONE = 0 , TREE_FLAG_ALLOW_EDIT = (1 << 0) , TREE_FLAG_DEFAULT = (1 << 1) , TREE_FLAG_SHOW_NAME = (1 << 2) ,
  TREE_FLAG_COPY_TEXT = (1 << 3) , TREE_FLAG_SEARCHABLE = (1 << 4)
}
 treeview field flags More...
 

Functions

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...
 
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. 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...
 
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...
 
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_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...
 
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_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...
 
nserror treeview_delete_node (treeview *tree, treeview_node *n, treeview_node_options_flags flags)
 Delete a treeview node. More...
 
nserror treeview_node_expand (treeview *tree, treeview_node *node)
 Expand a treeview node. More...
 
nserror treeview_node_contract (treeview *tree, treeview_node *node)
 Contract a treeview node. More...
 
nserror treeview_expand (treeview *tree, bool only_folders)
 Expand a treeview's nodes. More...
 
nserror treeview_contract (treeview *tree, bool all)
 Contract a treeview's nodes. More...
 
void treeview_redraw (treeview *tree, int x, int y, struct rect *clip, const struct redraw_context *ctx)
 Redraw a treeview object. More...
 
bool treeview_keypress (treeview *tree, uint32_t key)
 Key press handling for treeviews. More...
 
void treeview_mouse_action (treeview *tree, browser_mouse_state mouse, int x, int y)
 Handles all kinds of mouse action. More...
 
bool treeview_has_selection (treeview *tree)
 Determine whether treeview has a selection. More...
 
enum treeview_node_type treeview_get_selection (treeview *tree, void **node_data)
 Get the first selected node. More...
 
void treeview_edit_selection (treeview *tree)
 Edit the first selected node. 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...
 

Detailed Description

Treeview handling interface.

Definition in file treeview.h.

Typedef Documentation

◆ treeview

typedef struct treeview treeview

Definition at line 36 of file treeview.h.

◆ treeview_node

typedef struct treeview_node treeview_node

Definition at line 37 of file treeview.h.

◆ treeview_walk_cb

typedef nserror(* treeview_walk_cb) (void *ctx, void *node_data, enum treeview_node_type type, bool *abort)

Client callback for treeview_walk.

Parameters
ctxClient context
node_dataClient data for the current treeview node
typeThe node type
abortSet to true to abort treeview walk prematurely
Returns
NSERROR_OK on success, or appropriate error otherwise

Definition at line 344 of file treeview.h.

Enumeration Type Documentation

◆ treeview_field_flags

treeview field flags

Enumerator
TREE_FLAG_NONE 

No flags set.

TREE_FLAG_ALLOW_EDIT 

Whether allow edit field.

TREE_FLAG_DEFAULT 

Whether field is default.

TREE_FLAG_SHOW_NAME 

Whether field name shown.

TREE_FLAG_COPY_TEXT 

Whether to copy to clipb.

TREE_FLAG_SEARCHABLE 

Whether field is searchable.

Definition at line 115 of file treeview.h.

◆ treeview_flags

treeview control flags

Enumerator
TREEVIEW_NO_FLAGS 

No flags set.

TREEVIEW_NO_MOVES 

No node drags.

TREEVIEW_NO_DELETES 

No node deletes.

TREEVIEW_READ_ONLY 
TREEVIEW_DEL_EMPTY_DIRS 

Delete dirs on empty.

TREEVIEW_SEARCHABLE 

Treeview has search bar.

Definition at line 73 of file treeview.h.

◆ treeview_msg

treeview message types

Enumerator
TREE_MSG_NODE_DELETE 

Node to be deleted.

TREE_MSG_NODE_EDIT 

Node to be edited.

TREE_MSG_NODE_LAUNCH 

Node to be launched.

Definition at line 85 of file treeview.h.

◆ treeview_node_options_flags

Node change handling options.

Enumerator
TREE_OPTION_NONE 
TREE_OPTION_SPECIAL_DIR 
TREE_OPTION_SUPPRESS_RESIZE 
TREE_OPTION_SUPPRESS_REDRAW 

Definition at line 63 of file treeview.h.

◆ treeview_node_type

treeview node type

Enumerator
TREE_NODE_NONE 

No node

TREE_NODE_ROOT 

Node is treeview's root.

TREE_NODE_FOLDER 

Node is folder.

TREE_NODE_ENTRY 

Node is an entry.

Definition at line 43 of file treeview.h.

◆ treeview_relationship

Relationship between nodes.

Enumerator
TREE_REL_FIRST_CHILD 
TREE_REL_NEXT_SIBLING 

Definition at line 54 of file treeview.h.

Function Documentation

◆ 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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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: