blob: 8a287f668abe0cad2544a962e5073239730adf07 [file] [log] [blame]
Alexandre Lision6da08a82015-09-24 17:09:24 -04001/*
Alexandre Lision9fe374b2016-01-06 10:17:31 -05002 * Copyright (C) 2015-2016 Savoir-faire Linux Inc.
Alexandre Lision6da08a82015-09-24 17:09:24 -04003 * Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
Alexandre Lision6da08a82015-09-24 17:09:24 -040019#import <Cocoa/Cocoa.h>
20
Alexandre Lision6da08a82015-09-24 17:09:24 -040021@interface IconButton : NSButton
22
23@property (nonatomic) BOOL mouseDown;
24
25/*
26 * This properties can be overriden in IB in User Defined Runtime Attributes
Alexandre Lision266fca02015-09-28 14:47:05 -040027 * By default this values will be initialized in awakeFromNib
28 */
29
30/*
31 * Background color of the button
Kateryna Kostiuke28a0382019-10-25 16:29:08 -040032 * default value : [NSColor clearColor]
Alexandre Lision6da08a82015-09-24 17:09:24 -040033 */
34@property (nonatomic, strong) NSColor* bgColor;
Alexandre Lision266fca02015-09-28 14:47:05 -040035
36/*
37 * Background color of the button when highlighted
Kateryna Kostiuke28a0382019-10-25 16:29:08 -040038 * default value bgColor
Alexandre Lision266fca02015-09-28 14:47:05 -040039 */
40@property (nonatomic, strong) NSColor* highlightColor;
41
42/*
43 * Background color of the button when highlighted
44 * default value : view frame width / 2 (circle)
45 */
Alexandre Lision6da08a82015-09-24 17:09:24 -040046@property (nonatomic, strong) NSNumber* cornerRadius;
47
Alexandre Lision266fca02015-09-28 14:47:05 -040048/*
Alexandre Lision4baba4c2016-02-11 13:00:57 -050049 * Define pressed state of the button
50 */
51@property (atomic, getter=isPressed) BOOL pressed;
52
53/*
Alexandre Lision266fca02015-09-28 14:47:05 -040054 * Padding
Andreas Traczyk252a94a2018-04-20 16:36:20 -040055 * default value : 8.0
Alexandre Lision266fca02015-09-28 14:47:05 -040056 */
57@property CGFloat imageInsets;
58
Kateryna Kostiuk3c960bf2017-06-01 12:11:54 -040059/*
Kateryna Kostiuk88a6ee82019-09-10 17:55:08 -040060 * Channging of image size when mouse is down
61 * default value : 0.0
62 */
63@property CGFloat imageIncreaseOnClick;
64
65/*
Kateryna Kostiuk958cd072017-07-14 15:56:35 -040066 * Button image color
Kateryna Kostiuke28a0382019-10-25 16:29:08 -040067 * default value : [NSColor ringDarkBlue];
Kateryna Kostiuk958cd072017-07-14 15:56:35 -040068 */
69
70@property (nonatomic, strong) NSColor* imageColor;
71
Kateryna Kostiukdb95b472018-04-17 16:35:57 -040072/*
73 * Image color when button is disabled
74 * default value : [[NSColor grayColor] colorWithAlphaComponent:0.3];
75 */
76
77@property (nonatomic, strong) NSColor* buttonDisableColor;
78
Kateryna Kostiukefc665d2018-09-17 15:42:43 -040079/*
80 * Color of the button corners. Draw circle with cornerRadius filled with bgColor
81 * and fill corner with cornerColor
82 */
83@property (nonatomic, strong) NSColor* cornerColor;
Kateryna Kostiuk4f37d952018-12-04 13:19:17 -050084/*
85 * Font size of the button title.
86 */
87@property CGFloat fontSize;
88
Kateryna Kostiuk88a6ee82019-09-10 17:55:08 -040089-(void)startBlinkAnimationfrom:(NSColor*)startColor
90 to:(NSColor*)endColor
91 scaleFactor:(CGFloat)scaleFactor
92 duration:(CGFloat) duration;
Kateryna Kostiukefc665d2018-09-17 15:42:43 -040093
Kateryna Kostiuk88a6ee82019-09-10 17:55:08 -040094-(void)stopBlinkAnimation;
Alexandre Lision266fca02015-09-28 14:47:05 -040095
Kateryna Kostiuk88a6ee82019-09-10 17:55:08 -040096@property BOOL animating;
Kateryna Kostiuke28a0382019-10-25 16:29:08 -040097@property BOOL isDarkMode;
98
99/*
100 * Button image color when in dark mode
101 * default value : [NSColor whiteColor];
102 */
103
104@property (nonatomic, strong) NSColor* imageDarkColor;
105
106/*
107 * Button image color
108 * default value : [NSColor ringDarkBlue];
109 */
110
111@property (nonatomic, strong) NSColor* imageLightColor;
112
113/*
114 * Button highlight color when in dark mode
115 * default value : highlightColor;
116 */
117
118@property (nonatomic, strong) NSColor* highlightDarkColor;
119
120/*
121 * Button highlight color when in light mode
122 * default value : highlightColor;
123 */
124
125@property (nonatomic, strong) NSColor* highlightLightColor;
126
127/*
128 * Define if should draw boreder
129 * default value false;
130 */
131@property (atomic) BOOL shouldDrawBorder;
132
133/*
134 * Image coler when button pressed
135 * default value : imageColor;
136 */
137
138@property (nonatomic, strong) NSColor* imagePressedColor;
139
140/*
141 * Image coler when button pressed in dark mode
142 * default value : imagePressedColor;
143 */
144
145@property (nonatomic, strong) NSColor* imagePressedDarkColor;
146
147/*
148 * Image coler when button pressed in light mode
149 * default value : imagePressedColor;
150 */
151
152@property (nonatomic, strong) NSColor* imagePressedLightColor;
153
154-(void) onAppearanceChanged;
155
Alexandre Lision6da08a82015-09-24 17:09:24 -0400156@end