1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        wx/itemattr.h
3 // Purpose:     wxItemAttr documentation
4 // Author:      Vadim Zeitlin
5 // Copyright:   (c) 2016 Vadim Zeitlin <vadim@wxwidgets.org>
6 // Licence:     wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8 
9 /**
10     @class wxItemAttr
11 
12     Represents the attributes (colour, font, ...) of an item of a control with
13     multiple items such as e.g. wxListCtrl.
14 
15     @library{wxcore}
16     @category{data}
17 
18     @see @ref overview_listctrl
19 
20     @since 3.1.1 (previous versions had a similar wxListItemAttr class)
21 */
22 class wxItemAttr
23 {
24 public:
25     /**
26         Default Constructor.
27     */
28     wxItemAttr();
29 
30     /**
31         Construct a wxItemAttr with the specified foreground and
32         background colours and font.
33     */
34     wxItemAttr(const wxColour& colText,
35                const wxColour& colBack,
36                const wxFont& font);
37 
38     /**
39         Compare two item attributes for equality.
40     */
41     bool operator==(const wxItemAttr& other) const;
42 
43     /**
44         Compare two item attributes for inequality.
45     */
46     bool operator!=(const wxItemAttr& other) const;
47 
48     /**
49         Returns the currently set background colour.
50     */
51     const wxColour& GetBackgroundColour() const;
52 
53     /**
54         Returns the currently set font.
55     */
56     const wxFont& GetFont() const;
57 
58     /**
59         Returns the currently set text colour.
60     */
61     const wxColour& GetTextColour() const;
62 
63     /**
64         Returns @true if the currently set background colour is valid.
65     */
66     bool HasBackgroundColour() const;
67 
68     /**
69         Returns @true if either text or background colour is set.
70 
71         @see HasBackgroundColour(), HasTextColour()
72     */
73     bool HasColours() const;
74 
75     /**
76         Returns @true if the currently set font is valid.
77     */
78     bool HasFont() const;
79 
80     /**
81         Returns @true if the currently set text colour is valid.
82     */
83     bool HasTextColour() const;
84 
85     /**
86         Returns @true if this object has no custom attributes set.
87      */
88     bool IsDefault() const;
89 
90     /**
91         Sets a new background colour.
92     */
93     void SetBackgroundColour(const wxColour& colour);
94 
95     /**
96         Sets a new font.
97     */
98     void SetFont(const wxFont& font);
99 
100     /**
101         Sets a new text colour.
102     */
103     void SetTextColour(const wxColour& colour);
104 };
105