Opened 11 years ago

Closed 10 years ago

#11712 closed enhancement (fixed)

wxAuiToolBar auto-orientation

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


The wxAuiToolbar has a "direction" determined by the presence or absence of wxAUI_TB_VERTICAL in its style. However, it makes very little sense for a horizontal toolbar to be docked on the left or right, and very little sense for a vertical toolbar to be docked on the top or bottom. The auidemo deals with this by forbidding the demo's toolbars from docking on the sides where the toolbar orientation looks wrong, but I would rather allow the toolbars to dock on any side, and have the toolbar's orientation be determined by its docking position. This patch modifies wxAui to implement this auto-orientation concept. It is not ready to be applied to svn yet, but I would like feedback on it, especially the issue (noted in the comments in the patch) of whether to generalize the implementation of the wxAuiPaneInfo::MakeValid() function I added. I realize I haven't provided any documentation, but I am postponing that until I have a final design.

Attachments (3)

aui toolbar auto orient.patch download (14.5 KB) - added by wsu 11 years ago.
aui toolbar auto orient 2.patch download (15.6 KB) - added by wsu 10 years ago.
new patch incorporating feedback
aui toolbar auto orient 3.patch download (22.0 KB) - added by wsu 10 years ago.

Download all attachments as: .zip

Change History (6)

Changed 11 years ago by wsu

comment:1 Changed 10 years ago by vadz

  • Status changed from new to infoneeded_new

Thanks for the patch and sorry for getting to it so late.

Unfortunately the absence of the documentation makes it difficult to understand how exactly is this supposed to behave. I think it would be nice to describe this, in English, first. For instance, it's not clear to me if we can specify that the given toolbar should always be horizontal (and not be dockable to the left or right)?

I also wonder if we could get rid of ugly, IMO, MakePaneValid() and just ensure that the state is always valid. Why can't we do this?

Couple of minor comments about the patch details:

  1. Don't use wxASSERT(false), use wxFAIL_MSG( explanation here ) instead. Better yet, use wxCHECK().
  2. Please use wxWidgets style conventions, notably put the opening braces on their own lines.
  3. Avoid complicated and difficult to read expressions such as
    (m_style & ~wxAUI_ORIENTATION_MASK) | (m_orientation == wxHORIZONTAL ? 0 : wxAUI_TB_VERTICAL);


int style = m_style & ~wxAUI_ORIENTATION_MASK;
if ( m_orientation == wxVERTICAL )
  style |= wxAUI_TB_VERTICAL;

is much clearer.


Changed 10 years ago by wsu

new patch incorporating feedback

Changed 10 years ago by wsu

comment:2 Changed 10 years ago by wsu

Version 3 of the patch incorporates more feedback from the mailing list. It now supports using wxAuiToolBar style bits to configure wxAuiPaneInfo docking locations.

It also behaves appropriately when its wxAuiPaneInfo has Resizable() set.

comment:3 Changed 10 years ago by VZ

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

(In [65061]) Add support for auto-orientable toolbars to AUI.

Allow wxAUI to change the toolbar orientation depending on where is it docked.
It is also now possible to specify wxAUI_TB_VERTICAL or HORIZONTAL to force
the toolbar to be always oriented in the given sense and to prevent it from
being docked at the sides incompatible with it.

Closes #11712.

Note: See TracTickets for help on using tickets.