kexi

kexiviewbase.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2004 Jaroslaw Staniek <js@iidea.pl>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef KEXIVIEWBASE_H
00021 #define KEXIVIEWBASE_H
00022 
00023 #include <qwidget.h>
00024 
00025 #include "kexiactionproxy.h"
00026 
00027 class KexiMainWindow;
00028 class KexiDialogBase;
00029 
00030 namespace KoProperty {
00031     class Set;
00032 }
00033 
00034 namespace KexiDB {
00035     class SchemaData;
00036 }
00037 
00039 
00052 class KEXICORE_EXPORT KexiViewBase : public QWidget, public KexiActionProxy
00053 {
00054     Q_OBJECT
00055 
00056     public:
00057         KexiViewBase(KexiMainWindow *mainWin, QWidget *parent, const char *name = 0);
00058         virtual ~KexiViewBase();
00059 
00061         inline KexiMainWindow *mainWin() const { return m_mainWin; }
00062 
00064         KexiDialogBase* parentDialog() const { return m_dialog; }
00065 
00069         KexiPart::Part* part() const;
00070 
00076         virtual QSize preferredSizeHint(const QSize& otherSize);
00077 
00078         virtual bool eventFilter( QObject *o, QEvent *e );
00079 
00080         void addChildView( KexiViewBase* childView );
00081 
00090         virtual bool dirty() const { return m_dirty; }
00091 
00093         int viewMode() const { return m_viewMode; }
00094 
00099         virtual KAction* sharedAction( const char *action_name );
00100 
00103         virtual void setAvailable(const char* action_name, bool set);
00104 
00105     public slots:
00106         virtual void setFocus();
00107 
00111         void propertySetSwitched();
00112 
00118         void setDirty(bool set);
00119 
00121         void setDirty() { setDirty(true); }
00122 
00123     signals:
00125         void closing(bool& cancel);
00126 
00127         void focus(bool in);
00128 
00129     protected:
00138         virtual tristate beforeSwitchTo(int mode, bool &dontStore);
00139 
00146         virtual tristate afterSwitchFrom(int mode);
00147 
00148         virtual void closeEvent( QCloseEvent * e );
00149 
00151         virtual KoProperty::Set *propertySet();
00152 
00159         void propertySetReloaded(bool preservePrevSelection = false);
00160 
00180         virtual KexiDB::SchemaData* storeNewData(const KexiDB::SchemaData& sdata, bool &cancel);
00181 
00188         bool loadDataBlock( QString &dataString, const QString& dataID = QString::null, bool canBeEmpty = false );
00189 
00202         virtual tristate storeData(bool dontAsk = false);
00203 
00214         bool storeDataBlock( const QString &dataString, const QString &dataID = QString::null );
00215 
00221         bool removeDataBlock( const QString& dataID = QString::null);
00222 
00223         void setViewWidget(QWidget* w, bool focusProxy = false);
00224 
00231         virtual void updateActions(bool activated);
00232 
00233         virtual void setFocusInternal() { QWidget::setFocus(); }
00234 
00239         virtual void parentDialogDetached() {};
00240 
00245         virtual void parentDialogAttached() {};
00246 
00247         QString m_defaultIconName;
00248 
00249         KexiMainWindow *m_mainWin;
00250 
00251         KexiDialogBase *m_dialog;
00252 
00253         QWidget *m_viewWidget;
00254 
00255         KexiViewBase *m_parentView;
00256 
00257         QGuardedPtr<QWidget> m_lastFocusedChildBeforeFocusOut;
00258 
00259     private:
00266         int m_newlyAssignedID;
00267 
00270         int m_viewMode;
00271 
00272         QPtrList<KexiViewBase> m_children;
00273 
00274         bool m_dirty : 1;
00275 
00276     friend class KexiDialogBase;
00277 };
00278 
00279 #endif
00280 
KDE Home | KDE Accessibility Home | Description of Access Keys