1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
|
/********************************************************************************
* *
* C a l e n d a r W i d g e t *
* *
*********************************************************************************
* Copyright (C) 2006,2022 by Sander Jansen. All Rights Reserved. *
*********************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/> *
********************************************************************************/
#ifndef FXCALENDAR_H
#define FXCALENDAR_H
#ifndef FXPACKER_H
#include "FXPacker.h"
#endif
namespace FX {
class FXLabel;
class FXPopup;
class FXOptionMenu;
class FXHorizontalFrame;
class FXCalendarView;
/**
* The Calendar Widget. In addition of displaying the calendar, also provides month and year
* controls and optional frame.
*/
class FXAPI FXCalendar : public FXPacker {
FXDECLARE(FXCalendar)
protected:
FXCalendarView *view;
FXHorizontalFrame *frame;
FXLabel *year;
FXOptionMenu *month;
FXPopup *monthpopup;
FXOption *months[12];
FXArrowButton *arrows[4];
protected:
FXCalendar();
private:
FXCalendar(const FXCalendar&);
FXCalendar &operator=(const FXCalendar&);
public:
enum{
ID_CALENDAR=FXPacker::ID_LAST,
ID_NEXTYEAR,
ID_PREVYEAR,
ID_NEXTMONTH,
ID_PREVMONTH,
ID_MONTH_START,
ID_MONTH_END=ID_MONTH_START+12,
ID_MONTH
};
public:
long onCmdDate(FXObject*,FXSelector,void*);
long onCmdMonth(FXObject*,FXSelector,void*);
long onCmdNextYear(FXObject*,FXSelector,void*);
long onCmdPrevYear(FXObject*,FXSelector,void*);
long onCmdNextMonth(FXObject*,FXSelector,void*);
long onCmdPrevMonth(FXObject*,FXSelector,void*);
long onCmdSelectMonth(FXObject*,FXSelector,void*);
long onFwdToView(FXObject*,FXSelector,void*);
long onFwdToTarget(FXObject*,FXSelector,void*);
public:
/// Constructor
FXCalendar(FXComposite *p,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
/// Create
void create();
/// Enable the window to receive mouse and keyboard events
virtual void enable();
/// Disable the window from receiving mouse and keyboard events
virtual void disable();
/// Set date
void setCurrentDate(FXDate date,FXbool notify=false);
/// Get the current date
FXDate getCurrentDate() const;
/// Set the current month; current day will be properly updated for the choosen month
void setCurrentMonth(FXint mo,FXbool notify=false);
/**
* Return the current month shown. The month may be different than
* the current date if a day in a sibling month is current.
*/
FXint getCurrentMonth() const;
/// Return calendar view control
FXCalendarView* calendarView() const { return view; }
/// Set the first day of the week [0 -> 6]
void setFirstDay(FXint d);
/// Get the first day of the week [0 -> 6]
FXint getFirstDay() const;
/// Change the Frame Style
void setFrameStyle(FXuint);
/// Set the Calendar Style
void setCalendarStyle(FXuint);
/// Get the Calendar Style
FXuint getCalendarStyle() const;
/// Set the back color
void setBackColor(FXColor c);
/// Get the back color
FXColor getBackColor() const;
/// Set the display color of titles
void setTitleColor(FXColor c);
/// Get the display color of titles
FXColor getTitleColor() const;
/// Set the display color of titles
void setTitleBackColor(FXColor c);
/// Get the display color of titles
FXColor getTitleBackColor() const;
/// Set the display color of non-weekend days
void setDayColor(FXColor c);
/// Get the display color of non-weekend days
FXColor getDayColor() const;
/// Set the display color of non-weekend days not in the current month
void setOtherDayColor(FXColor c);
/// Get the display color of non-weekend days not in the current month
FXColor getOtherDayColor() const;
/// Set the display color of today
void setTodayColor(FXColor c);
/// Get the display color of today
FXColor getTodayColor() const;
/// Set the display color of days in the weekend
void setWeekendColor(FXColor c);
/// Get the display color of days in the weekend
FXColor getWeekendColor() const;
/// Set the display color of days in the weekend not in the current month
void setOtherWeekendColor(FXColor c);
/// Get the display color of days in the weekend not in the current month
FXColor getOtherWeekendColor() const;
/// Set font used by the header
void setHeaderFont(FXFont *fnt);
/// Get font used by the header
FXFont* getHeaderFont() const;
/// Set font used by the calendar
void setCalendarFont(FXFont *fnt);
/// Get font used by the calendar
FXFont* getCalendarFont() const;
/// Destructor
virtual ~FXCalendar();
};
}
#endif
|