Re: Drawing customized window

2012-11-01 Thread Nick
Corbin, is it possible to make the background color pattern image stretch
the picture across the window, instead of repeating it?. If not, is dealing
with borderless window the only way to get this functionality (like, having
a custom colored title bar, and white title bar text)?
Thank you



2012/11/1 Nick eveningn...@gmail.com

 Thanks Corbin, it works great (unfortunately I can't draw the gradient
 depending on the window size (so it's always white on top and black on
 bottom, no matter how high the window is, for example), but I guess that
 still gives possibilities for skinning)..
 I will join the Iain's question.. Is it possible to somehow alter the
 color of the title text? Or at least set the title to @, and draw
 manually NSAttributedString in that title area?


 2012/11/1 iain i...@sleepfive.com

 Hi Corbin, sorry for semi-hijacking the thread

 On Wed, Oct 31, 2012 at 8:17 PM, Corbin Dunn corb...@apple.com wrote:


  I am wondering if anyone created customized windows like this or
 reverse
  engineered this NSThemeFrame? Maybe there are any articles on the
 internet
  that I have missed (actually the link I gave in the beginning is the
 only
  one I have found on this topic). Somehow Apple's iCalendar works pretty
  fast on 10.7, while my app doesn't..

 Calendar uses the public API of setBackgroundColor: on the window, and
 sets it to a pattern color. That is it.


 When you use setBackgroundColor: on the window, is there a way to get the
 titlebar text to draw in a different colour? When you set the background to
 a dark colour, the titlebar text is still drawn dark with a light highlight
 so it looks quite bad.

 thanks,
 iain



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drawing customized window

2012-11-01 Thread Corbin Dunn

On Oct 31, 2012, at 7:25 PM, Nick eveningn...@gmail.com wrote:

 Thanks Corbin, it works great (unfortunately I can't draw the gradient 
 depending on the window size (so it's always white on top and black on 
 bottom, no matter how high the window is, for example), but I guess that 
 still gives possibilities for skinning).. 
 I will join the Iain's question.. Is it possible to somehow alter the color 
 of the title text? Or at least set the title to @, and draw manually 
 NSAttributedString in that title area?

No; there is no way to customize the title; please log a bug requesting the 
ability to do this.

corbin

 
 
 2012/11/1 iain i...@sleepfive.com
 Hi Corbin, sorry for semi-hijacking the thread
 
 On Wed, Oct 31, 2012 at 8:17 PM, Corbin Dunn corb...@apple.com wrote:
 
  I am wondering if anyone created customized windows like this or reverse
  engineered this NSThemeFrame? Maybe there are any articles on the internet
  that I have missed (actually the link I gave in the beginning is the only
  one I have found on this topic). Somehow Apple's iCalendar works pretty
  fast on 10.7, while my app doesn't..
 
 Calendar uses the public API of setBackgroundColor: on the window, and sets 
 it to a pattern color. That is it.
 
 
 When you use setBackgroundColor: on the window, is there a way to get the 
 titlebar text to draw in a different colour? When you set the background to a 
 dark colour, the titlebar text is still drawn dark with a light highlight so 
 it looks quite bad.
 
 thanks,
 iain
 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drawing customized window

2012-11-01 Thread Corbin Dunn
hi nick,

No; you can't stretch it, but you can create a pattern image that is tall, and 
appears to repeat or stretch. Other than that, the only official way to 
customize a window is via a borderless custom window.

However, please do log bugs requesting that AppKit provide an easy way to 
customize windows. It is good to hear from developers that they want this 
functionality.

corbin


