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