Ticket #10585 (closed enhancement: fixed)

Opened 4 years ago

Last modified 5 months ago

Allow to easily use plain background for wxAuiToolbar

Reported by: allanjos Owned by:
Priority: low Milestone:
Component: wxAui Version: 2.9-svn
Keywords: Cc:
Blocked By: Patch: yes
Blocking:

Description

Follows a proposed modification to the wxAuiToolBar,
adding a item to wxAuiToolBarStyle. The item is
wxAUI_TB_PLAIN_BACKGROUND that allows to easy setup a plain background
to the AUI toolbar, without the need to override drawing methods. This
style contrasts with the default behaviour of the wxAuiToolBar that
draws a background gradient and this break the window design when
putting it within a control that has margin between the borders and
the toolbar (example: put wxAuiToolBar within a wxStaticBoxSizer that
has a plain background). This was the old behaviour of wxToolBar on
MSW, but Windows Vista changes this behaviour drawing a gradient
background on the toolbar control.

Modifications to the wxAuiToolBar::OnPaint:

if (m_style & wxAUI_TB_PLAIN_BACKGROUND)

m_art->DrawPlainBackground(dc, this, cli_rect);

else

m_art->DrawBackground(dc, this, cli_rect);

Thank you.

Attachments

wxlistctrl-wxauitoolbar-20090313.patch download (4.0 KB) - added by allanjos 4 years ago.
wxauitoolbar-20120120.patch download (4.2 KB) - added by allanjos 5 months ago.
Patch with documentation against revision 73415

Change History

Changed 4 years ago by allanjos

Changed 2 years ago by vadz

  • priority changed from normal to low
  • status changed from new to confirmed
  • summary changed from wxAuiToolbar - Plain background to Allow to easily use plain background for wxAuiToolbar
  • patch unset

I'm not really opposed to this patch but OTOH it doesn't seem very useful neither, after all it is easy enough to override the drawing method. But in any case to apply this we need the documentation update for the new feature in interface/wx/aui and also, ideally, an example of using it in samples/aui.

Could you please update the patch to include them? TIA!

Changed 5 months ago by allanjos

Patch with documentation against revision 73415

Changed 5 months ago by allanjos

  • patch set

Hi. Attached the patch with documentation.

Thank you very much.

Changed 5 months ago by vadz

Thanks, I'll apply this for now but I wonder if it actually wouldn't make more sense to just make SetBackgroundColour() work as expected, i.e. override the default gradient background with the specified solid colour?

Also, why do we use rect.GetX() - 1 and rect.GetWidth() + 2 in DrawPlainBackground(), are we really supposed to draw outside of the provided rectangle?

Finally, it would be nice to have a patch to the aui sample showing changing the background in action, if you could please make one it would be appreciated.

Changed 5 months ago by VZ

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

(In [73423]) Add wxAUI_TB_PLAIN_BACKGROUND wxAuiToolBar style.

This style allows to use a plain, solid colour, background instead of the
default gradient one.

Closes #10585.

Note: See TracTickets for help on using tickets.