Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXCalendarView.h
1 /********************************************************************************
2 * *
3 * B a s e C a l e n d a r W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2006,2024 by Sander Jansen. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXCALENDARVIEW_H
22 #define FXCALENDARVIEW_H
23 
24 #ifndef FXWINDOW_H
25 #include "FXWindow.h"
26 #endif
27 
28 namespace FX {
29 
30 
32 enum {
33  CALENDAR_BROWSESELECT = 0x00000000,
34  CALENDAR_SINGLESELECT = 0x00100000,
35  CALENDAR_WEEKNUMBERS = 0x00200000,
36  CALENDAR_STATIC = 0x00400000,
37  CALENDAR_HIDEOTHER = 0x00800000,
38  };
39 
40 
41 class FXFont;
42 
43 
48 class FXAPI FXCalendarView : public FXWindow {
49 FXDECLARE(FXCalendarView)
50 protected:
51  FXFont *font; // Font
52  FXDate current; // Current Date
53  FXDate selected; // Selected Date
54  FXDate ds; // First Day in Calendar
55  FXint month; // Which month is being viewed.
56  FXint firstday; // Which day of the week we display in the first column
57  FXint ws; // First week number in Calendar
58  FXColor todayColor; // Today Color
59  FXColor titleColor; // Title Color
60  FXColor titleBackColor; // Title Back Color
61  FXColor dayColor; // Normal Day Color
62  FXColor otherDayColor; // Normal Day Color Disabled
63  FXColor weekendColor; // Weekend Color
64  FXColor otherWeekendColor; // Weekend Color Disabled
65  FXbool has_selection; // If any date is selected
66  FXbool state; // State
67 protected:
69  void moveFocus(FXDate);
70  void markdirty(FXDate);
71  void updateview(FXbool notify=true);
72 private:
74  FXCalendarView &operator=(const FXCalendarView&);
75 public:
76  long onPaint(FXObject*,FXSelector,void*);
77  long onLeftBtnPress(FXObject*,FXSelector,void*);
78  long onLeftBtnRelease(FXObject*,FXSelector,void*);
79  long onKeyPress(FXObject*,FXSelector,void*);
80  long onKeyRelease(FXObject*,FXSelector,void*);
81  long onFocusIn(FXObject*,FXSelector,void*);
82  long onFocusOut(FXObject*,FXSelector,void*);
83  long onClicked(FXObject*,FXSelector,void*);
84  long onDoubleClicked(FXObject*,FXSelector,void*);
85  long onTripleClicked(FXObject*,FXSelector,void*);
86  long onCommand(FXObject*,FXSelector,void*);
87  long onCmdSetValue(FXObject*,FXSelector,void*);
88  long onCmdSetIntValue(FXObject*,FXSelector,void*);
89  long onCmdGetIntValue(FXObject*,FXSelector,void*);
90 public:
91 
93  FXCalendarView(FXComposite *p,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=CALENDAR_BROWSESELECT,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
94 
96  virtual void create();
97 
99  virtual void detach();
100 
102  virtual FXbool canFocus() const;
103 
105  virtual void setFocus();
106 
108  virtual void killFocus();
109 
111  virtual void enable();
112 
114  virtual void disable();
115 
117  virtual FXint getDefaultWidth();
118 
120  virtual FXint getDefaultHeight();
121 
123  FXbool getDateAt(FXint x,FXint y,FXDate& date) const;
124 
126  void setCurrentDate(FXDate date,FXbool notify=false);
127 
129  FXDate getCurrentDate() const { return current; }
130 
132  void setCurrentMonth(FXint month,FXbool notify=false);
133 
138  FXint getCurrentMonth() const { return month; }
139 
141  void selectDate(FXDate date,FXbool notify=false);
142 
144  void killSelection(FXbool notify=false);
145 
147  FXbool getSelectedDate(FXDate& date) const;
148 
150  void setFirstDay(FXint d);
151 
153  FXint getFirstDay() const { return firstday; }
154 
156  void setCalendarStyle(FXuint);
157 
159  FXuint getCalendarStyle() const;
160 
162  void setTitleColor(FXColor c);
163 
165  FXColor getTitleColor() const { return titleColor; }
166 
168  void setTitleBackColor(FXColor c);
169 
171  FXColor getTitleBackColor() const { return titleBackColor; }
172 
174  void setDayColor(FXColor c);
175 
177  FXColor getDayColor() const { return dayColor; }
178 
180  void setOtherDayColor(FXColor c);
181 
183  FXColor getOtherDayColor() const { return otherDayColor; }
184 
186  void setTodayColor(FXColor c);
187 
189  FXColor getTodayColor() const { return todayColor; }
190 
192  void setWeekendColor(FXColor c);
193 
195  FXColor getWeekendColor() const { return weekendColor; }
196 
198  void setOtherWeekendColor(FXColor c);
199 
201  FXColor getOtherWeekendColor() const { return otherWeekendColor; }
202 
204  void setFont(FXFont *fnt);
205 
207  FXFont* getFont() const { return font; }
208 
210  virtual ~FXCalendarView();
211  };
212 
213 }
214 
215 #endif
216 
FXint getFirstDay() const
Get the first day of the week [0...6].
Definition: FXCalendarView.h:153
Window is the base class for all widgets in FOX.
Definition: FXWindow.h:130
FXColor getTodayColor() const
Get the display color of today.
Definition: FXCalendarView.h:189
FXColor getTitleColor() const
Get the display color of titles.
Definition: FXCalendarView.h:165
FXColor getDayColor() const
Get the display color of non-weekend days.
Definition: FXCalendarView.h:177
FXColor getWeekendColor() const
Get the display color of days in the weekend.
Definition: FXCalendarView.h:195
FXColor getTitleBackColor() const
Get the display background color of titles.
Definition: FXCalendarView.h:171
Base composite.
Definition: FXComposite.h:32
FXColor getOtherWeekendColor() const
Get the display color of days in the weekend not in the current month.
Definition: FXCalendarView.h:201
Gregorian date class, which is useful for calendrical calculations.
Definition: FXDate.h:31
Definition: FX4Splitter.h:28
FXint getCurrentMonth() const
Return the current month shown.
Definition: FXCalendarView.h:138
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:134
FXColor getOtherDayColor() const
Get the display color of non-weekend days not in the current month.
Definition: FXCalendarView.h:183
FXDate getCurrentDate() const
Get the current date.
Definition: FXCalendarView.h:129
FXFont * getFont() const
Get the text font.
Definition: FXCalendarView.h:207
Font class.
Definition: FXFont.h:137
The Basic Calendar Widget.
Definition: FXCalendarView.h:48

Copyright © 1997-2022 Jeroen van der Zijp