-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[wxhaskell-from-cvs @ 2003-07-13 21:22:32 by dleijen]
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.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |