]> git.lyx.org Git - lyx.git/blob - src/insets/inset.C
Place inset content on the button when collapsed
[lyx.git] / src / insets / inset.C
1 /**
2  * \file inset.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Alejandro Aguilar Sierra
7  * \author Jürgen Vigna
8  * \author Lars Gullik Bjønnes
9  * \author Matthias Ettrich
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #include <config.h>
15
16 #include "inset.h"
17 #include "updatableinset.h"
18
19 #include "BufferView.h"
20 #include "gettext.h"
21 #include "LColor.h"
22
23
24 using std::string;
25
26
27 InsetOld::InsetOld()
28         : InsetBase(),
29           xo_(0), yo_(0), scx(0), owner_(0),
30           //background_color_(LColor::inherit)
31           background_color_(LColor::background)
32 {}
33
34
35 InsetOld::InsetOld(InsetOld const & in)
36         : InsetBase(),
37           xo_(0), yo_(0), scx(0), owner_(0), name_(in.name_),
38           background_color_(in.background_color_)
39 {}
40
41
42 bool InsetOld::directWrite() const
43 {
44         return false;
45 }
46
47
48 InsetOld::EDITABLE InsetOld::editable() const
49 {
50         return NOT_EDITABLE;
51 }
52
53
54 bool InsetOld::autoDelete() const
55 {
56         return false;
57 }
58
59
60 string const InsetOld::editMessage() const
61 {
62         return _("Opened inset");
63 }
64
65
66 void InsetOld::setBackgroundColor(LColor_color color)
67 {
68         background_color_ = color;
69 }
70
71
72 LColor_color InsetOld::backgroundColor() const
73 {
74         return LColor::color(background_color_);
75 }
76
77
78 bool InsetOld::forceDefaultParagraphs(InsetOld const * inset) const
79 {
80         if (owner())
81                 return owner()->forceDefaultParagraphs(inset);
82         return false;
83 }
84
85
86 int InsetOld::ascent() const
87 {
88         return dim_.asc;
89 }
90
91
92 int InsetOld::descent() const
93 {
94         return dim_.des;
95 }
96
97
98 int InsetOld::width() const
99 {
100         return dim_.wid;
101 }
102
103
104 bool InsetOld::insetAllowed(InsetOld * in) const
105 {
106         return insetAllowed(in->lyxCode());
107 }
108
109
110 int InsetOld::scroll(bool recursive) const
111 {
112         if (!recursive || !owner_)
113                 return scx;
114         return 0;
115 }
116
117 bool isEditableInset(InsetOld const * i)
118 {
119         return i && i->editable();
120 }
121
122
123 bool isHighlyEditableInset(InsetOld const * i)
124 {
125         return i && i->editable() == InsetOld::HIGHLY_EDITABLE;
126 }