plan9fox/libpanel/scroll.c
xfnw 856abd2f7d Squashed 'sys/src/cmd/gopher/' content from commit 3680728b6
git-subtree-dir: sys/src/cmd/gopher
git-subtree-split: 3680728b631ed65201b397f4ae3e5d1b03be42f9
2022-07-01 15:46:23 -04:00

22 lines
555 B
C

#include <u.h>
#include <libc.h>
#include <draw.h>
#include <event.h>
#include <panel.h>
#include "pldefs.h"
void plscroll(Panel *scrollee, Panel *xscroller, Panel *yscroller){
scrollee->xscroller=xscroller;
scrollee->yscroller=yscroller;
if(xscroller) xscroller->scrollee=scrollee;
if(yscroller) yscroller->scrollee=scrollee;
}
Scroll plgetscroll(Panel *p){
return p->scr;
}
void plsetscroll(Panel *p, Scroll s){
if(p->scroll){
if(s.size.x) p->scroll(p, HORIZ, 2, s.pos.x, s.size.x);
if(s.size.y) p->scroll(p, VERT, 2, s.pos.y, s.size.y);
}
}