Commit Graph

13 Commits

Author SHA1 Message Date
Vadim Zeitlin
3bd28ef9e8 Add wxWithImages::GetImages() protected accessor
This is required to be able to implement an object delegating actual
images display to another one, as e.g. wx{List,Tree}book do with
wx{List,Tree}Ctrl.
2021-11-12 17:49:54 +00:00
Vadim Zeitlin
9ea8feec37 Make GetUpdatedImageListFor() work when using old API too
Return the image list set via {Set,Assign}ImageList() if SetImages()
hadn't been called to make this function return the correct image list
in any case, both when using the old wxImageList API and the new one
using wxBitmapBundle.

This commit is best viewed ignoring whitespace-only changes.
2021-11-11 01:20:35 +00:00
Vadim Zeitlin
907f6da047 Make wxWithImages::GetUpdatedImageListFor() public
It should be possible to call this function on wxWithImages objects
contained in derived classes too.

This commit is best viewed with --color-moved git option.
2021-11-11 00:52:12 +00:00
Vadim Zeitlin
638d865632 Add more useful wxWithImages::GetUpdatedImageListFor()
This replaces the previously added UpdateImageListIfNecessary() as we
almost always needed the image list after calling that function anyhow,
so it makes more sense to return the image list from it -- which also
required renaming it.

No real changes.
2021-11-11 00:52:12 +00:00
Vadim Zeitlin
f1da96db27 Add helper wxWithImages::GetBitmapBundle()
This function can be used in the ports that don't require wxImageList
(i.e. anything but wxMSW) to use wxBitmapBundle if it's available,
rather than passing by wxImageList.
2021-11-07 23:39:59 +01:00
Vadim Zeitlin
c777a34d78 Move wxBookCtrlBase::WXHandleDPIChanged() to wxWithImages itself
This function is not really wxBookCtrl-specific and can be used with
other classes as well, so allow reusing it in them.

No real changes, this is just a refactoring.
2021-11-07 21:13:39 +00:00
Vadim Zeitlin
ddb3b4a80a Use wxWithImages in wxTreeCtrl
Replace direct use of wxImageList with the use of wxWithImages, which
will make adding support for using wxBitmapBundle later simpler.

In fact, this already somewhat simplifies the code by removing the need
to manually take care of m_ownsImageListXXX flags.
2021-11-07 17:52:35 +00:00
Vadim Zeitlin
b0d9465921 Add wxWithImages::SetImages() and update wxMSW wxNotebook for it
This new function will allow selecting the bitmap of the most suitable
size and automatically react to DPI scale changes (although this hasn't
been implemented yet) in all controls using image lists.

For now, only wxNotebook in wxMSW has been updated to work with it, the
other classes and ports will be updated to override OnImagesChanged()
instead of SetImageList() later.

Also update the notebook sample to use SetImages() rather than
SetImageList() -- which means that it doesn't show the icons any longer
in non-MSW ports, which haven't been updated yet.
2021-10-31 20:54:58 +01:00
Vadim Zeitlin
0df49f0a54 Add wxWithImages::GetImageCount() and HasImages() helpers
These functions allow avoiding using wxImageList explicitly in a couple
of places.

No real changes, this just prepares for adding new API not based on
wxImageList.
2021-10-31 17:34:44 +01:00
Vadim Zeitlin
3f66f6a5b3 Remove all lines containing cvs/svn "$Id$" keyword.
This keyword is not expanded by Git which means it's not replaced with the
correct revision value in the releases made using git-based scripts and it's
confusing to have lines with unexpanded "$Id$" in the released files. As
expanding them with Git is not that simple (it could be done with git archive
and export-subst attribute) and there are not many benefits in having them in
the first place, just remove all these lines.

If nothing else, this will make an eventual transition to Git simpler.

Closes #14487.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-07-26 16:02:46 +00:00
Vadim Zeitlin
665ec08c05 Add missing wx/icon.h header to fix wxGTK compilation.
wx/withimages.h needs to include wx/icon.h as it contains an inline function
returning wxIcon.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68813 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-08-21 14:52:16 +00:00
Vadim Zeitlin
1871b9facb No changes, just use symbolic NO_IMAGE constant instead of -1 or wxNOT_FOUND.
Existing declarations used -1 in several places to indicate the absence of the
image which wasn't especially clear and was also inconsistent with other
places that used wxNOT_FOUND which didn't make much sense in this context.

Add a new symbolic constant NO_IMAGE in wxWithImages and use it in the classes
deriving from it. This still doesn't help with wx{Tree,List}Ctrl but improves
clarity for the other classes.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68810 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-08-21 14:08:49 +00:00
Vadim Zeitlin
abfdefede3 Add wxWithImages helper mix-in with {Set,Get,Assign}ImageList() methods.
Avoid defining SetImageList() in several different places in wx API as not
only this resulted in (trivial) code duplication but this method also had
different semantics before: it didn't take ownership of the pointer passed to
it in wxTreeCtrl, wxListCtrl and wxBookCtrl and derived classes but did take
its ownership in wxDataViewTreeCtrl and wxRichTextFormattingDialog.

Harmonize this for all the classes now: SetImageList() never takes ownership
while AssignImageList() (which is now available in all classes having
SetImageList()) always does.

Also add convenience wxWithImages::GetImage() helper to avoid (more) code
duplication in wxDataViewTreeCtrl code.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68809 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-08-21 14:08:43 +00:00