#ifndef _PAGER_
#define _PAGER_

#include "main.hh"
#include "misc.hh"
#include "windows.hh"
#include "boxes.hh"

struct Desktop;
struct Pager;

extern Desktop dsk;
extern Pager pager;
extern SWindow *spager;

#define ST_ORDINARY	0
#define ST_SWAP		1
#define ST_WRAP		2

struct SWM_Pager_Prop
{
	int x;
	int y;
};

struct Desktop
{
	int cols, rows; // size (in screens)
	int x_start, y_start; // initial (starting) position on desktop (in multiples of disp.wd,.ht
	SWM_Pager_Prop pager_prop; // server-side saved position
	int x, y; // current position (top left corner)
	int xmax, ymax; // max position
	int wd, ht; // size (in pixels)
	int lock;
	int xscrolled, yscrolled;

	Desktop ();

	int init ();
	int save_prop ();
	int scroll (int, int, int);
	int viewport_to (int, int);
};

struct Pager
{
	Window w;
	GC vpGC, textGC;
	int scale;
	int x, y, wd, ht;
	Rect v;
	MyFont font;
	MyColor view_fore, win_border;
	MyPixmap *bkg, *win_bkg;

	Pager ();

	int init ();
	int done ();
	int update ();
	int handle_event ();
	int p2ir (int, int, int &, int &);
	int p2r (int, int, int &, int &);
};

int pager_view_handle_ButtonPress ();

#endif
