]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormMathsBitmap.h
Tiny clean-ups.
[lyx.git] / src / frontends / xforms / FormMathsBitmap.h
1 // -*- C++ -*-
2 /**
3  * \file FormMathsBitmap.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_MATHSBITMAP_H
15 #define FORM_MATHSBITMAP_H
16
17 #include "FormDialogView.h"
18 #include <vector>
19
20 struct BitmapStore
21 {
22         BitmapStore(int nt_in, int nx_in, int ny_in, int bw_in, int bh_in,
23                     unsigned char const * data_in, bool vert_in)
24                 : nt(nt_in), nx(nx_in), ny(ny_in), bw(bw_in), bh(bh_in),
25                   data(data_in), vert(vert_in)
26         {}
27
28         int nt;
29         int nx;
30         int ny;
31         int bw;
32         int bh;
33         unsigned char const * data;
34         bool vert;
35 };
36
37
38 struct FD_maths_bitmap
39 {
40         ~FD_maths_bitmap();
41         FL_FORM * form;
42         FL_OBJECT * button_close;
43 };
44
45
46 /**
47  * This class provides an XForms implementation of a maths bitmap form.
48  */
49
50 class ControlMath;
51
52 class FormMathsBitmap
53         : public FormController<ControlMath, FormView<FD_maths_bitmap> > {
54 public:
55         ///
56         FormMathsBitmap(Dialog &, std::string const &, std::vector<std::string> const &);
57         ///
58         void addBitmap(BitmapStore const &);
59
60 private:
61         ///
62         int GetIndex(FL_OBJECT *);
63
64         ///
65         virtual void apply();
66         ///
67         virtual void build();
68         ///
69         virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
70         /// Not needed.
71         virtual void update() {}
72
73         ///
74         FL_OBJECT * buildBitmap(BitmapStore const & bmstore);
75
76         /// The latex names associated with each symbol
77         std::vector<std::string> latex_;
78         /// The latex name chosen
79         std::string latex_chosen_;
80
81         /** Temporary store for bitmap data passed to addBitmap()
82          *  but before the FL_OBJECT is created in build().
83          */
84         std::vector<BitmapStore> bitmaps_;
85
86         /// Border width
87         int ww_;
88         ///
89         int x_;
90         ///
91         int y_;
92         ///
93         int w_;
94         ///
95         int h_;
96 };
97
98
99 #endif // FORM_MATHSBITMAP_H