kkallio@8: (* TogglePanel provides a panel or section of xml which appears and kkallio@8: * disappears when the user activates an associated control. The kkallio@8: * panel may contain another gui widget as content. *) kkallio@8: kkallio@8: con togglePanel :: Type -> Type kkallio@8: (* The type of appearing and disappearing panels. The argument kkallio@8: * is the type of the content. *) kkallio@8: kkallio@8: type formatCtl = {FormatPanel : xbody -> xbody -> xbody, kkallio@8: (* Allows for formatting the panel. The first two parameters kkallio@8: * represent "holes" for the control and panel respectively while kkallio@8: * the result should be the desired xml laying out the whole structure. kkallio@8: * The controls can be formatted with the options below. kkallio@8: * The panel part appears and disappears according to the use kkallio@8: * of the controls. *) kkallio@8: kkallio@8: OpenCtl : transaction unit -> xbody, kkallio@8: (* This should accept the transaction representing the opening of kkallio@8: * the panel and produce an xml control having this as action. *) kkallio@8: kkallio@8: CloseCtl : transaction unit -> xbody} kkallio@8: (* This should accept the transaction representing the closing of kkallio@8: * the panel and produce an xml control having this as action. *) kkallio@8: kkallio@8: val defaultFormat : formatCtl kkallio@8: (* Some reasonable default formats for the layout and controls. *) kkallio@8: rmbruijn@18: val create : t ::: Type -> Gui.gui t xbody -> formatCtl -> t -> bool -> transaction (togglePanel t) kkallio@8: (* Given instructions for formatting the display, some content and whether to start in kkallio@8: * the open state get such a togglePanel. *) kkallio@8: rmbruijn@18: val gui_togglePanel : t ::: Type -> Gui.gui t xbody -> Gui.gui (togglePanel t) xbody kkallio@8: (* The togglePanel is itself a widget. It can be pretty printed to a piece kkallio@8: * of xml with a use of toXml. *)