]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormMathsPanel.h
John's patches (except for [PATCH] fix quit etc. from inset about which I
[lyx.git] / src / frontends / xforms / FormMathsPanel.h
1 // -*- C++ -*-
2 /** 
3  * \file FormMathsPanel.h
4  * Copyright 2001 The LyX Team.
5  * See the file COPYING.
6  * 
7  * \author Alejandro Aguilar Sierra 
8  * \author John Levon, moz@compsoc.man.ac.uk
9  * \author Angus Leeming, a.leeming@ic.ac.uk
10  */
11
12 #ifndef FORM_MATHSPANEL_H
13 #define FORM_MATHSPANEL_H
14
15 #include <boost/smart_ptr.hpp>
16
17 #ifdef __GNUG_
18 #pragma interface
19 #endif
20
21 #include "FormBaseDeprecated.h"
22
23 class FormMathsBitmap;
24 class FormMathsDeco;
25 class FormMathsDelim;
26 class FormMathsMatrix;
27 class FormMathsSpace;
28 class FormMathsSub;
29 struct FD_form_maths_panel;
30
31 /// values used by the xforms callbacks 
32 enum MathsCallbackValues {
33         MM_GREEK,
34         MM_ARROW,
35         MM_BOP,
36         MM_BRELATS,
37         MM_VARSIZE,
38         MM_MISC,
39         MM_FRAC,
40         MM_SQRT,
41         MM_DELIM,
42         MM_MATRIX,
43         MM_EQU,
44         MM_DECO,
45         MM_SPACE,
46         MM_DOTS,
47         MM_FUNC
48 };
49  
50 /** 
51  * This class provides an XForms implementation of the maths panel.
52  */
53 class FormMathsPanel : public FormBaseBD {
54 public:
55         ///
56         FormMathsPanel(LyXView *, Dialogs *);
57         ///
58         void setActive(FormMathsSub *) const;
59         /// dispatch a symbol insert 
60         void insertSymbol(string const & sym) const;
61
62 private:
63         /// Pointer to the actual instantiation of the ButtonController.
64         virtual xformsBC & bc();
65         
66         /// Build the dialog
67         virtual void build();
68         /// input handler
69         virtual bool input(FL_OBJECT *, long);
70    
71         /// Pointer to the actual instantiation of the xforms form
72         virtual FL_FORM * form() const;
73
74         // build the panels
75         FD_form_maths_panel * build_maths_panel();
76         
77         /// send LFUN_MATH_DISPLAY
78         void mathDisplay() const;
79
80         // Real GUI implementation
81         boost::scoped_ptr<FD_form_maths_panel> dialog_;
82
83         /// Subdialogs
84         boost::scoped_ptr<FormMathsDeco>   deco_;
85         boost::scoped_ptr<FormMathsDelim>  delim_;
86         boost::scoped_ptr<FormMathsMatrix> matrix_;
87         boost::scoped_ptr<FormMathsSpace>  space_;
88         boost::scoped_ptr<FormMathsBitmap> arrow_;
89         boost::scoped_ptr<FormMathsBitmap> boperator_;
90         boost::scoped_ptr<FormMathsBitmap> brelats_;
91         boost::scoped_ptr<FormMathsBitmap> greek_;
92         boost::scoped_ptr<FormMathsBitmap> misc_;
93         boost::scoped_ptr<FormMathsBitmap> dots_;
94         boost::scoped_ptr<FormMathsBitmap> varsize_;
95
96         /// A pointer to the currently active subdialog
97         mutable FormMathsSub * active_;
98
99         /// The ButtonController
100         ButtonController<OkCancelReadOnlyPolicy, xformsBC> bc_;
101 };
102
103
104 class FormMathsSub : public FormBaseBD {
105         friend class FormMathsPanel; // has subdialogs to manipulate
106
107 public:
108         ///
109         FormMathsSub(LyXView *, Dialogs *, FormMathsPanel const &,
110                      string const &);
111
112 protected:
113         /// Pointer to the actual instantiation of the ButtonController.
114         virtual xformsBC & bc();
115         /// The parent Maths Panel
116         FormMathsPanel const & parent_;
117 private:
118         ///
119         virtual void connect();
120         ///
121         virtual void disconnect();
122         /// The ButtonController
123         ButtonController<IgnorantPolicy, xformsBC> bc_;
124 };
125
126
127 inline
128 xformsBC & FormMathsSub::bc()
129 {
130         return bc_;
131 }
132
133 inline
134 xformsBC & FormMathsPanel::bc()
135 {
136         return bc_;
137 }
138 #endif //  FORM_MATHSPANEL_H