Skip to content

Commit

Permalink
[wxhaskell-from-cvs @ 2004-05-27 14:35:39 by dleijen]
Browse files Browse the repository at this point in the history
Only add resize gripper to statusbar when the frame is resizeable.

darcs-hash:20040527143543-deb31-0c317945b04f914ec821b9b20f983fe14da87442.gz
  • Loading branch information
dleijen committed May 27, 2004
1 parent 354ab9d commit 4183186
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
1 change: 1 addition & 0 deletions changes.txt
Expand Up @@ -15,6 +15,7 @@ Not backward compatible changes:
- Removed sorted argument for listboxes.
- Added default "stretch" to every toplevel layout, assuring that
such layout gets at least all available space assigned.
- (un)set "maximize box" when "resizeable" is set.

Backward compatible additions:
- Added "changes.txt" file :-)
Expand Down
13 changes: 7 additions & 6 deletions wx/src/Graphics/UI/WX/Frame.hs
Expand Up @@ -64,9 +64,9 @@ frameEx :: Style -> [Prop (Frame ())] -> Window a -> IO (Frame ())
frameEx style props parent
= do f <- frameCreate parent idAny "" rectNull
( minimizeableFlags props
$ maximizeableFlags props
$ clipChildrenFlags props
$ resizeableFlags props
$ maximizeableFlags props
$ closeableFlags props
$ fullRepaintOnResizeFlags props style)
wxcAppSetTopWindow f
Expand Down Expand Up @@ -194,7 +194,8 @@ tile = mdiParentFrameTile
{--------------------------------------------------------------------------
Framed instances
--------------------------------------------------------------------------}
-- | Display a resize border on a 'Frame' or 'Dialog' window.
-- | 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 :: Attr (Window a) Bool
windowResizeable
Expand All @@ -205,16 +206,16 @@ windowResizeable
return (bitsSet wxRESIZE_BORDER s)
setFlag w resize
= set w [style :~ \stl -> if resize
then stl .+. wxRESIZE_BORDER
else stl .-. wxRESIZE_BORDER]
then stl .+. wxRESIZE_BORDER .+. wxMAXIMIZE_BOX
else stl .-. wxRESIZE_BORDER .-. wxMAXIMIZE_BOX]

-- | Helper function that transforms the style accordding
-- to the 'resizeable' flag out of the properties
resizeableFlags :: [Prop (Window a)] -> Int -> Int
resizeableFlags props stl
= case getPropValue windowResizeable props of
Just True -> stl .+. wxRESIZE_BORDER
Just False -> stl .-. wxRESIZE_BORDER
Just True -> stl .+. wxRESIZE_BORDER .+. wxMAXIMIZE_BOX
Just False -> stl .-. wxRESIZE_BORDER .-. wxMAXIMIZE_BOX
Nothing -> stl


Expand Down
15 changes: 9 additions & 6 deletions wx/src/Graphics/UI/WX/Menu.hs
Expand Up @@ -376,13 +376,16 @@ toolBar parent props
-- above the toolbar.
toolBarEx :: Frame a -> Bool -> Bool -> [Prop (ToolBar ())] -> IO (ToolBar ())
toolBarEx parent showText showDivider props
= do t <- toolBarCreate parent idAny rectNull
( wxTB_DOCKABLE .+. wxTB_FLAT
.+. (if showText then wxTB_TEXT else 0)
.+. (if showDivider then 0 else 0x200 {- wxTB_NODIVIDER -})
)
set t props
= do let style = ( wxTB_DOCKABLE .+. wxTB_FLAT
.+. (if showText then wxTB_TEXT else 0)
.+. (if showDivider then 0 else 0x200) -- wxTB_NODIVIDER
)
t <- toolBarCreate parent idAny rectNull style
frameSetToolBar parent t
{-
t <- frameCreateToolBar parent style
-}
set t props
return t

-- | A tool in a toolbar.
Expand Down
4 changes: 3 additions & 1 deletion wxcore/src/Graphics/UI/WXCore/Frame.hs
Expand Up @@ -108,7 +108,9 @@ windowGetScreenPosition w
------------------------------------------------------------------------------------------
statusBarCreateFields :: Frame a -> [Int] -> IO (StatusBar ())
statusBarCreateFields parent widths
= do sb <- frameCreateStatusBar parent (length widths) wxST_SIZEGRIP
= do pst <- windowGetWindowStyleFlag parent
let st = if (bitsSet wxRESIZE_BORDER pst) then wxST_SIZEGRIP else 0
sb <- frameCreateStatusBar parent (length widths) st
let len = length widths
if (len <= 1)
then return sb
Expand Down

0 comments on commit 4183186

Please sign in to comment.