minor changes in MessageLayout

This commit is contained in:
fourtf
2018-01-28 04:07:45 +01:00
parent 772dc97d92
commit f474db9443
3 changed files with 13 additions and 42 deletions
+3 -24
View File
@@ -23,7 +23,7 @@ MessageLayout::MessageLayout(MessagePtr _message)
, buffer(nullptr)
{
if (_message->flags & Message::Collapsed) {
this->addFlags(MessageLayout::Collapsed);
this->flags &= MessageLayout::Collapsed;
}
}
@@ -38,27 +38,6 @@ int MessageLayout::getHeight() const
return container.getHeight();
}
// Flags
MessageLayout::Flags MessageLayout::getFlags() const
{
return this->flags;
}
bool MessageLayout::hasFlags(Flags _flags) const
{
return this->flags & _flags;
}
void MessageLayout::addFlags(Flags _flags)
{
this->flags = (Flags)((MessageLayoutFlagsType)this->flags | (MessageLayoutFlagsType)_flags);
}
void MessageLayout::removeFlags(Flags _flags)
{
this->flags = (Flags)((MessageLayoutFlagsType)this->flags & ~((MessageLayoutFlagsType)_flags));
}
// Layout
// return true if redraw is required
bool MessageLayout::layout(int width, float scale, MessageElement::Flags flags)
@@ -105,11 +84,11 @@ bool MessageLayout::layout(int width, float scale, MessageElement::Flags flags)
// update word sizes if needed
if (imagesChanged) {
// this->container.updateImages();
this->addFlags(MessageLayout::RequiresBufferUpdate);
this->flags &= MessageLayout::RequiresBufferUpdate;
}
if (textChanged) {
// this->container.updateText();
this->addFlags(MessageLayout::RequiresBufferUpdate);
this->flags &= MessageLayout::RequiresBufferUpdate;
}
if (widthChanged || wordMaskChanged) {
this->deleteBuffer();