On Nov 1, 2012, at 7:35 AM, Nick eveningn...@gmail.com wrote:

 Corbin, is it possible to make the background color pattern image stretch the 
 picture across the window, instead of repeating it?. If not, is dealing with 
 borderless window the only way to get this functionality (like, having a 
 custom colored title bar, and white title bar text)?
 Thank you
 
 
 
 2012/11/1 Nick eveningn...@gmail.com
 Thanks Corbin, it works great (unfortunately I can't draw the gradient 
 depending on the window size (so it's always white on top and black on 
 bottom, no matter how high the window is, for example), but I guess that 
 still gives possibilities for skinning).. 
 I will join the Iain's question.. Is it possible to somehow alter the color 
 of the title text? Or at least set the title to @, and draw manually 
 NSAttributedString in that title area?
 
 
 2012/11/1 iain i...@sleepfive.com
 Hi Corbin, sorry for semi-hijacking the thread
 
 On Wed, Oct 31, 2012 at 8:17 PM, Corbin Dunn corb...@apple.com wrote:
 
  I am wondering if anyone created customized windows like this or reverse
  engineered this NSThemeFrame? Maybe there are any articles on the internet
  that I have missed (actually the link I gave in the beginning is the only
  one I have found on this topic). Somehow Apple's iCalendar works pretty
  fast on 10.7, while my app doesn't..
 
 Calendar uses the public API of setBackgroundColor: on the window, and sets 
 it to a pattern color. That is it.
 
 
 When you use setBackgroundColor: on the window, is there a way to get the 
 titlebar text to draw in a different colour? When you set the background to a 
 dark colour, the titlebar text is still drawn dark with a light highlight so 
 it looks quite bad.
 
 thanks,
 iain
 
 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drawing customized window

2012-11-01 Thread Lee Ann Rucker
Done;  rdar://12617674 I also included a suggestion for a hasDarkBackground 
flag that'll switch to buttons like QuickTime Player uses because the shadow on 
the default ones looks weird on dark backgrounds.

On Nov 1, 2012, at 11:12 AM, Corbin Dunn wrote:

 hi nick,
 
 No; you can't stretch it, but you can create a pattern image that is tall, 
 and appears to repeat or stretch. Other than that, the only official way to 
 customize a window is via a borderless custom window.
 
 However, please do log bugs requesting that AppKit provide an easy way to 
 customize windows. It is good to hear from developers that they want this 
 functionality.
 
 corbin
 
 
 On Nov 1, 2012, at 7:35 AM, Nick eveningn...@gmail.com wrote:
 
 Corbin, is it possible to make the background color pattern image stretch 
 the picture across the window, instead of repeating it?. If not, is dealing 
 with borderless window the only way to get this functionality (like, having 
 a custom colored title bar, and white title bar text)?
 Thank you
 
 
 
 2012/11/1 Nick eveningn...@gmail.com
 Thanks Corbin, it works great (unfortunately I can't draw the gradient 
 depending on the window size (so it's always white on top and black on 
 bottom, no matter how high the window is, for example), but I guess that 
 still gives possibilities for skinning).. 
 I will join the Iain's question.. Is it possible to somehow alter the color 
 of the title text? Or at least set the title to @, and draw manually 
 NSAttributedString in that title area?
 
 
 2012/11/1 iain i...@sleepfive.com
 Hi Corbin, sorry for semi-hijacking the thread
 
 On Wed, Oct 31, 2012 at 8:17 PM, Corbin Dunn corb...@apple.com wrote:
 
 I am wondering if anyone created customized windows like this or reverse
 engineered this NSThemeFrame? Maybe there are any articles on the internet
 that I have missed (actually the link I gave in the beginning is the only
 one I have found on this topic). Somehow Apple's iCalendar works pretty
 fast on 10.7, while my app doesn't..
 
 Calendar uses the public API of setBackgroundColor: on the window, and sets 
 it to a pattern color. That is it.
 
 
 When you use setBackgroundColor: on the window, is there a way to get the 
 titlebar text to draw in a different colour? When you set the background to 
 a dark colour, the titlebar text is still drawn dark with a light highlight 
 so it looks quite bad.
 
 thanks,
 iain
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/lrucker%40vmware.com
 
 This email sent to lruc...@vmware.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drawing customized window

