Emergency 2017 Dokumentation  v3.0.1
qsf::macosx Namespace Reference

Functions

void setupMinimalMenuBar (const char *applicationName)
 Setup a minimal Mac OS X menu bar for the application. More...
 
void performApplicationRunLoop (const boost::function< bool(void)> &function)
 Perform the run loop regularly calling the given function until it returns "false". More...
 
void DisabledDictationMenuItemDisabledCharacterPaletteMenuItem ()
 
void MessageBox (const std::string &title, const std::string &msg, const std::string &defaultButton)
 Show an alter popup (like MessageBox on Windows) More...
 
bool ShowAssertBreakMessageBox (const std::string &message, ErrorHandling::SeverityLevel severityLevel, const char *file, uint32 line, bool showDebuggingOptions)
 
void GetDesktopWidthAndHeight (uint32_t &width, uint32_t &height)
 Retrieves the desktop width and height. More...
 
bool ShowOpenFileDialog (std::string &outFilename, const std::string &initialDirectory, const std::string &filter)
 Shows the standard Mac OS X open file dialog. More...
 
bool GetWindowClientRect (handle window, float &x, float &y, float &width, float &height)
 Retrieves the window's inner frame ("client area") origin and size. More...
 
bool GetViewRect (handle view, float &x, float &y, float &width, float &height)
 Retrieves the view's frame ("client area") origin and size. More...
 
bool GetMousePosRelativeToWindow (handle window, float &x, float &y)
 Retrieves the mouse position in window coordinates. More...
 
bool SetForegroundWindow (handle window)
 Puts the given window on top of all non-modal windows. More...
 
bool SetWindowAboveEverythingElse (handle window, bool everythingElse)
 Puts the given window on above everything else (useful for e.g. a borderless fullscreen window) More...
 
bool SetWindowTitle (handle window, const std::string &title)
 Changes the title of a window. More...
 
bool EnableWindowMaximize (handle window, bool enable)
 Enables or disables maximizing a window. More...
 
bool EnableWindowResizing (handle window, bool enable)
 Enables or disables resizing a window. More...
 
bool EnableWindowBorder (handle window, bool enable)
 Enables or disables the border of a window. More...
 
void SetWindowContentSize (handle window, int width, int height)
 Resize window by defining its content size (i.e. without window decoration) More...
 
void ProcessApplicationMessageQueue ()
 Processes all currently queued application messages and calls the appropriate event handlers. More...
 
std::string getBundleResourceDirectory ()
 Get UTF-8 path to bundle resource directory. More...
 
std::string getUserHomeDirectory ()
 
std::string getSystemLocale ()
 
handle CreateNsImageFromBitmap (const std::string &filename)
 
void FreeNsImage (handle nsImageHandle)
 
handle CreateSplashScreen (handle nsImageHandle, handle parentWindowHandle)
 
void SetSplashScreenStatusMessage (handle splashScreenWindow, const std::string &statusMessage, float marginLeft, float marginTop, float marginRight, float height)
 
void FreeSplashScreen (handle splashScreenWindow)
 

Function Documentation

handle qsf::macosx::CreateNsImageFromBitmap ( const std::string &  filename)
handle qsf::macosx::CreateSplashScreen ( handle  nsImageHandle,
handle  parentWindowHandle 
)
void qsf::macosx::DisabledDictationMenuItemDisabledCharacterPaletteMenuItem ( )
bool qsf::macosx::EnableWindowBorder ( handle  window,
bool  enable 
)

Enables or disables the border of a window.

Parameters
[in]windowThe native window handle of the window
[in]enable"true" to enable the border, "false" to disable it
Returns
"true" if successful, "false" otherwise
bool qsf::macosx::EnableWindowMaximize ( handle  window,
bool  enable 
)

Enables or disables maximizing a window.

Parameters
[in]windowThe native window handle of the window
[in]enable"true" to enable the maximize title bar button, "false" to disable it
Returns
"true" if successful, "false" otherwise
bool qsf::macosx::EnableWindowResizing ( handle  window,
bool  enable 
)

Enables or disables resizing a window.

Parameters
[in]windowThe native window handle of the window
[in]enable"true" to enable resizing, "false" to disable it
Returns
"true" if successful, "false" otherwise
void qsf::macosx::FreeNsImage ( handle  nsImageHandle)
void qsf::macosx::FreeSplashScreen ( handle  splashScreenWindow)
std::string qsf::macosx::getBundleResourceDirectory ( )

Get UTF-8 path to bundle resource directory.

void qsf::macosx::GetDesktopWidthAndHeight ( uint32_t &  width,
uint32_t &  height 
)

