KHolidays Library
holidayregionselector.h
00001 /* 00002 This file is part of the kholidays library. 00003 00004 Copyright 2010 John Layt <john@layt.net> 00005 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 00014 GNU 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 the 00018 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #ifndef KHOLIDAYS_HOLIDAYREGIONSELECTOR_H 00023 #define KHOLIDAYS_HOLIDAYREGIONSELECTOR_H 00024 00025 #include "kholidays_export.h" 00026 00027 #include <QtGui/QTreeWidget> 00028 00029 class QString; 00030 class QStringList; 00031 00032 namespace KHolidays { 00033 00034 class HolidayRegion; 00035 00036 class KHOLIDAYS_EXPORT HolidayRegionSelector : public QWidget 00037 { 00038 Q_OBJECT 00039 Q_PROPERTY( QAbstractItemView::SelectionMode listSelectionMode READ selectionMode WRITE setSelectionMode ) 00040 Q_PROPERTY( bool enableRegionUseFlags READ regionUseFlagsEnabled WRITE setRegionUseFlagsEnabled ) 00041 Q_PROPERTY( bool hideSearch READ searchHidden WRITE setSearchHidden ) 00042 Q_PROPERTY( bool hideDescription READ descriptionHidden WRITE setDescriptionHidden ) 00043 Q_PROPERTY( bool hideLanguage READ languageHidden WRITE setLanguageHidden ) 00044 Q_PROPERTY( QStringList languageFilter READ languageFilter WRITE setLanguageFilter ) 00045 00046 public: 00050 enum SelectionStatus { 00051 RegionHidden, 00052 RegionDisabled, 00053 RegionAvailable, 00054 RegionSelected 00055 }; 00056 00060 enum RegionUseFlag { 00061 NotUsed = 0x00, 00062 UseInformationOnly = 0x01, 00063 UseDaysOff = 0x02 00064 }; 00065 Q_DECLARE_FLAGS( RegionUseFlags, RegionUseFlag ) 00066 00067 00082 explicit HolidayRegionSelector( QWidget *parent = 0 ); 00083 00087 virtual ~HolidayRegionSelector(); 00088 00094 QStringList holidayRegions() const; 00095 00108 void setSelectionMode( QAbstractItemView::SelectionMode selectionMode ); 00109 00116 QAbstractItemView::SelectionMode selectionMode() const; 00117 00132 void setRegionUseFlagsEnabled( bool enableRegionUseFlags ); 00133 00140 bool regionUseFlagsEnabled() const; 00141 00149 void setSelectionStatus( const QString &holidayRegionCode, 00150 HolidayRegionSelector::SelectionStatus status ); 00151 00159 HolidayRegionSelector::SelectionStatus selectionStatus( 00160 const QString &holidayRegionCode ) const; 00161 00168 QHash<QString, HolidayRegionSelector::SelectionStatus> selectionStatus() const; 00169 00179 QStringList selection( HolidayRegionSelector::SelectionStatus selectionStatus = 00180 HolidayRegionSelector::RegionSelected ) const; 00181 00190 QStringList selection( HolidayRegionSelector::RegionUseFlags regionUseFlags ) const; 00191 00199 void clearSelection(); 00200 00208 void setRegionUseFlags( const QString &holidayRegionCode, 00209 HolidayRegionSelector::RegionUseFlags regionUseFlags ); 00210 00218 HolidayRegionSelector::RegionUseFlags regionUseFlags( const QString &holidayRegionCode ) const; 00219 00226 QHash<QString, HolidayRegionSelector::RegionUseFlags> regionUseFlags() const; 00227 00239 void setLanguageFilter( const QStringList &languages ); 00240 00247 QStringList languageFilter() const; 00248 00255 void setSearchHidden( bool hideSearch ); 00256 00263 bool searchHidden() const; 00264 00271 void setLanguageHidden( bool hideLanguage ); 00272 00279 bool languageHidden() const; 00280 00287 void setDescriptionHidden( bool hideDescription ); 00288 00295 bool descriptionHidden() const; 00296 00297 private Q_SLOTS: 00298 void itemChanged( QTreeWidgetItem *item, int column ); 00299 void itemChanged( int index ); 00300 00301 Q_SIGNALS: 00302 void selectionChanged(); 00303 00304 private: 00305 class Private; 00306 Private *const d; 00307 }; 00308 00309 } // namespace KHolidays 00310 00311 Q_DECLARE_OPERATORS_FOR_FLAGS( KHolidays::HolidayRegionSelector::RegionUseFlags ) 00312 00313 #endif // KHOLIDAYS_HOLIDAYREGIONSELECTOR_H
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Aug 27 2012 22:08:09 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Aug 27 2012 22:08:09 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.