]> git.lyx.org Git - lyx.git/blob - src/insets/inset.h
more cursor dispatch
[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 class UpdatableInset;
23
24
25 /// Insets
26 class InsetOld : public InsetBase {
27 public:
28         ///
29         enum {
30                 ///
31                 TEXT_TO_INSET_OFFSET = 2
32         };
33
34         ///
35         InsetOld();
36         ///
37         InsetOld(InsetOld const & in);
38         ///
39         int ascent() const;
40         ///
41         int descent() const;
42         ///
43         int width() const;
44
45         ///
46         void setInsetName(std::string const & s) { name_ = s; }
47         ///
48         std::string const & getInsetName() const { return name_; }
49         ///
50         void setOwner(UpdatableInset * inset) { owner_ = inset; }
51         ///
52         UpdatableInset * owner() const { return owner_; }
53         ///
54         virtual void setBackgroundColor(LColor_color);
55         ///
56         LColor_color backgroundColor() const;
57         /// set x/y drawing position cache
58         void setPosCache(PainterInfo const &, int, int) const;
59         ///
60         int xo() const { return xo_; }
61         ///
62         int yo() const { return yo_; }
63         /// returns the actual scroll-value
64         virtual int scroll(bool recursive = true) const;
65
66         ///
67         bool forceDefaultParagraphs(InsetBase const * inset) const;
68 protected:
69         ///
70         mutable int xo_;
71         ///
72         mutable int yo_;
73         ///
74         mutable int scx;
75         ///
76         mutable Dimension dim_;
77
78 private:
79         ///
80         UpdatableInset * owner_;
81         ///
82         std::string name_;
83         /** We store the LColor::color value as an int to get LColor.h out
84          *  of the header file.
85          */
86         int background_color_;
87 };
88
89
90 /** \c InsetOld_code is a wrapper for InsetOld::Code.
91  *  It can be forward-declared and passed as a function argument without
92  *  having to expose inset.h.
93  */
94 class InsetOld_code {
95         InsetOld::Code val_;
96 public:
97         InsetOld_code(InsetOld::Code val) : val_(val) {}
98         operator InsetOld::Code() const { return val_; }
99 };
100
101 #endif