Opened 6 years ago

Closed 6 years ago

#9150 closed enhancement (fixed)

gtk wxChoice/wxCombobox refactoring

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

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 (2)

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

Download all attachments as: .zip

Change History (7)

Changed 6 years ago by wojdyr

comment:1 Changed 6 years ago by roebling

wxChoice uses GtkComboBox

There is no reason for wxChoice to use GtkComboBox.

comment:2 Changed 6 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.

comment:3 Changed 6 years ago by vadz

  • Resolution set to fixed
  • Status changed from new to closed
  • Type set to enhancement

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 6 years ago by wojdyr

comment:4 Changed 6 years ago by wojdyr

  • Resolution fixed deleted
  • Status changed from closed to reopened

"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

comment:5 Changed 6 years ago by vadz

  • Resolution set to fixed
  • Status changed from reopened to closed

Applied DoGetBestSize() patch, thanks.

Note: See TracTickets for help on using tickets.