3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 // Too hard to make concept checks work with this file
14 #ifdef _GLIBCPP_CONCEPT_CHECKS
15 #undef _GLIBCPP_CONCEPT_CHECKS
20 #include "GMiniBuffer.h"
22 #include "BufferView.h"
25 #include "MenuBackend.h"
27 #include "frontends/Toolbars.h"
29 #include "support/filetools.h"
31 #include <boost/bind.hpp>
42 void add_el(Gtk::Box::BoxList & list, Gtk::Box & box, bool shrink)
44 Gtk::PackOptions const packing =
45 shrink ? Gtk::PACK_SHRINK : Gtk::PACK_EXPAND_WIDGET;
46 list.push_back(Gtk::Box_Helpers::Element(box, packing));
54 // The physical store for the boxes making up the layout.
55 box_store_.push_back(BoxPtr(new Gtk::VBox));
56 box_store_.push_back(BoxPtr(new Gtk::HBox));
57 box_store_.push_back(BoxPtr(new Gtk::VBox));
58 box_store_.push_back(BoxPtr(new Gtk::HBox));
59 box_store_.push_back(BoxPtr(new Gtk::HBox));
60 box_store_.push_back(BoxPtr(new Gtk::HBox));
62 // Lay them out correctly.
65 Gtk::Box::BoxList & layout1 = top_box_.children();
66 add_el(layout1, *box_store_[0], true);
67 add_el(layout1, *box_store_[1], false);
68 add_el(layout1, *box_store_[2], true);
70 Gtk::Box::BoxList & layout2 = box_store_[1]->children();
71 add_el(layout2, *box_store_[3], true);
72 add_el(layout2, *box_store_[4], false);
73 add_el(layout2, *box_store_[5], true);
75 // Define accessors to the various Boxes.
76 box_map_[Top] = box_store_[0];
77 box_map_[Bottom] = box_store_[2];
78 box_map_[Left] = box_store_[3];
79 box_map_[Center] = box_store_[4];
80 box_map_[Right] = box_store_[5];
82 // Make all Boxes visible.
85 // Define the components making up the window.
86 menubar_.reset(new GMenubar(this, menubackend));
88 bufferview_.reset(new BufferView(this, 300, 300));
89 minibuffer_.reset(new GMiniBuffer(this, *controlcommand_));
91 focus_command_buffer.connect(
92 boost::bind(&GMiniBuffer::editMode, minibuffer_.get()));
93 view_state_changed.connect(boost::bind(&GView::showViewState, this));
94 signal_focus_in_event().connect(sigc::mem_fun(*this, &GView::onFocusIn));
95 set_default_size(620, 550);
96 // Make sure the buttons are disabled if needed.
98 string const iconName =
99 support::LibFileSearch("images", "lyx", "xpm");
100 if (!iconName.empty())
101 set_icon_from_file(iconName);
109 Gtk::Box & GView::getBox(Position pos)
111 return *box_map_[pos];
115 bool GView::on_delete_event(GdkEventAny * /*event*/)
122 bool GView::onFocusIn(GdkEventFocus * /*event*/)
124 workArea_->grab_focus();
129 void GView::prohibitInput() const
131 view()->hideCursor();
132 const_cast<GView*>(this)->set_sensitive(false);
136 void GView::allowInput() const
138 const_cast<GView*>(this)->set_sensitive(true);
142 void GView::message(string const & msg)
144 minibuffer_->message(msg);
148 void GView::showViewState()
150 message(getLyXFunc().viewStatusMessage());
154 void GView::setWindowTitle(string const & t, string const & /*it*/)
156 set_title(Glib::locale_to_utf8(t));
160 void GView::busy(bool yes) const
163 view()->hideCursor();
164 Gdk::Cursor cursor(Gdk::WATCH);
165 const_cast<GView *>(this)->get_window()->set_cursor(cursor);
166 const_cast<GView *>(this)->set_sensitive(false);
168 const_cast<GView *>(this)->get_window()->set_cursor();
169 const_cast<GView *>(this)->set_sensitive(true);
174 void GView::clearMessage()
176 message(getLyXFunc().viewStatusMessage());
180 bool GView::hasFocus() const
182 // No real implementation needed for now
187 } // namespace frontend