]> git.lyx.org Git - features.git/blob - src/frontends/xforms/FormInset.C
Cleanup patches for xforms (Angus) and KDE (John)
[features.git] / src / frontends / xforms / FormInset.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
12 #include <config.h>
13
14 #include FORMS_H_LOCATION
15
16 #ifdef __GNUG__
17 #pragma implementation
18 #endif
19
20
21 #include "Dialogs.h"
22 #include "LyXView.h"
23 #include "FormInset.h"
24
25 FormInset::FormInset(LyXView * lv, Dialogs * d, string const & t,
26                      ButtonPolicy * bp,
27                      char const * close, char const * cancel)
28         : FormBaseBD( lv, d, t, bp, close, cancel ), ih_(0)
29 {}
30
31
32 void FormInset::disconnect()
33 {
34         ih_.disconnect();
35         FormBaseBD::disconnect();
36 }
37
38
39 void FormInset::updateSlot( bool switched )
40 {
41         if (switched)
42                 hide();
43         else
44                 update();
45 }
46
47
48 FormCommand::FormCommand( LyXView * lv, Dialogs * d, string const & t,
49                           ButtonPolicy * bp,
50                           char const * close, char const * cancel)
51         : FormInset( lv, d, t, bp, close, cancel ),
52           inset_(0)
53 {}
54
55
56 void FormCommand::disconnect()
57 {
58         inset_ = 0;
59         params = InsetCommandParams( string() );
60         FormInset::disconnect();
61 }
62
63        
64 void FormCommand::showInset( InsetCommand * inset )
65 {
66         if (inset == 0) return;  // maybe we should Assert this?
67
68         // If connected to another inset, disconnect from it.
69         if (inset_)
70                 ih_.disconnect();
71
72         inset_    = inset;
73         params    = inset->params();
74         ih_ = inset->hide.connect(slot(this, &FormCommand::hide));
75         show();
76 }
77
78
79 void FormCommand::createInset( string const & arg )
80 {
81         if (inset_) {
82                 ih_.disconnect();
83                 inset_ = 0;
84         }
85
86         params.setFromString( arg );
87         show();
88 }