Commit fb964bf4 authored by Peter Achten's avatar Peter Achten
Browse files

(PA) bug removed (hide/show)Control

parent 1ca5710f
...@@ -154,8 +154,8 @@ hideControl :: !Id !(IOSt .l) -> IOSt .l ...@@ -154,8 +154,8 @@ hideControl :: !Id !(IOSt .l) -> IOSt .l
hideControl id ioState = hideControls [id] ioState hideControl id ioState = hideControls [id] ioState
setControlsShowState` :: !Bool ![Id] !*WState -> *WState setControlsShowState` :: !Bool ![Id] !*WState -> *WState
setControlsShowState` show ids wState=:{wIds={wPtr},wRep,wTb,wMetrics} setControlsShowState` show ids wState=:{wIds,wRep,wTb,wMetrics}
# (wH,tb) = setcontrolsshowstate ids show wMetrics wPtr wRep wTb # (wH,tb) = setcontrolsshowstate ids show wMetrics wIds wRep wTb
wH = invalidateWindowClipState` wH wH = invalidateWindowClipState` wH
= {wState & wRep=wH,wTb=tb} = {wState & wRep=wH,wTb=tb}
......
...@@ -12,7 +12,7 @@ enablecontrols :: ![Id] !Bool !OSWindowMetrics !OSWindowPtr !Wind ...@@ -12,7 +12,7 @@ enablecontrols :: ![Id] !Bool !OSWindowMetrics !OSWindowPtr !Wind
-> ( !WindowHandle`, !*OSToolbox) -> ( !WindowHandle`, !*OSToolbox)
disablecontrols :: ![Id] !Bool !OSWindowMetrics !OSWindowPtr !WindowHandle` !*OSToolbox disablecontrols :: ![Id] !Bool !OSWindowMetrics !OSWindowPtr !WindowHandle` !*OSToolbox
-> ( !WindowHandle`, !*OSToolbox) -> ( !WindowHandle`, !*OSToolbox)
setcontrolsshowstate:: ![Id] !Bool !OSWindowMetrics !OSWindowPtr !WindowHandle` !*OSToolbox setcontrolsshowstate:: ![Id] !Bool !OSWindowMetrics !WIDS !WindowHandle` !*OSToolbox
-> ( !WindowHandle`, !*OSToolbox) -> ( !WindowHandle`, !*OSToolbox)
setcontrolsmarkstate:: !Id !MarkState ![Index] !OSWindowMetrics !OSWindowPtr !WindowHandle` !*OSToolbox setcontrolsmarkstate:: !Id !MarkState ![Index] !OSWindowMetrics !OSWindowPtr !WindowHandle` !*OSToolbox
-> ( !WindowHandle`, !*OSToolbox) -> ( !WindowHandle`, !*OSToolbox)
......
...@@ -5,10 +5,10 @@ implementation module controlinternal ...@@ -5,10 +5,10 @@ implementation module controlinternal
import StdBool, StdEnum, StdList, StdMisc, StdTuple import StdBool, StdEnum, StdList, StdMisc, StdTuple
import oswindow import osrgn, oswindow
from ospicture import defaultPen from ospicture import defaultPen
from ostooltip import OSaddControlToolTip from ostooltip import OSaddControlToolTip
from osrgn import osisemptyrgn, osdisposergn //from osrgn import osisemptyrgn, osdisposergn
import commondef, wstateaccess import commondef, wstateaccess
from StdControlAttribute import isControlTip, getControlTipAtt, isControlKeyboard from StdControlAttribute import isControlTip, getControlTipAtt, isControlKeyboard
from controldraw import drawCustomButtonLook`, drawCustomLook`, drawCompoundLook`, from controldraw import drawCustomButtonLook`, drawCustomLook`, drawCompoundLook`,
...@@ -275,45 +275,68 @@ where ...@@ -275,45 +275,68 @@ where
// Set the show state of the controls and provide proper feedback. // Set the show state of the controls and provide proper feedback.
setcontrolsshowstate :: ![Id] !Bool !OSWindowMetrics !OSWindowPtr !WindowHandle` !*OSToolbox -> (!WindowHandle`,!*OSToolbox) setcontrolsshowstate :: ![Id] !Bool !OSWindowMetrics !WIDS !WindowHandle` !*OSToolbox -> (!WindowHandle`,!*OSToolbox)
setcontrolsshowstate ids itemsShow wMetrics wPtr wH=:{whItems`,whSelect`,whSize`,whWindowInfo`} tb setcontrolsshowstate ids itemsShow wMetrics wids=:{wPtr} wH=:{whItems`,whSelect`,whSize`,whWindowInfo`} tb
# (_,itemHs,tb) = setWElements (setWItemShowStates wMetrics wPtr itemsShow contextShow contextSelect clipRect) ids whItems` tb # (updRgn,tb) = osnewrgn tb // PA+++
= ({wH & whItems`=itemHs},tb) # (_,itemHs,(updRgn,tb))= setWElements (setWItemShowStates wMetrics wPtr itemsShow contextShow contextSelect clipRect) ids whItems` (updRgn,tb)
wH = {wH & whItems`=itemHs}
// # (wH,tb) = updatewindowbackgrounds` wMetrics updRgn wids wH tb // PA+++
# (_,updRgnRect,tb) = osgetrgnbox updRgn tb
# tb = OSinvalidateWindowRect wPtr updRgnRect tb
// # tb = OSinvalidateWindow wPtr tb
# tb = osdisposergn updRgn tb
= (wH,tb)
where where
clipRect = getContentRect wMetrics whWindowInfo` whSize` clipRect = getContentRect wMetrics whWindowInfo` whSize`
contextShow = True contextShow = True
contextSelect = if whSelect` Able Unable contextSelect = if whSelect` Able Unable
setWItemShowStates :: !OSWindowMetrics !OSWindowPtr !Bool !Bool !SelectState !Rect ![Id] !WItemHandle` !*OSToolbox setWItemShowStates :: !OSWindowMetrics !OSWindowPtr !Bool !Bool !SelectState !Rect ![Id] !WItemHandle` !(!OSRgnHandle,!*OSToolbox)
-> (![Id],!WItemHandle`,!*OSToolbox) -> (![Id],!WItemHandle`,!(!OSRgnHandle,!*OSToolbox))
setWItemShowStates wMetrics wPtr itemsShow contextShow contextSelect clipRect ids itemH=:{wItemKind`=IsRadioControl} tb setWItemShowStates wMetrics wPtr itemsShow contextShow contextSelect clipRect ids itemH=:{wItemKind`=IsRadioControl} (updRgn,tb)
# (found,ids) = maybeRemoveCheck itemH.wItemId` ids # (found,ids) = maybeRemoveCheck itemH.wItemId` ids
| not found | not found
= (ids,itemH,tb) = (ids,itemH,(updRgn,tb))
| otherwise | otherwise
# osShow = contextShow && itemsShow # osShow = contextShow && itemsShow
itemH = {itemH & wItemShow`=itemsShow} itemH = {itemH & wItemShow`=itemsShow}
info = getWItemRadioInfo` itemH.wItemInfo` info = getWItemRadioInfo` itemH.wItemInfo`
# tb = StateMap2 (\{radioItemPtr`} tb->OSsetRadioControlShow wPtr radioItemPtr` clipRect osShow tb) info.radioItems` tb // # (updRgn,tb) = StateMap2 (\{radioItemPtr`} tb->OSsetRadioControlShow wPtr radioItemPtr` clipRect osShow tb) info.radioItems` (updRgn,tb)
= (ids,itemH,tb) # (updRgn,tb) = StateMap2 (setradio osShow clipRect) info.radioItems` (updRgn,tb)
= (ids,itemH,(updRgn,tb))
where
setradio osShow clipRect {radioItemPtr`,radioItemPos`,radioItemSize`} (updRgn,tb)
# (itemRgn,tb) = osnewrectrgn (PosSizeToRect radioItemPos` radioItemSize`) tb
# (unionRgn,tb) = osunionrgn updRgn itemRgn tb
# tb = osdisposergn updRgn (osdisposergn itemRgn tb)
# tb = OSsetRadioControlShow wPtr radioItemPtr` clipRect osShow tb
= (unionRgn,tb)
setWItemShowStates wMetrics wPtr itemsShow contextShow contextSelect clipRect ids itemH=:{wItemKind`=IsCheckControl} tb setWItemShowStates wMetrics wPtr itemsShow contextShow contextSelect clipRect ids itemH=:{wItemKind`=IsCheckControl} (updRgn,tb)
# (found,ids) = maybeRemoveCheck itemH.wItemId` ids # (found,ids) = maybeRemoveCheck itemH.wItemId` ids
| not found | not found
= (ids,itemH,tb) = (ids,itemH,(updRgn,tb))
| otherwise | otherwise
# osShow = contextShow && itemsShow # osShow = contextShow && itemsShow
itemH = {itemH & wItemShow`=itemsShow} itemH = {itemH & wItemShow`=itemsShow}
info = getWItemCheckInfo` itemH.wItemInfo` info = getWItemCheckInfo` itemH.wItemInfo`
# tb = StateMap2 (\{checkItemPtr`} tb->OSsetCheckControlShow wPtr checkItemPtr` clipRect osShow tb) info.checkItems` tb // # (updRgn,tb) = StateMap2 (\{checkItemPtr`} tb->OSsetCheckControlShow wPtr checkItemPtr` clipRect osShow tb) info.checkItems` (updRgn,tb)
= (ids,itemH,tb) # (updRgn,tb) = StateMap2 (setcheck osShow clipRect) info.checkItems` (updRgn,tb)
= (ids,itemH,(updRgn,tb))
where
setcheck osShow clipRect {checkItemPtr`,checkItemPos`,checkItemSize`} (updRgn,tb)
# (itemRgn,tb) = osnewrectrgn (PosSizeToRect checkItemPos` checkItemSize`) tb
# (unionRgn,tb) = osunionrgn updRgn itemRgn tb
# tb = osdisposergn updRgn (osdisposergn itemRgn tb)
# tb = OSsetRadioControlShow wPtr checkItemPtr` clipRect osShow tb
= (unionRgn,tb)
setWItemShowStates wMetrics wPtr itemsShow contextShow contextSelect clipRect ids itemH=:{wItemKind`} tb setWItemShowStates wMetrics wPtr itemsShow contextShow contextSelect clipRect ids itemH=:{wItemKind`} (updRgn,tb)
| isMember wItemKind` [IsPopUpControl,IsSliderControl,IsTextControl,IsEditControl,IsButtonControl,IsCustomControl,IsCustomButtonControl] | isMember wItemKind` [IsPopUpControl,IsSliderControl,IsTextControl,IsEditControl,IsButtonControl,IsCustomControl,IsCustomButtonControl]
# (found,ids) = maybeRemoveCheck itemH.wItemId` ids # (found,ids) = maybeRemoveCheck itemH.wItemId` ids
| not found | not found
= (ids,itemH,tb) = (ids,itemH,(updRgn,tb))
// otherwise // otherwise
# osShow = contextShow && itemsShow # osShow = contextShow && itemsShow
itemH = {itemH & wItemShow`=itemsShow} itemH = {itemH & wItemShow`=itemsShow}
...@@ -327,18 +350,27 @@ where ...@@ -327,18 +350,27 @@ where
IsCustomControl -> OSsetCustomControlShow IsCustomControl -> OSsetCustomControlShow
_ -> controlinternalFatalError "setWItemShowStates" "unexpected ControlKind alternative" _ -> controlinternalFatalError "setWItemShowStates" "unexpected ControlKind alternative"
# tb = osAction wPtr itemH.wItemPtr` clipRect osShow tb # tb = osAction wPtr itemH.wItemPtr` clipRect osShow tb
= (ids,itemH,tb) # (updRgn,tb) = set osShow clipRect itemH.wItemPtr` (PosSizeToRect itemH.wItemPos` itemH.wItemSize`) (updRgn,tb)
= (ids,itemH,(updRgn,tb))
where
set osShow clipRect itemPtr` itemRect (updRgn,tb)
# (itemRgn,tb) = osnewrectrgn itemRect tb
# (unionRgn,tb) = osunionrgn updRgn itemRgn tb
# tb = osdisposergn updRgn (osdisposergn itemRgn tb)
# tb = OSsetRadioControlShow wPtr itemPtr` clipRect osShow tb
= (unionRgn,tb)
setWItemShowStates wMetrics wPtr itemsShow contextShow contextSelect clipRect ids itemH=:{wItemKind`=IsCompoundControl} tb setWItemShowStates wMetrics wPtr itemsShow contextShow contextSelect clipRect ids itemH=:{wItemKind`=IsCompoundControl} (updRgn,tb)
# (found,ids) = maybeRemoveCheck itemH.wItemId` ids # (found,ids) = maybeRemoveCheck itemH.wItemId` ids
# (ids,itemHs,tb) = setWElements (setWItemShowStates wMetrics wPtr itemsShow contextShow1 contextSelect1 clipRect1) ids itemH.wItems` tb # (ids,itemHs,(updRgn,tb))
= setWElements (setWItemShowStates wMetrics wPtr itemsShow contextShow1 contextSelect1 clipRect1) ids itemH.wItems` (updRgn,tb)
itemH = {itemH & wItems`=itemHs} itemH = {itemH & wItems`=itemHs}
| not found | not found
= (ids,itemH,tb) = (ids,itemH,(updRgn,tb))
| otherwise | otherwise
# itemH = {itemH & wItemShow`=itemsShow} # itemH = {itemH & wItemShow`=itemsShow}
# tb = OSsetCompoundShow wPtr itemH.wItemPtr` clipRect itemsShow tb # tb = OSsetCompoundShow wPtr itemH.wItemPtr` clipRect itemsShow tb
= (ids,itemH,tb) = (ids,itemH,(updRgn,tb))
where where
contextSelect1 = if (enabled contextSelect) (if itemH.wItemSelect` Able Unable) contextSelect contextSelect1 = if (enabled contextSelect) (if itemH.wItemSelect` Able Unable) contextSelect
contextShow1 = contextShow && itemH.wItemShow` contextShow1 = contextShow && itemH.wItemShow`
...@@ -346,15 +378,15 @@ where ...@@ -346,15 +378,15 @@ where
itemSize = itemH.wItemSize` itemSize = itemH.wItemSize`
clipRect1 = intersectRectContent wMetrics clipRect info itemH.wItemPos` itemSize clipRect1 = intersectRectContent wMetrics clipRect info itemH.wItemPos` itemSize
setWItemShowStates wMetrics wPtr itemsShow contextShow contextSelect clipRect ids itemH=:{wItemKind`=IsOtherControl _} tb setWItemShowStates wMetrics wPtr itemsShow contextShow contextSelect clipRect ids itemH=:{wItemKind`=IsOtherControl _} (updRgn,tb)
# (found,ids) = maybeRemoveCheck itemH.wItemId` ids # (found,ids) = maybeRemoveCheck itemH.wItemId` ids
| not found | not found
= (ids,itemH,tb) = (ids,itemH,(updRgn,tb))
| otherwise | otherwise
# itemSelect = if (enabled contextSelect) (if itemH.wItemSelect` Able Unable) contextSelect # itemSelect = if (enabled contextSelect) (if itemH.wItemSelect` Able Unable) contextSelect
itemSelected = enabled itemSelect itemSelected = enabled itemSelect
itemH = {itemH & wItemSelect`=itemSelected} itemH = {itemH & wItemSelect`=itemSelected}
= (ids,itemH,tb) = (ids,itemH,(updRgn,tb))
// Set the MarkState of the controls and provide proper feedback. // Set the MarkState of the controls and provide proper feedback.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment