+void wxMenuBar::SetLayoutDirection(wxLayoutDirection dir)
+{
+ if ( dir == wxLayout_Default )
+ {
+ const wxWindow *const frame = GetFrame();
+ if ( frame )
+ {
+ // inherit layout from frame.
+ dir = frame->GetLayoutDirection();
+ }
+ else // use global layout
+ {
+ dir = wxTheApp->GetLayoutDirection();
+ }
+ }
+
+ if ( dir == wxLayout_Default )
+ return;
+
+ GTKSetLayout(m_menubar, dir);
+
+ // also set the layout of all menus we already have (new ones will inherit
+ // the current layout)
+ for ( wxMenuList::compatibility_iterator node = m_menus.GetFirst();
+ node;
+ node = node->GetNext() )
+ {
+ wxMenu *const menu = node->GetData();
+ menu->SetLayoutDirection(dir);
+ }
+}
+
+wxLayoutDirection wxMenuBar::GetLayoutDirection() const
+{
+ return GTKGetLayout(m_menubar);
+}
+
+void wxMenuBar::Attach(wxFrame *frame)
+{
+ wxMenuBarBase::Attach(frame);
+
+ SetLayoutDirection(wxLayout_Default);
+}
+