summaryrefslogtreecommitdiff
path: root/atari/treeview.c
diff options
context:
space:
mode:
authorOle Loots <ole@monochrom.net>2012-11-20 01:41:42 +0100
committerOle Loots <ole@monochrom.net>2012-11-20 01:41:42 +0100
commit7e94f32e4c99ced99ab4efaef1e56ad96430fb40 (patch)
tree35d53a0b981b9200608dd44ec111a4fb5db9056a /atari/treeview.c
parent5449303bd1bf27e4cc8baccb0985e4d52c563caf (diff)
downloadnetsurf-7e94f32e4c99ced99ab4efaef1e56ad96430fb40.tar.gz
netsurf-7e94f32e4c99ced99ab4efaef1e56ad96430fb40.tar.bz2
Initial work at making scrolling work
Diffstat (limited to 'atari/treeview.c')
-rwxr-xr-xatari/treeview.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/atari/treeview.c b/atari/treeview.c
index ab0afb515..4cddea417 100755
--- a/atari/treeview.c
+++ b/atari/treeview.c
@@ -86,6 +86,11 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
on_redraw_event(tv, ev_out, msg);
break;
+ case WM_SIZED:
+ case WM_FULLED:
+ guiwin_update_slider(win, 3);
+ break;
+
default:
break;
}
@@ -322,18 +327,16 @@ void atari_treeview_destroy( NSTREEVIEW tv )
bool atari_treeview_mevent( NSTREEVIEW tv, browser_mouse_state bms, int x, int y)
{
GRECT work;
+ struct guiwin_scroll_info_s *slid;
if( tv == NULL )
return ( false );
guiwin_get_grect(tv->window, GUIWIN_AREA_CONTENT, &work);
+ slid = guiwin_get_scroll_info(tv->window);
- //int rx = (x-work.g_x)+(tv->window->xpos*tv->window->w_u);
- //int ry = (y-work.g_y)+(tv->window->ypos*tv->window->h_u);
-
- // TODO: get slider values
- int rx = (x-work.g_x);
- int ry = (y-work.g_y);
+ int rx = (x-work.g_x)+(slid->x_pos*slid->x_unit_px);
+ int ry = (y-work.g_y)+(slid->y_pos*slid->y_unit_px);
tree_mouse_action(tv->tree, bms, rx, ry);
@@ -353,9 +356,11 @@ void atari_treeview_redraw( NSTREEVIEW tv)
short todo[4];
GRECT work;
- short handle = guiwin_get_handle(tv->window);
+ short handle = guiwin_get_handle(tv->window);
+ struct guiwin_scroll_info_s *slid;
guiwin_get_grect(tv->window, GUIWIN_AREA_CONTENT, &work);
+ slid = guiwin_get_scroll_info(tv->window);
struct redraw_context ctx = {
.interactive = true,
@@ -378,8 +383,8 @@ void atari_treeview_redraw( NSTREEVIEW tv)
/* convert screen to treeview coords: */
// TODO: get slider values:
- todo[0] = todo[0] - work.g_x;/*+ tv->window->xpos*tv->window->w_u;*/
- todo[1] = todo[1] - work.g_y;/*+ tv->window->ypos*tv->window->h_u;*/
+ todo[0] = todo[0] - work.g_x + slid->x_pos*slid->x_unit_px;
+ todo[1] = todo[1] - work.g_y + slid->y_pos*slid->y_unit_px;
if( todo[0] < 0 ){
todo[2] = todo[2] + todo[0];
todo[0] = 0;
@@ -389,10 +394,10 @@ void atari_treeview_redraw( NSTREEVIEW tv)
todo[1] = 0;
}
- // TODO: get slider values
+ // TODO: get slider values
if (rc_intersect((GRECT *)&tv->rdw_area,(GRECT *)&todo)) {
- tree_draw(tv->tree, 0/*-tv->window->xpos*16*/,
- 0 /*-tv->window->ypos*16*/,
+ tree_draw(tv->tree, -(slid->x_pos*slid->x_unit_px),
+ -(slid->y_pos*slid->y_unit_px),
todo[0], todo[1], todo[2], todo[3], &ctx
);
}
@@ -472,7 +477,6 @@ void atari_treeview_resized(struct tree *tree, int width, int height, void *pw)
struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(tv->window);
slid->x_pos_max = (width / slid->x_unit_px);
slid->y_pos_max = (height / slid->y_unit_px);
- printf("updating slider...\n");
guiwin_update_slider(tv->window, 3);
}
}