ui: update in-call actions
- use new button theme for call controls buttons.
- add an icon for recording
- gide buttons when available instead of disabling them
Issue: #79400
Change-Id: I712467b8f7b7fe16317f4283ae9d4f91bc8b9203
diff --git a/src/views/IconButton.h b/src/views/IconButton.h
index b20d16b..ae22b35 100644
--- a/src/views/IconButton.h
+++ b/src/views/IconButton.h
@@ -16,21 +16,40 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
#import <Cocoa/Cocoa.h>
-
@interface IconButton : NSButton
@property (nonatomic) BOOL mouseDown;
/*
* This properties can be overriden in IB in User Defined Runtime Attributes
- * By default this values will be initialized in awakeFromNib with:
- * bgColor -> [NSColor ringBlue]
- * cornerRadius to view frame width / 2 (circle)
+ * By default this values will be initialized in awakeFromNib
+ */
+
+/*
+ * Background color of the button
+ * default value : [NSColor ringBlue]
*/
@property (nonatomic, strong) NSColor* bgColor;
+
+/*
+ * Background color of the button when highlighted
+ * default value : view frame width / 2 (circle)
+ */
+@property (nonatomic, strong) NSColor* highlightColor;
+
+/*
+ * Background color of the button when highlighted
+ * default value : view frame width / 2 (circle)
+ */
@property (nonatomic, strong) NSNumber* cornerRadius;
+/*
+ * Padding
+ * default value : 5.0
+ */
+@property CGFloat imageInsets;
+
+
@end
diff --git a/src/views/IconButton.mm b/src/views/IconButton.mm
index f50a53a..93c0e29 100644
--- a/src/views/IconButton.mm
+++ b/src/views/IconButton.mm
@@ -21,7 +21,6 @@
#import "NSColor+RingTheme.h"
-
@implementation IconButton
-(void) awakeFromNib {
@@ -32,6 +31,9 @@
if (!self.cornerRadius) {
self.cornerRadius = @(NSWidth(self.frame) / 2);
}
+
+ if (self.imageInsets == 0)
+ self.imageInsets = 5.0f;
}
- (void)drawRect:(NSRect)dirtyRect
@@ -42,8 +44,14 @@
NSColor* backgroundStrokeColor5;
if (self.mouseDown || self.state == NSOnState) {
- backgroundColor6 = [self.bgColor darkenColorByValue:0.3];
- backgroundStrokeColor5 = [self.bgColor darkenColorByValue:0.4];
+ if (self.highlightColor) {
+ backgroundColor6 = self.highlightColor;
+ backgroundStrokeColor5 = [self.highlightColor darkenColorByValue:0.1];
+ } else {
+ backgroundColor6 = [self.bgColor darkenColorByValue:0.3];
+ backgroundStrokeColor5 = [self.bgColor darkenColorByValue:0.4];
+ }
+
} else {
backgroundColor6 = self.bgColor;
backgroundStrokeColor5 = [self.bgColor darkenColorByValue:0.1];
@@ -52,13 +60,10 @@
//// Subframes
NSRect group = NSMakeRect(NSMinX(dirtyRect) + floor(NSWidth(dirtyRect) * 0.03333) + 0.5, NSMinY(dirtyRect) + floor(NSHeight(dirtyRect) * 0.03333) + 0.5, floor(NSWidth(dirtyRect) * 0.96667) - floor(NSWidth(dirtyRect) * 0.03333), floor(NSHeight(dirtyRect) * 0.96667) - floor(NSHeight(dirtyRect) * 0.03333));
-
//// Group
{
//// Oval Drawing
-// NSBezierPath* ovalPath = [NSBezierPath bezierPathWithOvalInRect: NSMakeRect(NSMinX(group) + floor(NSWidth(group) * 0.00000 + 0.5), NSMinY(group) + floor(NSHeight(group) * 0.00000 + 0.5), floor(NSWidth(group) * 1.00000 + 0.5) - floor(NSWidth(group) * 0.00000 + 0.5), floor(NSHeight(group) * 1.00000 + 0.5) - floor(NSHeight(group) * 0.00000 + 0.5))];
-
-NSBezierPath* ovalPath = [NSBezierPath bezierPathWithRoundedRect:NSMakeRect(NSMinX(group) + floor(NSWidth(group) * 0.00000 + 0.5), NSMinY(group) + floor(NSHeight(group) * 0.00000 + 0.5), floor(NSWidth(group) * 1.00000 + 0.5) - floor(NSWidth(group) * 0.00000 + 0.5), floor(NSHeight(group) * 1.00000 + 0.5) - floor(NSHeight(group) * 0.00000 + 0.5)) xRadius:[self.cornerRadius floatValue] yRadius:[self.cornerRadius floatValue]];
+ NSBezierPath* ovalPath = [NSBezierPath bezierPathWithRoundedRect:NSMakeRect(NSMinX(group) + floor(NSWidth(group) * 0.00000 + 0.5), NSMinY(group) + floor(NSHeight(group) * 0.00000 + 0.5), floor(NSWidth(group) * 1.00000 + 0.5) - floor(NSWidth(group) * 0.00000 + 0.5), floor(NSHeight(group) * 1.00000 + 0.5) - floor(NSHeight(group) * 0.00000 + 0.5)) xRadius:[self.cornerRadius floatValue] yRadius:[self.cornerRadius floatValue]];
[backgroundColor6 setFill];
[ovalPath fill];
@@ -72,7 +77,8 @@
[path addClip];
[self setImagePosition:NSImageOnly];
- auto rect2 = NSInsetRect(dirtyRect, 5, 5);
+ auto rect2 = NSInsetRect(dirtyRect, self.imageInsets, self.imageInsets);
+
[[NSColor image:self.image tintedWithColor:[NSColor whiteColor]]
drawInRect:rect2