1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 2001 The LyX Team.
8 * ======================================================
10 * \author Jürgen Vigna, jug@sad.it
11 * \author Angus Leeming, a.leeming@ic.ac.uk
17 #pragma implementation
21 #include "ButtonControllerBase.h"
22 #include "ControlMinipage.h"
26 #include "BufferView.h"
31 // sorry this is just a temporary hack we should include vspace.h! (Jug)
32 extern const char * stringFromUnit(int);
34 ControlMinipage::ControlMinipage(LyXView & lv, Dialogs & d)
35 : ControlInset<InsetMinipage, MinipageParams>(lv, d)
37 d_.showMinipage.connect(slot(this, &ControlMinipage::showInset));
39 // We could have an extra method updateInset that calls
40 // view().update() rather than view().show(), but I don't see why
41 // it is really needed.
42 d_.updateMinipage.connect(slot(this, &ControlMinipage::showInset));
46 void ControlMinipage::applyParamsToInset()
48 inset()->width(params().width);
49 inset()->pos(params().pos);
51 lv_.view()->updateInset(inset(), true);
55 void ControlMinipage::applyParamsNoInset()
60 MinipageParams const ControlMinipage::getParams(InsetMinipage const & inset)
62 return MinipageParams(inset);
66 MinipageParams::MinipageParams()
67 : pos(InsetMinipage::top)
70 MinipageParams::MinipageParams(InsetMinipage const & inset)
71 : width(inset.width()), pos(inset.pos())
75 bool operator==(MinipageParams const & p1, MinipageParams const & p2)
77 return (p1.width == p2.width && p1.pos == p2.pos);
81 bool operator!=(MinipageParams const & p1, MinipageParams const & p2)
88 vector<string> const getUnits()
92 for(int i=0; (str = stringFromUnit(i)); ++i)
98 } // namespace minipage