Merge branch 'owner-draw-headers'
Implement support for changing fonts and colours in wxMSW header control.
This commit is contained in:
@@ -1547,6 +1547,25 @@ public:
|
||||
*/
|
||||
void SetCurrentItem(const wxDataViewItem& item);
|
||||
|
||||
/**
|
||||
Set custom colours and/or font to use for the header.
|
||||
|
||||
This method allows to customize the display of the control header (it
|
||||
does nothing if @c wxDV_NO_HEADER style is used).
|
||||
|
||||
Currently it is only implemented in the generic version and just
|
||||
returns @false without doing anything elsewhere.
|
||||
|
||||
@param attr The attribute defining the colour(s) and font to use. It
|
||||
can be default, in which case the attributes are reset to their
|
||||
default values.
|
||||
@return @true if the attributes were updated, @false if the method is
|
||||
not implemented or failed.
|
||||
|
||||
@since 3.1.1
|
||||
*/
|
||||
bool SetHeaderAttr(const wxItemAttr& attr);
|
||||
|
||||
/**
|
||||
Sets the indentation.
|
||||
*/
|
||||
|
104
interface/wx/itemattr.h
Normal file
104
interface/wx/itemattr.h
Normal file
@@ -0,0 +1,104 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/itemattr.h
|
||||
// Purpose: wxItemAttr documentation
|
||||
// Author: Vadim Zeitlin
|
||||
// Copyright: (c) 2016 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
@class wxItemAttr
|
||||
|
||||
Represents the attributes (colour, font, ...) of an item of a control with
|
||||
multiple items such as e.g. wxListCtrl.
|
||||
|
||||
@library{wxcore}
|
||||
@category{data}
|
||||
|
||||
@see @ref overview_listctrl
|
||||
|
||||
@since 3.1.1 (previous versions had a similar wxListItemAttr class)
|
||||
*/
|
||||
class wxItemAttr
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Default Constructor.
|
||||
*/
|
||||
wxItemAttr();
|
||||
|
||||
/**
|
||||
Construct a wxItemAttr with the specified foreground and
|
||||
background colours and font.
|
||||
*/
|
||||
wxItemAttr(const wxColour& colText,
|
||||
const wxColour& colBack,
|
||||
const wxFont& font);
|
||||
|
||||
/**
|
||||
Compare two item attributes for equality.
|
||||
*/
|
||||
bool operator==(const wxItemAttr& other) const;
|
||||
|
||||
/**
|
||||
Compare two item attributes for inequality.
|
||||
*/
|
||||
bool operator!=(const wxItemAttr& other) const;
|
||||
|
||||
/**
|
||||
Returns the currently set background colour.
|
||||
*/
|
||||
const wxColour& GetBackgroundColour() const;
|
||||
|
||||
/**
|
||||
Returns the currently set font.
|
||||
*/
|
||||
const wxFont& GetFont() const;
|
||||
|
||||
/**
|
||||
Returns the currently set text colour.
|
||||
*/
|
||||
const wxColour& GetTextColour() const;
|
||||
|
||||
/**
|
||||
Returns @true if the currently set background colour is valid.
|
||||
*/
|
||||
bool HasBackgroundColour() const;
|
||||
|
||||
/**
|
||||
Returns @true if either text or background colour is set.
|
||||
|
||||
@see HasBackgroundColour(), HasTextColour()
|
||||
*/
|
||||
bool HasColours() const;
|
||||
|
||||
/**
|
||||
Returns @true if the currently set font is valid.
|
||||
*/
|
||||
bool HasFont() const;
|
||||
|
||||
/**
|
||||
Returns @true if the currently set text colour is valid.
|
||||
*/
|
||||
bool HasTextColour() const;
|
||||
|
||||
/**
|
||||
Returns @true if this object has no custom attributes set.
|
||||
*/
|
||||
bool IsDefault() const;
|
||||
|
||||
/**
|
||||
Sets a new background colour.
|
||||
*/
|
||||
void SetBackgroundColour(const wxColour& colour);
|
||||
|
||||
/**
|
||||
Sets a new font.
|
||||
*/
|
||||
void SetFont(const wxFont& font);
|
||||
|
||||
/**
|
||||
Sets a new text colour.
|
||||
*/
|
||||
void SetTextColour(const wxColour& colour);
|
||||
};
|
@@ -1052,6 +1052,25 @@ public:
|
||||
*/
|
||||
bool SetColumnsOrder(const wxArrayInt& orders);
|
||||
|
||||
/**
|
||||
Change the font and the colours used for the list control header.
|
||||
|
||||
This method can be used to change the appearance of the header shown by
|
||||
the control in report mode (unless @c wxLC_NO_HEADER style is used).
|
||||
|
||||
Currently it is implemented only for wxMSW and does nothing in the
|
||||
other ports.
|
||||
|
||||
@param attr The object containing the font and text and background
|
||||
colours to use. It may be default, i.e. not specify any custom font
|
||||
nor colours, to reset any previously set custom attribute.
|
||||
@return @true if the attributes have been updated or @false if this is
|
||||
not supported by the current platform.
|
||||
|
||||
@since 3.1.1
|
||||
*/
|
||||
bool SetHeaderAttr(const wxItemAttr& attr);
|
||||
|
||||
/**
|
||||
Sets the image list associated with the control.
|
||||
|
||||
@@ -1278,14 +1297,14 @@ protected:
|
||||
@c item or @NULL to use the default appearance parameters.
|
||||
|
||||
wxListCtrl will not delete the pointer or keep a reference of it.
|
||||
You can return the same wxListItemAttr pointer for every OnGetItemAttr() call.
|
||||
You can return the same wxItemAttr pointer for every OnGetItemAttr() call.
|
||||
|
||||
The base class version always returns @NULL.
|
||||
|
||||
@see OnGetItemImage(), OnGetItemColumnImage(), OnGetItemText(),
|
||||
OnGetItemColumnAttr()
|
||||
*/
|
||||
virtual wxListItemAttr* OnGetItemAttr(long item) const;
|
||||
virtual wxItemAttr* OnGetItemAttr(long item) const;
|
||||
|
||||
/**
|
||||
This function may be overridden in the derived class for a control with
|
||||
@@ -1302,7 +1321,7 @@ protected:
|
||||
@see OnGetItemAttr(), OnGetItemText(),
|
||||
OnGetItemImage(), OnGetItemColumnImage(),
|
||||
*/
|
||||
virtual wxListItemAttr* OnGetItemColumnAttr(long item, long column) const;
|
||||
virtual wxItemAttr* OnGetItemColumnAttr(long item, long column) const;
|
||||
|
||||
/**
|
||||
Override this function in the derived class for a control with
|
||||
@@ -1513,80 +1532,6 @@ wxEventType wxEVT_LIST_ITEM_CHECKED;
|
||||
wxEventType wxEVT_LIST_ITEM_UNCHECKED;
|
||||
|
||||
|
||||
/**
|
||||
@class wxListItemAttr
|
||||
|
||||
Represents the attributes (color, font, ...) of a wxListCtrl's wxListItem.
|
||||
|
||||
@library{wxcore}
|
||||
@category{data}
|
||||
|
||||
@see @ref overview_listctrl, wxListCtrl, wxListItem
|
||||
*/
|
||||
class wxListItemAttr
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Default Constructor.
|
||||
*/
|
||||
wxListItemAttr();
|
||||
|
||||
/**
|
||||
Construct a wxListItemAttr with the specified foreground and
|
||||
background colors and font.
|
||||
*/
|
||||
wxListItemAttr(const wxColour& colText,
|
||||
const wxColour& colBack,
|
||||
const wxFont& font);
|
||||
|
||||
/**
|
||||
Returns the currently set background color.
|
||||
*/
|
||||
const wxColour& GetBackgroundColour() const;
|
||||
|
||||
/**
|
||||
Returns the currently set font.
|
||||
*/
|
||||
const wxFont& GetFont() const;
|
||||
|
||||
/**
|
||||
Returns the currently set text color.
|
||||
*/
|
||||
const wxColour& GetTextColour() const;
|
||||
|
||||
/**
|
||||
Returns @true if the currently set background color is valid.
|
||||
*/
|
||||
bool HasBackgroundColour() const;
|
||||
|
||||
/**
|
||||
Returns @true if the currently set font is valid.
|
||||
*/
|
||||
bool HasFont() const;
|
||||
|
||||
/**
|
||||
Returns @true if the currently set text color is valid.
|
||||
*/
|
||||
bool HasTextColour() const;
|
||||
|
||||
/**
|
||||
Sets a new background color.
|
||||
*/
|
||||
void SetBackgroundColour(const wxColour& colour);
|
||||
|
||||
/**
|
||||
Sets a new font.
|
||||
*/
|
||||
void SetFont(const wxFont& font);
|
||||
|
||||
/**
|
||||
Sets a new text color.
|
||||
*/
|
||||
void SetTextColour(const wxColour& colour);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@class wxListView
|
||||
|
||||
|
Reference in New Issue
Block a user