Skip to content

Commit

Permalink
[wxhaskell-from-cvs @ 2003-07-13 21:22:32 by dleijen]
Browse files Browse the repository at this point in the history
initial import

darcs-hash:20030713212232-deb31-b6d1a32e02e9c807627d2382efb012ce0a592162.gz
  • Loading branch information
dleijen committed Jul 13, 2003
1 parent 4c1429c commit f8182eb
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions wxh/src/Graphics/UI/WXH/Frame.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
-----------------------------------------------------------------------------------------
{-| Module : Frame
Copyright : (c) Daan Leijen 2003
License : wxWindows
Maintainer : daan@cs.uu.nl
Stability : provisional
Portability : portable
Frame utility functions.
-}
-----------------------------------------------------------------------------------------
module Graphics.UI.WXH.Frame
( frameCreateTopFrame
, frameCreateDefault
, frameSetTopFrame
, frameDefaultStyle
, dialogDefaultStyle
, statusBarCreateFields
) where

import Data.Bits
import Foreign.Marshal.Array
import Graphics.UI.WXH.WxcTypes
import Graphics.UI.WXH.WxcDefs
import Graphics.UI.WXH.WxcClasses
import Graphics.UI.WXH.Types


-- | The default frame style for a normal top-level 'Frame'.
frameDefaultStyle :: Int
frameDefaultStyle
= wxDEFAULT_FRAME_STYLE .|. wxNO_FULL_REPAINT_ON_RESIZE .|. wxCLIP_CHILDREN

-- | The default frame style for a normal 'Dialog'.
dialogDefaultStyle :: Int
dialogDefaultStyle
= wxCAPTION .|. wxSYSTEM_MENU .|. wxTAB_TRAVERSAL .|. wxNO_FULL_REPAINT_ON_RESIZE .|. wxCLIP_CHILDREN



------------------------------------------------------------------------------------------
--
------------------------------------------------------------------------------------------
-- | Create a default frame and make it the top-level window.
frameCreateTopFrame :: String -> IO (Frame ())
frameCreateTopFrame title
= do frame <- frameCreateDefault title
frameSetTopFrame frame
return frame

-- | Set the top-level frame (calls 'cAppSetTopWindow').
frameSetTopFrame :: Frame a -> IO ()
frameSetTopFrame frame
= wxcAppSetTopWindow frame

-- | Create a frame with default settings.
frameCreateDefault :: String -> IO (Frame ())
frameCreateDefault title
= frameCreate objectNull idAny title rectNull frameDefaultStyle

------------------------------------------------------------------------------------------
-- Statusbar
------------------------------------------------------------------------------------------
statusBarCreateFields :: Frame a -> [Int] -> IO (StatusBar ())
statusBarCreateFields parent widths
= do sb <- frameCreateStatusBar parent (length widths) wxST_SIZEGRIP
let len = length widths
if (len <= 1)
then return sb
else do withArray (map toCInt widths) (\pwidths -> statusBarSetStatusWidths sb (length widths) pwidths)
return sb

0 comments on commit f8182eb

Please sign in to comment.