kexi

kexirecordnavigator.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2004 Lucijan Busch <lucijan@kde.org>
00003    Copyright (C) 2003-2004 Jaroslaw Staniek <js@iidea.pl>
00004 
00005    This program is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this program; see the file COPYING.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef KEXIRECORDNAVIGATOR_H
00022 #define KEXIRECORDNAVIGATOR_H
00023 
00024 #include <qframe.h>
00025 #include <kexi_export.h>
00026 
00027 class QToolButton;
00028 class QIntValidator;
00029 class QScrollView;
00030 class QScrollBar;
00031 class QLabel;
00032 class KLineEdit;
00033 class KGuiItem;
00034 class KexiRecordNavigatorPrivate;
00035 
00037 class KEXIGUIUTILS_EXPORT KexiRecordNavigatorHandler
00038 {
00039     public:
00040         KexiRecordNavigatorHandler();
00041         virtual ~KexiRecordNavigatorHandler();
00042 
00044         virtual void moveToRecordRequested(uint r) = 0;
00045         virtual void moveToLastRecordRequested() = 0;
00046         virtual void moveToPreviousRecordRequested() = 0;
00047         virtual void moveToNextRecordRequested() = 0;
00048         virtual void moveToFirstRecordRequested() = 0;
00049         virtual void addNewRecordRequested() = 0;
00050 };
00051 
00052 
00054 
00065 class KEXIGUIUTILS_EXPORT KexiRecordNavigator : public QFrame
00066 {
00067     Q_OBJECT
00068 
00069     public:
00070         KexiRecordNavigator(QWidget *parent, int leftMargin = 0, const char *name=0);
00071         virtual ~KexiRecordNavigator();
00072 
00073         void setParentView(QScrollView *view);
00074 
00077         void setRecordHandler(KexiRecordNavigatorHandler *handler);
00078 
00080         inline bool isInsertingEnabled() const { return m_isInsertingEnabled; }
00081 
00084         uint currentRecordNumber() const;
00085 
00087         uint recordCount() const;
00088 
00094         void setHBarGeometry( QScrollBar & hbar, int x, int y, int w, int h );
00095 
00097         virtual bool eventFilter( QObject *o, QEvent *e );
00098 
00101         bool editingIndicatorVisible() const;
00102 
00105         bool editingIndicatorEnabled() const;
00106 
00108 
00109         class KEXIGUIUTILS_EXPORT Actions {
00110             public:
00111                 static const KGuiItem& moveToFirstRecord();
00112                 static const KGuiItem& moveToPreviousRecord();
00113                 static const KGuiItem& moveToNextRecord();
00114                 static const KGuiItem& moveToLastRecord();
00115                 static const KGuiItem& moveToNewRecord();
00116         };
00117 
00118     public slots:
00120         void setInsertingEnabled(bool set);
00121 
00123         void setInsertingButtonVisible(bool set);
00124 
00130         void setEditingIndicatorEnabled(bool set);
00131 
00133         void showEditingIndicator(bool show);
00134 
00135         virtual void setEnabled(bool set);
00136 
00141         void setCurrentRecordNumber(uint r);
00142 
00146         void setRecordCount(uint count);
00147 
00148         void updateGeometry(int leftMargin);
00149 
00152         void setLabelText(const QString& text);
00153 
00154     signals:
00155         void prevButtonClicked();
00156         void nextButtonClicked();
00157         void lastButtonClicked();
00158         void firstButtonClicked();
00159         void newButtonClicked();
00160         void recordNumberEntered( uint r );
00161 
00162     protected slots:
00163         void slotPrevButtonClicked();
00164         void slotNextButtonClicked();
00165         void slotLastButtonClicked();
00166         void slotFirstButtonClicked();
00167         void slotNewButtonClicked();
00168         //void slotRecordNumberReturnPressed(const QString& text);
00169 
00170     protected:
00171         void updateButtons(uint recCnt);
00172 
00173         QLabel *m_textLabel;
00174         QToolButton *m_navBtnFirst;
00175         QToolButton *m_navBtnPrev;
00176         QToolButton *m_navBtnNext;
00177         QToolButton *m_navBtnLast;
00178         QToolButton *m_navBtnNew;
00179         KLineEdit *m_navRecordNumber;
00180         QIntValidator *m_navRecordNumberValidator;
00181         KLineEdit *m_navRecordCount; 
00182         uint m_nav1DigitWidth;
00183 //      uint m_recordCount;
00184         QScrollView *m_view;
00185         bool m_isInsertingEnabled : 1;
00186 
00187         KexiRecordNavigatorPrivate *d;
00188 };
00189 
00190 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys