Add support for reserving X number of images for image list (include ribbon's image list) (PR #25868)

28 views
Skip to first unread message

Blake-Madden

unread,
Oct 7, 2025, 6:50:01 PM (9 days ago) Oct 7
to wx-...@googlegroups.com, Subscribed

You can view, comment on, or merge this pull request online at:

  https://github.com/wxWidgets/wxWidgets/pull/25868

Commit Summary

  • 5ff6bc8 Generic image list: use initalCount argument to reserve elements
  • 8337aa6 Add support for reserving X number of images for ribbon's image list

File Changes

(4 files)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/25868@github.com>

Blake-Madden

unread,
Oct 7, 2025, 6:56:08 PM (9 days ago) Oct 7
to wx-...@googlegroups.com, Push

@Blake-Madden pushed 1 commit.

  • 58b05f7 Document other parameter and return type.


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/25868/before/8337aa6d32e329b6e3f506b59c056f31cc2335a2/after/58b05f793831d270db43232cd2e4b48b6e67c34b@github.com>

VZ

unread,
Oct 8, 2025, 11:11:16 AM (9 days ago) Oct 8
to wx-...@googlegroups.com, Subscribed

@vadz commented on this pull request.

As I said, I'd rather stop using wxImageList completely, but as long as don't have any alternative here, I don't see any problem with adding this.


In interface/wx/ribbon/bar.h:

> @@ -480,9 +480,14 @@ class wxRibbonBar : public wxRibbonControl
         Return the image list containing images of the given size, creating it
         if necessary.
 
+        @param size The size of the images going into this image list.
+        @param initialCount The initial number of images to reserve for the
+            image list.
⬇️ Suggested change
-            image list.
+            image list (this parameter is available since wxWidgets 3.3.2).

In interface/wx/ribbon/bar.h:

>          @since 3.1.4
     */
-    wxImageList* GetButtonImageList(wxSize size);
+    wxImageList* GetButtonImageList(wxSize size, int initialCount);
⬇️ Suggested change
-    wxImageList* GetButtonImageList(wxSize size, int initialCount);
+    wxImageList* GetButtonImageList(wxSize size, int initialCount = 1);

In src/generic/imaglist.cpp:

>  {
     // Prevent from storing negative dimensions
     m_size = wxSize(wxMax(width, 0), wxMax(height, 0));
     m_useMask = mask;
 
+    m_images.reserve(initialCount);

Maybe

⬇️ Suggested change
-    m_images.reserve(initialCount);
+    if ( initialCount > 1 )
+        m_images.reserve(initialCount);

to avoid a useless (I believe) call by default?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/25868/review/3315290627@github.com>

Blake-Madden

unread,
Oct 8, 2025, 5:30:16 PM (8 days ago) Oct 8
to wx-...@googlegroups.com, Push

@Blake-Madden pushed 1 commit.

  • c71bf73 Update interface/wx/ribbon/bar.h


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/25868/before/58b05f793831d270db43232cd2e4b48b6e67c34b/after/c71bf738193cec98d8e3a01f831866445b481575@github.com>

Blake-Madden

unread,
Oct 8, 2025, 5:31:12 PM (8 days ago) Oct 8
to wx-...@googlegroups.com, Push

@Blake-Madden pushed 1 commit.

  • d62f955 Update interface/wx/ribbon/bar.h


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/25868/before/c71bf738193cec98d8e3a01f831866445b481575/after/d62f95548d76a9359879fc1ee3b40f5877fa6464@github.com>

Blake-Madden

unread,
Oct 8, 2025, 5:31:24 PM (8 days ago) Oct 8
to wx-...@googlegroups.com, Push

@Blake-Madden pushed 1 commit.

  • cb8b764 Update src/generic/imaglist.cpp


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/25868/before/d62f95548d76a9359879fc1ee3b40f5877fa6464/after/cb8b7640a3021cf78f67822ff534cf7e897f1811@github.com>

VZ

unread,
Oct 9, 2025, 5:21:56 PM (7 days ago) Oct 9
to wx-...@googlegroups.com, Subscribed

Closed #25868 via 216c9b4.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/25868/issue_event/20194325751@github.com>

Reply all
Reply to author
Forward
0 new messages