File indexing completed on 2024-06-23 04:40:22

0001 /*
0002    SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 #pragma once
0007 
0008 #include "textemoticonswidgets_private_export.h"
0009 #include <QListView>
0010 namespace TextEmoticonsWidgets
0011 {
0012 class TEXTEMOTICONSWIDGETS_TESTS_EXPORT EmoticonListView : public QListView
0013 {
0014     Q_OBJECT
0015 public:
0016     explicit EmoticonListView(QWidget *parent = nullptr);
0017     ~EmoticonListView() override;
0018 
0019     void setFontSize(int newFontSize);
0020 
0021     [[nodiscard]] bool isRecentView() const;
0022     void setIsRecentView(bool newIsRecentView);
0023 
0024 Q_SIGNALS:
0025     void emojiItemSelected(const QString &str, const QString &identifier);
0026     void fontSizeChanged(int size);
0027     void clearHistory();
0028 
0029 protected:
0030     void keyPressEvent(QKeyEvent *event) override;
0031     void wheelEvent(QWheelEvent *e) override;
0032     void contextMenuEvent(QContextMenuEvent *event) override;
0033 
0034 private:
0035     void applyFontSize();
0036     int mFontSize = 18;
0037     int mRowSize = 0;
0038     bool mIsRecentView = false;
0039 };
0040 }