00001 /**************************************************************************** 00002 ** 00003 ** Copyright (C) Qxt Foundation. Some rights reserved. 00004 ** 00005 ** This file is part of the QxtGui module of the Qxt library. 00006 ** 00007 ** This library is free software; you can redistribute it and/or modify it 00008 ** under the terms of the Common Public License, version 1.0, as published 00009 ** by IBM, and/or under the terms of the GNU Lesser General Public License, 00010 ** version 2.1, as published by the Free Software Foundation. 00011 ** 00012 ** This file is provided "AS IS", without WARRANTIES OR CONDITIONS OF ANY 00013 ** KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY 00014 ** WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR 00015 ** FITNESS FOR A PARTICULAR PURPOSE. 00016 ** 00017 ** You should have received a copy of the CPL and the LGPL along with this 00018 ** file. See the LICENSE file and the cpl1.0.txt/lgpl-2.1.txt files 00019 ** included with the source distribution for more information. 00020 ** If you did not receive a copy of the licenses, contact the Qxt Foundation. 00021 ** 00022 ** <http://libqxt.org> <foundation@libqxt.org> 00023 ** 00024 ****************************************************************************/ 00025 #ifndef QXTCONFIGDIALOG_P_H 00026 #define QXTCONFIGDIALOG_P_H 00027 00028 #include "qxtpimpl.h" 00029 #include "qxtconfigdialog.h" 00030 #include <QItemDelegate> 00031 #include <QTableWidget> 00032 00033 QT_FORWARD_DECLARE_CLASS(QSplitter) 00034 QT_FORWARD_DECLARE_CLASS(QStackedWidget) 00035 QT_FORWARD_DECLARE_CLASS(QDialogButtonBox) 00036 00037 class QxtConfigTableWidget : public QTableWidget 00038 { 00039 public: 00040 QxtConfigTableWidget(QWidget* parent = 0); 00041 QStyleOptionViewItem viewOptions() const; 00042 QSize sizeHint() const; 00043 00044 bool hasHoverEffect() const; 00045 void setHoverEffect(bool enabled); 00046 }; 00047 00048 class QxtConfigDelegate : public QItemDelegate 00049 { 00050 public: 00051 QxtConfigDelegate(QObject* parent = 0); 00052 void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const; 00053 QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const; 00054 bool hover; 00055 }; 00056 00057 class QxtConfigDialogPrivate : public QObject, public QxtPrivate<QxtConfigDialog> 00058 { 00059 Q_OBJECT 00060 00061 public: 00062 QXT_DECLARE_PUBLIC(QxtConfigDialog); 00063 00064 void init(QxtConfigDialog::IconPosition position = QxtConfigDialog::West); 00065 void initTable(); 00066 void relayout(); 00067 QTableWidgetItem* item(int index) const; 00068 00069 QSplitter* splitter; 00070 QStackedWidget* stack; 00071 #if QT_VERSION >= 0x040200 00072 QDialogButtonBox* buttons; 00073 #else // QT_VERSION >= 0x040200 00074 QWidget* buttons; 00075 #endif // QT_VERSION 00076 QxtConfigTableWidget* table; 00077 QxtConfigDialog::IconPosition pos; 00078 00079 public Q_SLOTS: 00080 void setCurrentIndex(int row, int column); 00081 void setCurrentIndex(int index); 00082 }; 00083 00084 #endif // QXTCONFIGDIALOG_P_H