]> git.lyx.org Git - lyx.git/blob - src/insets/insetcollapsable.h
use more explicit on constructors use the pimpl idom to reduce size with about 500k
[lyx.git] / src / insets / insetcollapsable.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  * 
5  *           LyX, The Document Processor
6  *
7  *           Copyright 2000 The LyX Team.
8  *
9  *======================================================
10  */
11
12
13 #ifndef INSETCOLLAPSABLE_H
14 #define INSETCOLLAPSABLE_H
15
16 #ifdef __GNUG__
17 #pragma interface
18 #endif
19
20 #include "insettext.h"
21 #include "lyxfont.h"
22 #include "LColor.h"
23
24
25 class Painter;
26
27 /** A colapsable text inset
28   
29 */
30 class InsetCollapsable : public InsetText {
31 public:
32     ///
33     static int const TEXT_TO_TOP_OFFSET = 2;
34     ///
35     static int const TEXT_TO_BOTTOM_OFFSET = 2;
36     ///
37         explicit
38     InsetCollapsable(Buffer *);
39     ///
40     ~InsetCollapsable() {}
41     ///
42     Inset * Clone() const;
43     ///
44     int ascent(Painter &, LyXFont const &) const;
45     ///
46     int descent(Painter &, LyXFont const &) const;
47     ///
48     int width(Painter &, LyXFont const & f) const;
49     ///
50     void draw(Painter & pain, const LyXFont &, int , float &) const;
51     ///
52     void Edit(BufferView *, int, int, unsigned int);
53     ///
54     EDITABLE Editable() const;
55     ///
56     void InsetUnlock(BufferView *);
57     ///
58     bool display() const { return (!collapsed); }
59     ///
60     void InsetButtonRelease(BufferView *, int, int, int);
61     ///
62     void InsetButtonPress(BufferView *, int, int, int);
63     ///
64     void InsetMotionNotify(BufferView *, int, int, int);
65     ///
66     void setLabel(string const & l) { label = l; }
67     ///
68     void setLabelFont(LyXFont & f) { labelfont = f; }
69     ///
70     void setAutoCollapse(bool f) { autocolapse = f; }
71
72 protected:
73     ///
74     int ascent_collapsed(Painter &, LyXFont const &) const;
75     ///
76     int descent_collapsed(Painter &, LyXFont const &) const;
77     ///
78     int width_collapsed(Painter &, LyXFont const & f) const;
79     ///
80     void draw_collapsed(Painter & pain, const LyXFont &, int , float &) const;
81     ///
82     void UpdateLocal(BufferView *, bool);
83     
84     ///
85     bool collapsed;
86     ///
87     LColor::color framecolor;
88
89 private:
90     ///
91     string label;
92     ///
93     LyXFont labelfont;
94     ///
95     bool autocolapse;
96     ///
97     mutable int
98         top_baseline, top_x,
99         button_x, button_top_y, button_bottom_y;
100 };
101
102 #endif