diff options
author | Damon Chaplin <damon@helixcode.com> | 2000-07-26 03:45:47 +0800 |
---|---|---|
committer | Damon Chaplin <damon@src.gnome.org> | 2000-07-26 03:45:47 +0800 |
commit | 516b594aa9e8abf1643905e7eb48e21f8684c1aa (patch) | |
tree | 5c49805707d514c76c1154681d9b593222e1ea34 /widgets/misc/e-calendar-item.h | |
parent | 28288cc95b02571c9ede385411392d61abd7d409 (diff) | |
download | gsoc2013-evolution-516b594aa9e8abf1643905e7eb48e21f8684c1aa.tar.gz gsoc2013-evolution-516b594aa9e8abf1643905e7eb48e21f8684c1aa.tar.zst gsoc2013-evolution-516b594aa9e8abf1643905e7eb48e21f8684c1aa.zip |
new widget and canvas item to replace GtkCalendar. Not quite finished yet.
2000-07-25 Damon Chaplin <damon@helixcode.com>
* e-calendar-item.h:
* e-calendar.[hc]: new widget and canvas item to replace GtkCalendar.
Not quite finished yet.
svn path=/trunk/; revision=4322
Diffstat (limited to 'widgets/misc/e-calendar-item.h')
-rw-r--r-- | widgets/misc/e-calendar-item.h | 151 |
1 files changed, 151 insertions, 0 deletions
diff --git a/widgets/misc/e-calendar-item.h b/widgets/misc/e-calendar-item.h new file mode 100644 index 0000000000..a59ca6d407 --- /dev/null +++ b/widgets/misc/e-calendar-item.h @@ -0,0 +1,151 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ + +/* + * Author : + * Damon Chaplin <damon@helixcode.com> + * + * Copyright 2000, Helix Code, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ +#ifndef _E_CALENDAR_ITEM_H_ +#define _E_CALENDAR_ITEM_H_ + +#include <libgnomeui/gnome-canvas.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * ECalendarItem - canvas item displaying a calendar. + */ + +#define E_CALENDAR_ITEM_YPAD1 1 +#define E_CALENDAR_ITEM_YPAD2 1 + +/* These index our colors array. */ +typedef enum +{ + E_CALENDAR_COLOR_SELECTION, + E_CALENDAR_COLOR_HIGHLIGHT, + E_CALENDAR_COLOR_TODAY, + + E_CALENDAR_COLOR_LAST +} ECalendarColors; + + +#define E_CALENDAR_ITEM(obj) (GTK_CHECK_CAST((obj), \ + e_calendar_item_get_type (), ECalendarItem)) +#define E_CALENDAR_ITEM_CLASS(k) (GTK_CHECK_CLASS_CAST ((k),\ + e_calendar_item_get_type ())) +#define E_IS_CALENDAR_ITEM(o) (GTK_CHECK_TYPE((o), \ + e_calendar_item_get_type ())) + +typedef struct { + GnomeCanvasItem canvas_item; + + /* The year & month of the first calendar being displayed. */ + gint year; + gint month; /* 0 to 11 */ + + /* Bounds of item. */ + gdouble x1, y1, x2, y2; + + /* The minimum & maximum number of rows & columns of months. */ + gint min_rows; + gint min_cols; + gint max_rows; + gint max_cols; + + /* The number of rows & columns of months. */ + gint rows; + gint cols; + + /* Whether we show week nubers. */ + gboolean show_week_numbers; + + /* The first day of the week, 0 (Monday) to 6 (Sunday). */ + gint week_start_day; + + /* Whether the cells expand to fill extra space. */ + gboolean expand; + + /* The minimum size of each month, based on the fonts used. */ + gint min_month_width; + gint min_month_height; + + /* The actual size of each month, after dividing extra space. */ + gint month_width; + gint month_height; + + /* The offset to the left edge of the first calendar. */ + gint x_offset; + + /* The padding around each calendar month. */ + gint month_lpad, month_rpad; + gint month_tpad, month_bpad; + + /* The size of each cell. */ + gint cell_width; + gint cell_height; + + + /* The current selection. The month offsets are from 0, which is the + top-left calendar month view. The day offsets are from 0, which is + the top-left cell in the month view (which may be empty). */ + gint selection_start_month_offset; + gint selection_start_day_offset; + gint selection_end_month_offset; + gint selection_end_day_offset; + gboolean selecting; + gboolean selection_dragging_end; + + /* The first character of each day of the week, e.g. 'MTWTFSS'. */ + gchar *days; + + /* Widths of the day characters. */ + gint day_widths[7]; + + /* Widths of the digits, '0' .. '9'. */ + gint digit_widths[10]; + gint max_digit_width; + gint week_number_digit_widths[10]; + gint max_week_number_digit_width; + + /* Fonts for drawing text. If font isn't set it uses the font from the + canvas widget. If week_number_font isn't set it uses font. */ + GdkFont *font, *old_font; + GdkFont *week_number_font, *old_week_number_font; + + /* Colors for drawing. */ + GdkColor colors[E_CALENDAR_COLOR_LAST]; +} ECalendarItem; + +typedef struct { + GnomeCanvasItemClass parent_class; + +} ECalendarItemClass; + + +GtkType e_calendar_item_get_type (void); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _E_CALENDAR_ITEM_H_ */ |