24#ifndef _NETSURF_DESKTOP_TREEVIEW_H_
25#define _NETSURF_DESKTOP_TREEVIEW_H_
29#include <libwapcaplet/libwapcaplet.h>
193 struct core_window *cw,
nserror treeview_cw_detach(treeview *tree)
Detach a treeview from a corewindow.
nserror treeview_cw_attach(treeview *tree, struct core_window *cw)
Attach a treeview to a corewindow.
nserror treeview_node_contract(treeview *tree, treeview_node *node)
Contract a treeview node.
nserror(* treeview_walk_cb)(void *ctx, void *node_data, enum treeview_node_type type, bool *abort)
Client callback for treeview_walk.
void treeview_redraw(treeview *tree, int x, int y, struct rect *clip, const struct redraw_context *ctx)
Redraw a treeview object.
void treeview_mouse_action(treeview *tree, browser_mouse_state mouse, int x, int y)
Handles all kinds of mouse action.
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.
nserror treeview_contract(treeview *tree, bool all)
Contract a treeview's nodes.
nserror treeview_delete_node(treeview *tree, treeview_node *n, treeview_node_options_flags flags)
Delete a treeview node.
treeview_msg
treeview message types
@ TREE_MSG_NODE_EDIT
Node to be edited.
@ TREE_MSG_NODE_LAUNCH
Node to be launched.
@ TREE_MSG_NODE_DELETE
Node to be deleted.
enum treeview_node_type treeview_get_selection(treeview *tree, void **node_data)
Get the first selected node.
nserror treeview_fini(void)
Finalise the treeview module (all treeviews must have been destroyed first)
void treeview_edit_selection(treeview *tree)
Edit the first selected node.
bool treeview_has_selection(treeview *tree)
Determine whether treeview has a selection.
bool treeview_keypress(treeview *tree, uint32_t key)
Key press handling for treeviews.
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.
nserror treeview_get_relation(treeview *tree, treeview_node **relation, enum treeview_relationship *rel, bool at_y, int y)
Find a relation for node creation.
nserror treeview_create_node_folder(treeview *tree, treeview_node **folder, treeview_node *relation, enum treeview_relationship rel, const struct treeview_field_data *field, void *data, treeview_node_options_flags flags)
Create a folder node in given treeview.
nserror treeview_destroy(treeview *tree)
Destroy a treeview object.
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.
int treeview_get_height(treeview *tree)
Find current height of a treeview.
nserror treeview_node_expand(treeview *tree, treeview_node *node)
Expand a treeview node.
nserror treeview_init(void)
Prepare treeview module for treeview usage.
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.
nserror treeview_expand(treeview *tree, bool only_folders)
Expand a treeview's nodes.
treeview_node_type
treeview node type
@ TREE_NODE_ENTRY
Node is an entry.
@ TREE_NODE_FOLDER
Node is folder.
@ TREE_NODE_ROOT
Node is treeview's root.
nserror treeview_set_search_string(treeview *tree, const char *string)
Set the search string for a treeview with TREEVIEW_SEARCHABLE.
treeview_node_options_flags
Node change handling options.
@ TREE_OPTION_SUPPRESS_RESIZE
@ TREE_OPTION_SPECIAL_DIR
@ TREE_OPTION_SUPPRESS_REDRAW
treeview_field_flags
treeview field flags
@ TREE_FLAG_SEARCHABLE
Whether field is searchable.
@ TREE_FLAG_SHOW_NAME
Whether field name shown.
@ TREE_FLAG_COPY_TEXT
Whether to copy to clipb.
@ TREE_FLAG_ALLOW_EDIT
Whether allow edit field.
@ TREE_FLAG_NONE
No flags set.
@ TREE_FLAG_DEFAULT
Whether field is default.
treeview_relationship
Relationship between nodes.
treeview_flags
treeview control flags
@ TREEVIEW_NO_DELETES
No node deletes.
@ TREEVIEW_DEL_EMPTY_DIRS
Delete dirs on empty.
@ TREEVIEW_NO_FLAGS
No flags set.
@ TREEVIEW_SEARCHABLE
Treeview has search bar.
@ TREEVIEW_NO_MOVES
No node drags.
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.
nserror
Enumeration of error codes.
static struct directory * root
Core mouse and pointer states.
browser_mouse_state
Mouse state.
static BList * callbacks
List of all callbacks.
Client callbacks for events concerning nodes.
nserror(* folder)(struct treeview_node_msg msg, void *data)
nserror(* entry)(struct treeview_node_msg msg, void *data)
const char * value
Field value.
lwc_string * field
Field name.
size_t value_len
Field value length (bytes)
Treeview field description.
lwc_string * field
A treeview field name.
enum treeview_field_flags flags
Flags for field.
bool user
True iff delete by user interaction.
lwc_string * field
The field being edited.
union treeview_node_msg::@94 data
The message data.
const char * text
The proposed new value.
browser_mouse_state mouse
struct treeview_node_msg::@94::@97 node_launch
struct treeview_node_msg::@94::@96 node_edit
enum treeview_msg msg
The message type.
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.