summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-06-18 02:32:32 +0300
committerAndrei Karas <akaras@inbox.ru>2017-06-18 02:32:32 +0300
commit4a819f03a40d0a402fda465dc3656cfe53317384 (patch)
treebb16c94679f17480fbc0b7d7b989773a8af73f2d
parentbe8edccc37bb2ce0b17cc950129cd57d65aac49a (diff)
downloadplus-4a819f03a40d0a402fda465dc3656cfe53317384.tar.gz
plus-4a819f03a40d0a402fda465dc3656cfe53317384.tar.bz2
plus-4a819f03a40d0a402fda465dc3656cfe53317384.tar.xz
plus-4a819f03a40d0a402fda465dc3656cfe53317384.zip
Fix asserts in browserbox on resize.
-rw-r--r--src/gui/widgets/browserbox.cpp7
-rw-r--r--src/gui/widgets/browserbox.h10
-rw-r--r--src/gui/widgets/tabs/chat/chattab.cpp1
3 files changed, 15 insertions, 3 deletions
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index f9ad9fc83..a4f6de473 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -65,6 +65,7 @@ BrowserBox::BrowserBox(const Widget2 *const widget,
const std::string &skin) :
Widget(widget),
MouseListener(),
+ WidgetListener(),
mTextRows(),
mTextRowLinksCount(),
mLineParts(),
@@ -98,6 +99,7 @@ BrowserBox::BrowserBox(const Widget2 *const widget,
setFocusable(true);
addMouseListener(this);
+ addWidgetListener(this);
mBackgroundColor = getThemeColor(ThemeColorId::BACKGROUND);
@@ -954,3 +956,8 @@ void BrowserBox::selectSelection()
mLinkHandler->handleLink(mLinks[CAST_SIZE(mSelectedLink)].link,
nullptr);
}
+
+void BrowserBox::widgetResized(const Event &event A_UNUSED)
+{
+ updateHeight();
+}
diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h
index aa5a70b0e..a80729cb5 100644
--- a/src/gui/widgets/browserbox.h
+++ b/src/gui/widgets/browserbox.h
@@ -24,8 +24,6 @@
#ifndef GUI_WIDGETS_BROWSERBOX_H
#define GUI_WIDGETS_BROWSERBOX_H
-#include "listeners/mouselistener.h"
-
#include "enums/simpletypes/opaque.h"
#include "enums/gui/browserboxmode.h"
@@ -36,6 +34,9 @@
#include "gui/widgets/linepart.h"
#include "gui/widgets/widget.h"
+#include "listeners/mouselistener.h"
+#include "listeners/widgetlistener.h"
+
#include "localconsts.h"
class LinkHandler;
@@ -45,7 +46,8 @@ class LinkHandler;
* parent conteiner.
*/
class BrowserBox final : public Widget,
- public MouseListener
+ public MouseListener,
+ public WidgetListener
{
public:
/**
@@ -155,6 +157,8 @@ class BrowserBox final : public Widget,
void selectSelection();
+ void widgetResized(const Event &event) override final;
+
private:
int calcHeight() A_WARN_UNUSED;
diff --git a/src/gui/widgets/tabs/chat/chattab.cpp b/src/gui/widgets/tabs/chat/chattab.cpp
index fc2f09350..d311ea83f 100644
--- a/src/gui/widgets/tabs/chat/chattab.cpp
+++ b/src/gui/widgets/tabs/chat/chattab.cpp
@@ -94,6 +94,7 @@ ChatTab::ChatTab(const Widget2 *const widget,
if (chatWindow != nullptr)
chatWindow->addTab(this);
+ mTextOutput->updateHeight();
}
ChatTab::~ChatTab()