#15037 closed defect (fixed)

wxToolBar style flags inconsistency when created

Reported by: catalin Owned by:
Priority: low Milestone:
Component: GUI-all Version: stable-latest
Keywords: Cc:
Blocked By: Blocking:
Patch: yes

Description

For wxToolBar constructor and Create():

  • docs and GTK say style = wxTB_HORIZONTAL;
  • Motif, MSW, WinCE, OS2, OSX say style = wxNO_BORDER|wxTB_HORIZONTAL.

For wxFrame::CreateToolBar():

  • docs say style = wxBORDER_NONE|wxTB_HORIZONTAL;
  • all implementations say style = -1.

Should they be changed to have the same default value? Which one?

Attachments (1)

15037_changes.patch download (10.2 KB) - added by catalin 17 months ago.

Download all attachments as: .zip

Change History (6)

comment:1 follow-up: Changed 19 months ago by vadz

  • Priority changed from normal to low
  • Status changed from new to confirmed

I think wxNO_BORDER (aka wxBORDER_NONE) should be removed and wxToolBar should override GetDefaultBorder() to return this from there instead.

As for wxFrame::CreateToolBar(), -1 there is explained by the comment in wxFrameBase::CreateToolBar() code. Although I don't find this very convincing to be honest... Still, we probably should keep the possibility to pass -1 here and so change the documentation accordingly.

But to summarize, there is no real inconsistency here so it's not that important.

comment:2 in reply to: ↑ 1 Changed 19 months ago by catalin

Replying to vadz:

I think wxNO_BORDER (aka wxBORDER_NONE) should be removed and wxToolBar should override GetDefaultBorder() to return this from there instead.

Something like

wxBorder wxToolBarBase::GetDefaultBorder() const { return wxBORDER_NONE; }

and for GTK

wxBorder wxToolBar::GetDefaultBorder() const { return wxBORDER_DEFAULT; }

?


As for wxFrame::CreateToolBar(), -1 there is explained by the comment in wxFrameBase::CreateToolBar() code.

So... under MSW for example:

  • creating a toolbar with wxToolBar constructor will continue to use style = wxNO_BORDER | wxTB_HORIZONTAL;
  • creating a toolbar with wxFrame::CreateToolBar() will continue to use style = wxBORDER_NONE | wxTB_HORIZONTAL | wxTB_FLAT.

They probably yield the same visual result in the end but are not exactly the same thing. Maybe a wxTB_DEFAULT should be created and defined differently for every platform..

comment:3 follow-up: Changed 19 months ago by vadz

Yes to both points: we should indeed override GetDefaultBorder() like this (unless using wxBORDER_NONE works correctly in wxGTK too, but I'm not sure about this) and we should indeed have wxTB_DEFAULT.

Changed 17 months ago by catalin

comment:4 in reply to: ↑ 3 Changed 17 months ago by catalin

  • Patch set

The attached patch adds GetDefaultBorder() and wxTB_DEFAULT_STYLE.

comment:5 Changed 17 months ago by VZ

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

(In [73757]) Make wxToolBar styles consistent and add wxTB_DEFAULT_STYLE.

Don't include wxBORDER_NONE in neither wxToolBar ctor and Create() nor
wxFrame::CreateToolBar() flags parameter, override GetDefaultBorder() in
wxToolBar itself instead to use the border style appropriate for the current
platform by default. This has the same effect -- the default border style is
used unless another one is explicitly specified -- but is more clear and
consistent.

Also add wxTB_DEFAULT_STYLE for consistency with the other classes.

Closes #15037.

Note: See TracTickets for help on using tickets.