NetSurf
|
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"
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_text * | treeview_get_text_for_field (treeview *tree, treeview_node *n, int i) |
Helper function to access the given field of a node. More... | |
static treeview_node * | treeview_node_next (treeview_node *node, bool full) |
Find the next node in depth first tree order. More... | |
static treeview_node * | treeview_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 textarea * | treeview__create_textarea (treeview *tree, int width, int height, colour border, colour background, colour foreground, plot_font_style_t text, textarea_client_callback ta_callback) |
Helper to create a textarea. 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_node * | treeview_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 bitmap * | treeview_generate_triangle_bitmap (colour bg, colour fg, int size) |
Create a right-pointing anti-aliased triangle bitmap. More... | |
static struct bitmap * | treeview_generate_copy_bitmap (struct bitmap *orig, int size) |
Create bitmap copy of another bitmap. More... | |
static struct bitmap * | treeview_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... | |
Treeview handling implementation.
Definition in file treeview.c.
#define REDRAW_MAX 8000 |
The maximum horizontal size a treeview can possibly be.
Definition at line 57 of file treeview.c.
Treeview furniture states.
Enumerator | |
---|---|
TREE_FURN_EXPAND | |
TREE_FURN_CONTRACT | |
TREE_FURN_LAST |
Definition at line 258 of file treeview.c.
enum treeview_node_flags |
flags indicating render state of node.
Definition at line 110 of file treeview.c.
enum 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.
enum 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.
enum 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.
enum treeview_walk_mode |
The treeview walk mode.
Controls which nodes are visited in a walk.
Definition at line 639 of file treeview.c.
|
static |
Helper to create a textarea.
[in] | tree | The treeview we're creating the textarea for. |
[in] | width | The width of the textarea. |
[in] | height | The height of the textarea. |
[in] | border | The border colour to use. |
[in] | background | The background colour to use. |
[in] | foreground | The foreground colour to use. |
[in] | text | The text style to use for the text area. |
[in] | ta_callback | The textarea callback function to give the textarea. |
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().
|
inlinestatic |
Corewindow callback wrapper: Inform corewindow owner of drag status.
[in] | tree | The treeview to report status on. |
[in] | ds | the 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().
|
inlinestatic |
Corewindow callback wrapper: Request a full redraw of the window.
[in] | tree | The 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().
|
inlinestatic |
Corewindow callback wrapper: Get window viewport dimensions.
[in] | tree | The treeview to get dimensions for. |
[out] | width | to be set to viewport width in px |
[out] | height | to 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().
|
inlinestatic |
Corewindow callback wrapper: Request a redraw of the window.
[in] | tree | The treeview to request redraw on. |
[in] | r | rectangle 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().
|
inlinestatic |
Corewindow callback_wrapper: Scroll to make node visible.
[in] | tree | The treeview to scroll. |
[in] | node | The 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().
|
inlinestatic |
Corewindow callback_wrapper: Scroll to top of window.
[in] | tree | The 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().
|
inlinestatic |
Corewindow callback wrapper: Update the limits of the window.
[in] | tree | The treeview to update size for. |
[in] | width | the width in px, or negative if don't care |
[in] | height | the 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().
|
static |
Convert from treeview drag to core window drag type.
[in] | tree | A treeview. |
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().
|
inlinestatic |
Get the display height of the treeview data component of the display.
[in] | tree | Treeview to get the height of. |
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().
|
inlinestatic |
Get height used by treeview's search bar (or 0 if not present).
tree | Treeview object to check. |
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().
|
static |
Redraw tree from given node to the bottom.
[in] | tree | Tree to redraw from node in. |
[in] | node | Node 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().
Search treeview for text.
[in] | tree | Treeview to search. |
[in] | text | UTF-8 string to search for. (NULL-terminated.) |
[in] | len | Byte length of UTF-8 string. |
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().
|
static |
Cancel a treeview search, optionally droping focus from search widget.
[in] | tree | Treeview to cancel search in. |
[in] | drop_focus | Iff 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().
|
static |
Update the layout for any active search.
[in] | tree | The 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().
|
static |
Treewalk node callback for handling search.
[in] | n | Current node. |
[in] | ctx | Treeview search context. |
[in,out] | skip_children | Flag to allow children to be skipped. |
[in,out] | end | Flag to allow iteration to be finished early. |
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().
Clear any selection in a treeview.
tree | Treeview object to clear selection in |
rect | Redraw rectangle (if 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().
|
static |
Commit a current selection drag, modifying the node's selection state.
tree | Treeview 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().
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().
|
static |
Copy a selection to the clipboard.
tree | Treeview 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().
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().
|
static |
Create treeview's root node.
[out] | root | Returns root node |
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().
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().
Delete any empty treeview folder nodes.
tree | Treeview object to delete empty nodes from |
interaction | Delete is result of user interaction with treeview |
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().
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().
|
static |
Delete a treeview node.
Will emit folder or entry deletion msg callback.
This function does not delete empty nodes, so if TREEVIEW_DEL_EMPTY_DIRS is set, caller must also call treeview_delete_empty.
tree | Treeview object to delete node from |
n | Node to delete |
interaction | Delete is result of user interaction with treeview |
flags | Treeview node options flags |
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().
|
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().
Delete a selection.
tree | Treeview object to delete selected nodes from |
rect | Updated to redraw rectangle |
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().
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().
|
static |
Cancel the editing of a treeview node.
tree | Treeview object to cancel node editing in |
redraw | Set 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().
|
static |
Complete a treeview edit.
Complete edit by informing the client with a change request msg
tree | Treeview 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().
|
static |
Start edit of node field, at given y-coord, if editable.
tree | Treeview object to consider editing in |
n | The treeview node to try editing |
node_y | The Y coord of the top of n |
mouse_x | X coord of mouse position |
mouse_y | Y coord of mouse position |
rect | Redraw rectangle (if 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().
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().
|
static |
Treewalk node callback for handling recursive node expansion.
n | current node |
ctx | node expansion context |
skip_children | flag to allow children to be skipped |
end | flag to allow iteration to be finished early. |
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().
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().
Create bitmap copy of another bitmap.
orig | bitmap to copy |
size | required 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().
Create bitmap from rotation of another bitmap.
orig | bitmap to create rotation of |
size | required 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().
Create a right-pointing anti-aliased triangle bitmap.
bg | background colour |
fg | foreground colour |
size | required 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().
|
static |
Get first selected node (in any)
tree | Treeview object in which to create folder |
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().
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().
|
inlinestatic |
Helper function to access the given field of a node.
tree | Treeview that node belongs to |
n | Node to get field from |
i | Index of field of interest |
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().
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().
|
static |
Measures width of characters used to represent treeview furniture.
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().
|
static |
Initialise the plot styles from CSS system colour values.
font_pt_size | font size to use |
Definition at line 4953 of file treeview.c.
References plot_font_style::background, treeview_node_style::bg, plot_font_style::family, plot_style_s::fill_colour, plot_style_s::fill_type, plot_font_style::flags, FONTF_NONE, plot_font_style::foreground, treeview_node_style::itext, NSCOLOUR_SEL_BG, NSCOLOUR_SEL_FG, NSCOLOUR_SEL_FG_SUBTLE, NSCOLOUR_WIN_EVEN_BG, NSCOLOUR_WIN_EVEN_FG, NSCOLOUR_WIN_EVEN_FG_FADED, NSCOLOUR_WIN_ODD_BG, nscolours, NSERROR_OK, PLOT_FONT_FAMILY_SANS_SERIF, PLOT_OP_TYPE_NONE, PLOT_OP_TYPE_SOLID, plot_style_even, plot_style_odd, treeview_node_style::sbg, treeview_node_style::sitext, plot_font_style::size, treeview_node_style::stext, plot_style_s::stroke_colour, plot_style_s::stroke_type, plot_style_s::stroke_width, treeview_node_style::text, and plot_font_style::weight.
Referenced by treeview_init().
|
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().
|
inlinestatic |
Insert a treeview node into a treeview.
tree | the treeview to insert node into. |
a | parentless node to insert |
b | tree node to insert a as a relation of |
rel | The 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().
|
static |
Handle keyboard navigation.
tree | Treeview object to launch selected nodes in |
key | The ucs4 character codepoint |
rect | Updated to redraw rectangle |
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().
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().
Launch a selection.
tree | Treeview object to launch selected nodes in |
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().
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().
Move a selection according to the current move drag.
tree | Treeview object to move selected nodes in |
rect | Redraw rectangle |
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().
|
static |
Yank a selection to the node move list.
tree | Treeview object to yank selection from |
fixed | Treeview 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().
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().
|
static |
Treewalk node callback for handling node contraction.
n | node |
ctx | contract iterator context |
end | flag to end iteration now |
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().
|
static |
Contract a treeview node.
tree | Treeview object to contract node in |
node | Node to contract |
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().
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().
|
static |
Expand a treeview's nodes.
tree | Treeview object to expand nodes in |
node | The node to expand. |
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().
|
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().
|
static |
Treewalk node walk forward callback for launching nodes.
n | current node |
ctx | node launch context |
skip_children | flag to allow children to be skipped |
end | flag to allow iteration to be finished early. |
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().
|
static |
Treewalk node callback for handling mouse action.
node | current node |
ctx | node context |
skip_children | flag to allow children to be skipped |
end | flag to allow iteration to be finished early. |
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().
|
static |
Treewalk node callback for handling mouse action.
node | current node |
ctx | node context |
skip_children | flag to allow children to be skipped |
end | flag to allow iteration to be finished early. |
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().
|
inlinestatic |
Find the next node in depth first tree order.
node | Start node |
full | Iff true, visit children of collapsed nodes |
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().
|
static |
Treewalk node callback for handling selection related actions.
n | current node |
ctx | node selection context |
skip_children | flag to allow children to be skipped |
end | flag to allow iteration to be finished early. |
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().
|
static |
Find y position of the top of a node.
tree | Treeview object to delete node from |
node | Node to get position of |
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().
Propagate selection to visible descendants of selected nodes.
tree | Treeview object to propagate selection in |
rect | Redraw rectangle (if 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().
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().
|
static |
Draw a treeview normally, in tree mode.
[in] | tree | The treeview we're rendering. |
[in] | x | X coordinate we're rendering the treeview at. |
[in] | y | Y coordinate we're rendering the treeview at. |
[in,out] | render_y | Current vertical position in tree, updated on exit. |
[in] | r | Clip rectangle. |
[in] | data | Redraw data for rendering contents. |
[in] | ctx | Current 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().
|
static |
Draw a treeview normally, in tree mode.
[in] | tree | The treeview we're rendering. |
[in] | x | X coordinate we're rendering the treeview at. |
[in] | y | Y coordinate we're rendering the treeview at. |
[in,out] | render_y | Current vertical position in tree, updated on exit. |
[in] | r | Clip rectangle. |
[in] | data | Redraw data for rendering contents. |
[in] | ctx | Current 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().
|
static |
Callback for hlcache retrieving resources.
handle | content hlcache handle |
event | The event that occurred on the content |
pw | treeview 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().
Select all in a treeview.
tree | Treeview object to select all in |
rect | Redraw rectangle (if 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().
|
static |
Set a node's inset from its parent.
This may be used as treeview walk callback
[in] | n | node to set inset on |
[in] | ctx | context unused |
[out] | skip_children | set to false so child nodes are not skipped. |
[out] | end | unused 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().
|
static |
Set the drag&drop drop indicator.
tree | Treeview object to set node indicator in |
need_redraw | True iff we already have a redraw region |
target | The treeview node with mouse pointer over it |
node_height | The height of node |
node_y | The Y coord of the top of target node |
mouse_y | Y coord of mouse position |
rect | Redraw rectangle (if 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().
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().
|
static |
Callback for textarea_create, in desktop/treeview.h.
data | treeview context |
msg | textarea 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().
|
static |
Callback for textarea_create, in desktop/treeview.h.
data | treeview context |
msg | textarea 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().
|
inlinestatic |
Unlink a treeview node.
n | Node to unlink |
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().
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().
|
static |
Treewalk node leave callback.
n | current node |
ctx | treewalk context |
end | set 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().
|
static |
Treewalk node enter callback.
n | current node |
ctx | treewalk context |
skip_children | set if child nodes should be skipped |
end | set 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().
|
static |
Walk a treeview subtree, calling a callback at each node (depth first)
tree | Treeview being walked. |
root | Root to walk tree from (doesn't get a callback call) |
mode | The treeview walk mode to use. |
callback_bwd | Function to call on each node in backwards order |
callback_fwd | Function to call on each node in forwards order |
ctx | Context to pass to callback |
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().
|
static |
Find node at given y-position.
tree | Treeview object to delete node from |
target_y | Target y-position |
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().
struct treeview_node_style plot_style_even |
Plot style for even rows.
Definition at line 294 of file treeview.c.
Referenced by treeview_fini(), treeview_init_furniture(), treeview_init_plot_styles(), treeview_redraw(), treeview_redraw_search(), and treeview_redraw_tree().
struct treeview_node_style plot_style_odd |
Plot style for odd rows.
Definition at line 288 of file treeview.c.
Referenced by treeview_create(), treeview_edit_node_at_point(), treeview_fini(), treeview_init_furniture(), treeview_init_plot_styles(), treeview_insert_node(), treeview_node_expand_internal(), treeview_redraw_search(), treeview_redraw_tree(), treeview_update_node_entry(), and treeview_update_node_folder().
struct treeview_globals tree_g |
Referenced by treeview__cw_scroll_to_node(), treeview__cw_scroll_top(), treeview__get_search_height(), treeview__search_cancel(), treeview_create(), treeview_create_node_entry(), treeview_create_node_folder(), treeview_create_node_root(), treeview_delete_node_walk_cb(), treeview_edit_node_at_point(), treeview_edit_selection(), treeview_fini(), treeview_init(), treeview_init_furniture(), treeview_insert_node(), treeview_mouse_action(), treeview_node_contract_cb(), treeview_node_expand_internal(), treeview_node_mouse_action_cb(), treeview_node_selection_walk_cb(), treeview_node_y(), treeview_redraw(), treeview_redraw_search(), treeview_redraw_tree(), treeview_set_inset_from_parent(), treeview_set_move_indicator(), treeview_textarea_search_callback(), treeview_update_node_folder(), and treeview_y_node().
|
static |
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().