Err... disregard patch.  I learned it wasn't needed after poking at  
CSS (you can configure list elements to layout horizontally).  If  
anyone's interested in horizontal list CSS for a menu, here's what I  
used and was able to separate list items with a vertical bar: "foo1 |  
foo2"

#hnav ul { margin-left: 0; padding-left: 0; display: inline; }
#hnav li { padding-left: 2px; padding-right: 2px; display: inline; }
#hnav ul li:before { content: "| \0020 "; }

   divParent = Div(root(), "hnav");
   menu_ = new WMenu(stack_, Wt::Horizontal, divParent);
   menu_->setRenderAsList(true);

   WMenuItem *foo1 = menu_->addItem(tr("nav-foo1"), new Foo1Widget());
   foo1->contents()->setStyleClass("hnav");

   WMenuItem *foo2 = menu_->addItem(tr("nav-foo2"), new Foo2Widget());
   foo2->contents()->setStyleClass("hnav");


-sc


On Jul 8, 2009, at 6:07 PM, Sean Chittenden wrote:

> Attached is a small patch to Wt::WMenu that lets you change the  
> horizontal separator between menu items.
>
>  Wt::WStackedWidget *stack_ = new Wt::WStackedWidget(parent);
>
>  Wt::WMenu *menu = new Wt::WMenu(stack_, Wt::Horizontal, parent);
>  menu->setItemHSeparator(" - ");
>  menu->addItem("item1", new WText("item1 page", content));
>  menu->addItem("item2", new WText("item2 page", content), false);
>
> This will output: item1 - item2
>
> That said, I'm not very happy about adding the 4th argument to  
> addItem:
>
>  WMenuItem *addItem(const WString& name, WWidget *contents,
>                     WMenuItem::LoadPolicy policy =  
> WMenuItem::LazyLoading,
>                     bool includeSeparator = true);
>  WMenuItem *addItem(WMenuItem *item, bool includeSeparator = true);
>
> But felt it was the best way to handle the rendering of the WMenu  
> since its rendering isn't handled at a later point.  -sc
>
>
> <patch-src-Wt-WMenu.txt>
>
> --
> Sean Chittenden
> [email protected]
>
>
>




--
Sean Chittenden
[email protected]




------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to