From 87cd3a6465ce64e2c0a296c73dfcd8bf510b1fc9 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Wed, 1 Jul 2015 17:45:07 +0200 Subject: getOSDInfoOffset as windows --- osdocumentinterface.dcl | 5 +++++ osdocumentinterface.icl | 22 +++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/osdocumentinterface.dcl b/osdocumentinterface.dcl index c674537..d3c7738 100644 --- a/osdocumentinterface.dcl +++ b/osdocumentinterface.dcl @@ -74,3 +74,8 @@ getOSDInfoOSToolbar :: !OSDInfo -> Maybe OSToolbar active menu system. (Always True on Windows; use menu bar on Mac.) */ osOSDInfoIsActive :: !OSDInfo !*OSToolbox -> (!Bool, !*OSToolbox) + +/* getOSDInfoOffset returns the offset vector (dx,dy) that points to the left-top corner of the client area + of the corresponding infrastructure. +*/ +getOSDInfoOffset :: !OSDInfo !*OSToolbox -> (!(!Int,!Int),!*OSToolbox) diff --git a/osdocumentinterface.icl b/osdocumentinterface.icl index e01ee6c..d523c27 100644 --- a/osdocumentinterface.icl +++ b/osdocumentinterface.icl @@ -1,7 +1,7 @@ implementation module osdocumentinterface -import StdMaybe, StdOverloaded, StdString, StdTuple +import StdMaybe, StdOverloaded, StdString, StdTuple, StdInt import clCrossCall_12, ostoolbar, ossystem, ostypes, windowCrossCall_12 from commondef import fatalError from StdIOCommon import :: DocumentInterface(..) @@ -189,3 +189,23 @@ getOSDInfoOSToolbar _ = Nothing */ osOSDInfoIsActive :: !OSDInfo !*OSToolbox -> (!Bool, !*OSToolbox) osOSDInfoIsActive osdinfo tb = (True,tb) + +/* getOSDInfoOffset returns the offset vector (dx,dy) that points to the left-top corner of the client area + of the corresponding infrastructure. +*/ +getOSDInfoOffset :: !OSDInfo !*OSToolbox -> (!(!Int,!Int),!*OSToolbox) +getOSDInfoOffset OSNoInfo tb + = ((0,0),tb) +getOSDInfoOffset osdInfo tb + # ((dw,dh),tb) = osStripOuterSize isMDI True tb + # (outerRect,tb)= osGetProcessWindowDimensions osdInfo tb // Outer Rect of (M/S)DI frame in screen coordinates + = ((outerRect.rleft,outerRect.rtop + dh + menuBarH + toolBarH),tb) +where + (isMDI,osInfo) = case osdInfo of + OSMDInfo {osmdOSInfo} = (True, osmdOSInfo) + OSSDInfo {ossdOSInfo} = (False,ossdOSInfo) + otherwise = osdocumentinterfaceFatalError "getOSDInfoHeight" "illegally applied to OSNoInfo argument" + toolBarH = case osInfo.osToolbar of + Just {toolbarHeight} = toolbarHeight + otherwise = 0 + menuBarH = 19 // PA: this should be derived platform independently! -- cgit v1.2.3