kexirecordnavigator.h
1/* This file is part of the KDE project
2 Copyright (C) 2004 Lucijan Busch <lucijan@kde.org>
3 Copyright (C) 2003-2004 Jaroslaw Staniek <js@iidea.pl>
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this program; see the file COPYING. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KEXIRECORDNAVIGATOR_H
22#define KEXIRECORDNAVIGATOR_H
23
24#include <tqframe.h>
25#include <kexi_export.h>
26
27class TQToolButton;
28class TQIntValidator;
29class TQScrollView;
30class TQScrollBar;
31class TQLabel;
32class KLineEdit;
33class KGuiItem;
34class KexiRecordNavigatorPrivate;
35
37class KEXIGUIUTILS_EXPORT KexiRecordNavigatorHandler
38{
39 public:
42
44 virtual void moveToRecordRequested(uint r) = 0;
45 virtual void moveToLastRecordRequested() = 0;
46 virtual void moveToPreviousRecordRequested() = 0;
47 virtual void moveToNextRecordRequested() = 0;
48 virtual void moveToFirstRecordRequested() = 0;
49 virtual void addNewRecordRequested() = 0;
50};
51
52
54
65class KEXIGUIUTILS_EXPORT KexiRecordNavigator : public TQFrame
66{
67 TQ_OBJECT
68
69
70 public:
71 KexiRecordNavigator(TQWidget *parent, int leftMargin = 0, const char *name=0);
72 virtual ~KexiRecordNavigator();
73
74 void setParentView(TQScrollView *view);
75
78 void setRecordHandler(KexiRecordNavigatorHandler *handler);
79
81 inline bool isInsertingEnabled() const { return m_isInsertingEnabled; }
82
85 uint currentRecordNumber() const;
86
88 uint recordCount() const;
89
95 void setHBarGeometry( TQScrollBar & hbar, int x, int y, int w, int h );
96
98 virtual bool eventFilter( TQObject *o, TQEvent *e );
99
102 bool editingIndicatorVisible() const;
103
106 bool editingIndicatorEnabled() const;
107
109
110 class KEXIGUIUTILS_EXPORT Actions {
111 public:
112 static const KGuiItem& moveToFirstRecord();
113 static const KGuiItem& moveToPreviousRecord();
114 static const KGuiItem& moveToNextRecord();
115 static const KGuiItem& moveToLastRecord();
116 static const KGuiItem& moveToNewRecord();
117 };
118
119 public slots:
121 void setInsertingEnabled(bool set);
122
124 void setInsertingButtonVisible(bool set);
125
131 void setEditingIndicatorEnabled(bool set);
132
134 void showEditingIndicator(bool show);
135
136 virtual void setEnabled(bool set);
137
142 void setCurrentRecordNumber(uint r);
143
147 void setRecordCount(uint count);
148
149 void updateGeometry(int leftMargin);
150
153 void setLabelText(const TQString& text);
154
155 signals:
156 void prevButtonClicked();
157 void nextButtonClicked();
158 void lastButtonClicked();
159 void firstButtonClicked();
160 void newButtonClicked();
161 void recordNumberEntered( uint r );
162
163 protected slots:
164 void slotPrevButtonClicked();
165 void slotNextButtonClicked();
166 void slotLastButtonClicked();
167 void slotFirstButtonClicked();
168 void slotNewButtonClicked();
169 //void slotRecordNumberReturnPressed(const TQString& text);
170
171 protected:
172 void updateButtons(uint recCnt);
173
174 TQLabel *m_textLabel;
175 TQToolButton *m_navBtnFirst;
176 TQToolButton *m_navBtnPrev;
177 TQToolButton *m_navBtnNext;
178 TQToolButton *m_navBtnLast;
179 TQToolButton *m_navBtnNew;
180 KLineEdit *m_navRecordNumber;
181 TQIntValidator *m_navRecordNumberValidator;
182 KLineEdit *m_navRecordCount;
183 uint m_nav1DigitWidth;
184// uint m_recordCount;
185 TQScrollView *m_view;
186 bool m_isInsertingEnabled : 1;
187
188 KexiRecordNavigatorPrivate *d;
189};
190
191#endif
KexiRecordNavigatorHandler interface handles requests generated by KexiRecordNavigator.
virtual void moveToRecordRequested(uint r)=0
Moving to record r is requested. Records are counted from 0.
A set of GUI items usable for displaying related actions.
KexiRecordNavigator class provides a record navigator.
bool isInsertingEnabled() const
KLineEdit * m_navRecordCount
readonly counter