view include/gui/sidebar.h @ 10:4b198a111713

Update things actually compile now btw qttest wants to fuck over the model but that might be my fault so /shrug
author Paper <mrpapersonic@gmail.com>
date Sat, 16 Sep 2023 02:06:01 -0400
parents 5c0397762b53
children cde8f67a7c7d
line wrap: on
line source

#ifndef __gui__sidebar_h
#define __gui__sidebar_h
#include <QItemSelectionModel>
#include <QListWidget>
#include <QListWidgetItem>
class SideBar : public QListWidget {
		Q_OBJECT

	public:
		SideBar(QWidget* parent = nullptr);
		QListWidgetItem* AddItem(QString name, QIcon icon = QIcon());
		QListWidgetItem* AddSeparator();
		bool IndexIsSeparator(QModelIndex index) const;
		static QIcon CreateIcon(const char* file);

	signals:
		void CurrentItemChanged(int index);

	protected:
		virtual void mouseMoveEvent(QMouseEvent* event) override;
		QItemSelectionModel::SelectionFlags selectionCommand(const QModelIndex& index,
															 const QEvent* event) const override;
		int RemoveSeparatorsFromIndex(int index);
};
#endif // __gui__sidebar_h