equal
deleted
inserted
replaced
1 /**************************************************************************** |
1 /**************************************************************************** |
2 ** |
2 ** |
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
4 ** All rights reserved. |
4 ** All rights reserved. |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
6 ** |
6 ** |
7 ** This file is part of the QtGui module of the Qt Toolkit. |
7 ** This file is part of the QtGui module of the Qt Toolkit. |
8 ** |
8 ** |
528 [item setEnabled:menu->qmenu->isEnabled() && action->isEnabled()]; |
528 [item setEnabled:menu->qmenu->isEnabled() && action->isEnabled()]; |
529 [item setState:action->isChecked() ? NSOnState : NSOffState]; |
529 [item setState:action->isChecked() ? NSOnState : NSOffState]; |
530 [item setToolTip:(NSString*)QCFString::toCFStringRef(action->toolTip())]; |
530 [item setToolTip:(NSString*)QCFString::toCFStringRef(action->toolTip())]; |
531 const QIcon icon = action->icon(); |
531 const QIcon icon = action->icon(); |
532 if(!icon.isNull()) { |
532 if(!icon.isNull()) { |
|
533 #ifndef QT_MAC_USE_COCOA |
|
534 const short scale = GetMBarHeight(); |
|
535 #else |
533 const short scale = [[NSApp mainMenu] menuBarHeight]; |
536 const short scale = [[NSApp mainMenu] menuBarHeight]; |
|
537 #endif |
534 NSImage *nsimage = static_cast<NSImage *>(qt_mac_create_nsimage(icon.pixmap(QSize(scale, scale)))); |
538 NSImage *nsimage = static_cast<NSImage *>(qt_mac_create_nsimage(icon.pixmap(QSize(scale, scale)))); |
535 [item setImage: nsimage]; |
539 [item setImage: nsimage]; |
536 [nsimage release]; |
540 [nsimage release]; |
537 } |
541 } |
538 if(action->menu()) { |
542 if(action->menu()) { |
567 action->activate(QAction::Trigger); |
571 action->activate(QAction::Trigger); |
568 } |
572 } |
569 } |
573 } |
570 @end |
574 @end |
571 |
575 |
572 |
|
573 /* Done here because this is the only .mm for now! -Sam */ |
|
574 QMacCocoaAutoReleasePool::QMacCocoaAutoReleasePool() |
|
575 { |
|
576 NSApplicationLoad(); |
|
577 pool = (void*)[[NSAutoreleasePool alloc] init]; |
|
578 } |
|
579 |
|
580 QMacCocoaAutoReleasePool::~QMacCocoaAutoReleasePool() |
|
581 { |
|
582 [(NSAutoreleasePool*)pool release]; |
|
583 } |
|
584 |
|