}
-bool InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
{
autoOpen_ = mi.base.bv->cursor().isInside(this);
int d = 0;
docstring s = layout_.labelstring;
theFontMetrics(font).rectText(s, w, a, d);
- dim.wid = max(dim.wid, w);
- dim.des += ascent();
+ dim.des += a + d;
break;
}
case TopButton:
}
break;
}
-
- bool const changed = dim_ != dim;
- dim_ = dim;
- return changed;
}
InsetText::draw(pi, textx, texty);
const_cast<InsetCollapsable *>(this)->setDrawFrame(true);
- int desc = InsetText::descent();
- if (geometry() == SubLabel)
- desc -= ascent();
- else
+ int desc = textdim.descent();
+ if (geometry() == Corners)
desc -= 3;
const int xx1 = x + TEXT_TO_INSET_OFFSET - 1;
int d = 0;
docstring s = layout_.labelstring;
theFontMetrics(font).rectText(s, w, a, d);
- pi.pain.rectText(x + (textdim.wid - w) / 2, y + desc + a,
+ int const ww = max(textdim.wid, w);
+ pi.pain.rectText(x + (ww - w) / 2, y + desc + a,
s, font, Color::none, Color::none);
+ desc += d;
}
// a visual cue when the cursor is inside the inset
Cursor & cur = pi.base.bv->cursor();
if (cur.isInside(this)) {
- y -= ascent();
+ y -= textdim.asc;
y += 3;
pi.pain.line(xx1, y + 4, xx1, y, layout_.labelfont.color());
pi.pain.line(xx1 + 4, y, xx1, y, layout_.labelfont.color());
void InsetCollapsable::cursorPos(BufferView const & bv,
CursorSlice const & sl, bool boundary, int & x, int & y) const
{
+ if (geometry() == ButtonOnly)
+ status_ = Open;
BOOST_ASSERT(geometry() != ButtonOnly);
InsetText::cursorPos(bv, sl, boundary, x, y);