Skip to content
This repository
tree: 39fdc21bd2
Fetching contributors…

Cannot retrieve contributors at this time

executable file 73 lines (59 sloc) 3.377 kb
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
//
// INAppStoreWindow.h
//
// Copyright 2011 Indragie Karunaratne. All rights reserved.
//
// Licensed under the BSD License <http://www.opensource.org/licenses/bsd-license>
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
// SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//

#import <Cocoa/Cocoa.h>

#if __has_feature(objc_arc)
#define INAppStoreWindowCopy nonatomic, strong
#define INAppStoreWindowRetain nonatomic, strong
#else
#define INAppStoreWindowCopy nonatomic, copy
#define INAppStoreWindowRetain nonatomic, retain
#endif

/** @class INTitlebarView
Draws a default style Mac OS X title bar.
*/
@interface INTitlebarView : NSView
@end

/** @class INAppStoreWindow
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

/** The height of the title bar. By default, this is set to the standard title bar height. */
@property (nonatomic) CGFloat titleBarHeight;

/** The title bar view itself. 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
styled title bar aside from the default one (textured, etc.). */
@property (INAppStoreWindowRetain) NSView *titleBarView;

/** Set whether the fullscreen or traffic light buttons are horizontally centered */
@property (nonatomic) BOOL centerFullScreenButton;
@property (nonatomic) BOOL centerTrafficLightButtons;

/** If you want to hide the title bar in fullscreen mode, set this boolean to YES */
@property (nonatomic) BOOL hideTitleBarInFullScreen;

/** Use this API to hide the baseline INAppStoreWindow draws between itself and the main window contents. */
@property (nonatomic) BOOL showsBaselineSeparator;

/** Adjust the left and right padding of the trafficlight and fullscreen buttons */
@property (nonatomic) CGFloat trafficLightButtonsLeftMargin;
@property (nonatomic) CGFloat fullScreenButtonRightMargin;


/** So much logic and work has gone into this window subclass to achieve a custom title bar,
it would be a shame to have to re-invent that just to change the look. So this block can be used
to override the default Mac App Store style titlebar drawing with your own drawing code!
*/
typedef void (^INAppStoreWindowTitleBarDrawingBlock)(BOOL drawsAsMainWindow,
                                                     CGRect drawingRect, CGPathRef clippingPath);
@property (INAppStoreWindowCopy) INAppStoreWindowTitleBarDrawingBlock titleBarDrawingBlock;

- (void)setTitleBarDrawingBlock:(INAppStoreWindowTitleBarDrawingBlock)titleBarDrawingBlock;

@end
Something went wrong with that request. Please try again.