]> git.lyx.org Git - lyx.git/blob - src/frontends/gtk/GViewBase.C
Various trivial bits 'n' bats about config.h, header blurb etc.
[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
19 GViewBase::GViewBase(Dialog & parent, string const & t, bool allowResize) :
20         Dialog::View(parent, t), allowResize_(allowResize)
21 {
22 }
23
24
25 GViewBase::~GViewBase()
26 {
27 }
28
29
30 void GViewBase::hide()
31 {
32         window()->hide();
33 }
34
35
36 void GViewBase::build()
37 {
38         doBuild();
39         string const iconName =
40                 lyx::support::LibFileSearch("images", "lyx", "xpm");
41         if (!iconName.empty())
42                 window()->set_icon_from_file(iconName);
43         window()->signal_delete_event().connect(
44                 SigC::slot(*this, &GViewBase::onDeleteEvent));
45         window()->set_title(Glib::locale_to_utf8(getTitle()));
46 }
47
48
49 void GViewBase::show()
50 {
51         if (!window()) {
52                 build();
53         }
54         window()->show();
55 }
56
57
58 bool GViewBase::isVisible() const
59 {
60         return window() && window()->is_visible();
61 }
62
63
64 GBC & GViewBase::bcview()
65 {
66         return static_cast<GBC &>(dialog().bc().view());
67 }
68
69
70 void GViewBase::onApply()
71 {
72         dialog().ApplyButton();
73 }
74
75
76 void GViewBase::onOK()
77 {
78         dialog().OKButton();
79 }
80
81
82 void GViewBase::onCancel()
83 {
84         dialog().CancelButton();
85 }
86
87
88 void GViewBase::onRestore()
89 {
90         dialog().RestoreButton();
91 }
92
93
94 bool GViewBase::onDeleteEvent(GdkEventAny *)
95 {
96         dialog().CancelButton();
97         return false;
98 }
99
100
101 GViewGladeB::GViewGladeB(Dialog & parent, string const & t, bool allowResize) :
102         GViewBase(parent, t, allowResize)
103 {
104 }
105
106
107 Gtk::Window * GViewGladeB::window()
108 {
109         Gtk::Window * win;
110         if (!xml_)
111                 return 0;
112         xml_->get_widget("dialog", win);
113         return win;
114 }
115
116
117 const Gtk::Window * GViewGladeB::window() const
118 {
119         Gtk::Window * win;
120         if (!xml_)
121                 return 0;
122         xml_->get_widget("dialog", win);
123         return win;
124 }