summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2017-10-27 22:20:33 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2017-10-27 22:20:33 +0300
commit845228ac6ac549ec9af97ee0da3aaa71168f605e (patch)
treec950a69b9eda9f167444a1db1a1e85a2e0c3c73e /include
parentAdjust scrollbar only after pagination (#94) (diff)
downloadnheko-845228ac6ac549ec9af97ee0da3aaa71168f605e.tar.xz
Add scroll-down button
Diffstat (limited to 'include')
-rw-r--r--include/TimelineView.h4
-rw-r--r--include/ui/FloatingButton.h26
2 files changed, 30 insertions, 0 deletions
diff --git a/include/TimelineView.h b/include/TimelineView.h
index 400b0db0..83247948 100644
--- a/include/TimelineView.h
+++ b/include/TimelineView.h
@@ -34,6 +34,8 @@
 #include "RoomInfoListItem.h"
 #include "Text.h"
 
+class FloatingButton;
+
 namespace msgs   = matrix::events::messages;
 namespace events = matrix::events;
 
@@ -155,6 +157,8 @@ private:
         int oldPosition_;
         int oldHeight_;
 
+        FloatingButton *scrollDownBtn_;
+
         TimelineDirection lastMessageDirection_;
 
         // The events currently rendered. Used for duplicate detection.
diff --git a/include/ui/FloatingButton.h b/include/ui/FloatingButton.h
new file mode 100644
index 00000000..91e99ebb
--- /dev/null
+++ b/include/ui/FloatingButton.h
@@ -0,0 +1,26 @@
+#pragma once
+
+#include "RaisedButton.h"
+
+constexpr int DIAMETER  = 40;
+constexpr int ICON_SIZE = 18;
+
+constexpr int OFFSET_X = 30;
+constexpr int OFFSET_Y = 20;
+
+class FloatingButton : public RaisedButton
+{
+        Q_OBJECT
+
+public:
+        FloatingButton(const QIcon &icon, QWidget *parent = nullptr);
+
+        QSize sizeHint() const override { return QSize(DIAMETER, DIAMETER); };
+        QRect buttonGeometry() const;
+
+protected:
+        bool event(QEvent *event) override;
+        bool eventFilter(QObject *obj, QEvent *event) override;
+
+        void paintEvent(QPaintEvent *event) override;
+};