File: colour.h

package info (click to toggle)
wxpython3.0 3.0.2.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 482,760 kB
  • ctags: 518,293
  • sloc: cpp: 2,127,226; python: 294,045; makefile: 51,942; ansic: 19,033; sh: 3,013; xml: 1,629; perl: 17
file content (87 lines) | stat: -rw-r--r-- 2,558 bytes parent folder | download | duplicates (10)
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
/////////////////////////////////////////////////////////////////////////////
// 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 wxColour: public wxColourBase
{
public:
    // constructors
    // ------------
    DEFINE_STD_WXCOLOUR_CONSTRUCTORS

    // default copy ctor and dtor are ok

    // accessors
    virtual bool IsOk() const { return m_cgColour != NULL; }

    virtual WXDLLIMPEXP_INLINE_CORE ChannelType Red() const { return m_red; }
    virtual WXDLLIMPEXP_INLINE_CORE ChannelType Green() const { return m_green; }
    virtual WXDLLIMPEXP_INLINE_CORE ChannelType Blue() const { return m_blue; }
    virtual WXDLLIMPEXP_INLINE_CORE ChannelType Alpha() const { return m_alpha; }

    // comparison
    bool operator == (const wxColour& colour) const;

    bool operator != (const wxColour& colour) const { return !(*this == colour); }

    CGColorRef GetPixel() const { return m_cgColour; }

    CGColorRef GetCGColor() const { return m_cgColour; }
    CGColorRef CreateCGColor() const { return wxCFRetain( (CGColorRef)m_cgColour ); }

#if wxOSX_USE_COCOA_OR_CARBON
    void GetRGBColor( RGBColor *col ) const;
#endif

    // Mac-specific ctor and assignment operator from the native colour
    // assumes ownership of CGColorRef
    wxColour( CGColorRef col );
#if wxOSX_USE_COCOA_OR_CARBON
    wxColour(const RGBColor& col);
    wxColour& operator=(const RGBColor& col);
#endif
#if wxOSX_USE_COCOA
    wxColour(WX_NSColor color);
    WX_NSColor OSXGetNSColor() const;
#endif
    wxColour& operator=(CGColorRef col);
    wxColour& operator=(const wxColour& col);

protected :
    virtual void
    InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a);
#if wxOSX_USE_COCOA_OR_CARBON
    void InitRGBColor( const RGBColor& col );
#endif
    void InitCGColorRef( CGColorRef col );
    void InitFromComponents(const CGFloat* components, size_t numComponents );
private:
    wxCFRef<CGColorRef>     m_cgColour;

    ChannelType             m_red;
    ChannelType             m_blue;
    ChannelType             m_green;
    ChannelType             m_alpha;

    DECLARE_DYNAMIC_CLASS(wxColour)
};

#endif
  // _WX_COLOUR_H_