From 631f5b826ce2547fa55a22133e95f232a03c4b3f Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Sun, 15 Feb 2015 17:22:04 +0000 Subject: 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 --- src/plugins/Ui/skinned/listwidgetdrawer.h | 92 +++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 src/plugins/Ui/skinned/listwidgetdrawer.h (limited to 'src/plugins/Ui/skinned/listwidgetdrawer.h') 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 +#include +#include +#include + +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 +*/ +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 -- cgit v1.2.3-13-gbd6f