MeVisLab Toolbox Reference
macApplication.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2007, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #ifndef MAC_APPLICATION_H
14 #define MAC_APPLICATION_H
15 
17 
18 #if defined(__APPLE__)
19 
21 #include <string>
22 #include <unistd.h>
23 
24 namespace macos {
25 
26  class ApplicationPrivate;
27 
29 
32  {
33 
34 #ifndef OSXSUPPORTSTANDALONE
35 
36  private:
37 
38  OSXSUPPORT_PRIVATE_API static ApplicationPrivate *priv();
39 
40  public:
41 
43  static void indicateBusyState(const std::string &message = std::string());
45  static void removeBusyStateIndicator();
46 
47 #endif
48 
49  public:
50 
52  static void initializeCocoa();
53 
55  enum {
56  ApplicationPresentationDefault = 0,
57  ApplicationPresentationAutoHideDock = (1 << 0),
58  ApplicationPresentationHideDock = (1 << 1),
59  ApplicationPresentationAutoHideMenuBar = (1 << 2),
60  ApplicationPresentationHideMenuBar = (1 << 3)
61  };
63  typedef unsigned int PresentationOptions;
64 
67 
72  ActivationPolicyProhibited
73  };
74 
77 
79  static bool isActive(pid_t pid = 0);
80 
82  static bool activate(pid_t pid = 0, uint32_t timeout = 800);
83 
85  static void enableSuddenTermination();
87  static void disableSuddenTermination();
88 
90  static void enableAutomaticTermination(const std::string &reason = std::string());
92  static void disableAutomaticTermination(const std::string &reason = std::string());
93 
95  static void enableRelaunchOnLogin();
97  static void disableRelaunchOnLogin();
98 
101 
103  static bool isAppearingDarkAqua();
104 
106  enum {
107  ActivityIdleDisplaySleepDisabled = (1 << 0),
108  ActivityIdleSystemSleepDisabled = (1 << 1),
109  ActivityAutomaticTerminationDisabled = (1 << 2),
110  ActivityUserInitiated = (1 << 3),
111  ActivityBackground = (1 << 4)
112  };
114  typedef unsigned int ActivityOptions;
115 
117  static ApplicationActivityToken beginActivityWithOptions(ActivityOptions options, const std::string &reason = std::string());
120  };
121 
123  {
124  public:
125 
126  ApplicationActivityBlock(Application::ActivityOptions options, const std::string &reason = std::string());
128  private:
129 
131  };
132 
133 }
134 
135 #endif // __APPLE__
136 #endif // __macApplication_H
ApplicationActivityBlock(Application::ActivityOptions options, const std::string &reason=std::string())
Application related functions.
static void setPresentationOptions(PresentationOptions options)
Sets the application presentation options to use when this application is active. Only certain combin...
static void removeBusyStateIndicator()
Hide busy state indicator.
static void endActivity(ApplicationActivityToken &token)
Ends the given activity.
static void disableWindowRestoration()
Disables the window restoration of Mac OS X 10.7 or later.
static bool setActivationPolicy(ActivationPolicy policy)
Attempts to modify the app's activation policy.
static void enableAutomaticTermination(const std::string &reason=std::string())
Enables automatic termination for the application of Mac OS X 10.7 or later.
static void disableAutomaticTermination(const std::string &reason=std::string())
Disables automatic termination for the application of Mac OS X 10.7 or later.
ActivationPolicy
Activation policies that control whether and how an app may be activated.
@ ActivationPolicyRegular
The application is an ordinary app that appears in the Dock and may have a user interface.
@ ActivationPolicyAccessory
The application does not appear in the Dock and does not have a menu bar, but it may be activated pro...
static bool activate(pid_t pid=0, uint32_t timeout=800)
Activate application and bring all process windows forward, timeout allows to wait for application to...
static void initializeCocoa()
Startup function to call when running Cocoa code from a Carbon application.
unsigned int ActivityOptions
Activity options storage type.
static void indicateBusyState(const std::string &message=std::string())
Show busy state indicator, possibly displaying a descriptive message (UTF8)
static void disableRelaunchOnLogin()
Disables relaunching the application on login of Mac OS X 10.7 or later.
static bool isAppearingDarkAqua()
Returns true if effective appearance of the App is Dark Aqua (macOS 10.14 or later)
static ApplicationActivityToken beginActivityWithOptions(ActivityOptions options, const std::string &reason=std::string())
Begin an activity using the given options and reason.
static void enableSuddenTermination()
Enables the application for quick killing using sudden termination of Mac OS X 10....
static bool isActive(pid_t pid=0)
Returns a boolean value indicating whether the referenced application is currently frontmost (active)
static void disableSuddenTermination()
Disables the application for quickly killing using sudden termination of Mac OS X 10....
static void enableRelaunchOnLogin()
Enables relaunching the application on login of Mac OS X 10.7 or later.
unsigned int PresentationOptions
Application presentation options storage type.
#define OSXSUPPORT_PUBLIC_API
Symbol visibility macros.
#define OSXSUPPORT_PRIVATE_API
AppleScript support.