wxWidgets / wxWidgets

Cross-Platform C++ GUI Library
https://www.wxwidgets.org/
6.08k stars 1.76k forks source link

Add a way to remove all the buttons from infobar #24841

Open vadz opened 1 week ago

vadz commented 1 week ago

IMO, if a way to remove all the buttons is added into the generic infobar in wx, then it is fine to remove the spacer for that version of wx - we can just conditionalize the code for this (we have done that a lot in the past anyway, so it isn't a big deal).

_Originally posted by @imciner2 in https://github.com/wxWidgets/wxWidgets/pull/24838#discussion_r1777705731_

vadz commented 1 week ago

I've started doing it, but it's trickier than I thought because I'm not sure if such RemoveAllButtons() should really remove all buttons or revert to the default state in which only the close button is shown.

If it really removes everything, we almost certainly also need AddCloseButton() to be able to add back a button allowing the user to close the bar. And this raises its own questions: what happens if you call AddCloseButton() twice? Presumably, it's a mistake and shouldn't be allowed, but OTOH we don't prevent adding other duplicate buttons now.

I think the API would be more difficult to misuse if RemoveAllButtons() actually removed only the custom buttons, adding back the default "Close" one, but I'm not sure if it's really going to satisfy everybody.

@marekr @imciner2 @dsa-t What do you think?