• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDEUI

kdatetable.h

Go to the documentation of this file.
00001 /*  -*- C++ -*-
00002     This file is part of the KDE libraries
00003     Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org)
00004               (C) 1998-2001 Mirko Boehm (mirko@kde.org)
00005               (C) 2007 John Layt <john@layt.net>
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010  
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015  
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #ifndef KDATETABLE_H
00023 #define KDATETABLE_H
00024 
00025 #include <kdeui_export.h>
00026 
00027 #include <QtGui/QValidator>
00028 #include <QtGui/QLineEdit>
00029 #include <QtCore/QDateTime>
00030 
00031 class KMenu;
00032 class KCalendarSystem;
00033 
00038 class KDEUI_EXPORT KPopupFrame : public QFrame
00039 {
00040     Q_OBJECT
00041 protected:
00045     virtual void keyPressEvent( QKeyEvent *e );
00046 
00047 public Q_SLOTS:
00052     void close( int r );
00053 
00054 public:
00058     KPopupFrame( QWidget *parent = 0 );
00059 
00063     ~KPopupFrame();
00064 
00072     void setMainWidget( QWidget* m );
00073 
00078     virtual void resizeEvent( QResizeEvent *resize );
00079 
00083     void popup( const QPoint &pos );
00084 
00088     int exec( const QPoint &p );
00089 
00093     int exec( int x, int y );
00094 
00095 Q_SIGNALS:
00096     void leaveModality();
00097 
00098 private:
00099     class KPopupFramePrivate;
00100     friend class KPopupFramePrivate;
00101     KPopupFramePrivate * const d;
00102 
00103     Q_DISABLE_COPY( KPopupFrame )
00104 };
00105 
00109 class KDEUI_EXPORT KDateValidator : public QValidator
00110 {
00111 public:
00112     KDateValidator( QWidget *parent = 0 );
00113     virtual State validate( QString &text, int &e ) const;
00114     virtual void fixup ( QString &input ) const;
00115     State date( const QString &text, QDate &date ) const;
00116 private:
00117     class KDateValidatorPrivate;
00118     friend class KDateValidatorPrivate;
00119     KDateValidatorPrivate * const d;
00120 };
00121 
00134 class KDEUI_EXPORT KDateTable : public QWidget
00135 {
00136     Q_OBJECT
00137     Q_PROPERTY( QDate date READ date WRITE setDate )
00138 //FIXME    Q_PROPERTY( KCalendarSystem calendar READ calendar WRITE setCalendar USER true )
00139     Q_PROPERTY( bool popupMenu READ popupMenuEnabled WRITE setPopupMenuEnabled )
00140 
00141 public:
00145     explicit KDateTable( QWidget* parent = 0 );
00146 
00150     explicit KDateTable( const QDate&, QWidget *parent = 0 );
00151 
00155     ~KDateTable();
00156 
00164     virtual QSize sizeHint() const;
00165 
00169     void setFontSize( int size );
00170 
00174     bool setDate( const QDate &date );
00175 
00179     const QDate &date() const;
00180 
00186     const KCalendarSystem *calendar() const;
00187 
00195     bool setCalendar( KCalendarSystem *calendar = 0 );
00196 
00204     bool setCalendar( const QString &calendarType );
00205 
00212     void setPopupMenuEnabled( bool enable );
00213 
00217     bool popupMenuEnabled() const;
00218 
00219     enum BackgroundMode { NoBgMode = 0, RectangleMode, CircleMode };
00220 
00225     void setCustomDatePainting( const QDate &date, const QColor &fgColor, 
00226                                 BackgroundMode bgMode = NoBgMode, const QColor &bgColor = QColor() );
00227 
00231     void unsetCustomDatePainting( const QDate &date );
00232 
00233 protected:
00238     virtual int posFromDate( const QDate &date );
00239 
00244     virtual QDate dateFromPos( int pos );
00245 
00246     virtual void paintEvent( QPaintEvent *e );
00247 
00251     virtual void mousePressEvent( QMouseEvent *e );
00252     virtual void wheelEvent( QWheelEvent *e );
00253     virtual void keyPressEvent( QKeyEvent *e );
00254     virtual void focusInEvent( QFocusEvent *e );
00255     virtual void focusOutEvent( QFocusEvent *e );
00256 
00257 Q_SIGNALS:
00261     void dateChanged( const QDate &date );
00262 
00269     void dateChanged( const QDate &cur, const QDate &old );
00270 
00274     void tableClicked();
00275 
00281     void aboutToShowContextMenu( KMenu *menu, const QDate &date );
00282 
00283 private:
00284     Q_PRIVATE_SLOT( d, void nextMonth() )
00285     Q_PRIVATE_SLOT( d, void previousMonth() )
00286     Q_PRIVATE_SLOT( d, void beginningOfMonth() )
00287     Q_PRIVATE_SLOT( d, void endOfMonth() )
00288     Q_PRIVATE_SLOT( d, void beginningOfWeek() )
00289     Q_PRIVATE_SLOT( d, void endOfWeek() )
00290 
00291 private:
00292     class KDateTablePrivate;
00293     friend class KDateTablePrivate;
00294     KDateTablePrivate * const d;
00295 
00296     void initAccels();
00297     void paintCell( QPainter *painter, int row, int col );
00298 
00299     Q_DISABLE_COPY( KDateTable )
00300 };
00301 
00302 #endif // KDATETABLE_H

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal