Commit 328cbb14 authored by Peter Achten's avatar Peter Achten
Browse files

PA: internal structure improved to decrease size executable;

type IOStGetDevice changed.
parent 2ef2fcd8
...@@ -16,6 +16,7 @@ import commondef, deviceevents, iostate ...@@ -16,6 +16,7 @@ import commondef, deviceevents, iostate
from menuaccess import menuStateHandleGetHandle, menuStateHandleGetMenuId from menuaccess import menuStateHandleGetHandle, menuStateHandleGetMenuId
from processstack import topShowProcessShowState from processstack import topShowProcessShowState
from StdProcessAttribute import getProcessToolbarAtt, isProcessToolbar from StdProcessAttribute import getProcessToolbarAtt, isProcessToolbar
from StdPSt import accPIO
menueventFatalError :: String String -> .x menueventFatalError :: String String -> .x
...@@ -25,69 +26,78 @@ menueventFatalError function error ...@@ -25,69 +26,78 @@ menueventFatalError function error
/* menuEvent filters the scheduler events that can be handled by this menu device. /* menuEvent filters the scheduler events that can be handled by this menu device.
For the time being no timer menu elements are added, so these events are ignored. For the time being no timer menu elements are added, so these events are ignored.
menuEvent assumes that it is not applied to an empty IOSt. menuEvent assumes that it is not applied to an empty IOSt and that its device is
present.
*/ */
menuEvent :: !SchedulerEvent !(PSt .l .p) -> (!Bool,!Maybe DeviceEvent,!SchedulerEvent,!PSt .l .p) menuEvent :: !SchedulerEvent !(PSt .l .p) -> (!Bool,!Maybe DeviceEvent,!SchedulerEvent,!PSt .l .p)
menuEvent schedulerEvent=:(ScheduleOSEvent osEvent=:{ccMsg} _) pState=:{io=ioState} menuEvent schedulerEvent pState
| isToolbarOSEvent ccMsg # (hasMenuDevice,pState) = accPIO (IOStHasDevice MenuDevice) pState
# (osdInfo,ioState) = IOStGetOSDInfo ioState | not hasMenuDevice // This condition should never hold
# (myEvent,replyToOS,deviceEvent,ioState) = menueventFatalError "menuEvent" "MenuDevice.dEvent applied while MenuDevice not present in IOSt"
= filterToolbarEvent osdInfo osEvent ioState
# pState = {pState & io=ioState}
schedulerEvent = if (isJust replyToOS) (ScheduleOSEvent osEvent (fromJust replyToOS)) schedulerEvent
= (myEvent,deviceEvent,schedulerEvent,pState)
| isMenuOSEvent ccMsg
# (processStack,ioState) = IOStGetProcessStack ioState
(found,systemId) = topShowProcessShowState processStack
# (ioId,ioState) = IOStGetIOId ioState
# (tb,ioState) = getIOToolbox ioState
# (mDevice,ioState) = IOStGetDevice MenuDevice ioState
menus = MenuSystemStateGetMenuHandles mDevice
# (myEvent,replyToOS,deviceEvent,menus,tb)
= filterOSEvent osEvent (found && systemId==ioId) menus tb
# ioState = IOStSetDevice (MenuSystemState menus) ioState
# ioState = setIOToolbox tb ioState
# pState = {pState & io=ioState}
schedulerEvent = if (isJust replyToOS) (ScheduleOSEvent osEvent (fromJust replyToOS)) schedulerEvent
= (myEvent,deviceEvent,schedulerEvent,pState)
| otherwise
= (False,Nothing,schedulerEvent,pState)
where
isMenuOSEvent :: !Int -> Bool
isMenuOSEvent CcWmCOMMAND = True
isMenuOSEvent _ = False
isToolbarOSEvent :: !Int -> Bool
isToolbarOSEvent CcWmBUTTONCLICKED = True
isToolbarOSEvent CcWmGETTOOLBARTIPTEXT = True
isToolbarOSEvent _ = False
menuEvent schedulerEvent=:(ScheduleMsgEvent msgEvent) pState=:{io=ioState}
# (ioId,ioState) = IOStGetIOId ioState
| ioId<>recLoc.rlIOId || recLoc.rlDevice<>MenuDevice
= (False,Nothing,schedulerEvent,{pState & io=ioState})
| otherwise | otherwise
# (mDevice,ioState) = IOStGetDevice MenuDevice ioState = menuEvent schedulerEvent pState
menus = MenuSystemStateGetMenuHandles mDevice
(found,menus) = hasMenuHandlesMenu recLoc.rlParentId menus
deviceEvent = if found (Just (ReceiverEvent msgEvent)) Nothing
# ioState = IOStSetDevice (MenuSystemState menus) ioState
= (found,deviceEvent,schedulerEvent,{pState & io=ioState})
where where
recLoc = getMsgEventRecLoc msgEvent menuEvent :: !SchedulerEvent !(PSt .l .p) -> (!Bool,!Maybe DeviceEvent,!SchedulerEvent,!PSt .l .p)
menuEvent schedulerEvent=:(ScheduleOSEvent osEvent=:{ccMsg} _) pState=:{io=ioState}
| isToolbarOSEvent ccMsg
# (osdInfo,ioState) = IOStGetOSDInfo ioState
# (myEvent,replyToOS,deviceEvent,ioState)
= filterToolbarEvent osdInfo osEvent ioState
# pState = {pState & io=ioState}
schedulerEvent = if (isJust replyToOS) (ScheduleOSEvent osEvent (fromJust replyToOS)) schedulerEvent
= (myEvent,deviceEvent,schedulerEvent,pState)
| isMenuOSEvent ccMsg
# (processStack,ioState) = IOStGetProcessStack ioState
(found,systemId) = topShowProcessShowState processStack
# (ioId,ioState) = IOStGetIOId ioState
# (tb,ioState) = getIOToolbox ioState
# (found,mDevice,ioState) = IOStGetDevice MenuDevice ioState
# menus = MenuSystemStateGetMenuHandles mDevice
# (myEvent,replyToOS,deviceEvent,menus,tb)
= filterOSEvent osEvent (found && systemId==ioId) menus tb
# ioState = IOStSetDevice (MenuSystemState menus) ioState
# ioState = setIOToolbox tb ioState
# pState = {pState & io=ioState}
schedulerEvent = if (isJust replyToOS) (ScheduleOSEvent osEvent (fromJust replyToOS)) schedulerEvent
= (myEvent,deviceEvent,schedulerEvent,pState)
| otherwise
= (False,Nothing,schedulerEvent,pState)
where
isMenuOSEvent :: !Int -> Bool
isMenuOSEvent CcWmCOMMAND = True
isMenuOSEvent _ = False
isToolbarOSEvent :: !Int -> Bool
isToolbarOSEvent CcWmBUTTONCLICKED = True
isToolbarOSEvent CcWmGETTOOLBARTIPTEXT = True
isToolbarOSEvent _ = False
hasMenuHandlesMenu :: !Id !(MenuHandles .pst) -> (!Bool,!MenuHandles .pst) menuEvent schedulerEvent=:(ScheduleMsgEvent msgEvent) pState=:{io=ioState}
hasMenuHandlesMenu menuId mHs=:{mMenus} # (ioId,ioState) = IOStGetIOId ioState
# (found,mMenus)= UContains (eqMenuId menuId) mMenus | ioId<>recLoc.rlIOId || recLoc.rlDevice<>MenuDevice
= (found,{mHs & mMenus=mMenus}) = (False,Nothing,schedulerEvent,{pState & io=ioState})
| otherwise
# (found,mDevice,ioState) = IOStGetDevice MenuDevice ioState
menus = MenuSystemStateGetMenuHandles mDevice
(found,menus) = hasMenuHandlesMenu recLoc.rlParentId menus
deviceEvent = if found (Just (ReceiverEvent msgEvent)) Nothing
# ioState = IOStSetDevice (MenuSystemState menus) ioState
= (found,deviceEvent,schedulerEvent,{pState & io=ioState})
where where
eqMenuId :: !Id !(MenuStateHandle .pst) -> (!Bool,!MenuStateHandle .pst) recLoc = getMsgEventRecLoc msgEvent
eqMenuId theId msH
# (mId,msH) = menuStateHandleGetMenuId msH hasMenuHandlesMenu :: !Id !(MenuHandles .pst) -> (!Bool,!MenuHandles .pst)
= (theId==mId,msH) hasMenuHandlesMenu menuId mHs=:{mMenus}
# (found,mMenus)= UContains (eqMenuId menuId) mMenus
menuEvent schedulerEvent pState = (found,{mHs & mMenus=mMenus})
= (False,Nothing,schedulerEvent,pState) where
eqMenuId :: !Id !(MenuStateHandle .pst) -> (!Bool,!MenuStateHandle .pst)
eqMenuId theId msH
# (mId,msH) = menuStateHandleGetMenuId msH
= (theId==mId,msH)
menuEvent schedulerEvent pState
= (False,Nothing,schedulerEvent,pState)
/* filterToolbarEvent filters the OSEvents that can be handled by this menu device. /* filterToolbarEvent filters the OSEvents that can be handled by this menu device.
......
...@@ -10,39 +10,59 @@ from ostypes import HWND ...@@ -10,39 +10,59 @@ from ostypes import HWND
from StdIOCommon import DocumentInterface, MDI, SDI, NDI from StdIOCommon import DocumentInterface, MDI, SDI, NDI
:: OSDInfo :: OSDInfo
= OSMDInfo OSMDInfo = OSMDInfo !OSMDInfo
| OSSDInfo OSSDInfo | OSSDInfo !OSSDInfo
| OSNoInfo | OSNoInfo
:: OSMDInfo :: OSMDInfo
= { osmdFrame :: !HWND // The frame window of the MDI frame window = { osmdOSInfo :: !OSInfo // The general document interface infrastructure
, osmdToolbar :: !Maybe OSToolbar // The toolbar of the MDI frame window (Nothing if no toolbar) , osmdWindowMenu :: !HMENU // The Window menu in the MDI menu bar
, osmdClient :: !HWND // The client window of the MDI frame window
, osmdMenubar :: !HMENU // The menu bar of the MDI frame window
, osmdWindowMenu :: !HMENU // The Window menu in the menu bar
} }
:: OSSDInfo :: OSSDInfo
= { ossdFrame :: !HWND // The frame window of the SDI frame window = { ossdOSInfo :: !OSInfo // The general document interface infrastructure
, ossdToolbar :: !Maybe OSToolbar // The toolbar of the SDI frame window (Nothing if no toolbar) }
, ossdClient :: !HWND // The client window of the SDI frame window :: OSInfo
, ossdMenubar :: !HMENU // The menu bar of the SDI frame window = { osFrame :: !HWND // The frame window of the (M/S)DI frame window
, osToolbar :: !Maybe OSToolbar // The toolbar of the (M/S)DI frame window (Nothing if no toolbar)
, osClient :: !HWND // The client window of the (M/S)DI frame window
, osMenuBar :: !HMENU // The menu bar of the (M/S)DI frame window
}
:: OSMenuBar
= { menuBar :: !HMENU
, menuWindow :: !HWND
, menuClient :: !HWND
} }
/* emptyOSDInfo creates a OSDInfo with dummy values for the argument document interface.
*/
emptyOSDInfo :: !DocumentInterface -> OSDInfo
/* getOSDInfoDocumentInterface returns the DocumentInterface of the argument OSDInfo. /* getOSDInfoDocumentInterface returns the DocumentInterface of the argument OSDInfo.
*/ */
getOSDInfoDocumentInterface :: !OSDInfo -> DocumentInterface getOSDInfoDocumentInterface :: !OSDInfo -> DocumentInterface
/* getOSDInfoOSMenuBar returns the OSMenuBar info from the argument OSDInfo.
setOSDInfoOSMenuBar sets the OSMenuBar info in the OSDInfo.
*/
getOSDInfoOSMenuBar :: !OSDInfo -> Maybe OSMenuBar
setOSDInfoOSMenuBar :: !OSMenuBar !OSDInfo -> OSDInfo
/* getOSDInfoOSInfo returns the OSInfo from the argument OSDInfo if present.
setOSDInfoOSInfo sets the OSInfo in the OSDInfo.
*/
getOSDInfoOSInfo :: !OSDInfo -> Maybe OSInfo
setOSDInfoOSInfo :: !OSInfo !OSDInfo -> OSDInfo
/* OSopenMDI creates the infrastructure of a MDI process. /* OSopenMDI creates the infrastructure of a MDI process.
If the first Bool argument is True, then the frame window is shown, otherwise it is hidden. If the first Bool argument is True, then the frame window is shown, otherwise it is hidden.
The second Bool indicates whether the process accepts file open events. The second Bool indicates whether the process accepts file open events.
OScloseMDI destroys the infrastructure of a MDI process.
OSopenSDI creates the infrastructure of a SDI process. OSopenSDI creates the infrastructure of a SDI process.
The Bool argument indicates whether the process accepts file open events. The Bool argument indicates whether the process accepts file open events.
OScloseSDI destroys the infrastructure of a SDI process. OScloseOSDInfo destroys the infrastructure.
*/ */
OSopenMDI :: !Bool !Bool !*OSToolbox -> (!OSMDInfo,!*OSToolbox) OSopenMDI :: !Bool !Bool !*OSToolbox -> (!OSDInfo,!*OSToolbox)
OScloseMDI:: !OSMDInfo !*OSToolbox -> *OSToolbox OSopenSDI :: !Bool !*OSToolbox -> (!OSDInfo,!*OSToolbox)
OSopenSDI :: !Bool !*OSToolbox -> (!OSSDInfo,!*OSToolbox) OScloseOSDInfo:: !OSDInfo !*OSToolbox -> *OSToolbox
OScloseSDI:: !OSSDInfo !*OSToolbox -> *OSToolbox
// getOSDInfoOSToolbar retrieves the OSToolbar, if any. /* getOSDInfoOSToolbar retrieves the OSToolbar, if any.
*/
getOSDInfoOSToolbar :: !OSDInfo -> Maybe OSToolbar getOSDInfoOSToolbar :: !OSDInfo -> Maybe OSToolbar
...@@ -11,21 +11,26 @@ from StdIOCommon import DocumentInterface, MDI, SDI, NDI ...@@ -11,21 +11,26 @@ from StdIOCommon import DocumentInterface, MDI, SDI, NDI
:: OSDInfo :: OSDInfo
= OSMDInfo OSMDInfo = OSMDInfo !OSMDInfo
| OSSDInfo OSSDInfo | OSSDInfo !OSSDInfo
| OSNoInfo | OSNoInfo
:: OSMDInfo :: OSMDInfo
= { osmdFrame :: !HWND // The frame window of the MDI frame window = { osmdOSInfo :: !OSInfo // The general document interface infrastructure
, osmdToolbar :: !Maybe OSToolbar // The toolbar of the MDI frame window (Nothing if no toolbar) , osmdWindowMenu :: !HMENU // The Window menu in the MDI menu bar
, osmdClient :: !HWND // The client window of the MDI frame window
, osmdMenubar :: !HMENU // The menu bar of the MDI frame window
, osmdWindowMenu :: !HMENU // The Window menu in the menu bar
} }
:: OSSDInfo :: OSSDInfo
= { ossdFrame :: !HWND // The frame window of the SDI frame window = { ossdOSInfo :: !OSInfo // The general document interface infrastructure
, ossdToolbar :: !Maybe OSToolbar // The toolbar of the SDI frame window (Nothing if no toolbar) }
, ossdClient :: !HWND // The client window of the SDI frame window :: OSInfo
, ossdMenubar :: !HMENU // The menu bar of the SDI frame window = { osFrame :: !HWND // The frame window of the (M/S)DI frame window
, osToolbar :: !Maybe OSToolbar // The toolbar of the (M/S)DI frame window (Nothing if no toolbar)
, osClient :: !HWND // The client window of the (M/S)DI frame window
, osMenuBar :: !HMENU // The menu bar of the (M/S)DI frame window
}
:: OSMenuBar
= { menuBar :: !HMENU
, menuWindow :: !HWND
, menuClient :: !HWND
} }
...@@ -34,17 +39,67 @@ osdocumentinterfaceFatalError function error ...@@ -34,17 +39,67 @@ osdocumentinterfaceFatalError function error
= FatalError function "osdocumentinterface" error = FatalError function "osdocumentinterface" error
/* emptyOSDInfo creates a OSDInfo with dummy values for the argument document interface.
*/
emptyOSDInfo :: !DocumentInterface -> OSDInfo
emptyOSDInfo di
= case di of
MDI -> OSMDInfo {osmdOSInfo=emptyOSInfo,osmdWindowMenu=(-1)}
SDI -> OSSDInfo {ossdOSInfo=emptyOSInfo}
NDI -> OSNoInfo
where
emptyOSInfo = {osFrame=(-1),osToolbar=Nothing,osClient=(-1),osMenuBar=(-1)}
/* getOSDInfoDocumentInterface returns the DocumentInterface of the argument OSDInfo.
*/
getOSDInfoDocumentInterface :: !OSDInfo -> DocumentInterface getOSDInfoDocumentInterface :: !OSDInfo -> DocumentInterface
getOSDInfoDocumentInterface (OSMDInfo _) = MDI getOSDInfoDocumentInterface (OSMDInfo _) = MDI
getOSDInfoDocumentInterface (OSSDInfo _) = SDI getOSDInfoDocumentInterface (OSSDInfo _) = SDI
getOSDInfoDocumentInterface OSNoInfo = NDI getOSDInfoDocumentInterface OSNoInfo = NDI
/* getOSDInfoOSMenuBar returns the OSMenuBar info from the argument OSDInfo.
setOSDInfoOSMenuBar sets the OSMenuBar info in the OSDInfo.
*/
getOSDInfoOSMenuBar :: !OSDInfo -> Maybe OSMenuBar
getOSDInfoOSMenuBar osdInfo
= case osdInfo of
OSMDInfo {osmdOSInfo} -> get osmdOSInfo
OSSDInfo {ossdOSInfo} -> get ossdOSInfo
osnoinfo -> Nothing
where
get {osFrame,osClient,osMenuBar} = Just {menuBar=osMenuBar,menuWindow=osFrame,menuClient=osClient}
setOSDInfoOSMenuBar :: !OSMenuBar !OSDInfo -> OSDInfo
setOSDInfoOSMenuBar {menuBar,menuWindow,menuClient} osdInfo
= case osdInfo of
OSMDInfo mdi=:{osmdOSInfo=info} -> OSMDInfo {mdi & osmdOSInfo=set info}
OSSDInfo sdi=:{ossdOSInfo=info} -> OSSDInfo {sdi & ossdOSInfo=set info}
osnoinfo -> osnoinfo
where
set info = {info & osMenuBar=menuBar,osFrame=menuWindow,osClient=menuClient}
/* getOSDInfoOSInfo returns the OSInfo from the argument OSDInfo if present.
setOSDInfoOSInfo sets the OSInfo in the OSDInfo.
*/
getOSDInfoOSInfo :: !OSDInfo -> Maybe OSInfo
getOSDInfoOSInfo (OSMDInfo {osmdOSInfo}) = Just osmdOSInfo
getOSDInfoOSInfo (OSSDInfo {ossdOSInfo}) = Just ossdOSInfo
getOSDInfoOSInfo osnoinfo = Nothing
setOSDInfoOSInfo :: !OSInfo !OSDInfo -> OSDInfo
setOSDInfoOSInfo osinfo (OSMDInfo osm) = OSMDInfo {osm & osmdOSInfo=osinfo}
setOSDInfoOSInfo osinfo (OSSDInfo oss) = OSSDInfo {oss & ossdOSInfo=osinfo}
setOSDInfoOSInfo _ osnoinfo = osnoinfo
/* OSopenMDI creates the infrastructure of an MDI process. /* OSopenMDI creates the infrastructure of an MDI process.
If the first Bool argument is True, then the frame window is shown, otherwise it is hidden. If the first Bool argument is True, then the frame window is shown, otherwise it is hidden.
The second Bool indicates whether the process accepts file open events. The second Bool indicates whether the process accepts file open events.
*/ */
OSopenMDI :: !Bool !Bool !*OSToolbox -> (!OSMDInfo,!*OSToolbox) OSopenMDI :: !Bool !Bool !*OSToolbox -> (!OSDInfo,!*OSToolbox)
OSopenMDI show acceptFileOpen tb OSopenMDI show acceptFileOpen tb
# createCci = Rq2Cci CcRqCREATEMDIFRAMEWINDOW (toInt show) (toInt acceptFileOpen) # createCci = Rq2Cci CcRqCREATEMDIFRAMEWINDOW (toInt show) (toInt acceptFileOpen)
# (returncci,tb) = IssueCleanRequest2 osCreateMDIWindowCallback createCci tb # (returncci,tb) = IssueCleanRequest2 osCreateMDIWindowCallback createCci tb
...@@ -53,7 +108,14 @@ OSopenMDI show acceptFileOpen tb ...@@ -53,7 +108,14 @@ OSopenMDI show acceptFileOpen tb
CcRETURN4 -> (returncci.p1,returncci.p2,returncci.p3,returncci.p4) CcRETURN4 -> (returncci.p1,returncci.p2,returncci.p3,returncci.p4)
CcWASQUIT -> (OSNoWindowPtr,OSNoWindowPtr,OSNoWindowPtr,OSNoWindowPtr) CcWASQUIT -> (OSNoWindowPtr,OSNoWindowPtr,OSNoWindowPtr,OSNoWindowPtr)
msg -> osdocumentinterfaceFatalError "OSopenMDI" ("CcRETURN4 expected instead of "+++toString msg) msg -> osdocumentinterfaceFatalError "OSopenMDI" ("CcRETURN4 expected instead of "+++toString msg)
= ({osmdFrame=framePtr,osmdToolbar=Nothing,osmdClient=clientPtr,osmdMenubar=menuBar,osmdWindowMenu=windowMenu},tb) # osmdinfo = { osmdOSInfo = { osFrame = framePtr
, osToolbar = Nothing
, osClient = clientPtr
, osMenuBar = menuBar
}
, osmdWindowMenu = windowMenu
}
= (OSMDInfo osmdinfo,tb)
where where
osCreateMDIWindowCallback :: !CrossCallInfo !*OSToolbox -> (!CrossCallInfo,!*OSToolbox) osCreateMDIWindowCallback :: !CrossCallInfo !*OSToolbox -> (!CrossCallInfo,!*OSToolbox)
osCreateMDIWindowCallback {ccMsg=CcWmDEACTIVATE} tb osCreateMDIWindowCallback {ccMsg=CcWmDEACTIVATE} tb
...@@ -63,11 +125,7 @@ where ...@@ -63,11 +125,7 @@ where
osCreateMDIWindowCallback {ccMsg} tb osCreateMDIWindowCallback {ccMsg} tb
= osdocumentinterfaceFatalError "osCreateMDIWindowCallback" ("received message nr:"+++toString ccMsg) = osdocumentinterfaceFatalError "osCreateMDIWindowCallback" ("received message nr:"+++toString ccMsg)
OScloseMDI :: !OSMDInfo !*OSToolbox -> *OSToolbox OSopenSDI :: !Bool !*OSToolbox -> (!OSDInfo,!*OSToolbox)
OScloseMDI {osmdFrame} tb
= snd (IssueCleanRequest2 (osDestroyProcessWindowCallback "OScloseMDI") (Rq1Cci CcRqDESTROYWINDOW osmdFrame) tb)
OSopenSDI :: !Bool !*OSToolbox -> (!OSSDInfo,!*OSToolbox)
OSopenSDI acceptFileOpen tb OSopenSDI acceptFileOpen tb
# createCci = Rq1Cci CcRqCREATESDIFRAMEWINDOW (toInt acceptFileOpen) # createCci = Rq1Cci CcRqCREATESDIFRAMEWINDOW (toInt acceptFileOpen)
# (returncci,tb) = IssueCleanRequest2 osCreateSDIWindowCallback createCci tb # (returncci,tb) = IssueCleanRequest2 osCreateSDIWindowCallback createCci tb
...@@ -75,7 +133,8 @@ OSopenSDI acceptFileOpen tb ...@@ -75,7 +133,8 @@ OSopenSDI acceptFileOpen tb
CcRETURN2 -> (returncci.p1,returncci.p2) CcRETURN2 -> (returncci.p1,returncci.p2)
CcWASQUIT -> (OSNoWindowPtr,OSNoWindowPtr) CcWASQUIT -> (OSNoWindowPtr,OSNoWindowPtr)
msg -> osdocumentinterfaceFatalError "OSopenSDI" ("CcRETURN2 expected instead of "+++toString msg) msg -> osdocumentinterfaceFatalError "OSopenSDI" ("CcRETURN2 expected instead of "+++toString msg)
= ({ossdFrame=framePtr,ossdToolbar=Nothing,ossdClient=OSNoWindowPtr,ossdMenubar=menuBar},tb) # ossdinfo = { ossdOSInfo = {osFrame=framePtr,osToolbar=Nothing,osClient=OSNoWindowPtr,osMenuBar=menuBar} }
= (OSSDInfo ossdinfo,tb)
where where
osCreateSDIWindowCallback :: !CrossCallInfo !*OSToolbox -> (!CrossCallInfo,!*OSToolbox) osCreateSDIWindowCallback :: !CrossCallInfo !*OSToolbox -> (!CrossCallInfo,!*OSToolbox)
osCreateSDIWindowCallback {ccMsg=CcWmDEACTIVATE} tb osCreateSDIWindowCallback {ccMsg=CcWmDEACTIVATE} tb
...@@ -85,9 +144,13 @@ where ...@@ -85,9 +144,13 @@ where
osCreateSDIWindowCallback {ccMsg} tb osCreateSDIWindowCallback {ccMsg} tb
= osdocumentinterfaceFatalError "osCreateSDIWindowCallback" ("received message nr:"+++toString ccMsg) = osdocumentinterfaceFatalError "osCreateSDIWindowCallback" ("received message nr:"+++toString ccMsg)
OScloseSDI :: !OSSDInfo !*OSToolbox -> *OSToolbox OScloseOSDInfo :: !OSDInfo !*OSToolbox -> *OSToolbox
OScloseSDI {ossdFrame} tb OScloseOSDInfo (OSMDInfo {osmdOSInfo={osFrame}}) tb
= snd (IssueCleanRequest2 (osDestroyProcessWindowCallback "OScloseSDI") (Rq1Cci CcRqDESTROYWINDOW ossdFrame) tb) = snd (IssueCleanRequest2 (osDestroyProcessWindowCallback "OScloseMDI") (Rq1Cci CcRqDESTROYWINDOW osFrame) tb)
OScloseOSDInfo (OSSDInfo {ossdOSInfo={osFrame}}) tb
= snd (IssueCleanRequest2 (osDestroyProcessWindowCallback "OScloseSDI") (Rq1Cci CcRqDESTROYWINDOW osFrame) tb)
OScloseOSDInfo _ tb
= tb
osDestroyProcessWindowCallback :: String !CrossCallInfo !*OSToolbox -> (!CrossCallInfo,!*OSToolbox) osDestroyProcessWindowCallback :: String !CrossCallInfo !*OSToolbox -> (!CrossCallInfo,!*OSToolbox)
osDestroyProcessWindowCallback function {ccMsg=CcWmDEACTIVATE} tb osDestroyProcessWindowCallback function {ccMsg=CcWmDEACTIVATE} tb
...@@ -101,6 +164,6 @@ osDestroyProcessWindowCallback function {ccMsg} tb ...@@ -101,6 +164,6 @@ osDestroyProcessWindowCallback function {ccMsg} tb
// getOSDInfoOSToolbar retrieves the OSToolbar, if any. // getOSDInfoOSToolbar retrieves the OSToolbar, if any.
getOSDInfoOSToolbar :: !OSDInfo -> Maybe OSToolbar getOSDInfoOSToolbar :: !OSDInfo -> Maybe OSToolbar
getOSDInfoOSToolbar (OSMDInfo {osmdToolbar}) = osmdToolbar getOSDInfoOSToolbar (OSMDInfo {osmdOSInfo={osToolbar}}) = osToolbar
getOSDInfoOSToolbar (OSSDInfo {ossdToolbar}) = ossdToolbar getOSDInfoOSToolbar (OSSDInfo {ossdOSInfo={osToolbar}}) = osToolbar
getOSDInfoOSToolbar _ = Nothing getOSDInfoOSToolbar _ = Nothing
...@@ -4,14 +4,15 @@ definition module osmenu ...@@ -4,14 +4,15 @@ definition module osmenu
// Clean Object I/O library, version 1.2 // Clean Object I/O library, version 1.2
from menuCrossCall_12 import HMENU, HITEM
from osdocumentinterface import OSMenuBar
from ostoolbox import OSToolbox from ostoolbox import OSToolbox
from ostypes import HWND from ostypes import HWND
from oswindow import OSWindowPtr from oswindow import OSWindowPtr
from menuCrossCall_12 import HMENU, HITEM
// Types for menus and menu elements: // Types for menus and menu elements:
:: MenuBar /*:: MenuBar
= NoMenuBar = NoMenuBar
| MenuBar OSMenuBar | MenuBar OSMenuBar
:: OSMenuBar :: OSMenuBar
...@@ -19,6 +20,7 @@ from menuCrossCall_12 import HMENU, HITEM ...@@ -19,6 +20,7 @@ from menuCrossCall_12 import HMENU, HITEM
, menuWindow :: !HWND , menuWindow :: !HWND
, menuClient :: !HWND // If MDI: client window; otherwise: OSNoWindowPtr , menuClient :: !HWND // If MDI: client window; otherwise: OSNoWindowPtr
} }
*/
:: OSMenu :== HMENU :: OSMenu :== HMENU
:: OSMenuItem :== HITEM :: OSMenuItem :== HITEM
:: OSMenuSeparator :== HITEM :: OSMenuSeparator :== HITEM
...@@ -32,9 +34,9 @@ OSNoMenuSeparator :== 0 ...@@ -32,9 +34,9 @@ OSNoMenuSeparator :== 0
/* Creation of a OSMenuBar: /* Creation of a OSMenuBar:
OSMenuBarNew frameWindow clientWindow menu OSMenuBarNew frameWindow clientWindow menu
creates an OSMenuBar instance that can be used to manipulate menus. creates an OSMenuBar instance that can be used to manipulate menus.
*/ PA---
OSMenuBarNew :: !HWND !HWND !HMENU -> OSMenuBar OSMenuBarNew :: !HWND !HWND !HMENU -> OSMenuBar
*/
/* Enabling and disabling of menus and menu elements: /* Enabling and disabling of menus and menu elements:
OS(Dis/En)ableMenu index menubar OS(Dis/En)ableMenu index menubar
......
...@@ -6,11 +6,12 @@ implementation module osmenu ...@@ -6,11 +6,12 @@ implementation module osmenu
import StdBool, StdChar, StdClass, StdInt, StdString import StdBool, StdChar, StdClass, StdInt, StdString
import menuCrossCall_12 import menuCrossCall_12
from oswindow import OSWindowPtr, OSNoWindowPtr from osdocumentinterface import OSMenuBar
from oswindow import OSWindowPtr, OSNoWindowPtr
// Types for menus and menu elements: // Types for menus and menu elements:
:: MenuBar /*:: MenuBar
= NoMenuBar = NoMenuBar
| MenuBar OSMenuBar | MenuBar OSMenuBar
:: OSMenuBar :: OSMenuBar
...@@ -18,6 +19,7 @@ from oswindow import OSWindowPtr, OSNoWindowPtr ...@@ -18,6 +19,7 @@ from oswindow import OSWindowPtr, OSNoWindowPtr
, menuWindow :: !HWND , menuWindow :: !HWND
, menuClient :: !HWND // If MDI: client window; otherwise: OSNoWindowPtr , menuClient :: !HWND // If MDI: client window; otherwise: OSNoWindowPtr
} }
*/
:: OSMenuHandle :== HMENU :: OSMenuHandle :== HMENU
:: OSMenu :== HMENU :: OSMenu :== HMENU
:: OSMenuItem :== HITEM :: OSMenuItem :== HITEM
...@@ -28,10 +30,11 @@ OSNoMenu :== 0 ...@@ -28,10 +30,11 @@ OSNoMenu :== 0
OSNoMenuItem :== 0 OSNoMenuItem :== 0
OSNoMenuSeparator :== 0 OSNoMenuSeparator :== 0
/* PA---
OSMenuBarNew :: !HWND !HWND !HMENU -> OSMenuBar OSMenuBarNew :: !HWND !HWND !HMENU -> OSMenuBar
OSMenuBarNew frameWindow clientWindow menu OSMenuBarNew frameWindow clientWindow menu
= {menuBar=menu, menuWindow=frameWindow, menuClient=clientWindow} = {menuBar=menu, menuWindow=frameWindow, menuClient=clientWindow}
*/