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,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: FXCalendar.h,v 1.15 2009/01/06 13:07:22 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   FXHorizontalFrame *frame;
00050   FXLabel           *year;
00051   FXOptionMenu      *month;
00052   FXPopup           *monthpopup;
00053   FXOption          *months[12];
00054   FXArrowButton     *arrows[4];
00055 protected:
00056   FXCalendar();
00057 private:
00058   FXCalendar(const FXCalendar&);
00059   FXCalendar &operator=(const FXCalendar&);
00060 public:
00061   enum{
00062     ID_CALENDAR=FXPacker::ID_LAST,
00063     ID_NEXTYEAR,
00064     ID_PREVYEAR,
00065     ID_NEXTMONTH,
00066     ID_PREVMONTH,
00067     ID_MONTH_START,
00068     ID_MONTH_END=ID_MONTH_START+12,
00069     ID_MONTH
00070     };
00071 public:
00072   long onCmdDate(FXObject*,FXSelector,void*);
00073   long onCmdMonth(FXObject*,FXSelector,void*);
00074   long onCmdNextYear(FXObject*,FXSelector,void*);
00075   long onCmdPrevYear(FXObject*,FXSelector,void*);
00076   long onCmdNextMonth(FXObject*,FXSelector,void*);
00077   long onCmdPrevMonth(FXObject*,FXSelector,void*);
00078   long onCmdSelectMonth(FXObject*,FXSelector,void*);
00079   long onFwdToView(FXObject*,FXSelector,void*);
00080   long onFwdToTarget(FXObject*,FXSelector,void*);
00081 public:
00082 
00083   /// Constructor
00084   FXCalendar(FXComposite *p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00085 
00086   /// Create
00087   void create();
00088 
00089   /// Enable the window to receive mouse and keyboard events
00090   virtual void enable();
00091 
00092   /// Disable the window from receiving mouse and keyboard events
00093   virtual void disable();
00094 
00095   /// Set date
00096   void setCurrentDate(FXDate date,FXbool notify=false);
00097 
00098   /// Get the current date
00099   FXDate getCurrentDate() const;
00100 
00101   /// Set the current month; current day will be properly updated for the choosen month
00102   void setCurrentMonth(FXint mo,FXbool notify=false);
00103 
00104   /**
00105   * Return the current month shown. The month may be different than
00106   * the current date if a day in a sibling month is current.
00107   */
00108   FXint getCurrentMonth() const;
00109 
00110   /// Return calendar view control
00111   FXCalendarView* calendarView() const { return view; }
00112 
00113   /// Set the first day of the week [0 -> 6]
00114   void setFirstDay(FXint d);
00115 
00116   /// Get the first day of the week [0 -> 6]
00117   FXint getFirstDay() const;
00118 
00119   /// Change the Frame Style
00120   void setFrameStyle(FXuint);
00121 
00122   /// Set the Calendar Style
00123   void setCalendarStyle(FXuint);
00124 
00125   /// Get the Calendar Style
00126   FXuint getCalendarStyle() const;
00127 
00128   /// Set the back color
00129   void setBackColor(FXColor c);
00130 
00131   /// Get the back color
00132   FXColor getBackColor() const;
00133 
00134   /// Set the display color of titles
00135   void setTitleColor(FXColor c);
00136 
00137   /// Get the display color of titles
00138   FXColor getTitleColor() const;
00139 
00140   /// Set the display color of titles
00141   void setTitleBackColor(FXColor c);
00142 
00143   /// Get the display color of titles
00144   FXColor getTitleBackColor() const;
00145 
00146   /// Set the display color of non-weekend days
00147   void setDayColor(FXColor c);
00148 
00149   /// Get the display color of non-weekend days
00150   FXColor getDayColor() const;
00151 
00152   /// Set the display color of non-weekend days not in the current month
00153   void setOtherDayColor(FXColor c);
00154 
00155   /// Get the display color of non-weekend days not in the current month
00156   FXColor getOtherDayColor() const;
00157 
00158   /// Set the display color of today
00159   void setTodayColor(FXColor c);
00160 
00161   /// Get the display color of today
00162   FXColor getTodayColor() const;
00163 
00164   /// Set the display color of days in the weekend
00165   void setWeekendColor(FXColor c);
00166 
00167   /// Get the display color of days in the weekend
00168   FXColor getWeekendColor() const;
00169 
00170   /// Set the display color of days in the weekend not in the current month
00171   void setOtherWeekendColor(FXColor c);
00172 
00173   /// Get the display color of days in the weekend not in the current month
00174   FXColor getOtherWeekendColor() const;
00175 
00176   /// Set font used by the header
00177   void setHeaderFont(FXFont *fnt);
00178 
00179   /// Get font used by the header
00180   FXFont* getHeaderFont() const;
00181 
00182   /// Set font used by the calendar
00183   void setCalendarFont(FXFont *fnt);
00184 
00185   /// Get font used by the calendar
00186   FXFont* getCalendarFont() const;
00187 
00188   /// Destructor
00189   virtual ~FXCalendar();
00190   };
00191 
00192 }
00193 
00194 #endif

Copyright © 1997-2009 Jeroen van der Zijp