NetSurf
|
Treeview handling interface. More...
#include <stdbool.h>
#include <stdint.h>
#include <libwapcaplet/libwapcaplet.h>
#include "netsurf/mouse.h"
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... | |
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... | |
Treeview handling interface.
Definition in file treeview.h.
Definition at line 36 of file treeview.h.
typedef struct treeview_node treeview_node |
Definition at line 37 of file treeview.h.
typedef nserror(* treeview_walk_cb) (void *ctx, void *node_data, enum treeview_node_type type, bool *abort) |
Client callback for treeview_walk.
ctx | Client context |
node_data | Client data for the current treeview node |
type | The node type |
abort | Set to true to abort treeview walk prematurely |
Definition at line 344 of file treeview.h.
enum treeview_field_flags |
treeview field flags
Definition at line 115 of file treeview.h.
enum treeview_flags |
treeview control flags
Definition at line 73 of file treeview.h.
enum 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.
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.
enum 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.
Relationship between nodes.
Enumerator | |
---|---|
TREE_REL_FIRST_CHILD | |
TREE_REL_NEXT_SIBLING |
Definition at line 54 of file treeview.h.
Contract a treeview's nodes.
tree | Treeview object to contract nodes in |
all | Iff false, only entries are contracted. |
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().
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.
tree | Returns created treeview object |
callbacks | Treeview client node event callbacks |
n_fields | Number of treeview fields (see description) |
fields | Array of treeview fields |
cw_t | Callback table for core_window containing the treeview |
cw | The core_window in which the treeview is shown |
flags | Treeview behaviour flags |
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().
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.
tree | Treeview object in which to create entry |
entry | Returns created entry node |
relation | Existing node to insert as relation of, or NULL |
rel | Folder's relationship to relation |
fields | Array of field data |
data | Client data for node event callbacks |
flags | Treeview node options flags |
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().
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.
tree | Treeview object in which to create folder |
folder | Returns created folder node |
relation | Existing node to insert as relation of, or NULL |
rel | Folder's relationship to relation |
field | Field data |
data | Client data for node event callbacks |
flags | Treeview node options flags |
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().
Attach a treeview to a corewindow.
Treeview must be detached.
tree | Treeview object |
cw_t | Callback table for core_window containing the treeview |
cw | The core_window in which the treeview is shown |
Definition at line 2132 of file treeview.c.
References treeview::cw_h, NSERROR_OK, NSERROR_UNKNOWN, and NSLOG.
Referenced by hotlist_manager_init().
Detach a treeview from a corewindow.
tree | Treeview object |
Definition at line 2147 of file treeview.c.
References treeview::cw_h, NSERROR_OK, and treeview__search_cancel().
Referenced by hotlist_manager_fini().
nserror treeview_delete_node | ( | treeview * | tree, |
treeview_node * | n, | ||
treeview_node_options_flags | flags | ||
) |
Delete a treeview node.
tree | Treeview object to delete node from |
n | Node to delete |
flags | Treeview node options flags |
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().
Destroy a treeview object.
Will emit folder and entry deletion msg callbacks for all nodes in treeview.
tree | Treeview object to destroy |
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().
void treeview_edit_selection | ( | treeview * | tree | ) |
Edit the first selected node.
tree | Treeview 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().
Expand a treeview's nodes.
tree | Treeview object to expand nodes in |
only_folders | Iff true, only folders are expanded. |
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().
nserror treeview_fini | ( | void | ) |
Finalise the treeview module (all treeviews must have been destroyed first)
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().
int treeview_get_height | ( | treeview * | tree | ) |
Find current height of a treeview.
tree | Treeview object to find height of |
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().
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.
tree | Treeview object in which to create folder |
relation | Existing node to insert as relation of, or NULL |
rel | Folder's relationship to relation |
at_y | Iff true, insert at y-offset |
y | Y-offset in px from top of hotlist. Ignored if (!at_y). |
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().
enum treeview_node_type treeview_get_selection | ( | treeview * | tree, |
void ** | node_data | ||
) |
Get the first selected node.
tree | Treeview object to get selected node in |
node_data | Client data for the selected treeview node, or NULL |
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().
bool treeview_has_selection | ( | treeview * | tree | ) |
Determine whether treeview has a selection.
tree | Treeview object to delete node from |
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().
nserror treeview_init | ( | void | ) |
Prepare treeview module for treeview usage.
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().
bool treeview_keypress | ( | treeview * | tree, |
uint32_t | key | ||
) |
Key press handling for treeviews.
tree | The treeview which got the keypress |
key | The ucs4 character codepoint |
< 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().
void treeview_mouse_action | ( | treeview * | tree, |
browser_mouse_state | mouse, | ||
int | x, | ||
int | y | ||
) |
Handles all kinds of mouse action.
tree | Treeview object |
mouse | The current mouse state |
x | X coordinate |
y | Y 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().
nserror treeview_node_contract | ( | treeview * | tree, |
treeview_node * | node | ||
) |
Contract a treeview node.
tree | Treeview object to contract node in |
node | Node to contract |
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().
nserror treeview_node_expand | ( | treeview * | tree, |
treeview_node * | node | ||
) |
Expand a treeview node.
tree | Treeview object to expand node in |
node | Node to expand |
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().
void treeview_redraw | ( | treeview * | tree, |
int | x, | ||
int | y, | ||
struct rect * | clip, | ||
const struct redraw_context * | ctx | ||
) |
Redraw a treeview object.
tree | Treeview object to render |
x | X coordinate to render treeview at |
y | Y coordinate to render treeview at |
clip | Current clip rectangle (wrt tree origin) |
ctx | Current 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().
Set the search string for a treeview with TREEVIEW_SEARCHABLE.
tree | Tree to set the search string for. |
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().
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.
tree | Treeview object in which to create entry |
entry | Entry node to update |
fields | Array of new field data |
data | Client data for node event callbacks |
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().
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.
tree | Treeview object in which to create entry |
folder | Folder node to update |
field | New field data |
data | Client data for node event callbacks |
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().
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.
tree | Treeview object to walk |
root | Root node to walk tree from (or NULL for tree root) |
enter_cb | Function to call on entering nodes, or NULL |
leave_cb | Function to call on leaving nodes, or NULL |
ctx | Client context, passed back to callback function |
type | The node type(s) of interest |
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().