Main Page - Header
Author: The Inti Development Team

Reference Manual

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

# calendar.h

Go to the documentation of this file.

    00001 /*  Inti: Integrated Foundation Classes
    00002  *  Copyright (C) 2002 The Inti Development Team.
    00003  *  Copyright (C) 2000 Red Hat, Inc.
    00004  *
    00005  *  This program is free software; you can redistribute it and/or modify
    00006  *  it under the terms of the GNU General Public License as published by
    00007  *  the Free Software Foundation; either version 2 of the License, or
    00008  *  (at your option) any later version.
    00009  *
    00010  *  This program is distributed in the hope that it will be useful,
    00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00013  *  GNU Library General Public License for more details.
    00014  *
    00015  *  You should have received a copy of the GNU Library General Public License
    00016  *  along with this program; if not, write to the Free Software
    00017  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    00018  */
    00019
    00022
    00023 #ifndef INTI_GTK_CALENDAR_H
    00024 #define INTI_GTK_CALENDAR_H
    00025
    00026 #ifndef INTI_GTK_WIDGET_H
    00027 #include <inti/gtk/widget.h>
    00028 #endif
    00029
    00030 #ifndef __GTK_CALENDAR_H__
    00031 #include <gtk/gtkcalendar.h>
    00032 #endif
    00033
    00034 namespace Inti {
    00035
    00036 namespace Gtk {
    00037
    00038 class CalendarClass;
    00039
    00042
    00043 enum CalendarDisplayOptions
    00044 {
    00045         CALENDAR_SHOW_HEADING = GTK_CALENDAR_SHOW_HEADING,
    00047         CALENDAR_SHOW_DAY_NAMES = GTK_CALENDAR_SHOW_DAY_NAMES,
    00049         CALENDAR_NO_MONTH_CHANGE = GTK_CALENDAR_NO_MONTH_CHANGE,
    00051         CALENDAR_SHOW_WEEK_NUMBERS = GTK_CALENDAR_SHOW_WEEK_NUMBERS,
    00053         CALENDAR_WEEK_START_MONDAY = GTK_CALENDAR_WEEK_START_MONDAY
    00055 };
    00056
    00058
    00059 typedef unsigned int CalendarDisplayOptionsField;
    00060
    00072
    00073 class Calendar : public Widget
    00074 {
    00075         friend class G::Object;
    00076         friend class CalendarClass;
    00077
    00078         Calendar(const Calendar&);
    00079         Calendar& operator=(const Calendar&);
    00080
    00081 protected:
    00084
    00085         explicit Calendar(GtkCalendar *calendar, bool reference = false);
    00092
    00095
    00096         virtual void on_month_changed();
    00098
    00099         virtual void on_day_selected();
    00101
    00102         virtual void on_day_selected_double_click();
    00104
    00105         virtual void on_prev_month();
    00107
    00108         virtual void on_next_month();
    00110
    00111         virtual void on_prev_year();
    00113
    00114         virtual void on_next_year();
    00116
    00118 //  Signals
    00119
    00120         typedef G::Signal0<void> MonthChangedSignalType;
    00121         typedef G::SignalProxy<TypeInstance, MonthChangedSignalType> MonthChangedSignalProxy;
    00122         static const MonthChangedSignalType month_changed_signal;
    00123
    00124         typedef G::Signal0<void> DaySelectedSignalType;
    00125         typedef G::SignalProxy<TypeInstance, DaySelectedSignalType> DaySelectedSignalProxy;
    00126         static const DaySelectedSignalType day_selected_signal;
    00127
    00128         typedef G::Signal0<void> DaySelectedDoubleClickSignalType;
    00129         typedef G::SignalProxy<TypeInstance, DaySelectedDoubleClickSignalType> DaySelectedDoubleClickSignalProxy;
    00130         static const DaySelectedDoubleClickSignalType day_selected_double_click_signal;
    00131
    00132         typedef G::Signal0<void> PrevMonthSignalType;
    00133         typedef G::SignalProxy<TypeInstance, PrevMonthSignalType> PrevMonthSignalProxy;
    00134         static const PrevMonthSignalType prev_month_signal;
    00135
    00136         typedef G::Signal0<void> NextMonthSignalType;
    00137         typedef G::SignalProxy<TypeInstance, NextMonthSignalType> NextMonthSignalProxy;
    00138         static const NextMonthSignalType next_month_signal;
    00139
    00140         typedef G::Signal0<void> PrevYearSignalType;
    00141         typedef G::SignalProxy<TypeInstance, PrevYearSignalType> PrevYearSignalProxy;
    00142         static const PrevYearSignalType prev_year_signal;
    00143
    00144         typedef G::Signal0<void> NextYearSignalType;
    00145         typedef G::SignalProxy<TypeInstance, NextYearSignalType> NextYearSignalProxy;
    00146         static const NextYearSignalType next_year_signal;
    00147
    00148 public:
    00151
    00152         Calendar();
    00154
    00155         explicit Calendar(CalendarDisplayOptionsField flags);
    00160
    00161         virtual ~Calendar();
    00163
    00167
    00168         GtkCalendar* gtk_calendar() const { return (GtkCalendar*)instance; }
    00170
    00171         GtkCalendarClass* gtk_calendar_class() const;
    00173
    00174         operator GtkCalendar* () const;
    00176
    00177         int year() const;
    00179
    00180         int month() const;
    00182
    00183         int day() const;
    00185
    00186         CalendarDisplayOptionsField display_flags() const;
    00188
    00189         int num_marked_dates() const;
    00191
    00192         std::vector<bool> marked_date() const;
    00194
    00195         void get_date(int *year, int *month, int *day) const;
    00200
    00204
    00205         bool select_month(int month, int year);
    00210
    00211         void select_day(int day);
    00214
    00215         bool mark_day(int day);
    00219
    00220         bool unmark_day(int day);
    00224
    00225         void clear_marks();
    00227
    00228         void display_options(CalendarDisplayOptionsField flags);
    00231
    00232         void freeze();
    00234
    00235         void thaw();
    00237
    00241
    00242         const MonthChangedSignalProxy sig_month_changed()
    00243         {
    00244                 return MonthChangedSignalProxy(this, &month_changed_signal);
    00245         }
    00247
    00248         const DaySelectedSignalProxy sig_day_selected()
    00249         {
    00250                 return DaySelectedSignalProxy(this, &day_selected_signal);
    00251         }
    00253
    00254         const DaySelectedDoubleClickSignalProxy sig_day_selected_double_click()
    00255         {
    00256                 return DaySelectedDoubleClickSignalProxy(this, &day_selected_double_click_signal);
    00257         }
    00259
    00260         const PrevMonthSignalProxy sig_prev_month()
    00261         {
    00262                 return PrevMonthSignalProxy(this, &prev_month_signal);
    00263         }
    00265
    00266         const NextMonthSignalProxy sig_next_month()
    00267         {
    00268                 return NextMonthSignalProxy(this, &next_month_signal);
    00269         }
    00271
    00272         const PrevYearSignalProxy sig_prev_year()
    00273         {
    00274                 return PrevYearSignalProxy(this, &prev_year_signal);
    00275         }
    00277
    00278         const NextYearSignalProxy sig_next_year()
    00279         {
    00280                 return NextYearSignalProxy(this, &next_year_signal);
    00281         }
    00283
    00285 };
    00286
    00287 } // namespace Gtk
    00288
    00289 } // namespace Inti
    00290
    00291 #endif // INTI_GTK_CALENDAR_H
    00292

Main Page - Footer