]> git.saurik.com Git - wxWidgets.git/blame - src/osx/cocoa/colour.mm
Fix wrong tab order in wxAuiNotebook after dragging.
[wxWidgets.git] / src / osx / cocoa / colour.mm
CommitLineData
b478f242
KO
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/osx/cocoa/colour.mm
3// Purpose: Cocoa additions to wxColour class
4// Author: Kevin Ollivier
5// Modified by:
6// Created: 2009-10-31
a9a4f229 7// RCS-ID: $Id$
b478f242
KO
8// Copyright: (c) Kevin Ollivier
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#include "wx/wxprec.h"
13
14#include "wx/colour.h"
15
16#ifndef WX_PRECOMP
17 #include "wx/gdicmn.h"
18#endif
19
20#include "wx/osx/private.h"
21
b478f242
KO
22wxColour::wxColour(WX_NSColor col)
23{
24 size_t noComp = [col numberOfComponents];
3721dc6e 25
df7d93f6
VZ
26 CGFloat components[4];
27 CGFloat *p;
28 if ( noComp < 1 || noComp > WXSIZEOF(components) )
b478f242
KO
29 {
30 // TODO verify whether we really are on a RGB color space
31 m_alpha = wxALPHA_OPAQUE;
32 [col getComponents: components];
df7d93f6 33 p = components;
b478f242 34 }
df7d93f6
VZ
35 else // Unsupported colour format.
36 {
37 p = NULL;
38 }
39
40 InitFromComponents(components, noComp);
b478f242 41}
19b40986 42
83586c2a 43WX_NSColor wxColour::OSXGetNSColor() const
19b40986 44{
2331e2ce 45 return [NSColor colorWithCalibratedRed:m_red / 255.0 green:m_green / 255.0 blue:m_blue / 255.0 alpha:m_alpha / 255.0];
19b40986 46}