[MonoDevelop] Change window title background on MAC

Tomas Trescak tomi.trescak at gmail.com
Thu Mar 21 09:48:06 UTC 2013


Michael

Thanks for the link! With a little digging around, I could repeat your solution!
Just in case someone wants to do the same the procedure is following:

1. Reference "MonoMac" in your code
2. Get the PlatformDetection and GtkQuartz classes from monodevelop projects:
3. Add following code to the constructor (and get the background) of the window:

if (PlatformDetection.IsMac) {
            // this is important to initialize correctly the MonoMac 
            MonoMac.AppKit.NSApplication.Init ();
            
    // get the Mac style window
            NSWindow w = GtkQuartz.GetWindow (this);
            w.IsOpaque = false;
            
            var resource = "maintoolbarbg.png";
            // LoadImage method only loads the png from disk to NSImage
            NSImage img = LoadImage (resource);
            w.BackgroundColor = NSColor.FromPatternImage (img);
            w.StyleMask |= NSWindowStyle.TexturedBackground;

}

4. Main toolbar is done in the same way as in the MainToolbar class from MonoDevelop.

Thanks again for your help!

Tomas 

On Wednesday 20 de March de 2013 at 03:26, Michael Hutchinson wrote:

> You would need some Mac-specific code like this:
> https://github.com/mono/monodevelop/blob/master/main/src/addins/MacPlatform/MacPlatform.cs#L602
> 
> On 19 March 2013 12:05, Tomas Trescak <tomi.trescak at gmail.com (mailto:tomi.trescak at gmail.com)> wrote:
> > Hello
> > 
> > I am trying to create a pretty window using GTK Sharp and a new Xamarin
> > theme.
> > All goes well, except for the widow title background, which is painted only
> > grey by default.
> > How can I achieve that seamless color transition between main window toolbar
> > and a window title (with close/maximize/minimize buttons)?
> > 
> > Thank you!
> > 
> > Tomas
> > 
> > 
> > _______________________________________________
> > Monodevelop-list mailing list
> > Monodevelop-list at lists.ximian.com (mailto:Monodevelop-list at lists.ximian.com)
> > http://lists.ximian.com/mailman/listinfo/monodevelop-list
> > 
> 
> 
> 
> 
> -- 
> Michael Hutchinson
> http://mjhutchinson.com
> 
> 
> 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/monodevelop-list/attachments/20130321/343880a7/attachment.html>


More information about the Monodevelop-list mailing list