VirtualBox

Changeset 24983 in vbox for trunk/src


Ignore:
Timestamp:
Nov 26, 2009 9:47:22 AM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4-OSX: Remove the title buttons by changing the style mask & not explicitly hide them.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin-cocoa.mm

    r24107 r24983  
    7676    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    7777
    78     NSButton *closeButton = [aWindow standardWindowButton:NSWindowCloseButton];
    79     if (closeButton != Nil)
    80         [closeButton setHidden:YES];
    81     NSButton *minButton = [aWindow standardWindowButton:NSWindowMiniaturizeButton];
    82     if (minButton != Nil)
    83         [minButton setHidden:YES];
    84     NSButton *zoomButton = [aWindow standardWindowButton:NSWindowZoomButton];
    85     if (zoomButton != Nil)
    86         [zoomButton setHidden:YES];
    87     NSButton *iconButton = [aWindow standardWindowButton:NSWindowDocumentIconButton];
    88     if (iconButton != Nil)
    89         [iconButton setHidden:YES];
     78    /* Remove all title buttons by changing the style mask. This method is
     79       available from 10.6 on only. */
     80    if ([aWindow respondsToSelector: @selector(setStyleMask:)])
     81        [aWindow performSelector: @selector(setStyleMask:) withObject: (id)NSTitledWindowMask];
     82    else
     83    {
     84        /* On pre 10.6 disable all the buttons currently displayed. Don't use
     85           setHidden cause this remove the buttons, but didn't release the
     86           place used for the buttons. */
     87        NSButton *pButton = [aWindow standardWindowButton:NSWindowCloseButton];
     88        if (pButton != Nil)
     89            [pButton setEnabled: NO];
     90        pButton = [aWindow standardWindowButton:NSWindowMiniaturizeButton];
     91        if (pButton != Nil)
     92            [pButton setEnabled: NO];
     93        pButton = [aWindow standardWindowButton:NSWindowZoomButton];
     94        if (pButton != Nil)
     95            [pButton setEnabled: NO];
     96        pButton = [aWindow standardWindowButton:NSWindowDocumentIconButton];
     97        if (pButton != Nil)
     98            [pButton setEnabled: NO];
     99    }
    90100
    91101    [pool release];
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette