VBoxUtils-darwin.h revision 01892aaba1ec28bb5179c9f32b3fa79e49e59df9
/** @file
*
* VBox frontends: Qt GUI ("VirtualBox"):
* Declarations of utility classes and functions for handling Darwin specific
* tasks
*/
/*
* Copyright (C) 2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#ifndef ___VBoxUtils_darwin_h
#define ___VBoxUtils_darwin_h
#include <VBox/VBoxCocoa.h>
#include <ApplicationServices/ApplicationServices.h>
#include <QRect>
/********************************************************************************
*
*
********************************************************************************/
/********************************************************************************
*
* Simple setter methods (OS System native)
*
********************************************************************************/
void darwinSetMouseCoalescingEnabled(bool fEnabled);
/********************************************************************************
*
* Simple helper methods (OS System native)
*
********************************************************************************/
float darwinSmallFontSize();
bool darwinSetFrontMostProcess();
void darwinCreateContextMenuEvent(void *pvWin, int x, int y);
void darwinRetranslateAppMenu();
DECLINLINE(CGRect) darwinToCGRect(const QRect& aRect) { return CGRectMake(aRect.x(), aRect.y(), aRect.width(), aRect.height()); }
DECLINLINE(CGRect) darwinFlipCGRect(CGRect aRect, double aTargetHeight) { aRect.origin.y = aTargetHeight - aRect.origin.y - aRect.size.height; return aRect; }
DECLINLINE(CGRect) darwinFlipCGRect(CGRect aRect, const CGRect &aTarget) { return darwinFlipCGRect(aRect, aTarget.size.height); }
{
return aRect;
}
/********************************************************************************
*
*
********************************************************************************/
/**
* Returns a reference to the native View of the QWidget.
*
* @returns either HIViewRef or NSView* of the QWidget.
* @param pWidget Pointer to the QWidget
*/
/**
* Returns a reference to the native Window of the QWidget.
*
* @returns either WindowRef or NSWindow* of the QWidget.
* @param pWidget Pointer to the QWidget
*/
/* This is necessary because of the C calling convention. Its a simple wrapper
for darwinToNativeWindowImpl to allow operator overloading which isn't
allowed in C. */
/**
* Returns a reference to the native Window of the View..
*
* @returns either WindowRef or NSWindow* of the View.
* @param pWidget Pointer to the native View
*/
/**
* Returns a reference to the native View of the Window.
*
* @returns either HIViewRef or NSView* of the Window.
* @param pWidget Pointer to the native Window
*/
/********************************************************************************
*
* Graphics stuff (Qt Wrapper)
*
********************************************************************************/
/**
* Returns a reference to the CGContext of the QWidget.
*
* @returns CGContextRef of the QWidget.
* @param pWidget Pointer to the QWidget
*/
#ifndef __OBJC__
/********************************************************************************
*
* Simple setter methods (Qt Wrapper)
*
********************************************************************************/
void darwinDisableIconsInMenus(void);
/********************************************************************************
*
* Simple helper methods (Qt Wrapper)
*
********************************************************************************/
QString darwinSystemLanguage(void);
#endif /* !__OBJC__ */
#endif /* !___VBoxUtils_darwin_h */