2012-10-31 Thread Nick
Forgot to add, the slowness on 10.7/10.8 can be seen in Activity monitor
during video playback (I am playing a QTMovie onto QTMovieLayer). While
QuickTime player takes  30%, my app takes up to 100% of the CPU power to
play the same video.. That's where I checked the app using Instruments - I
am getting 30-40% of time spent in QuickTime decoding functions, and the
rest of the time - deep inside RunLoop... It is slow like that only on Lion
and Moutain Lion. As soon as comment out this methods swizzling (that lets
me to draw a customized window NSThemeFrame), the performance increases
significantly..
Why might this happen?


2012/10/31 Nick eveningn...@gmail.com

 Hello

 I am attempting to create an application with custom looking windows
 (similar to new iCalendar on mountain lion, or QuickTime player). I am
 targeting systems from Snow Leopard to Mountain Lion.

 So far I've been customizing the window using the idea described at
 http://parmanoir.com/Custom_NSThemeFrame
 (basically I set the window to be Textured, and swizzle the draw Rect
 method of the [[window contentView] superview] (which is an instance of
 NSThemeFrame), then draw some nice gradient in that new drawRect
 implementation, and a custom gradiented toolbar.
 The advantage of this method is that I do not have to bother with resizing
 (even the resizing mark in the bottom right corner is drawn automatically)
 and manually drawing titlebar buttons (albeit they have a gray shadow,
 despite i need a black one). Another advantage is that NSToolbar works
 normally with it, and looks nicely with this customly drawn theme frame.

 This works fine on Leopard and Snow Leopard, but not on Lion/Mountain
 Lion. Somehow, the application becomes very slow there (Instruments says
 that the application spends a whole bunch of time in some timer event
 somewhere deep in the AppKit, even though I do not use any timers in my
 app). Apart from the windows, on Lion/ML the sheets and the panels get this
 custom drawn background with a titlebar.

 I am wondering if anyone created customized windows like this or reverse
 engineered this NSThemeFrame? Maybe there are any articles on the internet
 that I have missed (actually the link I gave in the beginning is the only
 one I have found on this topic). Somehow Apple's iCalendar works pretty
 fast on 10.7, while my app doesn't..

 If there's no way to fix this for 10.7/10.8, I guess I will have to draw
 my windows from scratch using NSBorderlessWindowMask, but I think it is
 very difficult to completely mimic the original window's behavior:
 borderless windows do not support NSToolBar (i.e., I have to create my own
 one from scratch), on different OS the windows look/behave differently
 (10.6 - large titlebar buttons, resizing only using right-bottom corner,
 while 10.7 and 10.8 - small titlebar buttons, resizing using any edge),
 etc..


 Thank you,
 Nicolas

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drawing customized window

2012-10-31 Thread Jens Alfke

On Oct 31, 2012, at 8:50 AM, Nick eveningn...@gmail.com wrote:

 I am wondering if anyone created customized windows like this or reverse
 engineered this NSThemeFrame?

Chrome does tricks like this; there’s some really ugly code to hack the window 
frame drawing to support its custom tabs. It’s been a while since I was in that 
code so I don’t remember exactly what file to look in, though. All I can 
suggest is to check out the Chromium sources and start grepping for likely 
keywords like NSThemeFrame (or NSGrayFrame IIRC).

—Jens

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Drawing customized window

2012-10-31 Thread Corbin Dunn

On Oct 31, 2012, at 8:50 AM, Nick eveningn...@gmail.com wrote:

 Hello
 
 I am attempting to create an application with custom looking windows
 (similar to new iCalendar on mountain lion, or QuickTime player). I am
 targeting systems from Snow Leopard to Mountain Lion.
 
 So far I've been customizing the window using the idea described at
 http://parmanoir.com/Custom_NSThemeFrame
 (basically I set the window to be Textured, and swizzle the drawRect
 method of the [[window contentView] superview] (which is an instance of
 NSThemeFrame), then draw some nice gradient in that new drawRect
 implementation, and a custom gradiented toolbar.
 The advantage of this method is that I do not have to bother with resizing
 (even the resizing mark in the bottom right corner is drawn automatically)
 and manually drawing titlebar buttons (albeit they have a gray shadow,
 despite i need a black one). Another advantage is that NSToolbar works
 normally with it, and looks nicely with this customly drawn theme frame.

Don't swizzle the theme frame drawRect: -- that won't always work (as you 
noticed) and isn't supported.

 
 This works fine on Leopard and Snow Leopard, but not on Lion/Mountain Lion.
 Somehow, the application becomes very slow there (Instruments says that the
 application spends a whole bunch of time in some timer event somewhere deep
 in the AppKit, even though I do not use any timers in my app). Apart from
 the windows, on Lion/ML the sheets and the panels get this custom drawn
 background with a titlebar.
 
 I am wondering if anyone created customized windows like this or reverse
 engineered this NSThemeFrame? Maybe there are any articles on the internet
 that I have missed (actually the link I gave in the beginning is the only
 one I have found on this topic). Somehow Apple's iCalendar works pretty
 fast on 10.7, while my app doesn't..

Calendar uses the public API of setBackgroundColor: on the window, and sets it 
to a pattern color. That is it.

corbin

 
 If there's no way to fix this for 10.7/10.8, I guess I will have to draw my
 windows from scratch using NSBorderlessWindowMask, but I think it is very
 difficult to completely mimic the original window's behavior: borderless
 windows do not support NSToolBar (i.e., I have to create my own one from
 scratch), on different OS the windows look/behave differently (10.6 - large
 titlebar buttons, resizing only using right-bottom corner, while 10.7 and
 10.8 - small titlebar buttons, resizing using any edge), etc..
 
 
 Thank you,
 Nicolas
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drawing customized window

2012-10-31 Thread Nick
Thanks Corbin, it works great (unfortunately I can't draw the gradient
depending on the window size (so it's always white on top and black on
bottom, no matter how high the window is, for example), but I guess that
still gives possibilities for skinning)..
I will join the Iain's question.. Is it possible to somehow alter the color
of the title text? Or at least set the title to @, and draw manually
NSAttributedString in that title area?


2012/11/1 iain i...@sleepfive.com

 Hi Corbin, sorry for semi-hijacking the thread

 On Wed, Oct 31, 2012 at 8:17 PM, Corbin Dunn corb...@apple.com wrote:


  I am wondering if anyone created customized windows like this or reverse
  engineered this NSThemeFrame? Maybe there are any articles on the
 internet
  that I have missed (actually the link I gave in the beginning is the
 only
  one I have found on this topic). Somehow Apple's iCalendar works pretty
  fast on 10.7, while my app doesn't..

 Calendar uses the public API of setBackgroundColor: on the window, and
 sets it to a pattern color. That is it.


 When you use setBackgroundColor: on the window, is there a way to get the
 titlebar text to draw in a different colour? When you set the background to
 a dark colour, the titlebar text is still drawn dark with a light highlight
 so it looks quite bad.

 thanks,
 iain

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drawing customized window

2012-10-31 Thread iain
Hi Corbin, sorry for semi-hijacking the thread

On Wed, Oct 31, 2012 at 8:17 PM, Corbin Dunn corb...@apple.com wrote:


  I am wondering if anyone created customized windows like this or reverse
  engineered this NSThemeFrame? Maybe there are any articles on the
 internet
  that I have missed (actually the link I gave in the beginning is the only
  one I have found on this topic). Somehow Apple's iCalendar works pretty
  fast on 10.7, while my app doesn't..

 Calendar uses the public API of setBackgroundColor: on the window, and
 sets it to a pattern color. That is it.


When you use setBackgroundColor: on the window, is there a way to get the
titlebar text to draw in a different colour? When you set the background to
a dark colour, the titlebar text is still drawn dark with a light highlight
so it looks quite bad.

thanks,
iain
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com