Retrieves the desktop width and height.

Parameters
[out]widthThe width of the desktop
[out]heightThe height of the desktop
bool qsf::macosx::GetMousePosRelativeToWindow ( handle  window,
float &  x,
float &  y 
)

Retrieves the mouse position in window coordinates.

Parameters
[out]xThe x coordinate of the current mouse position
[out]yThe y coordinate of the current mouse position
Returns
"true" if successful, "false" otherwise
std::string qsf::macosx::getSystemLocale ( )
std::string qsf::macosx::getUserHomeDirectory ( )
bool qsf::macosx::GetViewRect ( handle  view,
float &  x,
float &  y,
float &  width,
float &  height 
)

Retrieves the view's frame ("client area") origin and size.

Parameters
[out]xThe x origin of the inner frame
[out]yThe y origin of the inner frame
[out]widthThe width of the inner frame
[out]heightThe height of the inner frame
Returns
"true" if successful, "false" otherwise
bool qsf::macosx::GetWindowClientRect ( handle  window,
float &  x,
float &  y,
float &  width,
float &  height 
)

Retrieves the window's inner frame ("client area") origin and size.

Parameters
[out]xThe x origin of the inner frame
[out]yThe y origin of the inner frame
[out]widthThe width of the inner frame
[out]heightThe height of the inner frame
Returns
"true" if successful, "false" otherwise
void qsf::macosx::MessageBox ( const std::string &  title,
const std::string &  msg,
const std::string &  defaultButton 
)

Show an alter popup (like MessageBox on Windows)

Parameters
[in]titleAlert title
[in]msgAlert text
[in]defaultButtonAlert button text (Should be a localized "OK")
void qsf::macosx::performApplicationRunLoop ( const boost::function< bool(void)> &  function)

Perform the run loop regularly calling the given function until it returns "false".

Parameters
[in]functionThe function to call in a loop as long as it returns "true"; on "false" the run loop will stop
Note
  • This internally starts the NSApplication run loop, which is necessary for some functionality like working Cmd-Q keyboard shortcut and menu bar
void qsf::macosx::ProcessApplicationMessageQueue ( )

Processes all currently queued application messages and calls the appropriate event handlers.

bool qsf::macosx::SetForegroundWindow ( handle  window)

Puts the given window on top of all non-modal windows.

Parameters
[in]windowThe native window handle of the window to put into the foreground
Returns
"true" if successful, "false" otherwise
void qsf::macosx::SetSplashScreenStatusMessage ( handle  splashScreenWindow,
const std::string &  statusMessage,
float  marginLeft,
float  marginTop,
float  marginRight,
float  height 
)
void qsf::macosx::setupMinimalMenuBar ( const char *  applicationName)

Setup a minimal Mac OS X menu bar for the application.

Parameters
[in]applicationNameName of the application as it will appear in the menu bar
Note
  • Menu bar consists of apple menu and an application-specific menu with a single option "Quit <name> (Cmd-Q)"
  • Call this once before "performApplicationRunLoop"
bool qsf::macosx::SetWindowAboveEverythingElse ( handle  window,
bool  everythingElse 
)

Puts the given window on above everything else (useful for e.g. a borderless fullscreen window)

Parameters
[in]windowThe native window handle of the window to put above everything else
Returns
"true" if successful, "false" otherwise
void qsf::macosx::SetWindowContentSize ( handle  window,
int  width,
int  height 
)

Resize window by defining its content size (i.e. without window decoration)

Parameters
[in]windowThe native window handle of the window
[in]widthWindow width in pixels
[in]heightWindow height in pixels
bool qsf::macosx::SetWindowTitle ( handle  window,
const std::string &  title 
)

Changes the title of a window.

Parameters
[in]windowThe native window handle of the window
[in]titleThe new title
Returns
"true" if successful, "false" otherwise
bool qsf::macosx::ShowAssertBreakMessageBox ( const std::string &  message,
ErrorHandling::SeverityLevel  severityLevel,
const char *  file,
uint32  line,
bool  showDebuggingOptions 
)

Show a message box if needed and manage selective ignoring of issues; returns "true" if a break is requested

bool qsf::macosx::ShowOpenFileDialog ( std::string &  outFilename,
const std::string &  initialDirectory,
const std::string &  filter 
)

Shows the standard Mac OS X open file dialog.

Parameters
[out]outFilenameIf the return value is "true", the path of the selected file, otherwise the value of outFilename is undefined
[in]initialDirectoryignored
[in]filterignored
Returns
"true" if a file was selected, "false" otherwise