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"
30 // sorry this is just a temporary hack we should include vspace.h! (Jug)
31 extern const char * stringFromUnit(int);
33 ControlMinipage::ControlMinipage(LyXView & lv, Dialogs & d)
34 : ControlInset<InsetMinipage, MinipageParams>(lv, d)
36 d_.showMinipage.connect(slot(this, &ControlMinipage::showInset));
38 // We could have an extra method updateInset that calls
39 // view().update() rather than view().show(), but I don't see why
40 // it is really needed.
41 d_.updateMinipage.connect(slot(this, &ControlMinipage::showInset));
45 void ControlMinipage::applyParamsToInset()
47 inset()->width(params().width);
48 inset()->pos(params().pos);
50 lv_.view()->updateInset(inset(), true);
54 void ControlMinipage::applyParamsNoInset()
59 MinipageParams const ControlMinipage::getParams(InsetMinipage const & inset)
61 return MinipageParams(inset);
65 MinipageParams::MinipageParams()
66 : pos(InsetMinipage::top)
69 MinipageParams::MinipageParams(InsetMinipage const & inset)
70 : width(inset.width()), pos(inset.pos())
73 bool MinipageParams::operator==(MinipageParams const & o) const
75 return (width == o.width && pos == o.pos);
78 bool MinipageParams::operator!=(MinipageParams const & o) const
85 vector<string> const getUnits()
89 for(int i=0;(str=stringFromUnit(i));++i)
95 } // namespace minipage