Opened 9 years ago

Closed 5 years ago

Last modified 5 years ago

#10585 closed enhancement (fixed)

Allow to easily use plain background for wxAuiToolbar

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


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);


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

Thank you.

Attachments (2)

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

Download all attachments as: .zip

Change History (7)

Changed 9 years ago by allanjos

comment:1 Changed 7 years ago by vadz

  • Patch unset
  • 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

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 years ago by allanjos

Patch with documentation against revision 73415

comment:2 Changed 5 years ago by allanjos

  • Patch set

Hi. Attached the patch with documentation.

Thank you very much.

comment:3 Changed 5 years 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.

comment:4 Changed 5 years ago by VZ

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

(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.

comment:5 Changed 5 years ago by allanjos

Patch for sample is posted on ticket #15751 with modifications to the style to work with Create() and SetWindowStyleFlag() functions.

Note: See TracTickets for help on using tickets.