diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2015-02-15 17:22:04 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2015-02-15 17:22:04 +0000 |
| commit | 631f5b826ce2547fa55a22133e95f232a03c4b3f (patch) | |
| tree | 90a0f5ffa6b1f3fa5c655c171bf31bddb2080c18 /src/plugins/Ui/skinned/listwidgetdrawer.h | |
| parent | 14be2d439ed0bf0b3d1389bc6b9174808606974c (diff) | |
| download | qmmp-631f5b826ce2547fa55a22133e95f232a03c4b3f.tar.gz qmmp-631f5b826ce2547fa55a22133e95f232a03c4b3f.tar.bz2 qmmp-631f5b826ce2547fa55a22133e95f232a03c4b3f.zip | |
moved drawing functions to separate class
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@4725 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Ui/skinned/listwidgetdrawer.h')
| -rw-r--r-- | src/plugins/Ui/skinned/listwidgetdrawer.h | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/src/plugins/Ui/skinned/listwidgetdrawer.h b/src/plugins/Ui/skinned/listwidgetdrawer.h new file mode 100644 index 000000000..717401d1b --- /dev/null +++ b/src/plugins/Ui/skinned/listwidgetdrawer.h @@ -0,0 +1,92 @@ +/*************************************************************************** + * 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 <QColor> +#include <QRect> +#include <QFontMetrics> + +class Skin; +class QPainter; + +struct ListWidgetRow +{ + ListWidgetRow() + { + flags = NO_FLAGS; + } + QString title; + QString length; + QString extraString; + int number; + enum + { + NO_FLAGS = 0x00, + GROUP = 0x01, + SELECTED = 0x02, + CURRENT = 0x04, + ANCHOR = 0x08 + }; + + int flags; + + + //geometry + QRect rect; + + + + //TODO remove + bool separator; + bool selected; + bool current; + int bgY; //top of the background + int textY; //base line of the text +}; + +/** + @author Ilya Kotov <forkotov02@hotmail.ru> +*/ +class ListWidgetDrawer +{ +public: + ListWidgetDrawer(); + ~ListWidgetDrawer(); + + void readSettings(); + void loadColors(); + void drawBackground(QPainter *painter, ListWidgetRow *row); + void drawSeparator(QPainter *painter, int m_number_width, ListWidgetRow *row, bool rtl); + void drawTrack(QPainter *painter, int m_number_width, ListWidgetRow *row, bool rtl); + +private: + QColor m_normal, m_current, m_normal_bg, m_selected_bg; + Skin *m_skin; + QFontMetrics *m_metrics; + QFontMetrics *m_extra_metrics; + QFont m_font, m_extra_font; + bool m_show_anchor; + bool m_update; +}; + +#endif // LISTWIDGETDRAWER_H |
