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

FXCalendar.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                       C a l e n d a r   W i d g e t                           *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2006,2008 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: FXCalendar.h,v 1.11 2008/01/04 15:18:14 fox Exp $                        *
00022 ********************************************************************************/
00023 #ifndef FXCALENDAR_H
00024 #define FXCALENDAR_H
00025 
00026 #ifndef FXPACKER_H
00027 #include "FXPacker.h"
00028 #endif
00029 
00030 
00031 namespace FX {
00032 
00033 
00034 class FXLabel;
00035 class FXPopup;
00036 class FXOptionMenu;
00037 class FXHorizontalFrame;
00038 class FXCalendarView;
00039 
00040 
00041 /**
00042 * The Calendar Widget. In addition of displaying the calendar, also provides month and year
00043 * controls and optional frame.
00044 */
00045 class FXAPI FXCalendar : public FXPacker {
00046 FXDECLARE(FXCalendar)
00047 protected:
00048   FXCalendarView    *view;
00049   FXLabel           *year;
00050   FXPopup           *months;
00051   FXOptionMenu      *month;
00052   FXHorizontalFrame *frame;
00053   FXArrowButton     *arrows[4];
00054 protected:
00055   FXCalendar();
00056 private:
00057   FXCalendar(const FXCalendar&);
00058   FXCalendar &operator=(const FXCalendar&);
00059 public:
00060   enum{
00061     ID_CALENDAR=FXPacker::ID_LAST,
00062     ID_NEXTYEAR,
00063     ID_PREVYEAR,
00064     ID_NEXTMONTH,
00065     ID_PREVMONTH,
00066     ID_MONTH_START,
00067     ID_MONTH_END=ID_MONTH_START+12,
00068     ID_MONTH
00069     };
00070 public:
00071   long onCmdDate(FXObject*,FXSelector,void*);
00072   long onCmdMonth(FXObject*,FXSelector,void*);
00073   long onCmdNextYear(FXObject*,FXSelector,void*);
00074   long onCmdPrevYear(FXObject*,FXSelector,void*);
00075   long onCmdNextMonth(FXObject*,FXSelector,void*);
00076   long onCmdPrevMonth(FXObject*,FXSelector,void*);
00077   long onCmdSelectMonth(FXObject*,FXSelector,void*);
00078   long onFwdToView(FXObject*,FXSelector,void*);
00079   long onFwdToTarget(FXObject*,FXSelector,void*);
00080 public:
00081 
00082   /// Constructor
00083   FXCalendar(FXComposite *p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00084 
00085   /// Create
00086   void create();
00087 
00088   /// Enable the window to receive mouse and keyboard events
00089   virtual void enable();
00090 
00091   /// Disable the window from receiving mouse and keyboard events
00092   virtual void disable();
00093 
00094   /// Set date
00095   void setCurrentDate(FXDate date,FXbool notify=false);
00096 
00097   /// Get the current date
00098   FXDate getCurrentDate() const;
00099 
00100   /// Set the current month; current day will be properly updated for the choosen month
00101   void setCurrentMonth(FXint mo,FXbool notify=false);
00102 
00103   /// Return the current month shown. The month may be different than the current
00104   /// date if a day in a sibling month is current.
00105   FXint getCurrentMonth() const;
00106 
00107   /// Return calendar view control
00108   FXCalendarView* calendarView() const { return view; }
00109 
00110   /// Set the first day of the week [0 -> 6]
00111   void setFirstDay(FXint d);
00112 
00113   /// Get the first day of the week [0 -> 6]
00114   FXint getFirstDay() const;
00115 
00116   /// Change the Frame Style
00117   void setFrameStyle(FXuint);
00118 
00119   /// Set the Calendar Style
00120   void setCalendarStyle(FXuint);
00121 
00122   /// Get the Calendar Style
00123   FXuint getCalendarStyle() const;
00124 
00125   /// Set the back color
00126   void setBackColor(FXColor c);
00127 
00128   /// Get the back color
00129   FXColor getBackColor() const;
00130 
00131   /// Set the display color of titles
00132   void setTitleColor(FXColor c);
00133 
00134   /// Get the display color of titles
00135   FXColor getTitleColor() const;
00136 
00137   /// Set the display color of titles
00138   void setTitleBackColor(FXColor c);
00139 
00140   /// Get the display color of titles
00141   FXColor getTitleBackColor() const;
00142 
00143   /// Set the display color of non-weekend days
00144   void setDayColor(FXColor c);
00145 
00146   /// Get the display color of non-weekend days
00147   FXColor getDayColor() const;
00148 
00149   /// Set the display color of non-weekend days not in the current month
00150   void setOtherDayColor(FXColor c);
00151 
00152   /// Get the display color of non-weekend days not in the current month
00153   FXColor getOtherDayColor() const;
00154 
00155   /// Set the display color of today
00156   void setTodayColor(FXColor c);
00157 
00158   /// Get the display color of today
00159   FXColor getTodayColor() const;
00160 
00161   /// Set the display color of days in the weekend
00162   void setWeekendColor(FXColor c);
00163 
00164   /// Get the display color of days in the weekend
00165   FXColor getWeekendColor() const;
00166 
00167   /// Set the display color of days in the weekend not in the current month
00168   void setOtherWeekendColor(FXColor c);
00169 
00170   /// Get the display color of days in the weekend not in the current month
00171   FXColor getOtherWeekendColor() const;
00172 
00173   /// Destructor
00174   virtual ~FXCalendar();
00175   };
00176 
00177 }
00178 
00179 #endif

Copyright © 1997-2007 Jeroen van der Zijp