]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/carbon/colordlgosx.mm
use correct scale when drawing
[wxWidgets.git] / src / osx / carbon / colordlgosx.mm
index 1fdc0bee31872ae2b35e49cdc7741b95f73c9b37..278f9ec9cdca6a1df9b7acb9cf1ecfd42d1d8269 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "wx/colordlg.h"
 #include "wx/fontdlg.h"
 
 #include "wx/colordlg.h"
 #include "wx/fontdlg.h"
+#include "wx/modalhook.h"
 
 // ============================================================================
 // implementation
 
 // ============================================================================
 // implementation
@@ -56,7 +57,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog)
 
 - (id)init
 {
 
 - (id)init
 {
-    [super init];
+    self = [super init];
     m_bIsClosed = false;
 
     return self;
     m_bIsClosed = false;
 
     return self;
@@ -105,12 +106,13 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data)
     NSAutoreleasePool *thePool;
     thePool = [[NSAutoreleasePool alloc] init];
 
     NSAutoreleasePool *thePool;
     thePool = [[NSAutoreleasePool alloc] init];
 
+    [[NSColorPanel sharedColorPanel] setShowsAlpha:YES];
     if(m_colourData.GetColour().IsOk())
         [[NSColorPanel sharedColorPanel] setColor:
             [NSColor colorWithCalibratedRed:(CGFloat) (m_colourData.GetColour().Red() / 255.0)
                                         green:(CGFloat) (m_colourData.GetColour().Green() / 255.0)
                                         blue:(CGFloat) (m_colourData.GetColour().Blue() / 255.0)
     if(m_colourData.GetColour().IsOk())
         [[NSColorPanel sharedColorPanel] setColor:
             [NSColor colorWithCalibratedRed:(CGFloat) (m_colourData.GetColour().Red() / 255.0)
                                         green:(CGFloat) (m_colourData.GetColour().Green() / 255.0)
                                         blue:(CGFloat) (m_colourData.GetColour().Blue() / 255.0)
-                                        alpha:(CGFloat) 1.0]
+                                        alpha:(CGFloat) (m_colourData.GetColour().Alpha() / 255.0)]
         ];
     else
         [[NSColorPanel sharedColorPanel] setColor:[NSColor blackColor]];
         ];
     else
         [[NSColorPanel sharedColorPanel] setColor:[NSColor blackColor]];
@@ -122,6 +124,8 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data)
 }
 int wxColourDialog::ShowModal()
 {
 }
 int wxColourDialog::ShowModal()
 {
+    WX_HOOK_MODAL_DIALOG();
+
     //Start the pool.  Required for carbon interaction
     //(For those curious, the only thing that happens
     //if you don't do this is a bunch of error
     //Start the pool.  Required for carbon interaction
     //(For those curious, the only thing that happens
     //if you don't do this is a bunch of error
@@ -164,8 +168,9 @@ int wxColourDialog::ShowModal()
     m_colourData.GetColour().Set(
                                 (unsigned char) ([theColor redComponent] * 255.0),
                                 (unsigned char) ([theColor greenComponent] * 255.0),
     m_colourData.GetColour().Set(
                                 (unsigned char) ([theColor redComponent] * 255.0),
                                 (unsigned char) ([theColor greenComponent] * 255.0),
-                                (unsigned char) ([theColor blueComponent] * 255.0)
-                                   );
+                                (unsigned char) ([theColor blueComponent] * 255.0),
+                                (unsigned char) ([theColor alphaComponent] * 255.0)
+                                 );
 
     //Release the pool, we're done :)
     [thePool release];
 
     //Release the pool, we're done :)
     [thePool release];