]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiDialogView.cpp
renaming of some methods that hurt the eyes + removal of:
[lyx.git] / src / frontends / qt4 / GuiDialogView.cpp
1 /**
2  * \file GuiDialogView.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Angus Leeming
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "GuiDialogView.h"
14 #include "qt_helpers.h"
15
16
17 namespace lyx {
18 namespace frontend {
19
20 GuiDialogView::GuiDialogView(GuiDialog & parent, docstring const & t)
21         : Dialog::View(parent, t), updating_(false), parent_(parent)
22 {}
23
24
25 ButtonController & GuiDialogView::bc()
26 {
27         return parent_.bc();
28 }
29
30
31 bool GuiDialogView::isVisibleView() const
32 {
33         return form() && form()->isVisible();
34 }
35
36
37 bool GuiDialogView::readOnly() const
38 {
39         return kernel().isBufferReadonly();
40 }
41
42
43 void GuiDialogView::showView()
44 {
45         if (!form())
46                 build();
47
48         QSize const sizeHint = form()->sizeHint();
49         if (sizeHint.height() >= 0 && sizeHint.width() >= 0)
50                 form()->setMinimumSize(sizeHint);
51
52         updateView();  // make sure its up-to-date
53         if (dialog().controller().exitEarly())
54                 return;
55
56         form()->setWindowTitle(toqstr("LyX: " + getViewTitle()));
57
58         if (form()->isVisible()) {
59                 form()->raise();
60                 form()->activateWindow();
61                 form()->setFocus();
62         } else {
63                 form()->show();
64                 form()->setFocus();
65         }
66 }
67
68
69 void GuiDialogView::hideView()
70 {
71         if (form() && form()->isVisible())
72                 form()->hide();
73 }
74
75
76 void GuiDialogView::build()
77 {
78         // protect the BC from unwarranted state transitions
79         updating_ = true;
80         build_dialog();
81         updating_ = false;
82 }
83
84
85 bool GuiDialogView::isValid()
86 {
87         return true;
88 }
89
90
91 void GuiDialogView::changed()
92 {
93         if (updating_)
94                 return;
95         parent_.bc().setValid(isValid());
96 }
97
98
99 void GuiDialogView::slotWMHide()
100 {
101         parent_.CancelButton();
102 }
103
104
105 void GuiDialogView::slotApply()
106 {
107         parent_.ApplyButton();
108 }
109
110
111 void GuiDialogView::slotOK()
112 {
113         parent_.OKButton();
114 }
115
116
117 void GuiDialogView::slotClose()
118 {
119         parent_.CancelButton();
120 }
121
122
123 void GuiDialogView::slotRestore()
124 {
125         parent_.RestoreButton();
126 }
127
128 } // namespace frontend
129 } // namespace lyx
130
131 #include "GuiDialogView_moc.cpp"