1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
|
/////////////////////////////////////////////////////////////////////////////
// Name: wx/osx/core/colour.h
// Purpose: wxColour class
// Author: Stefan Csomor
// Modified by:
// Created: 1998-01-01
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_COLOUR_H_
#define _WX_COLOUR_H_
#include "wx/object.h"
#include "wx/string.h"
#include "wx/osx/core/cfref.h"
struct RGBColor;
// Colour
class WXDLLIMPEXP_CORE wxWARN_UNUSED wxColour: public wxColourBase
{
public:
// constructors
// ------------
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
// default copy ctor and dtor are ok
// accessors
virtual ChannelType Red() const wxOVERRIDE;
virtual ChannelType Green() const wxOVERRIDE;
virtual ChannelType Blue() const wxOVERRIDE;
virtual ChannelType Alpha() const wxOVERRIDE;
virtual bool IsSolid() const wxOVERRIDE;
// comparison
bool operator == (const wxColour& colour) const;
bool operator != (const wxColour& colour) const { return !(*this == colour); }
// CoreGraphics CGColor
// --------------------
// This ctor does take ownership of the color.
wxColour( CGColorRef col );
// don't take ownership of the returned value
CGColorRef GetCGColor() const;
// do take ownership of the returned value
CGColorRef CreateCGColor() const { return wxCFRetain(GetCGColor()); }
#if wxOSX_USE_COCOA_OR_CARBON
// Quickdraw RGBColor
// ------------------
wxColour(const RGBColor& col);
void GetRGBColor( RGBColor *col ) const;
#endif
#if wxOSX_USE_COCOA
// NSColor Cocoa
// -------------
// This ctor does not take ownership of the color.
explicit wxColour(WX_NSColor color);
WX_NSColor OSXGetNSColor() const;
WX_NSImage OSXGetNSPatternImage() const;
#endif
protected :
virtual void
InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a) wxOVERRIDE;
virtual wxGDIRefData *CreateGDIRefData() const wxOVERRIDE;
virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const wxOVERRIDE;
private:
wxDECLARE_DYNAMIC_CLASS(wxColour);
};
class wxColourRefData : public wxGDIRefData
{
public:
wxColourRefData() {}
virtual ~wxColourRefData() {}
virtual double Red() const = 0;
virtual double Green() const = 0;
virtual double Blue() const = 0;
virtual double Alpha() const = 0;
virtual bool IsSolid() const
{ return true; }
virtual CGColorRef GetCGColor() const = 0;
virtual wxColourRefData* Clone() const = 0;
#if wxOSX_USE_COCOA
virtual WX_NSColor GetNSColor() const;
virtual WX_NSImage GetNSPatternImage() const;
#endif
};
#endif
// _WX_COLOUR_H_
|