1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <rtl/ustrbuf.hxx>
22 #include <vcl/button.hxx>
24 #include <osx/salsys.h>
25 #include <osx/saldata.hxx>
26 #include <osx/salinst.h>
27 #include <quartz/utils.h>
29 #include <strings.hrc>
31 AquaSalSystem::~AquaSalSystem()
35 unsigned int AquaSalSystem::GetDisplayScreenCount()
37 NSArray
* pScreens
= [NSScreen screens
];
38 return pScreens
? [pScreens count
] : 1;
41 tools::Rectangle
AquaSalSystem::GetDisplayScreenPosSizePixel( unsigned int nScreen
)
43 NSArray
* pScreens
= [NSScreen screens
];
44 tools::Rectangle aRet
;
45 NSScreen
* pScreen
= nil
;
46 if( pScreens
&& nScreen
< [pScreens count
] )
47 pScreen
= [pScreens objectAtIndex
: nScreen
];
49 pScreen
= [NSScreen mainScreen
];
53 NSRect aFrame
= [pScreen frame
];
54 aRet
= tools::Rectangle( Point( static_cast<long int>(aFrame
.origin
.x
), static_cast<long int>(aFrame
.origin
.y
) ),
55 Size( static_cast<long int>(aFrame
.size
.width
), static_cast<long int>(aFrame
.size
.height
) ) );
60 static NSString
* getStandardString( StandardButtonType nButtonId
, bool bUseResources
)
65 aText
= Button::GetStandardText( nButtonId
);
67 if( aText
.isEmpty() ) // this is for bad cases, we might be missing the vcl resource
71 case StandardButtonType::OK
: aText
= "OK";break;
72 case StandardButtonType::Abort
: aText
= "Abort";break;
73 case StandardButtonType::Cancel
: aText
= "Cancel";break;
74 case StandardButtonType::Retry
: aText
= "Retry";break;
75 case StandardButtonType::Yes
: aText
= "Yes";break;
76 case StandardButtonType::No
: aText
= "No";break;
80 return aText
.isEmpty() ? nil
: CreateNSString( aText
);
83 int AquaSalSystem::ShowNativeMessageBox( const OUString
& rTitle
,
84 const OUString
& rMessage
)
86 NSString
* pTitle
= CreateNSString( rTitle
);
87 NSString
* pMessage
= CreateNSString( rMessage
);
89 NSString
* pDefText
= getStandardString( StandardButtonType::OK
, false/*bUseResources*/ );
91 SAL_WNODEPRECATED_DECLARATIONS_PUSH
//TODO: 10.10 NSRunAlertPanel
92 int nResult
= NSRunAlertPanel( pTitle
, @
"%@", pDefText
, nil
, nil
, pMessage
);
93 SAL_WNODEPRECATED_DECLARATIONS_POP
104 nRet
= SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK
;
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */