]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/XFormsView.C
Change glob() API to accept a dir parameter.
[lyx.git] / src / frontends / xforms / XFormsView.C
index 7f7db7abcf3e420a68686db646d7389bd9b375e7..9abe89488abc6f59ab3ab202e32b07fc2b97639a 100644 (file)
 
 #include <boost/bind.hpp>
 
-using lyx::frontend::Box;
-
-using lyx::support::LibFileSearch;
+using boost::shared_ptr;
 
 using std::abs;
 using std::endl;
 using std::string;
 
-
 //extern void AutoSave(BufferView *);
 extern void QuitLyX();
 
+namespace lyx {
+
+using support::LibFileSearch;
+
+namespace frontend {
+
 extern "C" {
 
 static
@@ -68,22 +71,22 @@ XFormsView::XFormsView(int width, int height)
        int const air = 2;
 
        // Logical layout of the boxes making up the LyX window.
-       Box & top    = window_.children().push_back(Box(0,0));
-       Box & middle = window_.children().push_back(Box(0,0));
-       middle.set(Box::Horizontal);
-       Box & bottom = window_.children().push_back(Box(0,0));
+       shared_ptr<Box> top = window_.children().push_back(Box(0,0));
+       shared_ptr<Box> middle = window_.children().push_back(Box(0,0));
+       middle->set(Box::Horizontal);
+       shared_ptr<Box> bottom = window_.children().push_back(Box(0,0));
 
-       Box & left   = middle.children().push_back(Box(air,0));
-       Box & center = middle.children().push_back(Box(0,0));
-       center.set(Box::Expand);
-       Box & right  = middle.children().push_back(Box(air,0));
+       shared_ptr<Box> left = middle->children().push_back(Box(air,0));
+       shared_ptr<Box> center = middle->children().push_back(Box(0,0));
+       center->set(Box::Expand);
+       shared_ptr<Box> right = middle->children().push_back(Box(air,0));
 
        // Define accessors to the various boxes.
-       box_map_[Top]    = &top;
-       box_map_[Bottom] = &bottom;
-       box_map_[Left]   = &left;
-       box_map_[Center] = &center;
-       box_map_[Right]  = &right;
+       box_map_[Top]    = top;
+       box_map_[Bottom] = bottom;
+       box_map_[Left]   = left;
+       box_map_[Center] = center;
+       box_map_[Right]  = right;
 
        // Define the XForms components making up the window.
        // Each uses the layout engine defined above to control its
@@ -144,11 +147,11 @@ XFormsView::~XFormsView()
 }
 
 
-Box & XFormsView::getBox(Position pos) const
+shared_ptr<Box> XFormsView::getBox(Position pos) const
 {
-       std::map<Position, Box *>::const_iterator it = box_map_.find(pos);
+       BoxMap::const_iterator it = box_map_.find(pos);
        BOOST_ASSERT(it != box_map_.end());
-       return *it->second;
+       return it->second;
 }
 
 
@@ -217,6 +220,13 @@ void XFormsView::updateMetrics(bool resize_form)
 }
 
 
+bool XFormsView::hasFocus() const
+{
+       // No real implementation needed for now
+       return true;
+}
+
+
 void XFormsView::setWindowTitle(string const & title, string const & icon_title)
 {
        fl_set_form_title(getForm(), title.c_str());
@@ -273,3 +283,6 @@ void XFormsView::busy(bool yes) const
                fl_activate_all_forms();
        }
 }
+
+} // namespace frontend
+} // namespace lyx