Use wxBitmapBundle in wxDataViewCtrl-related classes

Extend the existing use of wxIcon in wxDataViewIconText,
wxDataViewCheckIconText, the corresponding renderers and
wxDataViewTreeCtrl to wxBitmapBundle.

As with the other classes, the existing setters have been preserved as
they remain almost entirely compatible with the existing code and the
return type of the existing getters was preserved, with new getters
being introduced for returning wxBitmapBundle only where they're really
required.

Update the sample to use wxBitmapBundle with its wxDataViewTreeCtrl.
This commit is contained in:
Vadim Zeitlin
2022-01-23 00:52:45 +00:00
parent 90bbde8777
commit 4073f3b9bf
10 changed files with 173 additions and 174 deletions

View File

@@ -3294,12 +3294,12 @@ public:
/**
Calls the identical method from wxDataViewTreeStore.
*/
const wxIcon& GetItemExpandedIcon(const wxDataViewItem& item) const;
wxIcon GetItemExpandedIcon(const wxDataViewItem& item) const;
/**
Calls the identical method from wxDataViewTreeStore.
*/
const wxIcon& GetItemIcon(const wxDataViewItem& item) const;
wxIcon GetItemIcon(const wxDataViewItem& item) const;
/**
Returns the item's parent.
@@ -3386,12 +3386,12 @@ public:
Calls the identical method from wxDataViewTreeStore.
*/
void SetItemExpandedIcon(const wxDataViewItem& item,
const wxIcon& icon);
const wxBitmapBundle& icon);
/**
Calls the identical method from wxDataViewTreeStore.
*/
void SetItemIcon(const wxDataViewItem& item, const wxIcon& icon);
void SetItemIcon(const wxDataViewItem& item, const wxBitmapBundle& icon);
/**
Calls the identical method from wxDataViewTreeStore.
@@ -3589,8 +3589,8 @@ public:
*/
wxDataViewItem AppendContainer(const wxDataViewItem& parent,
const wxString& text,
const wxIcon& icon = wxNullIcon,
const wxIcon& expanded = wxNullIcon,
const wxBitmapBundle& icon = wxBitmapBundle(),
const wxBitmapBundle& expanded = wxBitmapBundle(),
wxClientData* data = NULL);
/**
@@ -3598,7 +3598,7 @@ public:
*/
wxDataViewItem AppendItem(const wxDataViewItem& parent,
const wxString& text,
const wxIcon& icon = wxNullIcon,
const wxBitmapBundle& icon = wxBitmapBundle(),
wxClientData* data = NULL);
/**
@@ -3629,12 +3629,12 @@ public:
/**
Returns the icon to display in expanded containers.
*/
const wxIcon& GetItemExpandedIcon(const wxDataViewItem& item) const;
wxIcon GetItemExpandedIcon(const wxDataViewItem& item) const;
/**
Returns the icon of the item.
*/
const wxIcon& GetItemIcon(const wxDataViewItem& item) const;
wxIcon GetItemIcon(const wxDataViewItem& item) const;
/**
Returns the text of the item.
@@ -3653,8 +3653,8 @@ public:
wxDataViewItem InsertContainer(const wxDataViewItem& parent,
const wxDataViewItem& previous,
const wxString& text,
const wxIcon& icon = wxNullIcon,
const wxIcon& expanded = wxNullIcon,
const wxBitmapBundle& icon = wxBitmapBundle(),
const wxBitmapBundle& expanded = wxBitmapBundle(),
wxClientData* data = NULL);
/**
@@ -3663,7 +3663,7 @@ public:
wxDataViewItem InsertItem(const wxDataViewItem& parent,
const wxDataViewItem& previous,
const wxString& text,
const wxIcon& icon = wxNullIcon,
const wxBitmapBundle& icon = wxBitmapBundle(),
wxClientData* data = NULL);
/**
@@ -3671,8 +3671,8 @@ public:
*/
wxDataViewItem PrependContainer(const wxDataViewItem& parent,
const wxString& text,
const wxIcon& icon = wxNullIcon,
const wxIcon& expanded = wxNullIcon,
const wxBitmapBundle& icon = wxBitmapBundle(),
const wxBitmapBundle& expanded = wxBitmapBundle(),
wxClientData* data = NULL);
/**
@@ -3680,7 +3680,7 @@ public:
*/
wxDataViewItem PrependItem(const wxDataViewItem& parent,
const wxString& text,
const wxIcon& icon = wxNullIcon,
const wxBitmapBundle& icon = wxBitmapBundle(),
wxClientData* data = NULL);
/**
@@ -3692,12 +3692,12 @@ public:
Sets the expanded icon for the item.
*/
void SetItemExpandedIcon(const wxDataViewItem& item,
const wxIcon& icon);
const wxBitmapBundle& icon);
/**
Sets the icon for the item.
*/
void SetItemIcon(const wxDataViewItem& item, const wxIcon& icon);
void SetItemIcon(const wxDataViewItem& item, const wxBitmapBundle& icon);
};
@@ -3718,22 +3718,47 @@ public:
Constructor.
*/
wxDataViewIconText(const wxString& text = wxEmptyString,
const wxIcon& icon = wxNullIcon);
const wxBitmapBundle& bitmap = wxBitmapBundle());
wxDataViewIconText(const wxDataViewIconText& other);
//@}
/**
Gets the associated image.
@since 3.1.6
*/
const wxBitmapBundle& GetBitmapBundle() const;
/**
Gets the icon.
This function can only return the icon in the size appropriate for the
standard 100% DPI scaling, use GetBitmapBundle() to retrieve image
representation suitable for another DPI scaling value.
*/
const wxIcon& GetIcon() const;
wxIcon GetIcon() const;
/**
Gets the text.
*/
wxString GetText() const;
/**
Sets the associated image.
This function allows to provide several representations of the same
image, so that the most appropriate one for the current DPI scaling
could be used, and so should be preferred to SetIcon().
@since 3.1.6
*/
void SetBitmapBundle(const wxBitmapBundle& bitmap);
/**
Set the icon.
Use SetBitmapBundle() instead to allow specifying different image
representations for different DPI scaling values.
*/
void SetIcon(const wxIcon& icon);