XSScroll

SYNTAX

	wid=XSScroll(parent,x,y,width,height,subwidth,subheight)

        XSWidget *wid,*parent;
        int x,y,width,height,subwidth,subheight;

DESCRIPTION

XSScroll create a button widget inside the selected parent, in the position x,y with size width,height with a scrolled sub-window inside with size subwidth,subheight. This sub-window is a standard XSWindow and can be used by any other widget.

All operations of XSScroll in the X server are delayed until XSCheckEvent is executed.

Example

#include <xstep.h>
#include <stdlib.h>

void viewportexposef(XSWidget *wid) {

	XDrawLine(wid->display,wid->window,wid->gc,
		8,8,wid->width-8,wid->height-8);

	XDrawLine(wid->display,wid->window,wid->gc,
		8,wid->height-8,wid->width-8,8);

	XDrawArc(wid->display,wid->window,wid->gc,
		8,8,wid->width-16,wid->height-16,
		0,360*64);
}

int main(int argc,char **argv) {

	XSWidget *d1,*w1,*w2;
	
	d1=XSDesktop(getenv("DISPLAY"),argv,argc);
	w1=XSWindow(d1,0,0,400,400,"scroll example");

	w2=XSScroll(w1,8,8,-8,-40,800,800);
	w2->viewport->on.event[Expose]=viewportexposef;

	XSButton(w1,-8,-8,72,24,"Close",XSWindowClose);
	
	while(XSCheckEvent(d1,XS_BLOCK));

	return 0;
}