![]() |
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
![]() |
00001 /******************************************************************************** 00002 * * 00003 * B a s e C a l e n d a r W i d g e t * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 2006,2009 by Sander Jansen. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or modify * 00009 * it under the terms of the GNU Lesser General Public License as published by * 00010 * the Free Software Foundation; either version 3 of the License, or * 00011 * (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00016 * GNU Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public License * 00019 * along with this program. If not, see <http://www.gnu.org/licenses/> * 00020 ********************************************************************************* 00021 * $Id: FXCalendarView.h,v 1.19 2009/01/06 13:07:22 fox Exp $ * 00022 ********************************************************************************/ 00023 #ifndef FXCALENDARVIEW_H 00024 #define FXCALENDARVIEW_H 00025 00026 #ifndef FXWINDOW_H 00027 #include "FXWindow.h" 00028 #endif 00029 00030 namespace FX { 00031 00032 00033 /// Calendar styles 00034 enum { 00035 CALENDAR_BROWSESELECT = 0x00000000, /// Browse selection mode enforces one single item to be selected at all times 00036 CALENDAR_SINGLESELECT = 0x00100000, /// Single selection mode allows up to one item to be selected 00037 CALENDAR_WEEKNUMBERS = 0x00200000, /// Show ISO8601 Week numbers 00038 CALENDAR_STATIC = 0x00400000, /// Disable navigation to prev/next month in display. 00039 CALENDAR_HIDEOTHER = 0x00800000, /// Do not show days of other months. 00040 }; 00041 00042 00043 class FXFont; 00044 00045 00046 /** 00047 * The Basic Calendar Widget. Renders the base calendar and keeps track of selection. 00048 * Most usefull to widget developers. Use it if you need a calendar rendered in some component. 00049 */ 00050 class FXAPI FXCalendarView : public FXWindow { 00051 FXDECLARE(FXCalendarView) 00052 protected: 00053 FXFont *font; // Font 00054 FXDate current; // Current Date 00055 FXDate selected; // Selected Date 00056 FXDate ds; // First Day in Calendar 00057 FXint month; // Which month is being viewed. 00058 FXint firstday; // Which day of the week we display in the first column 00059 FXint ws; // First week number in Calendar 00060 FXColor todayColor; // Today Color 00061 FXColor titleColor; // Title Color 00062 FXColor titleBackColor; // Title Back Color 00063 FXColor dayColor; // Normal Day Color 00064 FXColor otherDayColor; // Normal Day Color Disabled 00065 FXColor weekendColor; // Weekend Color 00066 FXColor otherWeekendColor; // Weekend Color Disabled 00067 FXbool has_selection; // If any date is selected 00068 FXbool state; // State 00069 protected: 00070 FXCalendarView(); 00071 void moveFocus(FXDate); 00072 void markdirty(FXDate); 00073 void updateview(FXbool notify=true); 00074 private: 00075 FXCalendarView(const FXCalendarView&); 00076 FXCalendarView &operator=(const FXCalendarView&); 00077 public: 00078 long onPaint(FXObject*,FXSelector,void*); 00079 long onLeftBtnPress(FXObject*,FXSelector,void*); 00080 long onLeftBtnRelease(FXObject*,FXSelector,void*); 00081 long onKeyPress(FXObject*,FXSelector,void*); 00082 long onKeyRelease(FXObject*,FXSelector,void*); 00083 long onFocusIn(FXObject*,FXSelector,void*); 00084 long onFocusOut(FXObject*,FXSelector,void*); 00085 long onClicked(FXObject*,FXSelector,void*); 00086 long onDoubleClicked(FXObject*,FXSelector,void*); 00087 long onTripleClicked(FXObject*,FXSelector,void*); 00088 long onCommand(FXObject*,FXSelector,void*); 00089 long onCmdSetValue(FXObject*,FXSelector,void*); 00090 long onCmdSetIntValue(FXObject*,FXSelector,void*); 00091 long onCmdGetIntValue(FXObject*,FXSelector,void*); 00092 public: 00093 00094 /// Construct a Calendar View 00095 FXCalendarView(FXComposite *p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=CALENDAR_BROWSESELECT,FXint x=0,FXint y=0,FXint w=0,FXint h=0); 00096 00097 /// Create server-side resources 00098 virtual void create(); 00099 00100 /// Detach server-side resources 00101 virtual void detach(); 00102 00103 /// Yes we can 00104 virtual FXbool canFocus() const; 00105 00106 /// Set focus 00107 virtual void setFocus(); 00108 00109 /// Kill focus 00110 virtual void killFocus(); 00111 00112 /// Enable the window 00113 virtual void enable(); 00114 00115 /// Disable the window 00116 virtual void disable(); 00117 00118 /// Return the default width of this window 00119 virtual FXint getDefaultWidth(); 00120 00121 /// Return the default height of this window 00122 virtual FXint getDefaultHeight(); 00123 00124 /// Get date at x,y if any 00125 FXbool getDateAt(FXint x,FXint y,FXDate& date) const; 00126 00127 /// Set date 00128 void setCurrentDate(FXDate date,FXbool notify=false); 00129 00130 /// Get the current date 00131 FXDate getCurrentDate() const { return current; } 00132 00133 /// Set the current month; current day will be properly updated for the choosen month 00134 void setCurrentMonth(FXint month,FXbool notify=false); 00135 00136 /** 00137 * Return the current month shown. The month may be different than the current 00138 * date if a day in a sibling month is current. 00139 */ 00140 FXint getCurrentMonth() const { return month; } 00141 00142 /// Select Date 00143 void selectDate(FXDate date,FXbool notify=false); 00144 00145 /// Deselect Date 00146 void killSelection(FXbool notify=false); 00147 00148 /// Get the selected date, if any 00149 FXbool getSelectedDate(FXDate& date) const; 00150 00151 /// Set the first day of the week [0...6] 00152 void setFirstDay(FXint d); 00153 00154 /// Get the first day of the week [0...6] 00155 FXint getFirstDay() const { return firstday; } 00156 00157 /// Set the calendar style 00158 void setCalendarStyle(FXuint); 00159 00160 /// Get the calendar style 00161 FXuint getCalendarStyle() const; 00162 00163 /// Set the display color of titles 00164 void setTitleColor(FXColor c); 00165 00166 /// Get the display color of titles 00167 FXColor getTitleColor() const { return titleColor; } 00168 00169 /// Set the display background color of titles 00170 void setTitleBackColor(FXColor c); 00171 00172 /// Get the display background color of titles 00173 FXColor getTitleBackColor() const { return titleBackColor; } 00174 00175 /// Set the display color of non-weekend days 00176 void setDayColor(FXColor c); 00177 00178 /// Get the display color of non-weekend days 00179 FXColor getDayColor() const { return dayColor; } 00180 00181 /// Set the display color of non-weekend days not in the current month 00182 void setOtherDayColor(FXColor c); 00183 00184 /// Get the display color of non-weekend days not in the current month 00185 FXColor getOtherDayColor() const { return otherDayColor; } 00186 00187 /// Set the display color of today 00188 void setTodayColor(FXColor c); 00189 00190 /// Get the display color of today 00191 FXColor getTodayColor() const { return todayColor; } 00192 00193 /// Set the display color of days in the weekend 00194 void setWeekendColor(FXColor c); 00195 00196 /// Get the display color of days in the weekend 00197 FXColor getWeekendColor() const { return weekendColor; } 00198 00199 /// Set the display color of days in the weekend not in the current month 00200 void setOtherWeekendColor(FXColor c); 00201 00202 /// Get the display color of days in the weekend not in the current month 00203 FXColor getOtherWeekendColor() const { return otherWeekendColor; } 00204 00205 /// Set the text font 00206 void setFont(FXFont *fnt); 00207 00208 /// Get the text font 00209 FXFont* getFont() const { return font; } 00210 00211 /// Destructor 00212 virtual ~FXCalendarView(); 00213 }; 00214 00215 } 00216 00217 #endif 00218
![]() |