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
20 #include "ControlMinipage.h"
28 // sorry this is just a temporary hack we should include vspace.h! (Jug)
29 extern const char * stringFromUnit(int);
31 ControlMinipage::ControlMinipage(LyXView & lv, Dialogs & d)
32 : ControlInset<InsetMinipage, MinipageParams>(lv, d)
34 d_.showMinipage.connect(slot(this, &ControlMinipage::showInset));
36 // We could have an extra method updateInset that calls
37 // view().update() rather than view().show(), but I don't see why
38 // it is really needed.
39 d_.updateMinipage.connect(slot(this, &ControlMinipage::showInset));
43 void ControlMinipage::applyParamsToInset()
45 inset()->width(params().width);
46 inset()->pos(params().pos);
48 lv_.view()->updateInset(inset(), true);
52 void ControlMinipage::applyParamsNoInset()
57 MinipageParams const ControlMinipage::getParams(InsetMinipage const & inset)
59 return MinipageParams(inset);
63 MinipageParams::MinipageParams()
64 : pos(InsetMinipage::top)
67 MinipageParams::MinipageParams(InsetMinipage const & inset)
68 : width(inset.width()), pos(inset.pos())
71 bool MinipageParams::operator==(MinipageParams const & o) const
73 return (width == o.width && pos == o.pos);
76 bool MinipageParams::operator!=(MinipageParams const & o) const
83 vector<string> const getUnits()
87 for(int i=0;(str=stringFromUnit(i));++i)
93 } // namespace minipage