-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathINAppStoreWindow.h
executable file
·344 lines (270 loc) · 10.5 KB
/
INAppStoreWindow.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
//
// INAppStoreWindow.h
//
// Copyright (c) 2011-2014 Indragie Karunaratne. All rights reserved.
// Copyright (c) 2014 Petroules Corporation. All rights reserved.
//
// Licensed under the BSD 2-clause License. See LICENSE file distributed in the source
// code of this project.
//
#import <Cocoa/Cocoa.h>
/**
Height of a small bottom bar of a window. Currently, this is 22 points.
*/
APPKIT_EXTERN const NSInteger kINAppStoreWindowSmallBottomBarHeight;
/**
Height of a large bottom bar of a window. Currently, this is 32 points.
*/
APPKIT_EXTERN const NSInteger kINAppStoreWindowLargeBottomBarHeight;
@class INWindowButton;
/**
* Draws default style OS X window backgrounds and separators.
*/
@interface INWindowBackgroundView : NSView
@end
/**
Draws a default style OS X title bar.
*/
@interface INTitlebarView : INWindowBackgroundView
@end
/**
Draws a default style OS X bottom bar.
*/
@interface INBottomBarView : INWindowBackgroundView
@end
/**
Creates a window similar to the Mac App Store window, with centered traffic lights and an
enlarged title bar. This does not handle creating the toolbar.
*/
@interface INAppStoreWindow : NSWindow
/**
Prototype for a block used to implement custom drawing code for a window's title bar or bottom bar.
@param drawsAsMainWindow Whether the window should be drawn in main state.
@param drawingRect Drawing area of the window's title bar.
@param edge NSMinYEdge to draw a bottom bar, NSMaxYEdge to draw a title bar.
@param clippingPath Path to clip drawing according to window's rounded corners.
*/
typedef void (^INAppStoreWindowBackgroundDrawingBlock)(BOOL drawsAsMainWindow, CGRect drawingRect,
CGRectEdge edge, CGPathRef clippingPath);
/**
The height of the title bar. By default, this is set to the standard title bar height.
*/
@property (nonatomic) CGFloat titleBarHeight;
/**
Container view for custom views added to the title bar.
Add subviews to this view that you want to show in the title bar (e.g. buttons, a toolbar, etc.).
This view can also be set if you want to use a different style title bar from the default one
(textured, etc.).
*/
@property (nonatomic, strong) NSView *titleBarView;
/**
The height of the bottom bar. By default, this is set to 0.
*/
@property (nonatomic) CGFloat bottomBarHeight;
/**
Container view for custom views added to the bottom bar.
Add subviews to this view that you want to show in the bottom bar (e.g. labels, sliders, etc.).
This view can also be set if you want to use a different style bottom bar from the default one
(textured, etc.).
*/
@property (nonatomic, strong) NSView *bottomBarView;
/**
Whether the fullscreen button is vertically centered.
*/
@property (nonatomic) BOOL centerFullScreenButton;
/**
Whether the traffic light buttons are vertically centered.
*/
@property (nonatomic) BOOL centerTrafficLightButtons;
/**
Whether the traffic light buttons are displayed in vertical orientation.
*/
@property (nonatomic) BOOL verticalTrafficLightButtons;
/**
Whether the title is centered vertically.
*/
@property (nonatomic) BOOL verticallyCenterTitle;
/**
Whether to hide the title bar in fullscreen mode.
*/
@property (nonatomic) BOOL hideTitleBarInFullScreen;
/**
Whether to display the baseline separator between the window's title bar and content area.
*/
@property (nonatomic) BOOL showsBaselineSeparator;
/**
Whether to display the bottom separator between the window's bottom bar and content area.
*/
@property (nonatomic) BOOL showsBottomBarSeparator;
/**
Distance between the traffic light buttons and the left edge of the window.
*/
@property (nonatomic) CGFloat trafficLightButtonsLeftMargin;
/**
* Distance between the traffic light buttons and the top edge of the window.
*/
@property (nonatomic) CGFloat trafficLightButtonsTopMargin;
/**
Distance between the fullscreen button and the right edge of the window.
*/
@property (nonatomic) CGFloat fullScreenButtonRightMargin;
/**
Distance between the fullscreen button and the top edge of the window.
*/
@property (nonatomic) CGFloat fullScreenButtonTopMargin;
/**
Spacing between the traffic light buttons.
*/
@property (nonatomic) CGFloat trafficLightSeparation;
/**
Number of points in any direction above which the window will be allowed to reposition.
A Higher value indicates coarser movements but much reduced CPU overhead. Defaults to 1.
*/
@property (nonatomic) CGFloat mouseDragDetectionThreshold;
/**
Whether to show the window's title text. If \c YES, the title will be shown even if
\a titleBarDrawingBlock is set. To draw the title manually, set this property to \c NO
and draw the title using \a titleBarDrawingBlock.
*/
@property (nonatomic) BOOL showsTitle;
/**
Whether to show the window's title text in fullscreen mode.
*/
@property (nonatomic) BOOL showsTitleInFullscreen;
/**
Whether the window displays the document proxy icon (for document-based applications).
*/
@property (nonatomic) BOOL showsDocumentProxyIcon;
/**
The button to use as the window's close button.
If this property is nil, the default button will be used.
*/
@property (nonatomic, strong) INWindowButton *closeButton;
/**
The button to use as the window's minimize button.
If this property is nil, the default button will be used.
*/
@property (nonatomic, strong) INWindowButton *minimizeButton;
/**
The button to use as the window's zoom button.
If this property is nil, the default button will be used.
*/
@property (nonatomic, strong) INWindowButton *zoomButton;
/**
The button to use as the window's fullscreen button.
If this property is nil, the default button will be used.
*/
@property (nonatomic, strong) INWindowButton *fullScreenButton;
/**
The divider line between the window title and document versions button.
*/
@property (nonatomic, readonly) NSTextField *titleDivider;
/**
The font used to draw the window's title text.
*/
@property (nonatomic, strong) NSFont *titleFont;
/**
Gradient used to draw the window's title bar, when the window is main.
If this property is \c nil, the system gradient will be used.
*/
@property (nonatomic, strong) NSGradient *titleBarGradient;
/**
Gradient used to draw the window's bottom bar, when the window is main.
If this property is \c nil, the system gradient will be used.
*/
@property (nonatomic, strong) NSGradient *bottomBarGradient;
/**
Color of the separator line between a window's title bar and content area,
when the window is main.
If this property is \c nil, the default color will be used.
*/
@property (nonatomic, strong) NSColor *baselineSeparatorColor;
/**
Color of the window's title text, when the window is main.
If this property is \c nil, the default color will be used.
*/
@property (nonatomic, strong) NSColor *titleTextColor;
/**
Drop shadow under the window's title text, when the window is main.
If this property is \c nil, the default shadow will be used.
*/
@property (nonatomic, strong) NSShadow *titleTextShadow;
/**
Gradient used to draw the window's title bar, when the window is not main.
If this property is \c nil, the system gradient will be used.
*/
@property (nonatomic, strong) NSGradient *inactiveTitleBarGradient;
/**
Gradient used to draw the window's bottom bar, when the window is not main.
If this property is \c nil, the system gradient will be used.
*/
@property (nonatomic, strong) NSGradient *inactiveBottomBarGradient;
/**
Color of the separator line between a window's title bar and content area,
when the window is not main.
If this property is \c nil, the default color will be used.
*/
@property (nonatomic, strong) NSColor *inactiveBaselineSeparatorColor;
/**
Color of the window's title text, when the window is not main.
If this property is \c nil, the default color will be used.
*/
@property (nonatomic, strong) NSColor *inactiveTitleTextColor;
/**
Drop shadow under the window's title text, when the window is not main.
If this property is \c nil, the default shadow will be used.
*/
@property (nonatomic, strong) NSShadow *inactiveTitleTextShadow;
/**
Block to override the drawing of the window title bar with a custom implementation.
*/
@property (nonatomic, copy) INAppStoreWindowBackgroundDrawingBlock titleBarDrawingBlock;
/**
Block to override the drawing of the window bottom bar with a custom implementation.
*/
@property (nonatomic, copy) INAppStoreWindowBackgroundDrawingBlock bottomBarDrawingBlock;
/**
Whether to draw a noise pattern overlay on the title bar on OS X 10.7-10.9. This
property has no effect when running on OS X 10.10 or higher.
*/
@property (nonatomic) BOOL drawsTitlePatternOverlay;
/*!
Default system gradient used to draw a window's title bar.
@param drawsAsMainWindow \c YES to return the gradient used when the window is drawn in its main
state, \c NO to return the color used when the window is inactive.
@note This gradient is identical to the one used by AppKit in OS X versions 10.7 through 10.9.
For OS X 10.6 it is currently an approximation.
*/
+ (NSGradient *)defaultTitleBarGradient:(BOOL)drawsAsMainWindow;
/*!
Default system gradient used to draw a window's bottom bar.
@param drawsAsMainWindow \c YES to return the gradient used when the window is drawn in its main
state, \c NO to return the color used when the window is inactive.
*/
+ (NSGradient *)defaultBottomBarGradient:(BOOL)drawsAsMainWindow;
/*!
Default system color of the separator line between a window's title bar and content area.
@param drawsAsMainWindow \c YES to return the color used when the window is drawn in its main
state, \c NO to return the color used when the window is inactive.
@note This color may be an approximation and is subject to change at any time.
*/
+ (NSColor *)defaultBaselineSeparatorColor:(BOOL)drawsAsMainWindow;
/*!
Default system color of a window's title text.
@param drawsAsMainWindow \c YES to return the color used when the window is drawn in its main
state, \c NO to return the color used when the window is inactive.
@note This color may be an approximation and is subject to change at any time.
*/
+ (NSColor *)defaultTitleTextColor:(BOOL)drawsAsMainWindow;
/**
Sets the height of the title bar. By default, this is set to the standard title bar height.
@param adjustWindowFrame Whether to adjust the window frame in response to the change in
the title bar height. By default, the window frame is adjusted when the title bar height
is changed.
*/
- (void)setTitleBarHeight:(CGFloat)titleBarHeight adjustWindowFrame:(BOOL)adjustWindowFrame;
/**
Returns the height of the window's NSToolbar. If the window has no NSToolbar, or if it's not visible, returns 0.
*/
- (CGFloat)toolbarHeight;
@end