summaryrefslogtreecommitdiff
path: root/desktop/tree.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2013-05-31 10:11:22 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2013-05-31 10:11:22 +0100
commitd9394608726224bdaf5678ea634564b9da2b5248 (patch)
tree424b3bc97e2b52082855e69e6e8fc601ed300a8e /desktop/tree.c
parent903122126703e70670131932acb9b5b3eba86e8f (diff)
downloadnetsurf-d9394608726224bdaf5678ea634564b9da2b5248.tar.gz
netsurf-d9394608726224bdaf5678ea634564b9da2b5248.tar.bz2
Add parasitic hack to allow the new treeview to be tested in the Hotlist window.
(Tested with GTK front end only, so far.)
Diffstat (limited to 'desktop/tree.c')
-rw-r--r--desktop/tree.c98
1 files changed, 98 insertions, 0 deletions
diff --git a/desktop/tree.c b/desktop/tree.c
index 25bd9488b..64ba91f1f 100644
--- a/desktop/tree.c
+++ b/desktop/tree.c
@@ -173,6 +173,90 @@ struct tree {
struct node *def_folder; /* Node to be used for additions by default */
};
+
+
+
+#include "desktop/treeview.h"
+#include "desktop/global_history.h"
+
+static void treeview_test_redraw_request(struct core_window *cw, struct rect r)
+{
+}
+
+static void treeview_test_update_size(struct core_window *cw,
+ int width, int height)
+{
+}
+
+static void treeview_test_scroll_visible(struct core_window *cw, struct rect r)
+{
+}
+
+static void treeview_test_get_window_dimensions(struct core_window *cw,
+ int *width, int *height)
+{
+}
+
+struct core_window_callback_table cw_t = {
+ .redraw_request = treeview_test_redraw_request,
+ .update_size = treeview_test_update_size,
+ .scroll_visible = treeview_test_scroll_visible,
+ .get_window_dimensions = treeview_test_get_window_dimensions
+};
+
+static void treeview_test_init(struct tree *tree)
+{
+ nserror err;
+
+ treeview_init();
+
+ err = global_history_init(&cw_t, (struct core_window *)tree);
+
+ if (err != NSERROR_OK) {
+ warn_user("Duffed it.", 0);
+ }
+}
+
+static void treeview_test_fini(struct tree *tree)
+{
+ nserror err;
+
+ err = global_history_fini(&cw_t, (struct core_window *)tree);
+
+ treeview_fini();
+
+ if (err != NSERROR_OK) {
+ warn_user("Duffed it.", 0);
+ }
+}
+
+static void treeview_test_redraw(struct tree *tree, int x, int y,
+ int clip_x, int clip_y, int clip_width, int clip_height,
+ const struct redraw_context *ctx)
+{
+ struct rect clip;
+ clip.x0 = clip_x;
+ clip.y0 = clip_y;
+ clip.x1 = clip_x + clip_width;
+ clip.y1 = clip_y + clip_height;
+
+ global_history_redraw(x, y, &clip, ctx);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
void tree_set_icon_dir(char *icon_dir)
{
LOG(("Tree icon directory set to %s", icon_dir));
@@ -276,6 +360,10 @@ struct tree *tree_create(unsigned int flags,
tree_setup_colours();
+ if (flags == TREE_MOVABLE) {
+ treeview_test_init(tree);
+ }
+
return tree;
}
@@ -1119,6 +1207,10 @@ void tree_delete(struct tree *tree)
{
tree->redraw = false;
+ if (tree->flags == TREE_MOVABLE) {
+ treeview_test_fini(tree);
+ }
+
if (tree->root->child != NULL)
tree_delete_node_internal(tree, tree->root->child, true);
@@ -2033,6 +2125,12 @@ void tree_draw(struct tree *tree, int x, int y,
assert(tree != NULL);
assert(tree->root != NULL);
+ if (tree->flags == TREE_MOVABLE) {
+ treeview_test_redraw(tree, x, y, clip_x, clip_y,
+ clip_width, clip_height, ctx);
+ return;
+ }
+
/* Start knockout rendering if it's available for this plotter */
if (ctx->plot->option_knockout)
knockout_plot_start(ctx, &new_ctx);