]> git.lyx.org Git - lyx.git/blob - src/insets/inset.h
The speed patch: redraw only rows that have changed
[lyx.git] / src / insets / inset.h
1 // -*- C++ -*-
2 /**
3  * \file inset.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 Jürgen Vigna
9  * \author Lars Gullik Bjønnes
10  * \author Matthias Ettrich
11  *
12  * Full author contact details are available in file CREDITS.
13  */
14
15 #ifndef INSETOLD_H
16 #define INSETOLD_H
17
18 #include "insetbase.h"
19 #include "dimension.h"
20
21 class LColor_color;
22
23
24 /// Insets
25 class InsetOld : public InsetBase {
26 public:
27         ///
28         enum {
29                 ///
30                 TEXT_TO_INSET_OFFSET = 2
31         };
32
33         ///
34         InsetOld();
35         ///
36         int ascent() const;
37         ///
38         int descent() const;
39         ///
40         int width() const;
41
42         ///
43         void setInsetName(std::string const & s) { name_ = s; }
44         ///
45         std::string const & getInsetName() const { return name_; }
46         ///
47         virtual void setBackgroundColor(LColor_color);
48         ///
49         LColor_color backgroundColor() const;
50         /// set x/y drawing position cache
51         void setPosCache(PainterInfo const &, int, int) const;
52
53 protected:
54         ///
55         InsetOld(InsetOld const & in);
56         ///
57         mutable Dimension dim_;
58
59 private:
60         InsetOld & operator=(InsetOld const &) const;
61
62         ///
63         std::string name_;
64         /** We store the LColor::color value as an int to get LColor.h out
65          *  of the header file.
66          */
67         int background_color_;
68 };
69
70
71 /** \c InsetBase_code is a wrapper for InsetBase::Code.
72  *  It can be forward-declared and passed as a function argument without
73  *  having to expose inset.h.
74  */
75 class InsetBase_code {
76         InsetBase::Code val_;
77 public:
78         InsetBase_code(InsetBase::Code val) : val_(val) {}
79         operator InsetBase::Code() const { return val_; }
80 };
81
82 #endif