]> git.lyx.org Git - lyx.git/blob - src/frontends/gtk/GView.h
This is the merging of the GUI API cleanup branch that was developed in svn+ssh:...
[lyx.git] / src / frontends / gtk / GView.h
1 // -*- C++ -*-
2 /**
3  * \file gtk/GView.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Huang Ying
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef GVIEW_H
13 #define GVIEW_H
14
15 #include "bufferview_funcs.h"
16
17 #include "frontends/LyXView.h"
18
19 #include "GuiImplementation.h"
20
21 #include <gtkmm.h>
22
23 #include <map>
24
25 namespace lyx {
26 namespace frontend {
27
28 class GMiniBuffer;
29
30 class GView : public LyXView, public Gtk::Window {
31 public:
32         enum Position {
33                 Top,
34                 Bottom,
35                 Left,
36                 Right,
37                 Center
38         };
39
40         GView();
41         ~GView();
42
43         Gtk::Box & getBox(Position pos);
44
45         virtual void prohibitInput() const;
46         virtual void allowInput() const;
47         virtual void message(std::string const &);
48
49         bool on_delete_event(GdkEventAny * event);
50         void focusWorkArea() { workArea_->grab_focus(); }
51         void setGWorkArea(Gtk::Widget * w) { workArea_ = w; }
52
53         /// show busy cursor
54         virtual void busy(bool) const;
55         /// clear any temporary message and replace with current status
56         virtual void clearMessage();
57
58         // returns true if this view has the focus.
59         virtual bool hasFocus() const;
60
61         ///
62         Gui & gui() { return frontend_; }
63
64 private:
65         void showViewState();
66         bool onFocusIn(GdkEventFocus * event);
67         virtual void setWindowTitle(std::string const & t, std::string const & it);
68
69         // The top-most box containing all other boxes.
70         Gtk::VBox top_box_;
71
72         // The physical store for the boxes making up the layout.
73         typedef boost::shared_ptr<Gtk::Box> BoxPtr;
74         typedef std::vector<BoxPtr> BoxStore;
75         BoxStore box_store_;
76
77         // Accessors to the various Boxes.
78         std::map<Position, BoxPtr> box_map_;
79
80         boost::scoped_ptr<GMiniBuffer> minibuffer_;
81         Gtk::Widget * workArea_;
82         ///
83         GuiImplementation frontend_;
84 };
85
86 } // namespace frontend
87 } // namespace lyx
88
89 #endif