]> git.lyx.org Git - lyx.git/blob - src/frontends/gtk/GViewBase.C
Minipage is no more (long live the box inset)
[lyx.git] / src / frontends / gtk / GViewBase.C
1 /**
2  * \file GViewBase.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Huang Ying
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12 #include <gtkmm.h>
13
14 #include "GViewBase.h"
15 #include "ControlButtons.h"
16 #include "support/filetools.h"
17
18 using std::string;
19
20
21 GViewBase::GViewBase(Dialog & parent, string const & t, bool allowResize) :
22         Dialog::View(parent, t), allowResize_(allowResize)
23 {
24 }
25
26
27 GViewBase::~GViewBase()
28 {
29 }
30
31
32 void GViewBase::hide()
33 {
34         window()->hide();
35 }
36
37
38 void GViewBase::build()
39 {
40         doBuild();
41         string const iconName =
42                 lyx::support::LibFileSearch("images", "lyx", "xpm");
43         if (!iconName.empty())
44                 window()->set_icon_from_file(iconName);
45         window()->signal_delete_event().connect(
46                 SigC::slot(*this, &GViewBase::onDeleteEvent));
47         window()->set_title(Glib::locale_to_utf8(getTitle()));
48 }
49
50
51 void GViewBase::show()
52 {
53         if (!window()) {
54                 build();
55         }
56         window()->show();
57 }
58
59
60 bool GViewBase::isVisible() const
61 {
62         return window() && window()->is_visible();
63 }
64
65
66 GBC & GViewBase::bcview()
67 {
68         return static_cast<GBC &>(dialog().bc().view());
69 }
70
71
72 void GViewBase::onApply()
73 {
74         dialog().ApplyButton();
75 }
76
77
78 void GViewBase::onOK()
79 {
80         dialog().OKButton();
81 }
82
83
84 void GViewBase::onCancel()
85 {
86         dialog().CancelButton();
87 }
88
89
90 void GViewBase::onRestore()
91 {
92         dialog().RestoreButton();
93 }
94
95
96 bool GViewBase::onDeleteEvent(GdkEventAny *)
97 {
98         dialog().CancelButton();
99         return false;
100 }
101
102
103 GViewGladeB::GViewGladeB(Dialog & parent, string const & t, bool allowResize) :
104         GViewBase(parent, t, allowResize)
105 {
106 }
107
108
109 Gtk::Window * GViewGladeB::window()
110 {
111         Gtk::Window * win;
112         if (!xml_)
113                 return 0;
114         xml_->get_widget("dialog", win);
115         return win;
116 }
117
118
119 const Gtk::Window * GViewGladeB::window() const
120 {
121         Gtk::Window * win;
122         if (!xml_)
123                 return 0;
124         xml_->get_widget("dialog", win);
125         return win;
126 }