]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormExternal.h
8e3e7762532ddd7cb7cf667f67775c54c81cfe9a
[lyx.git] / src / frontends / xforms / FormExternal.h
1 /**
2  * \file FormExternal.h
3  * Copyright 2001 the LyX Team
4  * Read the file COPYING
5  *
6  * \author unknown
7  * \author John Levon
8  */
9
10 #ifndef FORMEXTERNAL_H
11 #define FORMEXTERNAL_H
12
13 #include <boost/smart_ptr.hpp>
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include "FormBaseDeprecated.h"
20 #include "insets/insetexternal.h"
21 #include "xformsBC.h"
22
23 struct FD_form_external;
24
25 /// The class for editing External insets via a dialog
26 class FormExternal : public FormBaseBD {
27 public:
28         ///
29         FormExternal(LyXView *, Dialogs *);
30
31         /// Connect signals. Also perform any necessary initialisation.
32         virtual void connect();
33
34         /// Disconnect signals. Also perform any necessary housekeeping.
35         virtual void disconnect();
36
37         /// Slot launching dialog to an existing inset
38         void showInset(InsetExternal *);
39
40         /// bool indicates if a buffer switch took place
41         virtual void updateSlot(bool);
42
43         /// Callback function for the template drop-down
44         static void templateCB(FL_OBJECT *, long);
45
46         /// Callback function for the browse button
47         static void browseCB(FL_OBJECT *, long);
48
49         /// Callback function for the edit button
50         static void editCB(FL_OBJECT *, long);
51
52         /// Callback function for the view button
53         static void viewCB(FL_OBJECT *, long);
54
55         /// Callback function for the update production button
56         static void updateCB(FL_OBJECT *, long);
57
58         /// Pointer to the actual instantiation of the xform's form
59         virtual FL_FORM * form() const;
60
61 private:
62         /// calculate the string to set the combo box
63         string const getTemplatesComboString() const;
64
65         /// get the position in the combo for a given name
66         int getTemplateComboNumber(string const & name) const;
67
68         /// get a template given its combo position
69         ExternalTemplate getTemplate(int i) const;
70
71         /// change widgets on change of chosen template
72         void updateComboChange();
73  
74         /// build the dialog
75         void build();
76
77         /// the inset we're modifying
78         InsetExternal * inset_;
79
80         /// the parameters
81         InsetExternal::InsetExternalParams params_;
82
83         /// update the dialog
84         void update();
85
86         /// apply changes
87         void apply();
88
89         bool input(FL_OBJECT * obj, long data);
90
91         /// inset::hide connection.
92         Connection ih_;
93
94         /// build the dialog
95         FD_form_external * build_external();
96
97         /// Pointer to the actual instantiation of the ButtonController.
98         virtual xformsBC & bc();
99
100         /// the dialog implementation
101         boost::scoped_ptr<FD_form_external> dialog_;
102
103         /// The ButtonController
104         ButtonController<OkCancelReadOnlyPolicy, xformsBC> bc_;
105 };
106
107
108 inline
109 xformsBC & FormExternal::bc()
110 {
111         return bc_;
112 }
113
114 #endif // FORMEXTERNAL_H