mirror-chatterino2/src/widgets/notebook.hpp

80 lines
1.6 KiB
C++
Raw Normal View History

#pragma once
2016-12-29 17:31:07 +01:00
#include "widgets/basewidget.hpp"
2017-11-12 17:21:50 +01:00
#include "widgets/helper/notebookbutton.hpp"
#include "widgets/helper/notebooktab.hpp"
#include "widgets/splitcontainer.hpp"
2016-12-29 17:31:07 +01:00
2017-01-18 04:52:47 +01:00
#include <QList>
#include <QWidget>
#include <boost/property_tree/ptree.hpp>
2017-01-18 04:52:47 +01:00
2017-04-14 17:52:22 +02:00
namespace chatterino {
class ChannelManager;
2017-04-14 17:52:22 +02:00
namespace widgets {
2017-01-18 21:30:23 +01:00
2017-11-12 17:21:50 +01:00
class Window;
class Notebook : public BaseWidget
2016-12-29 17:31:07 +01:00
{
2017-01-11 18:52:09 +01:00
Q_OBJECT
2016-12-29 17:31:07 +01:00
public:
enum HighlightType { none, highlighted, newMessage };
2016-12-29 17:31:07 +01:00
2017-11-12 17:21:50 +01:00
explicit Notebook(ChannelManager &_channelManager, Window *parent, bool showButtons);
2016-12-30 12:20:26 +01:00
2017-11-12 17:21:50 +01:00
SplitContainer *addPage(bool select = false);
2016-12-30 12:20:26 +01:00
2017-11-12 17:21:50 +01:00
void removePage(SplitContainer *page);
void select(SplitContainer *page);
2017-11-12 17:21:50 +01:00
SplitContainer *getSelectedPage() const
{
return selectedPage;
}
2017-01-26 05:26:21 +01:00
void performLayout(bool animate = true);
2016-12-30 18:00:25 +01:00
2017-12-14 00:25:06 +01:00
int tabCount();
2017-11-12 17:21:50 +01:00
SplitContainer *tabAt(QPoint point, int &index);
void rearrangePage(SplitContainer *page, int index);
2017-01-22 12:46:35 +01:00
void nextTab();
void previousTab();
2016-12-30 12:20:26 +01:00
protected:
void resizeEvent(QResizeEvent *);
2016-12-29 17:31:07 +01:00
2017-01-01 18:43:52 +01:00
void settingsButtonMouseReleased(QMouseEvent *event);
public slots:
void settingsButtonClicked();
void usersButtonClicked();
void addPageButtonClicked();
2017-01-01 18:43:52 +01:00
public:
ChannelManager &channelManager;
private:
2017-11-12 17:21:50 +01:00
QList<SplitContainer *> pages;
2016-12-30 12:20:26 +01:00
NotebookButton addButton;
NotebookButton settingsButton;
NotebookButton userButton;
2016-12-30 12:20:26 +01:00
2017-11-12 17:21:50 +01:00
SplitContainer *selectedPage = nullptr;
bool showButtons;
public:
void load(const boost::property_tree::ptree &tree);
void save(boost::property_tree::ptree &tree);
void loadDefaults();
2016-12-29 17:31:07 +01:00
};
2017-04-14 17:52:22 +02:00
} // namespace widgets
} // namespace chatterino