2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 2000 The LyX Team.
9 *======================================================
13 #ifndef INSETCOLLAPSABLE_H
14 #define INSETCOLLAPSABLE_H
20 #include "insettext.h"
27 /** A colapsable text inset
30 class InsetCollapsable : public InsetText {
33 static int const TEXT_TO_TOP_OFFSET = 2;
35 static int const TEXT_TO_BOTTOM_OFFSET = 2;
40 ~InsetCollapsable() {}
42 Inset * Clone() const;
44 void Read(Buffer const *, LyXLex &);
46 void Write(Buffer const *, std::ostream &) const;
48 int ascent(Painter &, LyXFont const &) const;
50 int descent(Painter &, LyXFont const &) const;
52 int width(Painter &, LyXFont const & f) const;
54 void draw(BufferView *, const LyXFont &, int , float &, bool) const;
56 void update(BufferView *, LyXFont const &, bool =false);
58 void Edit(BufferView *, int, int, unsigned int);
60 EDITABLE Editable() const;
62 void InsetUnlock(BufferView *);
64 bool display() const { return (!collapsed); }
66 void InsetButtonRelease(BufferView *, int, int, int);
68 void InsetButtonPress(BufferView *, int, int, int);
70 void InsetMotionNotify(BufferView *, int, int, int);
72 void setLabel(string const & l) { label = l; }
74 void setLabelFont(LyXFont & f) { labelfont = f; }
76 void setAutoCollapse(bool f) { autocollapse = f; }
78 int getMaxWidth(Painter & pain, UpdatableInset const *) const;
82 int ascent_collapsed(Painter &, LyXFont const &) const;
84 int descent_collapsed(Painter &, LyXFont const &) const;
86 int width_collapsed(Painter &, LyXFont const & f) const;
88 void draw_collapsed(Painter & pain, const LyXFont &, int , float &) const;
90 int getMaxTextWidth(Painter & pain, UpdatableInset const *) const;
95 LColor::color framecolor;
105 // Instead of making these ints protected we could have a
106 // protected method "clickInButton" (Lgb)
109 button_length, button_top_y, button_bottom_y;
115 mutable int topbaseline;