\usemodule[simpleslides]
	[style=swoosh]

%%%%%%%%%%%%%%%%%%%%%%
%%% we redefine the visualcounter circle to make it interactive:
%%% clicking on the page number shown in the middle
%%% makes the PDF viewer to do a PreviousJump

\setupinteraction[state=start]
\startuseMPgraphic{simpleslides:MP:counter}
save b, s, t, p, circcenter, theta, pic ;
path p[] ;
pair t[] ;
pair s[] ;
pair circcenter ; 
circcenter = urcorner Page shifted (-1cm,-1cm) ;
% circcenter = lrcorner Page shifted (-1cm,1cm) ; 
pair zt, zr, zb, zl ;
picture pic ;
b = 1.5cm ;
if PageNumber > 3: % the page after which the visual counter is shown
	theta = (PageNumber - 1)/(NOfPages - 1) ;
 	p[4] = fullcircle scaled b rotated 90 ;
	p[4] := p[4] shifted circcenter ;
 	fill p[4] withcolor \MPcolor{simpleslides:altcontrastcolor} ;
 	t[0] = center p[4] ;
 	t[1] = point 1 along p[4] ;
 	t[2] = point -theta along p[4] ;
 	t[3] = point -theta/2 along p[4] ;
 	p[5] = t[0] -- t[1] .. t[3] .. t[2] -- cycle ;
 	fill p[5] withcolor \MPcolor{simpleslides:contrastcolor} ;
 	for i = 1 upto NOfPages :
 		s[i] = point i/(NOfPages -1) along p[4] ;
 		pickup pencircle scaled 1pt ;
 		draw s[i] -- t[0] withcolor \MPcolor{simpleslides:backgroundcolor} ;
 	endfor ;
 	zt = t[0] shifted (0, b * 0.2) ;
	zr = t[0] shifted (b * 0.2, 0) ;
	zb = t[0] shifted (0, -b * 0.2) ;
	zl = t[0] shifted (-b * 0.2, 0) ;
	p[3] = zt .. zr .. zb .. zl .. cycle ;
 	fill p[3] withcolor  \MPcolor{simpleslides:contrastcolor} ;
 	draw p[3] withcolor \MPcolor{simpleslides:backgroundcolor} ;
 	label(textext("\start\switchtobodyfont[10pt]%
	\setupinteraction[color=simpleslides:backgroundcolor,style=normal]%
	\startcolor[simpleslides:backgroundcolor]
	\goto{\pagenumber}[PreviousJump]
	\stopcolor\stop"),center p[3]) ;
fi ;
\stopuseMPgraphic

\definelist[ListOfTopics]
\setuplist[ListOfTopics][alternative=f]
\define[1]\GoToMyList{%
	\start
	\setupinteraction[color=simpleslides:backgroundcolor,style=normal]
	\goto{#1}[ListOfTopics]
	\stop}
	
\define[1]\Topic{%
	\SlideTitle{\GoToMyList{#1}}
	\unexpanded\define\TopicTitle{#1}
	\writetolist[ListOfTopics]{}{#1}
	}
\define\Slide{\SlideTitle{\GoToMyList{\TopicTitle}}}

\define[1]\placeListOfTopics{%
	\SlideTitle{#1}
	\start
	\setupinteraction[color=simpleslides:altcontrastcolor,style=bold]
	\startalignment[middle]
		\completelist[ListOfTopics]
	\stopalignment
	\reference[ListOfTopics]{}
	\stop}
%%%%%%%%%%%%%%%%%%%%%%

\endinput