diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2015-08-11 09:08:12 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2015-08-11 09:08:12 +0000 |
| commit | 017d2d27bfbcd97ada407212e925b280ff3482b5 (patch) | |
| tree | 2a832873a52ee7c8546b6262be58f41d1bdd480e /src/plugins/Ui/qsui/listwidgetdrawer.h | |
| parent | 22cf3c55368be9361b43eb002e7a2fb7f2868ac2 (diff) | |
| download | qmmp-017d2d27bfbcd97ada407212e925b280ff3482b5.tar.gz qmmp-017d2d27bfbcd97ada407212e925b280ff3482b5.tar.bz2 qmmp-017d2d27bfbcd97ada407212e925b280ff3482b5.zip | |
added qsui plugin
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@5367 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Ui/qsui/listwidgetdrawer.h')
| -rw-r--r-- | src/plugins/Ui/qsui/listwidgetdrawer.h | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/src/plugins/Ui/qsui/listwidgetdrawer.h b/src/plugins/Ui/qsui/listwidgetdrawer.h new file mode 100644 index 000000000..72c987427 --- /dev/null +++ b/src/plugins/Ui/qsui/listwidgetdrawer.h @@ -0,0 +1,108 @@ +/*************************************************************************** + * Copyright (C) 2015 by Ilya Kotov * + * forkotov02@hotmail.ru * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#ifndef LISTWIDGETDRAWER_H +#define LISTWIDGETDRAWER_H + +#include <QString> +#include <QStringList> +#include <QColor> +#include <QRect> +#include <QFontMetrics> + + +class QPainter; +class PlayListHeaderModel; + +struct ListWidgetRow +{ + ListWidgetRow() + { + flags = NO_FLAGS; + numberColumnWidth = 0; + lengthColumnWidth = 0; + trackStateColumn = -1; + autoResize = false; + } + QStringList titles; + QList<int> sizes; + QString length; + QString extraString; + int number; + int numberColumnWidth; + int lengthColumnWidth; + int trackStateColumn; + enum + { + NO_FLAGS = 0x00, + GROUP = 0x01, + SELECTED = 0x02, + CURRENT = 0x04, + ANCHOR = 0x08 + }; + + int flags; + QRect rect; //geometry + bool autoResize; +}; + +/** + @author Ilya Kotov <forkotov02@hotmail.ru> +*/ +class ListWidgetDrawer +{ +public: + ListWidgetDrawer(); + ~ListWidgetDrawer(); + + void readSettings(); + void loadSystemColors(); + int rowHeight() const; + int numberWidth() const; + void calculateNumberWidth(int count); + void setSingleColumnMode(int enabled); + void prepareRow(ListWidgetRow *row); + void fillBackground(QPainter *painter, int width, int height); + void drawBackground(QPainter *painter, ListWidgetRow *row, int index); + void drawSeparator(QPainter *painter, ListWidgetRow *row, bool rtl); + void drawTrack(QPainter *painter, ListWidgetRow *row, bool rtl); + void drawDropLine(QPainter *painter, int row_number, int width, int header_height); + +private: + QColor m_normal, m_current, m_normal_bg, m_selected_bg, m_alternate, m_highlighted; + QColor m_group_bg, m_group_alt_bg, m_group_text; + QFontMetrics *m_metrics; + QFontMetrics *m_extra_metrics; + QFontMetrics *m_bold_metrics; + PlayListHeaderModel *m_header_model; + QFont m_font, m_extra_font; + bool m_update; + bool m_show_number; + bool m_show_anchor; + bool m_align_numbres; + bool m_show_lengths; + bool m_use_system_colors; + bool m_single_column; + int m_padding; + int m_number_width; + int m_row_height; +}; + +#endif // LISTWIDGETDRAWER_H |
