kexi

kexiscrollview.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
00003    Copyright (C) 2004 Jaroslaw Staniek <js@iidea.pl>
00004 
00005    This library 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 library 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 library; see the file COPYING.LIB.  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 KEXISCROLLVIEW_H
00022 #define KEXISCROLLVIEW_H
00023 
00024 #include <qscrollview.h>
00025 #include <qtimer.h>
00026 
00027 class QColor;
00028 class QFont;
00029 class KexiRecordNavigator;
00030 
00032 
00034 class KEXIEXTWIDGETS_EXPORT KexiScrollView : public QScrollView
00035 {
00036     Q_OBJECT
00037 
00038     public:
00039         KexiScrollView(QWidget *parent, bool preview);
00040         virtual ~KexiScrollView();
00041 
00042         void setWidget(QWidget *w);
00043         void setSnapToGrid(bool enable, int gridSize=10);
00044 
00045         void setResizingEnabled(bool enabled) { m_enableResizing = enabled; }
00046         void setRecordNavigatorVisible(bool visible);
00047 
00048         void setOuterAreaIndicatorVisible(bool visible)  { m_outerAreaVisible = visible; }
00049 
00050         void refreshContentsSizeLater(bool horizontal, bool vertical);
00051         void updateNavPanelGeometry();
00052 
00053         KexiRecordNavigator* recordNavigator() const;
00054 
00055         inline bool preview() const { return m_preview; }
00056 
00057     public slots:
00059         virtual void refreshContentsSize();
00060 
00061     signals:
00062         void outerAreaClicked();
00063         void resizingStarted();
00064         void resizingEnded();
00065 
00066     protected:
00067         virtual void contentsMousePressEvent(QMouseEvent * ev);
00068         virtual void contentsMouseReleaseEvent(QMouseEvent * ev);
00069         virtual void contentsMouseMoveEvent(QMouseEvent * ev);
00070         virtual void drawContents( QPainter * p, int clipx, int clipy, int clipw, int cliph );
00071         virtual void leaveEvent( QEvent *e );
00072         virtual void setHBarGeometry( QScrollBar & hbar, int x, int y, int w, int h );
00073         void setupPixmapBuffer(QPixmap& pixmap, const QString& text, int lines);
00074 
00075         bool m_resizing;
00076         bool m_enableResizing;
00077         QWidget *m_widget;
00078 
00079         int m_gridSize;
00080         QFont m_helpFont;
00081         QColor m_helpColor;
00082         QTimer m_delayedResize;
00084         QScrollView::ScrollBarMode m_vsmode, m_hsmode;
00085         bool m_snapToGrid : 1;
00086         bool m_preview : 1;
00087         bool m_smodeSet : 1;
00088         bool m_outerAreaVisible : 1;
00089         KexiRecordNavigator* m_scrollViewNavPanel;
00090 };
00091 
00092 #endif
00093 
KDE Home | KDE Accessibility Home | Description of Access Keys