]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/FormBase.C
First attempt at converting copyright dialog to MVC architecture
[lyx.git] / src / frontends / qt2 / FormBase.C
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  *
5  *           LyX, The Document Processor
6  *
7  *           Copyright 2000 The LyX Team.
8  *
9  * ======================================================
10  *
11  * \author Angus Leeming <a.leeming@ic.ac.uk>
12  */
13
14 #include <config.h>
15
16 #ifdef __GNUG__
17 #pragma implementation
18 #endif
19
20 #include <qdialog.h>
21 #undef emit
22
23 #include "Dialogs.h"
24 #include "FormBase.h"
25 #include "qt2BC.h"
26 #include "support/LAssert.h"
27
28
29 FormBase::FormBase(ControlBase & c, string const & t)
30         : ViewBC<qt2BC>(c), title_(t)
31 {}
32
33
34
35 void FormBase::show()
36 {
37         if (!form()) {
38                 build();
39         }
40
41         update();  // make sure its up-to-date
42
43         if (form()->isVisible()) {
44             form()->raise();
45         } else {
46             form()->setCaption( title_.c_str() );
47             form()->show();
48         }
49 }
50
51
52 void FormBase::hide()
53 {
54     if (form() && form()->isVisible() )
55         form()->hide();
56 }
57
58
59 // void FormBase::InputCB(FL_OBJECT * ob, long data)
60 // {
61 //      bc().input(input(ob, data));
62 // }
63
64
65 // ButtonPolicy::SMInput FormBase::input(FL_OBJECT *, long)
66 // {
67 //      return ButtonPolicy::SMI_VALID;
68 // }
69
70
71 namespace {
72
73 // FormBase * GetForm(QWidget * ob)
74 // {
75 //      Assert(ob && ob->form && ob->form->u_vdata);
76 //      FormBase * pre = static_cast<FormBase *>(ob->form->u_vdata);
77 //      return pre;
78 // }
79
80 } // namespace anon
81
82
83 // extern "C" int C_FormBaseWMHideCB(FL_FORM * form, void *)
84 // {
85 //      // Close the dialog cleanly, even if the WM is used to do so.
86 //      Assert(form && form->u_vdata);
87 //      FormBase * pre = static_cast<FormBase *>(form->u_vdata);
88 //      pre->CancelButton();
89 //      return FL_CANCEL;
90 // }
91
92
93 // extern "C" void C_FormBaseApplyCB(FL_OBJECT * ob, long)
94 // {
95 //      GetForm(ob)->ApplyButton();
96 // }
97
98
99 // extern "C" void C_FormBaseOKCB(FL_OBJECT * ob, long)
100 // {
101 //      GetForm(ob)->OKButton();
102 // }
103
104
105 // extern "C" void C_FormBaseCancelCB(FL_OBJECT * ob, long)
106 // {
107 //      FormBase * form = GetForm(ob);
108 //      form->CancelButton();
109 // }
110
111
112 // extern "C" void C_FormBaseRestoreCB(FL_OBJECT * ob, long)
113 // {
114 //      GetForm(ob)->RestoreButton();
115 // }
116
117
118 // extern "C" void C_FormBaseInputCB(FL_OBJECT * ob, long d)
119 // {
120 //      GetForm(ob)->InputCB(ob, d);
121 // }