rust_macios/appkit/globals.rs
1use libc::{c_char, c_int};
2
3use crate::foundation::{Int, NSNotificationName, NSString};
4
5use super::{
6 NSColorSpaceName, NSDeviceDescriptionKey, NSPopoverCloseReasonValue, NSWindowDepth,
7 NSWindowLevel,
8};
9
10extern "C" {
11 /// Called by the main function to create and run the application.
12 ///
13 /// # Arguments
14 ///
15 /// * `argc` - The number of arguments passed to the program.
16 /// * `argv` - The arguments passed to the program.
17 ///
18 /// # Returns
19 ///
20 /// This method never returns a result code. Instead, it calls the exit
21 /// function to exit the application and terminate the process. If you want
22 /// to determine why the application exited, you should look at the result
23 /// code from the exit function instead.
24 pub fn NSApplicationMain(argc: c_int, argv: *const *const c_char) -> c_int;
25}
26
27extern "C" {
28 /// Returns the bits per pixel for the specified window depth.
29 pub fn NSBitsPerPixelFromDepth(depth: NSWindowDepth) -> Int;
30
31 /// Returns the bits per sample for the specified window depth.
32 pub fn NSBitsPerSampleFromDepth(depth: NSWindowDepth) -> Int;
33
34 /// Returns the name of the color space corresponding to the passed window depth.
35 pub fn NSColorSpaceFromDepth(depth: NSWindowDepth) -> NSColorSpaceName;
36
37 /// Returns the number of color components in the specified color space.
38 pub fn NSNumberOfColorComponents(colorSpace: NSColorSpaceName) -> Int;
39
40 /// Returns whether the specified window depth is planar.
41 pub fn NSPlanarFromDepth(depth: NSWindowDepth) -> bool;
42}
43
44extern "C" {
45 /// The corresponding value is an NSNumber object containing an integer that gives the bit depth of the window’s raster image (2-bit, 8-bit, and so forth).
46 pub static NSDeviceBitsPerSample: NSDeviceDescriptionKey;
47
48 /// The corresponding value is an NSString object giving the name of the window’s color space.
49 pub static NSDeviceColorSpaceName: NSDeviceDescriptionKey;
50
51 /// If there is a corresponding value, this indicates that the display device is a printer.
52 pub static NSDeviceIsPrinter: NSDeviceDescriptionKey;
53
54 /// If there is a corresponding value, this indicates that the display device is a screen.
55 pub static NSDeviceIsScreen: NSDeviceDescriptionKey;
56
57 /// The corresponding value is an NSValue object containing a value of type NSSize that describes the window’s raster resolution in dots per inch (dpi).
58 pub static NSDeviceResolution: NSDeviceDescriptionKey;
59
60 /// The corresponding value is an NSValue object containing a value of type NSSize that gives the size of the window’s frame rectangle.
61 pub static NSDeviceSize: NSDeviceDescriptionKey;
62}
63
64extern "C" {
65 /// The level for the dock.
66 #[deprecated]
67 pub static NSDockWindowLevel: NSWindowLevel;
68 /// Useful for floating palettes.
69 pub static NSFloatingWindowLevel: NSWindowLevel;
70 /// Reserved for the application’s main menu.
71 pub static NSMainMenuWindowLevel: NSWindowLevel;
72 /// The level for a modal panel.
73 pub static NSModalPanelWindowLevel: NSWindowLevel;
74 /// The default level for NSWindow objects.
75 pub static NSNormalWindowLevel: NSWindowLevel;
76 /// The level for a pop-up menu.
77 pub static NSPopUpMenuWindowLevel: NSWindowLevel;
78 /// The level for a screen saver.
79 pub static NSScreenSaverWindowLevel: NSWindowLevel;
80 /// The level for a status window.
81 pub static NSStatusWindowLevel: NSWindowLevel;
82 /// Reserved for submenus. Synonymous with NSTornOffMenuWindowLevel, which is preferred.
83 pub static NSSubmenuWindowLevel: NSWindowLevel;
84 /// The level for a torn-off menu. Synonymous with NSSubmenuWindowLevel.
85 pub static NSTornOffMenuWindowLevel: NSWindowLevel;
86}
87
88extern "C" {
89 /// The userInfo key containing the reason for the `NSPopoverWillCloseNotification.`
90 pub static NSPopoverCloseReasonKey: *const NSString;
91}
92
93extern "C" {
94 /// Specifies that the popover has been closed because it is being detached to a window.
95 pub static NSPopoverCloseReasonDetachToWindow: NSPopoverCloseReasonValue;
96
97 /// Specifies that the popover has been closed in a standard way.
98 pub static NSPopoverCloseReasonStandard: NSPopoverCloseReasonValue;
99}
100
101extern "C" {
102 /// NSPopoverWillShowNotification
103 pub static NSPopoverWillShowNotification: NSNotificationName;
104
105 /// Sent after the popover has finished animating onscreen.
106 pub static NSPopoverDidShowNotification: NSNotificationName;
107
108 /// Sent before the popover is closed.
109 pub static NSPopoverWillCloseNotification: NSNotificationName;
110
111 /// Sent after the popover has finished animating offscreen.
112 pub static NSPopoverDidCloseNotification: NSNotificationName;
113}