Spotify-App like title bar

Hi folks,

yesterday I used the spotify app for the first time and wondered if and how we could mimick the looks of its main window:

Maximilian Tyrtania

Disable border on the window, and use a custom canvas control which should act like the titlebar. That’s what I would do on Windows, not sure if it’s possible on Mac.

Theres lots of ways. This is one.

Drag a Toolbar onto a window. place this is open event.

[code] declare sub setStyleMask lib “Cocoa” selector “setStyleMask:” (w as integer, s As integer)
declare function styleMask lib “Cocoa” selector “styleMask” (w as integer) As integer

//Yosemite only
declare sub setTitlebarAppearsTransparent lib “Cocoa” selector “setTitlebarAppearsTransparent:” (windowHandle as integer, value as boolean)
setTitlebarAppearsTransparent(self.handle, true)

//add NSFullSizeContentViewWindowMask
setStyleMask(self.Handle, styleMask(self.Handle) or 32768)

#if targetmacos
const NSWindowTitleHidden = 1
declare sub setTitleVisibility lib “Cocoa” selector “setTitleVisibility:” (windowHandle as Integer, value as Integer)
setTitleVisibility(self.Handle,NSWindowTitleHidden)
#endif

dim rgb as color = &c22232600

declare function NSClassFromString lib “Cocoa” (aClassName as CFStringRef) as Ptr
declare Function colorWithSRGBRed lib “Cocoa” selector “colorWithSRGBRed:green:blue:alpha:”(cls as ptr,red as single,green as single,blue as single, alpha as single) as ptr
declare sub setBackgroundColor lib “Cocoa” selector “setBackgroundColor:” (windowRef as integer, backColor as Ptr)

dim NSColorInstance as Ptr = colorWithSRGBRed(NSClassFromString(“NSColor”), rgb.red / 255, rgb.Green / 255, rgb.blue/255, (255-rgb.Alpha)/255)

//add setBackgroundColor
setBackgroundColor(self.Handle, NSColorInstance)
[/code]

Excellent, I’ll start messing around with this. Thanks!

Is there a way to change font color of the windows Title? Its by default black. Black on a black window is a bit difficult to read. :slight_smile:

set window title empty and use a Label

If you want to set different controls on the toolbar. You can also use the declares from this thread by Eli Ott

I found something by accident the other day, if you set the window to have a background colour and then set the window type to metal, it will automatically put the background colour in the title bar… No need for declares and just a quick conditional compile to disable the background colour for the other platforms (if needed)