summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2016-12-29 14:43:38 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2016-12-29 14:43:38 +0000
commitded1979fa1b77ea6261df7a7f6f9177bde433f2d (patch)
tree7cf9e269a05d6f12c82a230726cd925a3fc911c7 /desktop
parent7750d926adf3740448ec2fada2e207a4b5bd5851 (diff)
downloadnetsurf-ded1979fa1b77ea6261df7a7f6f9177bde433f2d.tar.gz
netsurf-ded1979fa1b77ea6261df7a7f6f9177bde433f2d.tar.bz2
Treeview: Add API for attaching and detaching from corewindows.
Diffstat (limited to 'desktop')
-rw-r--r--desktop/treeview.c29
-rw-r--r--desktop/treeview.h22
2 files changed, 51 insertions, 0 deletions
diff --git a/desktop/treeview.c b/desktop/treeview.c
index c348146b8..1d0ac52a3 100644
--- a/desktop/treeview.c
+++ b/desktop/treeview.c
@@ -1422,6 +1422,35 @@ nserror treeview_create(treeview **tree,
/* Exported interface, documented in treeview.h */
+nserror treeview_cw_attach(treeview *tree,
+ const struct core_window_callback_table *cw_t,
+ struct core_window *cw)
+{
+ assert(cw_t != NULL);
+ assert(cw != NULL);
+
+ if (tree->cw_t != NULL || tree->cw_h != NULL) {
+ LOG("Treeview already attached.");
+ return NSERROR_UNKNOWN;
+ }
+ tree->cw_t = cw_t;
+ tree->cw_h = cw;
+
+ return NSERROR_OK;
+}
+
+
+/* Exported interface, documented in treeview.h */
+nserror treeview_cw_detach(treeview *tree)
+{
+ tree->cw_t = NULL;
+ tree->cw_h = NULL;
+
+ return NSERROR_OK;
+}
+
+
+/* Exported interface, documented in treeview.h */
nserror treeview_destroy(treeview *tree)
{
int f;
diff --git a/desktop/treeview.h b/desktop/treeview.h
index abe0e568d..518f045aa 100644
--- a/desktop/treeview.h
+++ b/desktop/treeview.h
@@ -150,6 +150,28 @@ nserror treeview_create(treeview **tree,
struct core_window *cw, treeview_flags flags);
/**
+ * Attach a treeview to a corewindow.
+ *
+ * Treeview must be detached.
+ *
+ * \param tree Treeview object
+ * \param cw_t Callback table for core_window containing the treeview
+ * \param cw The core_window in which the treeview is shown
+ * \return NSERROR_OK on success, appropriate error otherwise
+ */
+nserror treeview_cw_attach(treeview *tree,
+ const struct core_window_callback_table *cw_t,
+ struct core_window *cw);
+
+/**
+ * Detach a treeview from a corewindow
+ *
+ * \param tree Treeview object
+ * \return NSERROR_OK on success, appropriate error otherwise
+ */
+nserror treeview_cw_detach(treeview *tree);
+
+/**
* Destroy a treeview object
*
* \param tree Treeview object to destroy