src/gui/dialogs/qcolordialog_mac.mm
changeset 19 fcece45ef507
parent 18 2f34d5167611
child 30 5dc02b23752f
equal deleted inserted replaced
18:2f34d5167611 19:fcece45ef507
    94 - (NSColorPanel *)colorPanel;
    94 - (NSColorPanel *)colorPanel;
    95 - (QColor)qtColor;
    95 - (QColor)qtColor;
    96 - (void)finishOffWithCode:(NSInteger)result;
    96 - (void)finishOffWithCode:(NSInteger)result;
    97 - (void)showColorPanel;
    97 - (void)showColorPanel;
    98 - (void)exec;
    98 - (void)exec;
       
    99 - (void)setResultSet:(BOOL)result;
    99 @end
   100 @end
   100 
   101 
   101 @implementation QCocoaColorPanelDelegate
   102 @implementation QCocoaColorPanelDelegate
   102 - (id)initWithColorPanel:(NSColorPanel *)panel
   103 - (id)initWithColorPanel:(NSColorPanel *)panel
   103        stolenContentView:(NSView *)stolenContentView
   104        stolenContentView:(NSView *)stolenContentView
   154     }
   155     }
   155     [mColorPanel setDelegate:nil];
   156     [mColorPanel setDelegate:nil];
   156     [[NSNotificationCenter defaultCenter] removeObserver:self];
   157     [[NSNotificationCenter defaultCenter] removeObserver:self];
   157     delete mQtColor;
   158     delete mQtColor;
   158     [super dealloc];
   159     [super dealloc];
       
   160 }
       
   161 
       
   162 - (void)setResultSet:(BOOL)result
       
   163 {
       
   164     mResultSet = result;
   159 }
   165 }
   160 
   166 
   161 - (BOOL)windowShouldClose:(id)window
   167 - (BOOL)windowShouldClose:(id)window
   162 {
   168 {
   163     Q_UNUSED(window);
   169     Q_UNUSED(window);
   318             if (mResultCode == NSCancelButton) {
   324             if (mResultCode == NSCancelButton) {
   319                 mPriv->colorDialog()->reject();
   325                 mPriv->colorDialog()->reject();
   320             } else {
   326             } else {
   321                 mPriv->colorDialog()->accept();
   327                 mPriv->colorDialog()->accept();
   322             }
   328             }
   323         }
   329         } 
   324     }
   330     }
   325 }
   331 }
   326 
   332 
   327 - (void)showColorPanel
   333 - (void)showColorPanel
   328 {
   334 {
   431             okButton:okButton
   437             okButton:okButton
   432             cancelButton:cancelButton
   438             cancelButton:cancelButton
   433             priv:this];
   439             priv:this];
   434         [colorPanel setDelegate:static_cast<QCocoaColorPanelDelegate *>(delegate)];
   440         [colorPanel setDelegate:static_cast<QCocoaColorPanelDelegate *>(delegate)];
   435     }
   441     }
   436 
   442     [delegate setResultSet:false];
   437     setCocoaPanelColor(initial);
   443     setCocoaPanelColor(initial);
   438     [static_cast<QCocoaColorPanelDelegate *>(delegate) showColorPanel];
   444     [static_cast<QCocoaColorPanelDelegate *>(delegate) showColorPanel];
   439 }
   445 }
   440 
   446 
   441 void QColorDialogPrivate::closeCocoaColorPanel()
   447 void QColorDialogPrivate::closeCocoaColorPanel()