Commit f62c3666 authored by Felix Paul Kühne's avatar Felix Paul Kühne Committed by Jean-Baptiste Kempf

macosx: implement proper window button artwork (refs #5742)

(cherry picked from commit 3be591d4)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 2e0d3c3b
...@@ -275,23 +275,53 @@ EXTRA_DIST += \ ...@@ -275,23 +275,53 @@ EXTRA_DIST += \
extras/package/macosx/Resources/mainwindow_dark/shuffle_dark.png \ extras/package/macosx/Resources/mainwindow_dark/shuffle_dark.png \
extras/package/macosx/Resources/mainwindow_dark/stop-pressed_dark.png \ extras/package/macosx/Resources/mainwindow_dark/stop-pressed_dark.png \
extras/package/macosx/Resources/mainwindow_dark/stop_dark.png \ extras/package/macosx/Resources/mainwindow_dark/stop_dark.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/lion/lion-window-close-graphite.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/lion/lion-window-close-on-graphite.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/lion/lion-window-close-on.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/lion/lion-window-close-over-graphite.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/lion/lion-window-close-over.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/lion/lion-window-close.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/lion/lion-window-minimize-graphite.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/lion/lion-window-minimize-on-graphite.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/lion/lion-window-minimize-on.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/lion/lion-window-minimize-over.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/lion/lion-window-minimize-over-graphite.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/lion/lion-window-minimize.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/lion/lion-window-zoom-graphite.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/lion/lion-window-zoom-on-graphite.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/lion/lion-window-zoom-on.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/lion/lion-window-zoom-over-graphite.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/lion/lion-window-zoom-over.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/lion/lion-window-zoom.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/snowleo/snowleo-window-close-graphite.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/snowleo/snowleo-window-close-on-graphite.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/snowleo/snowleo-window-close-on.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/snowleo/snowleo-window-close-over-graphite.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/snowleo/snowleo-window-close-over.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/snowleo/snowleo-window-close.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/snowleo/snowleo-window-minimize-on-graphite.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/snowleo/snowleo-window-minimize-on.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/snowleo/snowleo-window-minimize-over-graphite.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/snowleo/snowleo-window-minimize-over.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/snowleo/snowleo-window-minimize-graphite.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/snowleo/snowleo-window-minimize.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/snowleo/snowleo-window-zoom-graphite.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/snowleo/snowleo-window-zoom-on-graphite.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/snowleo/snowleo-window-zoom-on.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/snowleo/snowleo-window-zoom-over-graphite.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/snowleo/snowleo-window-zoom-over.png \
extras/package/macosx/Resources/mainwindow_dark/titlebar/snowleo/snowleo-window-zoom.png \
extras/package/macosx/Resources/mainwindow_dark/topbar-dark-center-fill.png \
extras/package/macosx/Resources/mainwindow_dark/topbar-dark-left.png \
extras/package/macosx/Resources/mainwindow_dark/topbar-dark-right.png \
extras/package/macosx/Resources/mainwindow_dark/volume-high_dark.png \ extras/package/macosx/Resources/mainwindow_dark/volume-high_dark.png \
extras/package/macosx/Resources/mainwindow_dark/volume-low_dark.png \ extras/package/macosx/Resources/mainwindow_dark/volume-low_dark.png \
extras/package/macosx/Resources/mainwindow_dark/volume-slider-knob_dark.png \ extras/package/macosx/Resources/mainwindow_dark/volume-slider-knob_dark.png \
extras/package/macosx/Resources/mainwindow_dark/volume-slider-track_dark.png \ extras/package/macosx/Resources/mainwindow_dark/volume-slider-track_dark.png \
extras/package/macosx/Resources/mainwindow_dark/window-close-on.png \
extras/package/macosx/Resources/mainwindow_dark/window-close-over.png \
extras/package/macosx/Resources/mainwindow_dark/window-close.png \
extras/package/macosx/Resources/mainwindow_dark/window-fullscreen-on.png \ extras/package/macosx/Resources/mainwindow_dark/window-fullscreen-on.png \
extras/package/macosx/Resources/mainwindow_dark/window-fullscreen-over.png \ extras/package/macosx/Resources/mainwindow_dark/window-fullscreen-over.png \
extras/package/macosx/Resources/mainwindow_dark/window-fullscreen.png \ extras/package/macosx/Resources/mainwindow_dark/window-fullscreen.png \
extras/package/macosx/Resources/mainwindow_dark/window-minimize-on.png \
extras/package/macosx/Resources/mainwindow_dark/window-minimize-over.png \
extras/package/macosx/Resources/mainwindow_dark/window-minimize.png \
extras/package/macosx/Resources/mainwindow_dark/window-resize.png \ extras/package/macosx/Resources/mainwindow_dark/window-resize.png \
extras/package/macosx/Resources/mainwindow_dark/window-zoom-on.png \
extras/package/macosx/Resources/mainwindow_dark/window-zoom-over.png \
extras/package/macosx/Resources/mainwindow_dark/window-zoom.png \
extras/package/macosx/Resources/noart.png \ extras/package/macosx/Resources/noart.png \
extras/package/macosx/Resources/prefs/spref_cone_Audio_64.png \ extras/package/macosx/Resources/prefs/spref_cone_Audio_64.png \
extras/package/macosx/Resources/prefs/spref_cone_Hotkeys_64.png \ extras/package/macosx/Resources/prefs/spref_cone_Hotkeys_64.png \
......
...@@ -29,6 +29,16 @@ ...@@ -29,6 +29,16 @@
@interface VLCMainWindowTitleView : NSImageView @interface VLCMainWindowTitleView : NSImageView
{ {
NSImage * o_red_img;
NSImage * o_red_over_img;
NSImage * o_red_on_img;
NSImage * o_yellow_img;
NSImage * o_yellow_over_img;
NSImage * o_yellow_on_img;
NSImage * o_green_img;
NSImage * o_green_over_img;
NSImage * o_green_on_img;
IBOutlet id o_red_btn; IBOutlet id o_red_btn;
IBOutlet id o_yellow_btn; IBOutlet id o_yellow_btn;
IBOutlet id o_green_btn; IBOutlet id o_green_btn;
...@@ -36,6 +46,7 @@ ...@@ -36,6 +46,7 @@
IBOutlet id o_title_lbl; IBOutlet id o_title_lbl;
} }
- (void)loadButtonIcons;
- (IBAction)buttonAction:(id)sender; - (IBAction)buttonAction:(id)sender;
- (void)setWindowTitle:(NSString *)title; - (void)setWindowTitle:(NSString *)title;
- (void)setFullscreenButtonHidden:(BOOL)b_value; - (void)setFullscreenButtonHidden:(BOOL)b_value;
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#import "intf.h" #import "intf.h"
#import "MainWindowTitle.h" #import "MainWindowTitle.h"
#import "CoreInteraction.h" #import "CoreInteraction.h"
#import "CompatibilityFixes.h"
/***************************************************************************** /*****************************************************************************
* VLCMainWindowTitleView * VLCMainWindowTitleView
...@@ -35,25 +36,44 @@ ...@@ -35,25 +36,44 @@
*****************************************************************************/ *****************************************************************************/
@implementation VLCMainWindowTitleView @implementation VLCMainWindowTitleView
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver: self];
[o_red_img release];
[o_red_over_img release];
[o_red_on_img release];
[o_yellow_img release];
[o_yellow_over_img release];
[o_yellow_on_img release];
[o_green_img release];
[o_green_over_img release];
[o_green_on_img release];
[super dealloc];
}
- (void)awakeFromNib - (void)awakeFromNib
{ {
[self setImageScaling: NSScaleToFit]; [self setImageScaling: NSScaleToFit];
[self setImageFrameStyle: NSImageFrameNone]; [self setImageFrameStyle: NSImageFrameNone];
[self setImageAlignment: NSImageAlignCenter]; [self setImageAlignment: NSImageAlignCenter];
[self setImage: [NSImage imageNamed:@"bottom-background_dark"]]; [self setImage: [NSImage imageNamed:@"topbar-dark-center-fill"]];
[self setAutoresizesSubviews: YES]; [self setAutoresizesSubviews: YES];
[o_red_btn setImage: [NSImage imageNamed:@"window-close"]]; [self loadButtonIcons];
[o_red_btn setAlternateImage: [NSImage imageNamed:@"window-close-on"]]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(controlTintChanged:) name: NSControlTintDidChangeNotification object: nil];
[o_red_btn setImage: o_red_img];
[o_red_btn setAlternateImage: o_red_on_img];
[[o_red_btn cell] setShowsBorderOnlyWhileMouseInside: YES]; [[o_red_btn cell] setShowsBorderOnlyWhileMouseInside: YES];
[[o_red_btn cell] setTag: 0]; [[o_red_btn cell] setTag: 0];
[o_yellow_btn setImage: [NSImage imageNamed:@"window-minimize"]]; [o_yellow_btn setImage: o_yellow_img];
[o_yellow_btn setAlternateImage: [NSImage imageNamed:@"window-minimize-on"]]; [o_yellow_btn setAlternateImage: o_yellow_on_img];
[[o_yellow_btn cell] setShowsBorderOnlyWhileMouseInside: YES]; [[o_yellow_btn cell] setShowsBorderOnlyWhileMouseInside: YES];
[[o_yellow_btn cell] setTag: 1]; [[o_yellow_btn cell] setTag: 1];
[o_green_btn setImage: [NSImage imageNamed:@"window-zoom"]]; [o_green_btn setImage: o_green_img];
[o_green_btn setAlternateImage: [NSImage imageNamed:@"window-zoom-on"]]; [o_green_btn setAlternateImage: o_green_on_img];
[[o_green_btn cell] setShowsBorderOnlyWhileMouseInside: YES]; [[o_green_btn cell] setShowsBorderOnlyWhileMouseInside: YES];
[[o_green_btn cell] setTag: 2]; [[o_green_btn cell] setTag: 2];
[o_fullscreen_btn setImage: [NSImage imageNamed:@"window-fullscreen"]]; [o_fullscreen_btn setImage: [NSImage imageNamed:@"window-fullscreen"]];
...@@ -62,6 +82,77 @@ ...@@ -62,6 +82,77 @@
[[o_fullscreen_btn cell] setTag: 3]; [[o_fullscreen_btn cell] setTag: 3];
} }
- (void)controlTintChanged:(NSNotification *)notification
{
[o_red_img release];
[o_red_over_img release];
[o_red_on_img release];
[o_yellow_img release];
[o_yellow_over_img release];
[o_yellow_on_img release];
[o_green_img release];
[o_green_over_img release];
[o_green_on_img release];
[self loadButtonIcons];
[o_red_btn setNeedsDisplay];
[o_yellow_btn setNeedsDisplay];
[o_green_btn setNeedsDisplay];
}
- (void)loadButtonIcons
{
if (OSX_LION)
{
if( [NSColor currentControlTint] == NSBlueControlTint )
{
o_red_img = [[NSImage imageNamed:@"lion-window-close"] retain];
o_red_over_img = [[NSImage imageNamed:@"lion-window-close-over"] retain];
o_red_on_img = [[NSImage imageNamed:@"lion-window-close-on"] retain];
o_yellow_img = [[NSImage imageNamed:@"lion-window-minimize"] retain];
o_yellow_over_img = [[NSImage imageNamed:@"lion-window-minimize-over"] retain];
o_yellow_on_img = [[NSImage imageNamed:@"lion-window-minimize-on"] retain];
o_green_img = [[NSImage imageNamed:@"lion-window-zoom"] retain];
o_green_over_img = [[NSImage imageNamed:@"lion-window-zoom-over"] retain];
o_green_on_img = [[NSImage imageNamed:@"lion-window-zoom-on"] retain];
} else {
o_red_img = [[NSImage imageNamed:@"lion-window-close-graphite"] retain];
o_red_over_img = [[NSImage imageNamed:@"lion-window-close-over-graphite"] retain];
o_red_on_img = [[NSImage imageNamed:@"lion-window-close-on-graphite"] retain];
o_yellow_img = [[NSImage imageNamed:@"lion-window-minimize-graphite"] retain];
o_yellow_over_img = [[NSImage imageNamed:@"lion-window-minimize-over-graphite"] retain];
o_yellow_on_img = [[NSImage imageNamed:@"lion-window-minimize-on-graphite"] retain];
o_green_img = [[NSImage imageNamed:@"lion-window-zoom-graphite"] retain];
o_green_over_img = [[NSImage imageNamed:@"lion-window-zoom-over-graphite"] retain];
o_green_on_img = [[NSImage imageNamed:@"lion-window-zoom-on-graphite"] retain];
}
} else {
if( [NSColor currentControlTint] == NSBlueControlTint )
{
o_red_img = [[NSImage imageNamed:@"snowleo-window-close"] retain];
o_red_over_img = [[NSImage imageNamed:@"snowleo-window-close-over"] retain];
o_red_on_img = [[NSImage imageNamed:@"snowleo-window-close-on"] retain];
o_yellow_img = [[NSImage imageNamed:@"snowleo-window-minimize"] retain];
o_yellow_over_img = [[NSImage imageNamed:@"snowleo-window-minimize-over"] retain];
o_yellow_on_img = [[NSImage imageNamed:@"snowleo-window-minimize-on"] retain];
o_green_img = [[NSImage imageNamed:@"snowleo-window-zoom"] retain];
o_green_over_img = [[NSImage imageNamed:@"snowleo-window-zoom-over"] retain];
o_green_on_img = [[NSImage imageNamed:@"snowleo-window-zoom-on"] retain];
} else {
o_red_img = [[NSImage imageNamed:@"snowleo-window-close-graphite"] retain];
o_red_over_img = [[NSImage imageNamed:@"snowleo-window-close-over-graphite"] retain];
o_red_on_img = [[NSImage imageNamed:@"snowleo-window-close-on-graphite"] retain];
o_yellow_img = [[NSImage imageNamed:@"snowleo-window-minimize-graphite"] retain];
o_yellow_over_img = [[NSImage imageNamed:@"snowleo-window-minimize-over-graphite"] retain];
o_yellow_on_img = [[NSImage imageNamed:@"snowleo-window-minimize-on-graphite"] retain];
o_green_img = [[NSImage imageNamed:@"snowleo-window-zoom-graphite"] retain];
o_green_over_img = [[NSImage imageNamed:@"snowleo-window-zoom-over-graphite"] retain];
o_green_on_img = [[NSImage imageNamed:@"snowleo-window-zoom-on-graphite"] retain];
}
}
}
- (BOOL)mouseDownCanMoveWindow - (BOOL)mouseDownCanMoveWindow
{ {
return YES; return YES;
...@@ -98,15 +189,15 @@ ...@@ -98,15 +189,15 @@
{ {
if( b_value ) if( b_value )
{ {
[o_red_btn setImage: [NSImage imageNamed:@"window-close-over"]]; [o_red_btn setImage: o_red_over_img];
[o_yellow_btn setImage: [NSImage imageNamed:@"window-minimize-over"]]; [o_yellow_btn setImage: o_yellow_over_img];
[o_green_btn setImage: [NSImage imageNamed:@"window-zoom-over"]]; [o_green_btn setImage: o_green_over_img];
} }
else else
{ {
[o_red_btn setImage: [NSImage imageNamed:@"window-close"]]; [o_red_btn setImage: o_red_img];
[o_yellow_btn setImage: [NSImage imageNamed:@"window-minimize"]]; [o_yellow_btn setImage: o_yellow_img];
[o_green_btn setImage: [NSImage imageNamed:@"window-zoom"]]; [o_green_btn setImage: o_green_img];
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment