Opened 4 years ago

Closed 4 years ago

#16129 closed optimization (fixed)

Simplify wxToolBar implementation

Reported by: awi Owned by: vadz
Priority: normal Milestone:
Component: wxMSW Version: dev-latest
Keywords: wxToolBar control separator Cc:
Blocked By: Blocking:
Patch: yes


When a control tool is added to the toolbar then in order to display it (the control) later on there is reserved necessary space on the toolbar in the form of separator(s).
Current implementation of this feature is based on the assumption that sometimes it could be not possible to create a separator of the necessary size and in this case (as a fallback) it is created a cluster of default separators (of default size) which total size is enough to fit the control. This implementation really complicates the code.
Apparently, it must be a legacy solution because it is claimed in the older SDK I have access to (January 2003) that at least since Win NT 3.51 :) and Win 95 it is possible to create a separator of non-default size.

Resigning from this legacy solution and use always one separator for one control (and generally one button/separator for one tool) would simplify the code and make it more clear and less error-prone.

Patch applying this simplification in making necessary space for controls is attached.

Attachments (1)

toolbar.patch download (8.9 KB) - added by awi 4 years ago.
Simplify implementation of separators associated with controls.

Download all attachments as: .zip

Change History (3)

Changed 4 years ago by awi

Simplify implementation of separators associated with controls.

comment:1 Changed 4 years ago by vadz

  • Owner set to vadz
  • Status changed from new to accepted

Thanks for cleaning this up! To answer your (unasked) question, I think this code might indeed be left since the time when Win16 (i.e. Windows 3.1) was still supported...

Will apply soon.

comment:2 Changed 4 years ago by VZ

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

(In [76215]) Simplify wxMSW wxToolBar controls support implementation.

Rely on being able to set the separator size, which is supported since
comctl32.dll v4.71 (the version distributed with IE 4.0...).

This allows to remove big chunks of code dealing with multiple separators and
simplifies the rest.

Closes #16129.

Note: See TracTickets for help on using tickets.