File: colourdata.h

package info (click to toggle)
wxpython4.0 4.2.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 221,752 kB
  • sloc: cpp: 962,555; python: 230,573; ansic: 170,731; makefile: 51,756; sh: 9,342; perl: 1,564; javascript: 584; php: 326; xml: 200
file content (129 lines) | stat: -rw-r--r-- 3,580 bytes parent folder | download | duplicates (4)
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/////////////////////////////////////////////////////////////////////////////
// Name:        colourdata.h
// Purpose:     interface of wxColourData
// Author:      wxWidgets team
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

/**
    @class wxColourData

    This class holds a variety of information related to colour dialogs.

    @library{wxcore}
    @category{cmndlg,data}

    @see wxColour, wxColourDialog, @ref overview_cmndlg_colour
*/
class wxColourData : public wxObject
{
public:
    /// number of custom colours we store
    enum
    {
        NUM_CUSTOM = 16
    };

    /**
        Constructor. Initializes the custom colours to @c wxNullColour, the
        @e data colour setting to black, and the @e choose full setting to
        @true.
    */
    wxColourData();

    /**
        Destructor.
    */
    virtual ~wxColourData();

    /**
        Under Windows, determines whether the Windows colour dialog will
        display the full dialog with custom colour selection controls.

        Has no meaning under other platforms.

        The default value is @true.
    */
    bool GetChooseFull() const;

    /**
        Indicates whether the colour dialog will display alpha values
        and an opacity selector. It is meaningful under wxGTK, wxOSX
        and with regards to generic colour dialog.

        The default value is @false, except wxOSX where it is @true (for
        the sake of backward compatibility).
    */
    bool GetChooseAlpha() const;

    /**
        Gets the current colour associated with the colour dialog.

        The default colour is black.
    */
    wxColour& GetColour();

    /**
        Returns custom colours associated with the colour dialog.

        @param i
            An integer between 0 and 15, being any of the 15 custom colours
            that the user has saved. The default custom colours are invalid
            colours.
    */
    wxColour GetCustomColour(int i) const;

    /**
        Under Windows, tells the Windows colour dialog to display the full
        dialog with custom colour selection controls. Under other platforms,
        has no effect.

        The default value is @true.
    */
    void SetChooseFull(bool flag);

    /**
        Tells the colour dialog to show alpha values and an opacity selector
        (slider). Currently it has effect under wxGTK, wxOSX and for generic
        colour dialog.

        The default value is @false, except wxOSX where it is @true for
        backward compatibility.
    */
    void SetChooseAlpha(bool flag);

    /**
        Sets the default colour for the colour dialog.

        The default colour is black.
    */
    void SetColour(const wxColour& colour);

    /**
        Sets custom colours for the colour dialog.

        @param i
            An integer between 0 and 15 for whatever custom colour you want to
            set. The default custom colours are invalid colours.
        @param colour
            The colour to set
    */
    void SetCustomColour(int i, const wxColour& colour);

    /**
        Converts the colours saved in this class in a string form, separating
        the various colours with a comma.
    */
    wxString ToString() const;

    /**
        Decodes the given string, which should be in the same format returned
        by ToString(), and sets the internal colours.
    */
    bool FromString(const wxString& str);

    /**
        Assignment operator for the colour data.
    */
    wxColourData& operator =(const wxColourData& data);
};