{-# OPTIONS -fglasgow-exts #-}--------------------------------------------------------------------------------{-| Module : TopLevelWindow
Copyright : (c) Jeremy O'Donoghue, 2007
License : wxWindows
Maintainer : wxhaskell-devel@lists.sourceforge.net
Stability : provisional
Portability : portable
wxTopLevelwindow (wxWidgets >= 2.8.0) defines an (abstract) common base class
for wxFrame and wxDialog.
In the wxHaskell implementation, TopLevel has been added to encapsulate
some of the common functionality between the 'Dialog' and 'Frame' modules.
* Instances: 'HasDefault'
* Instances inherited from 'Window': 'Textual', 'Literate', 'Dimensions',
'Colored', 'Visible', 'Child', 'Able', 'Tipped', 'Identity',
'Styled', 'Reactive', 'Paint'.
-}--------------------------------------------------------------------------------moduleGraphics.UI.WX.TopLevelWindow(initialResizeable,initialMaximizeable,initialMinimizeable,initialCloseable)whereimportGraphics.UI.WXCoreimportGraphics.UI.WX.TypesimportGraphics.UI.WX.AttributesimportGraphics.UI.WX.ClassesimportGraphics.UI.WX.LayoutimportGraphics.UI.WX.WindowimportGraphics.UI.WX.Events-- The default control activated by return keyinstanceHasDefault(TopLevelWindowa)whereunsafeDefaultItem=newAttr"unsafeDefaultItem"gettersetterwheregetter::(TopLevelWindowa)->IO(Window())gettertlw=topLevelWindowGetDefaultItemtlwsettertlwwin=topLevelWindowSetDefaultItemtlwwindefaultButton=newAttr"defaultButton"gettersetterwheregetter::(TopLevelWindowa)->IO(Button())gettertlw=topLevelWindowGetDefaultButtontlwsettertlwwin=topLevelWindowSetDefaultButtontlwwin-- The icon of a frame. instancePictured(TopLevelWindowa)wherepicture=writeAttr"picture"topLevelWindowSetIconFromFile-- Defaults for framed TopLevel windowsinstanceFramed(TopLevelWindowa)whereresizeable=windowResizeablemaximizeable=windowMaximizeableminimizeable=windowMinimizeablecloseable=windowCloseable-- Default layout implementationinstanceForm(Framea)wherelayout=writeAttr"layout"windowSetLayout-- Default window closeinstanceCloseable(Framea)whereclosef=unitIO(windowClosefTrue{- force? -}){--------------------------------------------------------------------------
Framed instances
--------------------------------------------------------------------------}-- | Display a resize border on a 'Frame' or 'Dialog' window. Also enables or-- disables the the maximize box.-- This attribute must be set at creation time.windowResizeable::CreateAttr(Windowa)BoolwindowResizeable=reflectiveAttr"resizeable"getFlagsetFlagwheregetFlagw=dos<-getwstylereturn(bitsSetwxRESIZE_BORDERs)setFlagwresize=setw[style:~\stl->ifresizethenstl.+.wxRESIZE_BORDER.+.wxMAXIMIZE_BOXelsestl.-.wxRESIZE_BORDER.-.wxMAXIMIZE_BOX]-- | Helper function that transforms the style accordding-- to the 'windowResizable' flag in of the propertiesinitialResizeable::([Prop(Windoww)]->Style->a)->[Prop(Windoww)]->Style->ainitialResizeable=withStylePropertywindowResizeable(wxRESIZE_BORDER.+.wxMAXIMIZE_BOX)-- | Display a maximize box on a 'Frame' or 'Dialog' window.-- This attribute must be set at creation time.windowMaximizeable::CreateAttr(Windowa)BoolwindowMaximizeable=reflectiveAttr"maximizeable"getFlagsetFlagwheregetFlagw=dos<-getwstylereturn(bitsSetwxMAXIMIZE_BOXs)setFlagwmax=setw[style:~\stl->ifmaxthenstl.+.wxMAXIMIZE_BOXelsestl.-.wxMAXIMIZE_BOX]-- | Helper function that transforms the style accordding-- to the 'windowMaximizable' flag in of the propertiesinitialMaximizeable::([Prop(Windoww)]->Style->a)->[Prop(Windoww)]->Style->ainitialMaximizeable=withStylePropertywindowMaximizeablewxMAXIMIZE_BOX-- | Display a minimize box on a 'Frame' or 'Dialog' window.-- This attribute must be set at creation time.windowMinimizeable::CreateAttr(Windowa)BoolwindowMinimizeable=reflectiveAttr"minimizeable"getFlagsetFlagwheregetFlagw=dos<-getwstylereturn(bitsSetwxMINIMIZE_BOXs)setFlagwmin=setw[style:~\stl->ifminthenstl.+.wxMINIMIZE_BOXelsestl.-.wxMINIMIZE_BOX]-- | Helper function that transforms the style accordding-- to the 'windowMinimizable' flag in of the propertiesinitialMinimizeable::([Prop(Windoww)]->Style->a)->[Prop(Windoww)]->Style->ainitialMinimizeable=withStylePropertywindowMinimizeablewxMINIMIZE_BOX-- | Display a close box on a 'Frame' or 'Dialog' window.-- This attribute must be set at creation time.windowCloseable::CreateAttr(Windowa)BoolwindowCloseable=reflectiveAttr"closeable"getFlagsetFlagwheregetFlagw=dos<-getwstylereturn(bitsSetwxCLOSE_BOXs)setFlagwmin=setw[style:~\stl->ifminthenstl.+.wxCLOSE_BOXelsestl.-.wxCLOSE_BOX]-- | Helper function that transforms the style accordding-- to the 'windowMinimizable' flag in of the propertiesinitialCloseable::([Prop(Windoww)]->Style->a)->[Prop(Windoww)]->Style->ainitialCloseable=withStylePropertywindowCloseablewxCLOSE_BOX