planner-calendar.h 4.53 KB
Newer Older
Richard Hult's avatar
Richard Hult committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
/* GTK - The GIMP Toolkit
 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
 *
 * GTK Calendar Widget
 * Copyright (C) 1998 Cesar Miquel and Shawn T. Amundson
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

/*
 * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
 * file for a list of people on the GTK+ Team.  See the ChangeLog
 * files for a list of changes.  These files are distributed with
26
 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
Richard Hult's avatar
Richard Hult committed
27 28
 */

Richard Hult's avatar
Richard Hult committed
29 30
#ifndef __PLANNER_CALENDAR_H__
#define __PLANNER_CALENDAR_H__
Richard Hult's avatar
Richard Hult committed
31 32

#include <gdk/gdk.h>
33
#include <gtk/gtk.h>
Richard Hult's avatar
Richard Hult committed
34

Richard Hult's avatar
Richard Hult committed
35 36 37 38 39 40
#define PLANNER_TYPE_CALENDAR                  (planner_calendar_get_type ())
#define PLANNER_CALENDAR(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), PLANNER_TYPE_CALENDAR, PlannerCalendar))
#define PLANNER_CALENDAR_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), PLANNER_TYPE_CALENDAR, PlannerCalendarClass))
#define PLANNER_IS_CALENDAR(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PLANNER_TYPE_CALENDAR))
#define PLANNER_IS_CALENDAR_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), PLANNER_TYPE_CALENDAR))
#define PLANNER_CALENDAR_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), PLANNER_TYPE_CALENDAR, PlannerCalendarClass))
Richard Hult's avatar
Richard Hult committed
41 42


Richard Hult's avatar
Richard Hult committed
43 44
typedef struct _PlannerCalendar	      PlannerCalendar;
typedef struct _PlannerCalendarClass       PlannerCalendarClass;
Richard Hult's avatar
Richard Hult committed
45 46 47

typedef enum
{
Richard Hult's avatar
Richard Hult committed
48 49 50 51 52
	PLANNER_CALENDAR_SHOW_HEADING	= 1 << 0,
	PLANNER_CALENDAR_SHOW_DAY_NAMES	= 1 << 1,
	PLANNER_CALENDAR_NO_MONTH_CHANGE	= 1 << 2,
	PLANNER_CALENDAR_SHOW_WEEK_NUMBERS	= 1 << 3,
	PLANNER_CALENDAR_WEEK_START_MONDAY	= 1 << 4} PlannerCalendarDisplayOptions;
Richard Hult's avatar
Richard Hult committed
53 54 55

typedef enum
{
Richard Hult's avatar
Richard Hult committed
56 57 58 59 60 61 62 63
	PLANNER_CALENDAR_MARK_NONE,
	PLANNER_CALENDAR_MARK_BOLD,
	PLANNER_CALENDAR_MARK_UNDERLINE,
	PLANNER_CALENDAR_MARK_SHADE,
	PLANNER_CALENDAR_MARK_STRIPE
} PlannerCalendarMarkType;

struct _PlannerCalendar
Richard Hult's avatar
Richard Hult committed
64 65
{
	GtkWidget widget;
66

Richard Hult's avatar
Richard Hult committed
67 68
	GtkStyle  *header_style;
	GtkStyle  *label_style;
69

Richard Hult's avatar
Richard Hult committed
70 71 72
	gint month;
	gint year;
	gint selected_day;
73

Richard Hult's avatar
Richard Hult committed
74 75
	gint day_month[6][7];
	gint day[6][7];
76

Richard Hult's avatar
Richard Hult committed
77 78
	gint num_marked_dates;
	gint marked_date[31];
Richard Hult's avatar
Richard Hult committed
79
	PlannerCalendarDisplayOptions  display_flags;
Richard Hult's avatar
Richard Hult committed
80
	GdkColor marked_date_color[31];
81

Richard Hult's avatar
Richard Hult committed
82 83
	GdkGC *gc;
	GdkGC *xor_gc;
84

Richard Hult's avatar
Richard Hult committed
85 86
	gint focus_row;
	gint focus_col;
87

Richard Hult's avatar
Richard Hult committed
88 89
	gint highlight_row;
	gint highlight_col;
90

Richard Hult's avatar
Richard Hult committed
91 92
	gpointer private_data;
	gchar grow_space [32];
93

Richard Hult's avatar
Richard Hult committed
94 95 96 97 98 99 100
	/* Padding for future expansion */
	void (*_gtk_reserved1) (void);
	void (*_gtk_reserved2) (void);
	void (*_gtk_reserved3) (void);
	void (*_gtk_reserved4) (void);
};

Richard Hult's avatar
Richard Hult committed
101
struct _PlannerCalendarClass
Richard Hult's avatar
Richard Hult committed
102 103
{
	GtkWidgetClass parent_class;
104

Richard Hult's avatar
Richard Hult committed
105
	/* Signal handlers */
Richard Hult's avatar
Richard Hult committed
106 107 108 109 110 111 112
	void (* month_changed)		(PlannerCalendar *calendar);
	void (* day_selected)			(PlannerCalendar *calendar);
	void (* day_selected_double_click)	(PlannerCalendar *calendar);
	void (* prev_month)			(PlannerCalendar *calendar);
	void (* next_month)			(PlannerCalendar *calendar);
	void (* prev_year)			(PlannerCalendar *calendar);
	void (* next_year)			(PlannerCalendar *calendar);
113

Richard Hult's avatar
Richard Hult committed
114 115 116 117 118 119
};


GType	   planner_calendar_get_type	(void) G_GNUC_CONST;
GtkWidget* planner_calendar_new		(void);

120
gboolean   planner_calendar_select_month	(PlannerCalendar *calendar,
Richard Hult's avatar
Richard Hult committed
121 122
					 guint	      month,
					 guint	      year);
Richard Hult's avatar
Richard Hult committed
123
void	   planner_calendar_select_day	(PlannerCalendar *calendar,
Richard Hult's avatar
Richard Hult committed
124
					 guint	      day);
Richard Hult's avatar
Richard Hult committed
125
gboolean   planner_calendar_unmark_day	(PlannerCalendar *calendar,
Richard Hult's avatar
Richard Hult committed
126
					 guint	      day);
Richard Hult's avatar
Richard Hult committed
127
void	   planner_calendar_clear_marks	(PlannerCalendar *calendar);
Richard Hult's avatar
Richard Hult committed
128 129


Richard Hult's avatar
Richard Hult committed
130 131
void	   planner_calendar_display_options (PlannerCalendar		  *calendar,
					 PlannerCalendarDisplayOptions flags);
Richard Hult's avatar
Richard Hult committed
132

133
void	   planner_calendar_get_date	(PlannerCalendar *calendar,
Richard Hult's avatar
Richard Hult committed
134 135 136
				 guint	     *year,
				 guint	     *month,
				 guint	     *day);
Richard Hult's avatar
Richard Hult committed
137 138
void	   planner_calendar_freeze		(PlannerCalendar *calendar);
void	   planner_calendar_thaw		(PlannerCalendar *calendar);
Richard Hult's avatar
Richard Hult committed
139 140 141



Richard Hult's avatar
Richard Hult committed
142
void       planner_calendar_mark_day (PlannerCalendar         *calendar,
Richard Hult's avatar
Richard Hult committed
143
				 guint               day,
Richard Hult's avatar
Richard Hult committed
144
				 PlannerCalendarMarkType  type);
Richard Hult's avatar
Richard Hult committed
145 146


Richard Hult's avatar
Richard Hult committed
147
#endif /* __PLANNER_CALENDAR_H__ */