]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/XFormsMenubar.C
Change glob() API to accept a dir parameter.
[lyx.git] / src / frontends / xforms / XFormsMenubar.C
index a52ffe6c88938c08bf92e127aa1fa0b9681b070b..31aaac9475bef07ca9aed992bc8029d9fccbe71b 100644 (file)
 
 #include "lyx_forms.h"
 
-using lyx::frontend::Box;
-using lyx::frontend::BoxList;
-
-using lyx::support::lowercase;
-using lyx::support::subst;
+using boost::shared_ptr;
 
 using std::distance;
 using std::endl;
@@ -39,6 +35,12 @@ using std::for_each;
 using std::string;
 using std::vector;
 
+namespace lyx {
+
+using support::lowercase;
+using support::subst;
+
+namespace frontend {
 
 typedef vector<int>::size_type size_type;
 
@@ -88,10 +90,8 @@ extern "C" {
 
 XFormsMenubar::XFormsMenubar(LyXView * view, MenuBackend const & mb)
        : owner_(static_cast<XFormsView*>(view)),
-         menubackend_(&mb),
-         menubar_(0)
+         menubackend_(&mb)
 {
-       using lyx::frontend::WidgetMap;
        owner_->metricsUpdated.connect(boost::bind(&WidgetMap::updateMetrics,
                                                   &widgets_));
 
@@ -106,24 +106,24 @@ XFormsMenubar::~XFormsMenubar()
 void XFormsMenubar::makeMenubar(Menu const & menu)
 {
        // Draw a frame around the whole.
-       BoxList & boxlist = owner_->getBox(XFormsView::Top).children();
+       BoxList & boxlist = owner_->getBox(XFormsView::Top)->children();
 
        FL_OBJECT * frame = fl_add_frame(FL_UP_FRAME, 0, 0, 0, 0, "");
        fl_set_object_resize(frame, FL_RESIZE_ALL);
        fl_set_object_gravity(frame, NorthWestGravity, NorthEastGravity);
 
-       menubar_ = &widgets_.add(frame, boxlist, 0, mheight);
+       menubar_ = widgets_.add(frame, boxlist, 0, mheight);
 
        // The menubar contains three vertically-aligned Boxes,
        // the center one of which is to contain the buttons,
        // aligned horizontally.
        // The other two provide some visual padding.
        menubar_->children().push_back(Box(0, yloc));
-       Box & menubar_center = menubar_->children().push_back(Box(0,0));
-       menubar_center.set(Box::Horizontal);
+       shared_ptr<Box> menubar_center = menubar_->children().push_back(Box(0,0));
+       menubar_center->set(Box::Horizontal);
        menubar_->children().push_back(Box(0, yloc));
 
-       BoxList & menubar_buttons = menubar_center.children();
+       BoxList & menubar_buttons = menubar_center->children();
 
        // Add the buttons.
        Menu::const_iterator i = menu.begin();
@@ -401,7 +401,7 @@ void XFormsMenubar::MenuCallback(FL_OBJECT * ob, long button)
                // If the action value is too low, then it is not a
                // valid action, but something else.
                if (choice >= action_offset) {
-                       view->getLyXFunc().dispatch(funcs[choice - action_offset], true);
+                       view->getLyXFunc().dispatch(funcs[choice - action_offset]);
                } else {
                        lyxerr[Debug::GUI]
                                << "MenuCallback: ignoring bogus action "
@@ -428,3 +428,6 @@ XFormsMenubar::ItemInfo::ItemInfo
 
 XFormsMenubar::ItemInfo::~ItemInfo()
 {}
+
+} // namespace frontend
+} // namespace lyx