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