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 
00026 class QToolButton;
00027 class QIntValidator;
00028 class QScrollView;
00029 class QScrollBar;
00030 class QLabel;
00031 class KLineEdit;
00032 class KexiRecordNavigatorPrivate;
00033 
00035 class KEXIGUIUTILS_EXPORT KexiRecordNavigatorHandler
00036 {
00037     public:
00038         KexiRecordNavigatorHandler();
00039         virtual ~KexiRecordNavigatorHandler();
00040 
00042         virtual void moveToRecordRequested(uint r) = 0;
00043         virtual void moveToLastRecordRequested() = 0;
00044         virtual void moveToPreviousRecordRequested() = 0;
00045         virtual void moveToNextRecordRequested() = 0;
00046         virtual void moveToFirstRecordRequested() = 0;
00047         virtual void addNewRecordRequested() = 0;
00048 };
00049 
00051 
00062 class KEXIGUIUTILS_EXPORT KexiRecordNavigator : public QFrame
00063 {
00064     Q_OBJECT
00065 
00066     public:
00067         KexiRecordNavigator(QWidget *parent, int leftMargin = 0, const char *name=0);
00068         virtual ~KexiRecordNavigator();
00069 
00070         void setParentView(QScrollView *view);
00071 
00074         void setRecordHandler(KexiRecordNavigatorHandler *handler);
00075 
00077         inline bool isInsertingEnabled() const { return m_isInsertingEnabled; }
00078 
00081         uint currentRecordNumber() const;
00082 
00084         uint recordCount() const;
00085 
00091         void setHBarGeometry( QScrollBar & hbar, int x, int y, int w, int h );
00092 
00094         virtual bool eventFilter( QObject *o, QEvent *e );
00095 
00098         bool editingIndicatorVisible() const;
00099 
00102         bool editingIndicatorEnabled() const;
00103 
00104     public slots:
00106         void setInsertingEnabled(bool set);
00107 
00109         void setInsertingButtonVisible(bool set);
00110 
00116         void setEditingIndicatorEnabled(bool set);
00117 
00119         void showEditingIndicator(bool show);
00120 
00121         virtual void setEnabled(bool set);
00122 
00127         void setCurrentRecordNumber(uint r);
00128 
00132         void setRecordCount(uint count);
00133 
00134         void updateGeometry(int leftMargin);
00135 
00138         void setLabelText(const QString& text);
00139 
00140     signals:
00141         void prevButtonClicked();
00142         void nextButtonClicked();
00143         void lastButtonClicked();
00144         void firstButtonClicked();
00145         void newButtonClicked();
00146         void recordNumberEntered( uint r );
00147 
00148     protected slots:
00149         void slotPrevButtonClicked();
00150         void slotNextButtonClicked();
00151         void slotLastButtonClicked();
00152         void slotFirstButtonClicked();
00153         void slotNewButtonClicked();
00154         //void slotRecordNumberReturnPressed(const QString& text);
00155 
00156     protected:
00157         void updateButtons(uint recCnt);
00158 
00159         QLabel *m_textLabel;
00160         QToolButton *m_navBtnFirst;
00161         QToolButton *m_navBtnPrev;
00162         QToolButton *m_navBtnNext;
00163         QToolButton *m_navBtnLast;
00164         QToolButton *m_navBtnNew;
00165         KLineEdit *m_navRecordNumber;
00166         QIntValidator *m_navRecordNumberValidator;
00167         KLineEdit *m_navRecordCount; 
00168         uint m_nav1DigitWidth;
00169 //      uint m_recordCount;
00170         QScrollView *m_view;
00171         bool m_isInsertingEnabled : 1;
00172 
00173         KexiRecordNavigatorPrivate *d;
00174 };
00175 
00176 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys