Ticket #9150 (closed enhancement: fixed)

Opened 5 years ago

Last modified 5 years ago

gtk wxChoice/wxCombobox refactoring

Reported by: wojdyr Owned by:
Priority: normal Milestone:
Component: wxGTK Version:
Keywords: Cc: wojdyr, roebling
Blocked By: Patch: yes
Blocking:

Description

wxChoice uses GtkComboBox.
The code from wxComboBox was moved to wxChoice, and wxCombobox was derived from wxChoice (like on MSW). Very little new code was written.
wxComboBox::DoGetBestSize() was commented out.

include/wx/gtk/choice.h | 33 +--
include/wx/gtk/combobox.h | 68 +-----
samples/widgets/choice.cpp | 7
src/gtk/choice.cpp | 484 +++++++++++++--------------------------------
src/gtk/combobox.cpp | 221 --------------------
5 files changed, 182 insertions(+), 631 deletions(-)

Attachments

gtk-choice.diff download (35.4 KB) - added by wojdyr 5 years ago.
gtk-choice-size.diff download (1.9 KB) - added by wojdyr 5 years ago.

Change History

Changed 5 years ago by wojdyr

Changed 5 years ago by roebling

wxChoice uses GtkComboBox

There is no reason for wxChoice to use GtkComboBox.

Changed 5 years ago by wojdyr

There is no reason to use GtkOptionMenu which, as a comment in choice.cpp says, has been deprecated since GTK+ 2.3.0 in favour of GtkComboBox.
Note that the patch removes most of the code from choice.cpp, but doesn't add a new code, the code for GtkComboBox is shared with wxComboBox.

The patch needs to be changed, I'll leave wxComboBox::DoGetBestSize() as it was for now and will add it also to wxChoice.

Changed 5 years ago by vadz

  • status changed from new to closed
  • type set to enhancement
  • resolution set to fixed

Thanks, I've applied your patch.

I noticed that pressing the "Run tests" button in the choice and combobox pages of the widgets sample results in multiple test failures. This is not due to this patch as it also happened before it but if you still have this code fresh in your memory it would be great if you could have a look at it. TIA!

Changed 5 years ago by wojdyr

Changed 5 years ago by wojdyr

  • status changed from closed to reopened
  • resolution deleted

"Run tests" works for me - all test are passed.

I'm afraid DoGetBestSize() should be reverted. As Robert wrote recently on wx-dev, it is necessary. I haven't investigated it, but I think it's safer to leave it for now. The patch
gtk-choice-size.diff re-adds DoGetBestSize() as it was before, but this time to choice.cpp

Changed 5 years ago by vadz

  • status changed from reopened to closed
  • resolution set to fixed

Applied DoGetBestSize() patch, thanks.

Note: See TracTickets for help on using tickets.