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

FXCalendar.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                  Calendar widet                                               *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2003 by Mathew Robertson.   All Rights Reserved.                *
00007 * Copyright (C) by J. Knight.                                                   *
00008 *********************************************************************************
00009 * This library is free software; you can redistribute it and/or                 *
00010 * modify it under the terms of the GNU Lesser General Public                    *
00011 * License as published by the Free Software Foundation; either                  *
00012 * version 2.1 of the License, or (at your option) any later version.            *
00013 *                                                                               *
00014 * This library is distributed in the hope that it will be useful,               *
00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
00017 * Lesser General Public License for more details.                               *
00018 *                                                                               *
00019 * You should have received a copy of the GNU Lesser General Public              *
00020 * License along with this library; if not, write to the Free Software           *
00021 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00022 *********************************************************************************/
00023 #ifndef FXCALENDAR_H
00024 #define FXCALENDAR_H
00025 
00026 #ifndef FXVERTICALFRAME_H
00027 #include <fox/FXVerticalFrame.h>
00028 using namespace FX;
00029 #endif
00030 namespace FXEX {
00031 
00032 /// A Calendar widget
00033 class FXAPI FXCalendar : public FXVerticalFrame {
00034     FXDECLARE(FXCalendar)
00035      
00036   private:
00037     FXButton     *button_array[42];
00038     FXButton     *todayButton;
00039     FXLabel      *dateLabel;
00040     FXColor       hilite_color;
00041 
00042   protected:
00043     FXJulianDate  currentDate;  // date as julian object
00044 
00045   protected:
00046     /// serialisation
00047     FXCalendar(){}
00048    
00049   public:
00050     long onNextMonth(FXObject*,FXSelector,void*);
00051     long onPrevMonth(FXObject*,FXSelector,void*);
00052     long onNextYear(FXObject*,FXSelector,void*);
00053     long onPrevYear(FXObject*,FXSelector,void*);
00054     long onToday(FXObject*,FXSelector,void*);
00055     long onCmdDay(FXObject*,FXSelector,void*);
00056    
00057   public:
00058     enum {
00059       ID_CALENDAR=FXVerticalFrame::ID_LAST,
00060       ID_NEXTMONTH,
00061       ID_PREVMONTH,
00062       ID_NEXTYEAR,
00063       ID_PREVYEAR,
00064       ID_DAY,
00065       ID_TODAY,
00066       ID_LAST
00067       };  
00068 
00069   public:
00070     /// ctor
00071     FXCalendar(FXComposite *p,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0,
00072                FXint pl=DEFAULT_SPACING,FXint pr=DEFAULT_SPACING,
00073                FXint pt=DEFAULT_SPACING,FXint pb=DEFAULT_SPACING,
00074                FXint hs=DEFAULT_SPACING,FXint vs=DEFAULT_SPACING);
00075    
00076     /// manipulate the date selection
00077     void setDate(FXint y,FXint m,FXint d);
00078     void getDate(FXint& y,FXint& m,FXint& d);
00079 
00080     /// save to stream
00081     virtual void save(FXStream& store) const;
00082 
00083     /// load from stream
00084     virtual void load(FXStream& store);
00085 
00086     /// dtor
00087     virtual ~FXCalendar();
00088   };
00089 
00090 } // namespace FXEX
00091 #endif // FXCALENDAR_H