-
Notifications
You must be signed in to change notification settings - Fork 29
/
CocoaExtra.h
83 lines (51 loc) · 2.25 KB
/
CocoaExtra.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//
// CocoaExtra.h
// Trisection
//
// Created by bhaller on Thu May 17 2001.
// Copyright (c) 2001 Ben Haller. All rights reserved.
//
#import <Cocoa/Cocoa.h>
//#import <QuickTime/Movies.h>
#if 0
// Short-circuit to NSLocalizedString, passing nil for the comment so we don't inflate our binary
#define SSLocalizedString(key, comment) NSLocalizedString(key, nil)
#define SSLocalizedStringFromTable(key, table, comment) NSLocalizedStringFromTable(key, table, nil)
#else
// Test and log if a given key is not correctly defined
#define SSLocalizedString(key, comment) SSTestLocalizedString(key)
#define SSLocalizedStringFromTable(key, table, comment) SSTestLocalizedStringFromTable(key, table)
NSString *SSTestLocalizedString(NSString *key);
NSString *SSTestLocalizedStringFromTable(NSString *key, NSString *table);
#endif
static inline SInt32 StSRandomIntBetween(SInt32 start, SInt32 end) { return (SInt32)((random() % (end - start + 1)) + start); }
@interface NSTextView (SSCocoaExtra)
- (void)fixText:(NSString *)text toGoToLink:(NSString *)url;
@end
@interface NSTextField (SSCocoaExtra)
- (void)fixText:(NSString *)text toGoToLink:(NSString *)url;
@end
@interface WhiteView : NSView
@end
@interface BlueView : NSView
@end
NSModalResponse SSRunAlertPanel(NSString *title, NSString *msg, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, ...);
NSModalResponse SSRunInformationalAlertPanel(NSString *title, NSString *msg, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, ...);
NSModalResponse SSRunCriticalAlertPanel(NSString *title, NSString *msg, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, ...);
@interface NSScreen (SSScreens)
+ (NSScreen *)primaryScreen;
@end
@interface NSWindow (SSWindowCentering)
- (void)centerOnPrimaryScreen;
@end
@interface NSArray (SSRunLoopExtra)
+ (NSArray *)allRunLoopModes; // default, modal panel, and event tracking
+ (NSArray *)standardRunLoopModes; // default and modal panel
@end
@interface NSApplication (SSApplicationIcon)
- (NSImage *)SSApplicationIconScaledToSize:(NSSize)finalSize;
@end
// Front end to power management...
BOOL RunningOnBatteryOnly(void);
// Find out if the screen is locked (Apple Menu > Lock Screen)
BOOL ScreenIsLocked(void);