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;
38 InsetCollapsable(Buffer *);
40 ~InsetCollapsable() {}
42 Inset * Clone() const;
46 void Write(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(Painter & pain, const LyXFont &, int , float &) const;
56 void Edit(BufferView *, int, int, unsigned int);
58 EDITABLE Editable() const;
60 void InsetUnlock(BufferView *);
62 bool display() const { return (!collapsed); }
64 void InsetButtonRelease(BufferView *, int, int, int);
66 void InsetButtonPress(BufferView *, int, int, int);
68 void InsetMotionNotify(BufferView *, int, int, int);
70 void setLabel(string const & l) { label = l; }
72 void setLabelFont(LyXFont & f) { labelfont = f; }
74 void setAutoCollapse(bool f) { autocollapse = f; }
76 int getMaxWidth(Painter & pain, UpdatableInset const *) const;
80 int ascent_collapsed(Painter &, LyXFont const &) const;
82 int descent_collapsed(Painter &, LyXFont const &) const;
84 int width_collapsed(Painter &, LyXFont const & f) const;
86 void draw_collapsed(Painter & pain, const LyXFont &, int , float &) const;
88 void UpdateLocal(BufferView *, bool);
90 int getMaxTextWidth(Painter & pain, UpdatableInset const *, int x=0) const;
95 LColor::color framecolor;
106 button_length, button_top_y, button_bottom_y;