]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormMathsPanel.h
Hose MathsCallbacks.h.
[lyx.git] / src / frontends / xforms / FormMathsPanel.h
1 // -*- C++ -*-
2 /**
3  * \file FormMathsPanel.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Alejandro Aguilar Sierra
8  * \author John Levon
9  * \author Angus Leeming 
10  *
11  * Full author contact details are available in file CREDITS
12  */
13
14 #ifndef FORM_MATHSPANEL_H
15 #define FORM_MATHSPANEL_H
16
17 #include "commandtags.h"
18
19 #ifdef __GNUG__
20 #pragma interface
21 #endif
22
23 #include "FormBaseDeprecated.h"
24
25 #include <boost/scoped_ptr.hpp>
26
27 class FormMathsBitmap;
28 class FormMathsDeco;
29 class FormMathsDelim;
30 class FormMathsMatrix;
31 class FormMathsSpace;
32 class FormMathsStyle;
33 class FormMathsSub;
34 struct FD_maths_panel;
35
36 /**
37  * This class provides an XForms implementation of the maths panel.
38  */
39 class FormMathsPanel : public FormBaseBD {
40 public:
41         ///
42         FormMathsPanel(LyXView &, Dialogs &);
43         ///
44         void setActive(FormMathsSub *) const;
45         /// dispatch an LFUN:
46         void dispatchFunc(kb_action action) const;
47         /// dispatch a symbol insert
48         void insertSymbol(string const & sym, bool bs = true) const;
49 private:
50         /// Pointer to the actual instantiation of the ButtonController.
51         virtual xformsBC & bc();
52
53         /// Build the dialog
54         virtual void build();
55         /// input handler
56         virtual bool input(FL_OBJECT *, long);
57
58         /// Pointer to the actual instantiation of the xforms form
59         virtual FL_FORM * form() const;
60
61         // Real GUI implementation
62         boost::scoped_ptr<FD_maths_panel> dialog_;
63
64         /// send LFUN_MATH_DISPLAY
65         void mathDisplay() const;
66
67         /// Subdialogs
68         boost::scoped_ptr<FormMathsDeco>   deco_;
69         boost::scoped_ptr<FormMathsDelim>  delim_;
70         boost::scoped_ptr<FormMathsMatrix> matrix_;
71         boost::scoped_ptr<FormMathsSpace>  space_;
72         boost::scoped_ptr<FormMathsStyle>  style_;
73         boost::scoped_ptr<FormMathsBitmap> arrow_;
74         boost::scoped_ptr<FormMathsBitmap> boperator_;
75         boost::scoped_ptr<FormMathsBitmap> brelats_;
76         boost::scoped_ptr<FormMathsBitmap> greek_;
77         boost::scoped_ptr<FormMathsBitmap> misc_;
78         boost::scoped_ptr<FormMathsBitmap> dots_;
79         boost::scoped_ptr<FormMathsBitmap> varsize_;
80         boost::scoped_ptr<FormMathsBitmap> ams_misc_;
81         boost::scoped_ptr<FormMathsBitmap> ams_arrows_;
82         boost::scoped_ptr<FormMathsBitmap> ams_rel_;
83         boost::scoped_ptr<FormMathsBitmap> ams_nrel_;
84         boost::scoped_ptr<FormMathsBitmap> ams_ops_;
85
86         /// A pointer to the currently active subdialog
87         mutable FormMathsSub * active_;
88
89         /// The ButtonController
90         ButtonController<OkCancelReadOnlyPolicy, xformsBC> bc_;
91 };
92
93
94 class FormMathsSub : public FormBaseBD {
95         friend class FormMathsPanel; // has subdialogs to manipulate
96
97 public:
98         ///
99         FormMathsSub(LyXView &, Dialogs &, FormMathsPanel const &,
100                      string const &, bool allowResize = true);
101
102 protected:
103         /// Pointer to the actual instantiation of the ButtonController.
104         virtual xformsBC & bc();
105         /// The parent Maths Panel
106         FormMathsPanel const & parent_;
107 private:
108         ///
109         virtual void connect();
110         ///
111         virtual void disconnect();
112         /// The ButtonController
113         ButtonController<IgnorantPolicy, xformsBC> bc_;
114 };
115
116
117 inline
118 xformsBC & FormMathsSub::bc()
119 {
120         return bc_;
121 }
122
123 inline
124 xformsBC & FormMathsPanel::bc()
125 {
126         return bc_;
127 }
128 #endif //  FORM_MATHSPANEL_H