File indexing completed on 2024-12-22 04:17:30

0001 /***************************************************************************
0002  *                                                                         *
0003  *   copyright : (C) 2007 The University of Toronto                        *
0004  *                   netterfield@astro.utoronto.ca                         *
0005  *                                                                         *
0006  *   This program is free software; you can redistribute it and/or modify  *
0007  *   it under the terms of the GNU General Public License as published by  *
0008  *   the Free Software Foundation; either version 2 of the License, or     *
0009  *   (at your option) any later version.                                   *
0010  *                                                                         *
0011  ***************************************************************************/
0012 
0013 #ifndef DIALOGPAGE_H
0014 #define DIALOGPAGE_H
0015 
0016 #include <QTabWidget>
0017 #include <QPointer>
0018 
0019 #include "kst_export.h"
0020 
0021 namespace Kst {
0022 
0023 class Dialog;
0024 class DialogTab;
0025 
0026 class DialogPage : public QWidget
0027 {
0028   Q_OBJECT
0029   public:
0030     explicit DialogPage(Dialog *parent);
0031     virtual ~DialogPage();
0032 
0033     Dialog *dialog() const;
0034 
0035     QString pageTitle() const { return _pageTitle; }
0036     void setPageTitle(const QString &pageTitle) { _pageTitle = pageTitle; }
0037 
0038     QPixmap pageIcon() const { return _pageIcon; }
0039     void setPageIcon(const QPixmap &pageIcon) { _pageIcon = pageIcon; }
0040 
0041     void addDialogTab(DialogTab *tab);
0042 
0043     virtual QWidget* currentWidget();
0044 
0045   Q_SIGNALS:
0046     void ok();
0047     void apply();
0048     void cancel();
0049     void modified();
0050 
0051   private:
0052     QString _pageTitle;
0053     QPixmap _pageIcon;
0054     QPointer<Dialog> _dialog;
0055     QWidget* _widget;
0056 };
0057 
0058 class DialogPageTab : public DialogPage
0059 {
0060   Q_OBJECT
0061   public:
0062     explicit DialogPageTab(Dialog *parent);
0063     virtual ~DialogPageTab();
0064 
0065     void addDialogTab(DialogTab *tab);
0066     void setTabText(int i, const QString &title);
0067 
0068     QWidget* currentWidget();
0069 
0070   private:
0071     QTabWidget* _tabWidget;
0072 };
0073 
0074 }
0075 
0076 #endif
0077 
0078 // vim: ts=2 sw=2 et