RTL support for WNavigationBar (and WMenu)
WNavigationBar and the WMenu inside it do not behave correctly when setLayoutDirection(RightToLeft) is called. I have tried to implement a fix for it, but I am not familiar enough with the architecture of Wt yet, so I wasn't completely successful. I am not sure in which function the code should be added. I have attached three screenshots to help clarify the problem. WNavigationBar_noRTL.png shows the navigation bar without RTL, WNavigationBar_wrongRTL.png shows how the current buggy implementation behaves, and WNavigationBar_correctRTL.png is a screenshot that I have edited approximating how it should look for correct RTL behavior. I have also included a main.cpp file, which was used to take the screenshots and should help illustrate the problem better and implement a fix. It's a modification of the example found here http://www.webtoolkit.eu/widgets/navigation/navigation-bar.
While trying to implement the fix myself, here is what I have learned:
1- RTL for WMenu should be implemented first, since it's part of a typical WNavigationBar setup. This can be done by calling item->setAttributeValue("style", "float: right") on every WMenuItem inside WMenu whenever RTL is enabled.
2- Every menu added to the navigation bar should have the opposite alignment specified. For example, a call to navigation->addMenu(rightMenu, Wt::AlignRight) should actually align the menu to the left instead of to the right, and a default call to the function without a second argument should align the menu to the right.
3- The navigation bar title should go all the way to the right instead of to the left. I am not sure how to achieve this yet, as I wasn't able to successfully implement step 2, so I didn't get this far. But it is probably the simplest thing of the three to implement.
I am willing to implement this fix with some guidance, or maybe it is easy enough for you guys to implement a fix without much trouble. In any case, I would appreciate any feedback on this issue.
No data to display