2000-03-08 13:52:57 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
2000-03-09 03:36:48 +00:00
|
|
|
* Copyright 2000 The LyX Team.
|
2000-03-08 13:52:57 +00:00
|
|
|
*
|
|
|
|
*======================================================
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef INSETCOLLAPSABLE_H
|
|
|
|
#define INSETCOLLAPSABLE_H
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "insettext.h"
|
|
|
|
#include "lyxfont.h"
|
|
|
|
#include "LColor.h"
|
|
|
|
|
|
|
|
|
|
|
|
class Painter;
|
|
|
|
|
|
|
|
/** A colapsable text inset
|
|
|
|
|
|
|
|
*/
|
|
|
|
class InsetCollapsable : public InsetText {
|
|
|
|
public:
|
|
|
|
///
|
|
|
|
static int const TEXT_TO_TOP_OFFSET = 2;
|
|
|
|
///
|
|
|
|
static int const TEXT_TO_BOTTOM_OFFSET = 2;
|
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
explicit
|
2000-03-08 13:52:57 +00:00
|
|
|
InsetCollapsable(Buffer *);
|
|
|
|
///
|
|
|
|
~InsetCollapsable() {}
|
|
|
|
///
|
2000-03-09 16:13:43 +00:00
|
|
|
Inset * Clone() const;
|
2000-03-08 13:52:57 +00:00
|
|
|
///
|
2000-04-19 14:42:19 +00:00
|
|
|
void Read(LyXLex &);
|
|
|
|
///
|
|
|
|
void Write(std::ostream &) const;
|
|
|
|
///
|
2000-03-08 13:52:57 +00:00
|
|
|
int ascent(Painter &, LyXFont const &) const;
|
|
|
|
///
|
|
|
|
int descent(Painter &, LyXFont const &) const;
|
|
|
|
///
|
|
|
|
int width(Painter &, LyXFont const & f) const;
|
|
|
|
///
|
|
|
|
void draw(Painter & pain, const LyXFont &, int , float &) const;
|
|
|
|
///
|
|
|
|
void Edit(BufferView *, int, int, unsigned int);
|
|
|
|
///
|
|
|
|
EDITABLE Editable() const;
|
|
|
|
///
|
|
|
|
void InsetUnlock(BufferView *);
|
|
|
|
///
|
|
|
|
bool display() const { return (!collapsed); }
|
|
|
|
///
|
|
|
|
void InsetButtonRelease(BufferView *, int, int, int);
|
|
|
|
///
|
|
|
|
void InsetButtonPress(BufferView *, int, int, int);
|
|
|
|
///
|
|
|
|
void InsetMotionNotify(BufferView *, int, int, int);
|
|
|
|
///
|
|
|
|
void setLabel(string const & l) { label = l; }
|
|
|
|
///
|
|
|
|
void setLabelFont(LyXFont & f) { labelfont = f; }
|
|
|
|
///
|
2000-04-19 14:42:19 +00:00
|
|
|
void setAutoCollapse(bool f) { autocollapse = f; }
|
|
|
|
///
|
|
|
|
int getMaxWidth(Painter & pain, UpdatableInset const *) const;
|
2000-03-08 13:52:57 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
///
|
|
|
|
int ascent_collapsed(Painter &, LyXFont const &) const;
|
|
|
|
///
|
|
|
|
int descent_collapsed(Painter &, LyXFont const &) const;
|
|
|
|
///
|
|
|
|
int width_collapsed(Painter &, LyXFont const & f) const;
|
|
|
|
///
|
|
|
|
void draw_collapsed(Painter & pain, const LyXFont &, int , float &) const;
|
|
|
|
///
|
|
|
|
void UpdateLocal(BufferView *, bool);
|
2000-04-19 14:42:19 +00:00
|
|
|
///
|
|
|
|
int getMaxTextWidth(Painter & pain, UpdatableInset const *, int x=0) const;
|
2000-03-08 13:52:57 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
bool collapsed;
|
|
|
|
///
|
|
|
|
LColor::color framecolor;
|
|
|
|
|
|
|
|
private:
|
|
|
|
///
|
|
|
|
string label;
|
|
|
|
///
|
|
|
|
LyXFont labelfont;
|
|
|
|
///
|
2000-04-19 14:42:19 +00:00
|
|
|
bool autocollapse;
|
2000-03-08 13:52:57 +00:00
|
|
|
///
|
|
|
|
mutable int
|
2000-04-19 14:42:19 +00:00
|
|
|
button_length, button_top_y, button_bottom_y;
|
|
|
|
///
|
|
|
|
int widthOffset;
|
2000-03-08 13:52:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|