From c415f9bf989f83c7ced6bb930e3421dab6f4093b Mon Sep 17 00:00:00 2001 From: Ole Loots Date: Sun, 18 Nov 2012 23:22:43 +0100 Subject: Start to remove windom, wip. - Refactored menu event handling. - Load plain GEM resources. - Refactored Event handling --- atari/treeview.c | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) (limited to 'atari/treeview.c') diff --git a/atari/treeview.c b/atari/treeview.c index 4a5cb0a75..6e567f569 100755 --- a/atari/treeview.c +++ b/atari/treeview.c @@ -37,7 +37,19 @@ #include "atari/treeview.h" #include "atari/plot/plot.h" #include "atari/misc.h" -#include "cflib.h" +#include "cflib.h" + +/* +#define TREEVIEW_RECT_WORKAREA 0 +#define TREEVIEW_RECT_TOOLBAR 1 +#define TREEVIEW_RECT_CONTENT 2 +*/ + +enum treeview_area_e { + TREEVIEW_AREA_WORK = 0, + TREEVIEW_AREA_TOOLBAR, + TREEVIEW_AREA_CONTENT +}; extern int mouse_hold_start[3]; extern browser_mouse_state bmstate; @@ -46,9 +58,11 @@ extern short last_drag_y; extern long atari_plot_flags; extern int atari_plot_vdi_handle; -static void atari_treeview_resized(struct tree *tree,int w,int h,void *pw); +static void atari_treeview_resized(struct tree *tree,int w,int h, void *pw); static void atari_treeview_scroll_visible(int y, int h, void *pw); -static void atari_treeview_get_dimensions(int *width, int *height,void *pw); +static void atari_treeview_get_dimensions(int *width, int *height, void *pw); +static void atari_treeview_get_grect(NSTREEVIEW tree, + enum treeview_area_e mode, GRECT *dest); static const struct treeview_table atari_tree_callbacks = { atari_treeview_request_redraw, @@ -403,6 +417,24 @@ void atari_treeview_scroll_visible(int y, int height, void *pw) { /* we don't support dragging outside the treeview */ /* so we don't need to implement this? */ +} + +static void atari_treeview_get_grect(NSTREEVIEW tv, enum treeview_area_e mode, + GRECT *dest) +{ + + wind_get_grect(tv->window->handle, WF_WORKXYWH, dest); + if (mode == TREEVIEW_AREA_CONTENT) { + GRECT tb_grect; + atari_treeview_get_grect(tv, TREEVIEW_AREA_TOOLBAR, &tb_grect); + dest->g_y += tb_grect.g_h; + dest->g_h -= tb_grect.g_h; + } + else if (mode == TREEVIEW_AREA_TOOLBAR) { + // TODO: this requires something like: + // guiwin_get_toolbar(); + dest->g_h = 16; + } } /** @@ -418,8 +450,8 @@ void atari_treeview_get_dimensions(int *width, int *height, { if (pw != NULL && (width != NULL || height != NULL)) { NSTREEVIEW tv = (NSTREEVIEW) pw; - GRECT work; - WindGetGrect( tv->window, WF_WORKXYWH, &work ); + GRECT work; + atari_treeview_get_grect(tv, TREEVIEW_AREA_CONTENT, &work); *width = work.g_w; *height = work.g_h; } -- cgit v1.2.3