File indexing completed on 2024-11-24 04:48:24

0001 /*
0002   This file is part of KOrganizer.
0003 
0004   SPDX-FileCopyrightText: 2003 Cornelius Schumacher <schumacher@kde.org>
0005 
0006   SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
0007 */
0008 #pragma once
0009 
0010 #include <KCalendarCore/IncidenceBase> // for KCalendarCore::DateList typedef
0011 
0012 #include <QDate>
0013 #include <QWidget>
0014 class QToolButton;
0015 
0016 class NavigatorBar : public QWidget
0017 {
0018     Q_OBJECT
0019 public:
0020     explicit NavigatorBar(QWidget *parent = nullptr);
0021     ~NavigatorBar() override;
0022 
0023     void showButtons(bool left, bool right);
0024 
0025 public Q_SLOTS:
0026     void selectDates(const KCalendarCore::DateList &);
0027 
0028 Q_SIGNALS:
0029     void nextMonthClicked();
0030     void prevMonthClicked();
0031     void nextYearClicked();
0032     void prevYearClicked();
0033     void monthSelected(int month);
0034     void yearSelected(int year);
0035 
0036 protected:
0037     QToolButton *createNavigationButton(const QString &icon, const QString &toolTip, const QString &whatsThis);
0038 
0039 private:
0040     void selectMonthFromMenu();
0041     void selectYearFromMenu();
0042     QDate mDate;
0043 
0044     QToolButton *mPrevYear = nullptr;
0045     QToolButton *mPrevMonth = nullptr;
0046     QToolButton *const mMonth;
0047     QToolButton *const mYear;
0048     QToolButton *mNextMonth = nullptr;
0049     QToolButton *mNextYear = nullptr;
0050 };