new function. (gtk_clist_insert): added g_return_val_if_fail() statements.
Thu Oct 1 10:40:20 1998 Tim Janik <timj@gtk.org> * gtk/gtkclist.h (gtk_clist_prepend): * gtk/gtkclist.c (gtk_clist_prepend): new function. (gtk_clist_insert): added g_return_val_if_fail() statements. accept a row parameter < 0 or > clist->rows to indicate append mode. (real_clear): first clean up all internal pointers and lists (e.g. clist->row_list or clist->rows), then delete the distinct rows. this is required because of destroy notifiers, we need to have all internal structures updated and be reentrant. * gtk/gtkcalendar.h: * gtk/gtkcalendar.c: removed the `gtk_calendar_' prefix from the GtkCalendarClass signal methods. GtkType and macro fixups, put `void' into () prototypes, avoid C++ style comments, indentation fixes, fixed some g_return_if_fail() statements. (gtk_calendar_paint_header): (gtk_calendar_paint_day_names): (gtk_calendar_paint_week_numbers): (gtk_calendar_paint_main): made these static functions. (gtk_calendar_select_month): (gtk_calendar_select_day): (gtk_calendar_mark_day): (gtk_calendar_unmark_day): (gtk_calendar_get_date): signedness corrections, use guints rather than gints. (gtk_calendar_size_request): removed unused variables.
This commit is contained in:
30
ChangeLog
30
ChangeLog
@ -1,3 +1,33 @@
|
||||
Thu Oct 1 10:40:20 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkclist.h (gtk_clist_prepend):
|
||||
* gtk/gtkclist.c (gtk_clist_prepend): new function.
|
||||
(gtk_clist_insert): added g_return_val_if_fail()
|
||||
statements. accept a row parameter < 0 or > clist->rows to indicate
|
||||
append mode.
|
||||
(real_clear): first clean up all internal pointers and lists (e.g.
|
||||
clist->row_list or clist->rows), then delete the distinct rows. this
|
||||
is required because of destroy notifiers, we need to have all internal
|
||||
structures updated and be reentrant.
|
||||
|
||||
* gtk/gtkcalendar.h:
|
||||
* gtk/gtkcalendar.c: removed the `gtk_calendar_' prefix from the
|
||||
GtkCalendarClass signal methods.
|
||||
GtkType and macro fixups, put `void' into () prototypes, avoid C++
|
||||
style comments, indentation fixes, fixed some g_return_if_fail()
|
||||
statements.
|
||||
(gtk_calendar_paint_header):
|
||||
(gtk_calendar_paint_day_names):
|
||||
(gtk_calendar_paint_week_numbers):
|
||||
(gtk_calendar_paint_main): made these static functions.
|
||||
(gtk_calendar_select_month):
|
||||
(gtk_calendar_select_day):
|
||||
(gtk_calendar_mark_day):
|
||||
(gtk_calendar_unmark_day):
|
||||
(gtk_calendar_get_date): signedness corrections, use guints
|
||||
rather than gints.
|
||||
(gtk_calendar_size_request): removed unused variables.
|
||||
|
||||
Wed Sep 30 13:11:09 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkitemfactory.c (gtk_item_factory_add_item): list all
|
||||
|
||||
@ -1,3 +1,33 @@
|
||||
Thu Oct 1 10:40:20 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkclist.h (gtk_clist_prepend):
|
||||
* gtk/gtkclist.c (gtk_clist_prepend): new function.
|
||||
(gtk_clist_insert): added g_return_val_if_fail()
|
||||
statements. accept a row parameter < 0 or > clist->rows to indicate
|
||||
append mode.
|
||||
(real_clear): first clean up all internal pointers and lists (e.g.
|
||||
clist->row_list or clist->rows), then delete the distinct rows. this
|
||||
is required because of destroy notifiers, we need to have all internal
|
||||
structures updated and be reentrant.
|
||||
|
||||
* gtk/gtkcalendar.h:
|
||||
* gtk/gtkcalendar.c: removed the `gtk_calendar_' prefix from the
|
||||
GtkCalendarClass signal methods.
|
||||
GtkType and macro fixups, put `void' into () prototypes, avoid C++
|
||||
style comments, indentation fixes, fixed some g_return_if_fail()
|
||||
statements.
|
||||
(gtk_calendar_paint_header):
|
||||
(gtk_calendar_paint_day_names):
|
||||
(gtk_calendar_paint_week_numbers):
|
||||
(gtk_calendar_paint_main): made these static functions.
|
||||
(gtk_calendar_select_month):
|
||||
(gtk_calendar_select_day):
|
||||
(gtk_calendar_mark_day):
|
||||
(gtk_calendar_unmark_day):
|
||||
(gtk_calendar_get_date): signedness corrections, use guints
|
||||
rather than gints.
|
||||
(gtk_calendar_size_request): removed unused variables.
|
||||
|
||||
Wed Sep 30 13:11:09 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkitemfactory.c (gtk_item_factory_add_item): list all
|
||||
|
||||
@ -1,3 +1,33 @@
|
||||
Thu Oct 1 10:40:20 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkclist.h (gtk_clist_prepend):
|
||||
* gtk/gtkclist.c (gtk_clist_prepend): new function.
|
||||
(gtk_clist_insert): added g_return_val_if_fail()
|
||||
statements. accept a row parameter < 0 or > clist->rows to indicate
|
||||
append mode.
|
||||
(real_clear): first clean up all internal pointers and lists (e.g.
|
||||
clist->row_list or clist->rows), then delete the distinct rows. this
|
||||
is required because of destroy notifiers, we need to have all internal
|
||||
structures updated and be reentrant.
|
||||
|
||||
* gtk/gtkcalendar.h:
|
||||
* gtk/gtkcalendar.c: removed the `gtk_calendar_' prefix from the
|
||||
GtkCalendarClass signal methods.
|
||||
GtkType and macro fixups, put `void' into () prototypes, avoid C++
|
||||
style comments, indentation fixes, fixed some g_return_if_fail()
|
||||
statements.
|
||||
(gtk_calendar_paint_header):
|
||||
(gtk_calendar_paint_day_names):
|
||||
(gtk_calendar_paint_week_numbers):
|
||||
(gtk_calendar_paint_main): made these static functions.
|
||||
(gtk_calendar_select_month):
|
||||
(gtk_calendar_select_day):
|
||||
(gtk_calendar_mark_day):
|
||||
(gtk_calendar_unmark_day):
|
||||
(gtk_calendar_get_date): signedness corrections, use guints
|
||||
rather than gints.
|
||||
(gtk_calendar_size_request): removed unused variables.
|
||||
|
||||
Wed Sep 30 13:11:09 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkitemfactory.c (gtk_item_factory_add_item): list all
|
||||
|
||||
@ -1,3 +1,33 @@
|
||||
Thu Oct 1 10:40:20 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkclist.h (gtk_clist_prepend):
|
||||
* gtk/gtkclist.c (gtk_clist_prepend): new function.
|
||||
(gtk_clist_insert): added g_return_val_if_fail()
|
||||
statements. accept a row parameter < 0 or > clist->rows to indicate
|
||||
append mode.
|
||||
(real_clear): first clean up all internal pointers and lists (e.g.
|
||||
clist->row_list or clist->rows), then delete the distinct rows. this
|
||||
is required because of destroy notifiers, we need to have all internal
|
||||
structures updated and be reentrant.
|
||||
|
||||
* gtk/gtkcalendar.h:
|
||||
* gtk/gtkcalendar.c: removed the `gtk_calendar_' prefix from the
|
||||
GtkCalendarClass signal methods.
|
||||
GtkType and macro fixups, put `void' into () prototypes, avoid C++
|
||||
style comments, indentation fixes, fixed some g_return_if_fail()
|
||||
statements.
|
||||
(gtk_calendar_paint_header):
|
||||
(gtk_calendar_paint_day_names):
|
||||
(gtk_calendar_paint_week_numbers):
|
||||
(gtk_calendar_paint_main): made these static functions.
|
||||
(gtk_calendar_select_month):
|
||||
(gtk_calendar_select_day):
|
||||
(gtk_calendar_mark_day):
|
||||
(gtk_calendar_unmark_day):
|
||||
(gtk_calendar_get_date): signedness corrections, use guints
|
||||
rather than gints.
|
||||
(gtk_calendar_size_request): removed unused variables.
|
||||
|
||||
Wed Sep 30 13:11:09 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkitemfactory.c (gtk_item_factory_add_item): list all
|
||||
|
||||
@ -1,3 +1,33 @@
|
||||
Thu Oct 1 10:40:20 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkclist.h (gtk_clist_prepend):
|
||||
* gtk/gtkclist.c (gtk_clist_prepend): new function.
|
||||
(gtk_clist_insert): added g_return_val_if_fail()
|
||||
statements. accept a row parameter < 0 or > clist->rows to indicate
|
||||
append mode.
|
||||
(real_clear): first clean up all internal pointers and lists (e.g.
|
||||
clist->row_list or clist->rows), then delete the distinct rows. this
|
||||
is required because of destroy notifiers, we need to have all internal
|
||||
structures updated and be reentrant.
|
||||
|
||||
* gtk/gtkcalendar.h:
|
||||
* gtk/gtkcalendar.c: removed the `gtk_calendar_' prefix from the
|
||||
GtkCalendarClass signal methods.
|
||||
GtkType and macro fixups, put `void' into () prototypes, avoid C++
|
||||
style comments, indentation fixes, fixed some g_return_if_fail()
|
||||
statements.
|
||||
(gtk_calendar_paint_header):
|
||||
(gtk_calendar_paint_day_names):
|
||||
(gtk_calendar_paint_week_numbers):
|
||||
(gtk_calendar_paint_main): made these static functions.
|
||||
(gtk_calendar_select_month):
|
||||
(gtk_calendar_select_day):
|
||||
(gtk_calendar_mark_day):
|
||||
(gtk_calendar_unmark_day):
|
||||
(gtk_calendar_get_date): signedness corrections, use guints
|
||||
rather than gints.
|
||||
(gtk_calendar_size_request): removed unused variables.
|
||||
|
||||
Wed Sep 30 13:11:09 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkitemfactory.c (gtk_item_factory_add_item): list all
|
||||
|
||||
@ -1,3 +1,33 @@
|
||||
Thu Oct 1 10:40:20 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkclist.h (gtk_clist_prepend):
|
||||
* gtk/gtkclist.c (gtk_clist_prepend): new function.
|
||||
(gtk_clist_insert): added g_return_val_if_fail()
|
||||
statements. accept a row parameter < 0 or > clist->rows to indicate
|
||||
append mode.
|
||||
(real_clear): first clean up all internal pointers and lists (e.g.
|
||||
clist->row_list or clist->rows), then delete the distinct rows. this
|
||||
is required because of destroy notifiers, we need to have all internal
|
||||
structures updated and be reentrant.
|
||||
|
||||
* gtk/gtkcalendar.h:
|
||||
* gtk/gtkcalendar.c: removed the `gtk_calendar_' prefix from the
|
||||
GtkCalendarClass signal methods.
|
||||
GtkType and macro fixups, put `void' into () prototypes, avoid C++
|
||||
style comments, indentation fixes, fixed some g_return_if_fail()
|
||||
statements.
|
||||
(gtk_calendar_paint_header):
|
||||
(gtk_calendar_paint_day_names):
|
||||
(gtk_calendar_paint_week_numbers):
|
||||
(gtk_calendar_paint_main): made these static functions.
|
||||
(gtk_calendar_select_month):
|
||||
(gtk_calendar_select_day):
|
||||
(gtk_calendar_mark_day):
|
||||
(gtk_calendar_unmark_day):
|
||||
(gtk_calendar_get_date): signedness corrections, use guints
|
||||
rather than gints.
|
||||
(gtk_calendar_size_request): removed unused variables.
|
||||
|
||||
Wed Sep 30 13:11:09 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkitemfactory.c (gtk_item_factory_add_item): list all
|
||||
|
||||
@ -1,3 +1,33 @@
|
||||
Thu Oct 1 10:40:20 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkclist.h (gtk_clist_prepend):
|
||||
* gtk/gtkclist.c (gtk_clist_prepend): new function.
|
||||
(gtk_clist_insert): added g_return_val_if_fail()
|
||||
statements. accept a row parameter < 0 or > clist->rows to indicate
|
||||
append mode.
|
||||
(real_clear): first clean up all internal pointers and lists (e.g.
|
||||
clist->row_list or clist->rows), then delete the distinct rows. this
|
||||
is required because of destroy notifiers, we need to have all internal
|
||||
structures updated and be reentrant.
|
||||
|
||||
* gtk/gtkcalendar.h:
|
||||
* gtk/gtkcalendar.c: removed the `gtk_calendar_' prefix from the
|
||||
GtkCalendarClass signal methods.
|
||||
GtkType and macro fixups, put `void' into () prototypes, avoid C++
|
||||
style comments, indentation fixes, fixed some g_return_if_fail()
|
||||
statements.
|
||||
(gtk_calendar_paint_header):
|
||||
(gtk_calendar_paint_day_names):
|
||||
(gtk_calendar_paint_week_numbers):
|
||||
(gtk_calendar_paint_main): made these static functions.
|
||||
(gtk_calendar_select_month):
|
||||
(gtk_calendar_select_day):
|
||||
(gtk_calendar_mark_day):
|
||||
(gtk_calendar_unmark_day):
|
||||
(gtk_calendar_get_date): signedness corrections, use guints
|
||||
rather than gints.
|
||||
(gtk_calendar_size_request): removed unused variables.
|
||||
|
||||
Wed Sep 30 13:11:09 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gtk/gtkitemfactory.c (gtk_item_factory_add_item): list all
|
||||
|
||||
@ -240,28 +240,36 @@ static void gtk_calendar_state_changed (GtkWidget *widget,
|
||||
GtkStateType previous_state);
|
||||
static void gtk_calendar_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous_style);
|
||||
void gtk_calendar_paint_header (GtkWidget *widget);
|
||||
void gtk_calendar_paint_day_names (GtkWidget *widget);
|
||||
void gtk_calendar_paint_week_numbers (GtkWidget *widget);
|
||||
void gtk_calendar_paint_main (GtkWidget *widget);
|
||||
static void gtk_calendar_paint_header (GtkWidget *widget);
|
||||
static void gtk_calendar_paint_day_names (GtkWidget *widget);
|
||||
static void gtk_calendar_paint_week_numbers (GtkWidget *widget);
|
||||
static void gtk_calendar_paint_main (GtkWidget *widget);
|
||||
|
||||
|
||||
static void gtk_calendar_paint (GtkWidget *widget, GdkRectangle *area);
|
||||
static void gtk_calendar_paint_arrow (GtkWidget *widget, guint arrow);
|
||||
static void gtk_calendar_paint_day_num (GtkWidget *widget, gint day);
|
||||
static void gtk_calendar_paint_day (GtkWidget *widget, gint row, gint col);
|
||||
static void gtk_calendar_draw (GtkWidget *widget, GdkRectangle *area);
|
||||
static void gtk_calendar_paint (GtkWidget *widget,
|
||||
GdkRectangle *area);
|
||||
static void gtk_calendar_paint_arrow (GtkWidget *widget,
|
||||
guint arrow);
|
||||
static void gtk_calendar_paint_day_num (GtkWidget *widget,
|
||||
gint day);
|
||||
static void gtk_calendar_paint_day (GtkWidget *widget,
|
||||
gint row,
|
||||
gint col);
|
||||
static void gtk_calendar_draw (GtkWidget *widget,
|
||||
GdkRectangle *area);
|
||||
static void gtk_calendar_compute_days (GtkCalendar *calendar);
|
||||
static gint left_x_for_column (GtkCalendar *calendar, gint column);
|
||||
static gint top_y_for_row (GtkCalendar *calendar, gint row);
|
||||
static gint left_x_for_column (GtkCalendar *calendar,
|
||||
gint column);
|
||||
static gint top_y_for_row (GtkCalendar *calendar,
|
||||
gint row);
|
||||
|
||||
static char *default_abbreviated_dayname[7];
|
||||
static char *default_monthname[12];
|
||||
|
||||
guint
|
||||
gtk_calendar_get_type ()
|
||||
GtkType
|
||||
gtk_calendar_get_type (void)
|
||||
{
|
||||
static guint calendar_type = 0;
|
||||
static GtkType calendar_type = 0;
|
||||
|
||||
if (!calendar_type)
|
||||
{
|
||||
@ -276,7 +284,7 @@ gtk_calendar_get_type ()
|
||||
(GtkArgGetFunc) NULL,
|
||||
};
|
||||
|
||||
calendar_type = gtk_type_unique (gtk_widget_get_type (), &calendar_info);
|
||||
calendar_type = gtk_type_unique (GTK_TYPE_WIDGET, &calendar_info);
|
||||
}
|
||||
|
||||
return calendar_type;
|
||||
@ -291,7 +299,7 @@ gtk_calendar_class_init (GtkCalendarClass *class)
|
||||
object_class = (GtkObjectClass*) class;
|
||||
widget_class = (GtkWidgetClass*) class;
|
||||
|
||||
parent_class = gtk_type_class (gtk_widget_get_type ());
|
||||
parent_class = gtk_type_class (GTK_TYPE_WIDGET);
|
||||
|
||||
widget_class->realize = gtk_calendar_realize;
|
||||
widget_class->unrealize = gtk_calendar_unrealize;
|
||||
@ -313,50 +321,48 @@ gtk_calendar_class_init (GtkCalendarClass *class)
|
||||
gtk_calendar_signals[MONTH_CHANGED_SIGNAL] =
|
||||
gtk_signal_new ("month_changed",
|
||||
GTK_RUN_FIRST, object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GtkCalendarClass, gtk_calendar_month_changed),
|
||||
GTK_SIGNAL_OFFSET (GtkCalendarClass, month_changed),
|
||||
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
|
||||
gtk_calendar_signals[DAY_SELECTED_SIGNAL] =
|
||||
gtk_signal_new ("day_selected",
|
||||
GTK_RUN_FIRST, object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GtkCalendarClass, gtk_calendar_day_selected),
|
||||
GTK_SIGNAL_OFFSET (GtkCalendarClass, day_selected),
|
||||
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
|
||||
gtk_calendar_signals[DAY_SELECTED_DOUBLE_CLICK_SIGNAL] =
|
||||
gtk_signal_new ("day_selected_double_click",
|
||||
GTK_RUN_FIRST, object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GtkCalendarClass, gtk_calendar_day_selected_double_click),
|
||||
GTK_SIGNAL_OFFSET (GtkCalendarClass, day_selected_double_click),
|
||||
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
|
||||
gtk_calendar_signals[PREV_MONTH_SIGNAL] =
|
||||
gtk_signal_new ("prev_month",
|
||||
GTK_RUN_FIRST, object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GtkCalendarClass, gtk_calendar_prev_month),
|
||||
GTK_SIGNAL_OFFSET (GtkCalendarClass, prev_month),
|
||||
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
|
||||
gtk_calendar_signals[NEXT_MONTH_SIGNAL] =
|
||||
gtk_signal_new ("next_month",
|
||||
GTK_RUN_FIRST, object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GtkCalendarClass, gtk_calendar_next_month),
|
||||
GTK_SIGNAL_OFFSET (GtkCalendarClass, next_month),
|
||||
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
|
||||
gtk_calendar_signals[PREV_YEAR_SIGNAL] =
|
||||
gtk_signal_new ("prev_year",
|
||||
GTK_RUN_FIRST, object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GtkCalendarClass, gtk_calendar_prev_year),
|
||||
GTK_SIGNAL_OFFSET (GtkCalendarClass, prev_year),
|
||||
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
|
||||
gtk_calendar_signals[NEXT_YEAR_SIGNAL] =
|
||||
gtk_signal_new ("next_year",
|
||||
GTK_RUN_FIRST, object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GtkCalendarClass, gtk_calendar_next_year),
|
||||
GTK_SIGNAL_OFFSET (GtkCalendarClass, next_year),
|
||||
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
|
||||
|
||||
gtk_object_class_add_signals (object_class, gtk_calendar_signals, LAST_SIGNAL);
|
||||
|
||||
class->gtk_calendar_month_changed = NULL;
|
||||
class->gtk_calendar_day_selected = NULL;
|
||||
class->gtk_calendar_day_selected_double_click = NULL;
|
||||
class->gtk_calendar_prev_month = NULL;
|
||||
class->gtk_calendar_next_month = NULL;
|
||||
class->gtk_calendar_prev_year = NULL;
|
||||
class->gtk_calendar_next_year = NULL;
|
||||
|
||||
return;
|
||||
class->month_changed = NULL;
|
||||
class->day_selected = NULL;
|
||||
class->day_selected_double_click = NULL;
|
||||
class->prev_month = NULL;
|
||||
class->next_month = NULL;
|
||||
class->prev_year = NULL;
|
||||
class->next_year = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -417,15 +423,16 @@ gtk_calendar_init (GtkCalendar *calendar)
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
gtk_calendar_new ()
|
||||
gtk_calendar_new (void)
|
||||
{
|
||||
return GTK_WIDGET (gtk_type_new (gtk_calendar_get_type ()));
|
||||
return GTK_WIDGET (gtk_type_new (GTK_TYPE_CALENDAR));
|
||||
}
|
||||
|
||||
/* column_from_x: returns the column 0-6 that the
|
||||
* x pixel of the xwindow is in */
|
||||
static gint
|
||||
column_from_x (GtkCalendar *calendar, gint event_x)
|
||||
column_from_x (GtkCalendar *calendar,
|
||||
gint event_x)
|
||||
{
|
||||
gint c, column;
|
||||
gint x_left, x_right;
|
||||
@ -459,7 +466,8 @@ row_height (GtkCalendar *calendar)
|
||||
/* row_from_y: returns the row 0-5 that the
|
||||
* y pixel of the xwindow is in */
|
||||
static gint
|
||||
row_from_y (GtkCalendar *calendar, gint event_y)
|
||||
row_from_y (GtkCalendar *calendar,
|
||||
gint event_y)
|
||||
{
|
||||
gint r, row;
|
||||
gint height;
|
||||
@ -486,7 +494,8 @@ row_from_y (GtkCalendar *calendar, gint event_y)
|
||||
/* left_x_for_column: returns the x coordinate
|
||||
* for the left of the column */
|
||||
static gint
|
||||
left_x_for_column (GtkCalendar *calendar, gint column)
|
||||
left_x_for_column (GtkCalendar *calendar,
|
||||
gint column)
|
||||
{
|
||||
gint width;
|
||||
gint x_left;
|
||||
@ -503,7 +512,8 @@ left_x_for_column (GtkCalendar *calendar, gint column)
|
||||
/* top_y_for_row: returns the y coordinate
|
||||
* for the top of the row */
|
||||
static gint
|
||||
top_y_for_row (GtkCalendar *calendar, gint row)
|
||||
top_y_for_row (GtkCalendar *calendar,
|
||||
gint row)
|
||||
{
|
||||
|
||||
return calendar->main_h - (CALENDAR_MARGIN + (6 - row) *
|
||||
@ -513,7 +523,11 @@ top_y_for_row (GtkCalendar *calendar, gint row)
|
||||
/* This function should be done by the toolkit, but we don't like the
|
||||
* GTK arrows because they don't look good on this widget */
|
||||
static void
|
||||
draw_arrow_right (GdkWindow *window, GdkGC *gc, gint x, gint y, gint size)
|
||||
draw_arrow_right (GdkWindow *window,
|
||||
GdkGC *gc,
|
||||
gint x,
|
||||
gint y,
|
||||
gint size)
|
||||
{
|
||||
gint i;
|
||||
|
||||
@ -530,7 +544,11 @@ draw_arrow_right (GdkWindow *window, GdkGC *gc, gint x, gint y, gint size)
|
||||
/* This function should be done by the toolkit, but we don't like the
|
||||
* GTK arrows because they don't look good on this widget */
|
||||
static void
|
||||
draw_arrow_left (GdkWindow *window, GdkGC *gc, gint x, gint y, gint size)
|
||||
draw_arrow_left (GdkWindow *window,
|
||||
GdkGC *gc,
|
||||
gint x,
|
||||
gint y,
|
||||
gint size)
|
||||
{
|
||||
gint i;
|
||||
|
||||
@ -901,7 +919,6 @@ gtk_calendar_realize_week_numbers (GtkWidget *widget)
|
||||
calendar->week_win = NULL;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gtk_calendar_realize (GtkWidget *widget)
|
||||
{
|
||||
@ -1019,9 +1036,6 @@ gtk_calendar_size_request (GtkWidget *widget,
|
||||
gchar buffer[255];
|
||||
gint calendar_margin = CALENDAR_MARGIN;
|
||||
gint header_width, main_width;
|
||||
gint day_font_lbearing;
|
||||
gint day_font_rbearing;
|
||||
gint day_font_width;
|
||||
gint lbearing;
|
||||
gint rbearing;
|
||||
gint ascent;
|
||||
@ -1255,8 +1269,6 @@ gtk_calendar_size_allocate (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
gtk_calendar_draw_focus (GtkWidget *widget)
|
||||
{
|
||||
@ -1353,7 +1365,6 @@ gtk_calendar_draw (GtkWidget *widget,
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gtk_calendar_paint (GtkWidget *widget,
|
||||
GdkRectangle *area)
|
||||
@ -1381,7 +1392,7 @@ gtk_calendar_paint (GtkWidget *widget,
|
||||
gtk_widget_draw_focus (widget);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
gtk_calendar_paint_header (GtkWidget *widget)
|
||||
{
|
||||
GtkCalendar *calendar;
|
||||
@ -1460,7 +1471,7 @@ gtk_calendar_paint_header (GtkWidget *widget)
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
gtk_calendar_paint_day_names (GtkWidget *widget)
|
||||
{
|
||||
GtkCalendar *calendar;
|
||||
@ -1541,7 +1552,7 @@ gtk_calendar_paint_day_names (GtkWidget *widget)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
gtk_calendar_paint_week_numbers (GtkWidget *widget)
|
||||
{
|
||||
GtkCalendar *calendar;
|
||||
@ -1629,7 +1640,8 @@ gtk_calendar_paint_week_numbers (GtkWidget *widget)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_calendar_paint_day_num (GtkWidget *widget, gint day)
|
||||
gtk_calendar_paint_day_num (GtkWidget *widget,
|
||||
gint day)
|
||||
{
|
||||
GtkCalendar *calendar;
|
||||
gint r, c, row, col;
|
||||
@ -1656,9 +1668,10 @@ gtk_calendar_paint_day_num (GtkWidget *widget, gint day)
|
||||
gtk_calendar_paint_day (widget, row, col);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gtk_calendar_paint_day (GtkWidget *widget, gint row, gint col)
|
||||
gtk_calendar_paint_day (GtkWidget *widget,
|
||||
gint row,
|
||||
gint col)
|
||||
{
|
||||
GtkCalendar *calendar;
|
||||
GdkGC *gc;
|
||||
@ -1750,7 +1763,7 @@ gtk_calendar_paint_day (GtkWidget *widget, gint row, gint col)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
gtk_calendar_paint_main (GtkWidget *widget)
|
||||
{
|
||||
GtkCalendar *calendar;
|
||||
@ -1769,7 +1782,7 @@ gtk_calendar_paint_main (GtkWidget *widget)
|
||||
calendar->dirty_main = 0;
|
||||
gdk_window_clear (calendar->main_win);
|
||||
|
||||
// gtk_calendar_compute_days (calendar); /* REMOVE later */
|
||||
/* gtk_calendar_compute_days (calendar); */ /* REMOVE later */
|
||||
|
||||
for (col = 0; col < 7; col++)
|
||||
for (row = 0; row < 6; row++)
|
||||
@ -1864,15 +1877,17 @@ gtk_calendar_compute_days (GtkCalendar *calendar)
|
||||
GTK_CALENDAR_WEEK_START_MONDAY
|
||||
---------------------------------------------------------------------- */
|
||||
|
||||
void gtk_calendar_display_options (GtkCalendar *calendar,
|
||||
void
|
||||
gtk_calendar_display_options (GtkCalendar *calendar,
|
||||
GtkCalendarDisplayOptions flags)
|
||||
{
|
||||
gint resize = 0;
|
||||
GtkWidget *widget;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (calendar != NULL);
|
||||
g_return_if_fail (GTK_IS_CALENDAR (calendar));
|
||||
g_return_if_fail (GTK_IS_WIDGET (calendar));
|
||||
|
||||
widget = GTK_WIDGET (calendar);
|
||||
|
||||
if (GTK_WIDGET_REALIZED (widget))
|
||||
@ -1981,11 +1996,13 @@ void gtk_calendar_display_options (GtkCalendar *calendar,
|
||||
}
|
||||
|
||||
gint
|
||||
gtk_calendar_select_month (GtkCalendar *calendar, gint month, gint year)
|
||||
gtk_calendar_select_month (GtkCalendar *calendar,
|
||||
guint month,
|
||||
guint year)
|
||||
{
|
||||
g_return_val_if_fail (calendar != NULL, FALSE);
|
||||
g_return_val_if_fail (month >= 0 && month <= 11, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_CALENDAR (calendar), FALSE);
|
||||
g_return_val_if_fail (month <= 11, FALSE);
|
||||
|
||||
calendar->month = month;
|
||||
calendar->year = year;
|
||||
@ -2001,12 +2018,14 @@ gtk_calendar_select_month (GtkCalendar *calendar, gint month, gint year)
|
||||
}
|
||||
|
||||
void
|
||||
gtk_calendar_select_day (GtkCalendar *calendar, gint day)
|
||||
gtk_calendar_select_day (GtkCalendar *calendar,
|
||||
guint day)
|
||||
{
|
||||
g_return_if_fail (calendar != NULL);
|
||||
g_return_if_fail (GTK_IS_CALENDAR (calendar));
|
||||
g_return_if_fail (day <= 31);
|
||||
|
||||
// gtk_calendar_compute_days (calendar);
|
||||
/* gtk_calendar_compute_days (calendar); */
|
||||
|
||||
/* Deselect the old day */
|
||||
if (calendar->selected_day > 0)
|
||||
@ -2035,25 +2054,28 @@ gtk_calendar_select_day (GtkCalendar *calendar, gint day)
|
||||
void
|
||||
gtk_calendar_clear_marks (GtkCalendar *calendar)
|
||||
{
|
||||
gint day;
|
||||
guint day;
|
||||
|
||||
g_return_if_fail (calendar != NULL);
|
||||
g_return_if_fail (GTK_IS_CALENDAR (calendar));
|
||||
|
||||
for (day = 0; day < 31; day++)
|
||||
{
|
||||
calendar->marked_date[day] = FALSE;
|
||||
}
|
||||
|
||||
if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (calendar)))
|
||||
if (GTK_WIDGET_DRAWABLE (calendar))
|
||||
{
|
||||
gtk_calendar_paint_main (GTK_WIDGET (calendar));
|
||||
}
|
||||
}
|
||||
|
||||
gint
|
||||
gtk_calendar_mark_day (GtkCalendar *calendar, gint day)
|
||||
gtk_calendar_mark_day (GtkCalendar *calendar,
|
||||
guint day)
|
||||
{
|
||||
g_return_val_if_fail (calendar != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_CALENDAR (calendar), FALSE);
|
||||
|
||||
if (day >= 1 && day <= 31)
|
||||
calendar->marked_date[day - 1] = TRUE;
|
||||
@ -2062,13 +2084,16 @@ gtk_calendar_mark_day (GtkCalendar *calendar, gint day)
|
||||
{
|
||||
gtk_calendar_paint_main (GTK_WIDGET (calendar));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gint
|
||||
gtk_calendar_unmark_day (GtkCalendar *calendar, gint day)
|
||||
gtk_calendar_unmark_day (GtkCalendar *calendar,
|
||||
guint day)
|
||||
{
|
||||
g_return_val_if_fail (calendar != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_CALENDAR (calendar), FALSE);
|
||||
|
||||
if (day >= 1 && day <= 31)
|
||||
calendar->marked_date[day - 1] = FALSE;
|
||||
@ -2077,11 +2102,15 @@ gtk_calendar_unmark_day (GtkCalendar *calendar, gint day)
|
||||
{
|
||||
gtk_calendar_paint_main (GTK_WIDGET (calendar));
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_calendar_get_date (GtkCalendar *calendar, gint *year, gint *month, gint *day)
|
||||
gtk_calendar_get_date (GtkCalendar *calendar,
|
||||
guint *year,
|
||||
guint *month,
|
||||
guint *day)
|
||||
{
|
||||
g_return_if_fail (calendar != NULL);
|
||||
g_return_if_fail (GTK_IS_CALENDAR (calendar));
|
||||
@ -2259,7 +2288,8 @@ gtk_calendar_leave_notify (GtkWidget *widget,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_calendar_paint_arrow (GtkWidget *widget, guint arrow)
|
||||
gtk_calendar_paint_arrow (GtkWidget *widget,
|
||||
guint arrow)
|
||||
{
|
||||
GdkWindow *window;
|
||||
GdkGC *gc;
|
||||
@ -2301,14 +2331,18 @@ gtk_calendar_paint_arrow (GtkWidget *widget, guint arrow)
|
||||
void
|
||||
gtk_calendar_freeze (GtkCalendar *calendar)
|
||||
{
|
||||
g_return_if_fail (calendar != NULL);
|
||||
g_return_if_fail (GTK_IS_CALENDAR (calendar));
|
||||
|
||||
calendar->frozen++;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_calendar_thaw (GtkCalendar *calendar)
|
||||
{
|
||||
g_return_if_fail (calendar != NULL);
|
||||
g_return_if_fail (GTK_IS_CALENDAR (calendar));
|
||||
|
||||
if (calendar->frozen)
|
||||
{
|
||||
calendar->frozen--;
|
||||
@ -2339,7 +2373,9 @@ gtk_calendar_set_background(GtkWidget *widget)
|
||||
GtkCalendar *calendar;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (widget != NULL);
|
||||
g_return_if_fail (GTK_IS_CALENDAR (widget));
|
||||
|
||||
if (GTK_WIDGET_REALIZED (widget))
|
||||
{
|
||||
calendar = GTK_CALENDAR (widget);
|
||||
@ -2382,7 +2418,8 @@ gtk_calendar_state_changed (GtkWidget *widget,
|
||||
gtk_calendar_set_background (widget);
|
||||
}
|
||||
|
||||
static gint gtk_calendar_focus_in (GtkWidget *widget,
|
||||
static gint
|
||||
gtk_calendar_focus_in (GtkWidget *widget,
|
||||
GdkEventFocus *event)
|
||||
{
|
||||
GtkCalendar *calendar;
|
||||
@ -2403,10 +2440,10 @@ static gint gtk_calendar_focus_in (GtkWidget *widget,
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
static gint gtk_calendar_focus_out (GtkWidget *widget,
|
||||
static gint
|
||||
gtk_calendar_focus_out (GtkWidget *widget,
|
||||
GdkEventFocus *event)
|
||||
{
|
||||
GtkCalendar *calendar;
|
||||
@ -2441,7 +2478,6 @@ gtk_calendar_key_press (GtkWidget *widget,
|
||||
calendar = GTK_CALENDAR (widget);
|
||||
return_val = FALSE;
|
||||
|
||||
|
||||
switch (event->keyval)
|
||||
{
|
||||
case GDK_Left:
|
||||
@ -2542,5 +2578,6 @@ gtk_calendar_key_press (GtkWidget *widget,
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return return_val;
|
||||
}
|
||||
|
||||
@ -18,22 +18,26 @@
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_CALENDAR_H__
|
||||
#define __GTK_CALENDAR_H__
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <gtk/gtksignal.h>
|
||||
#include <gtk/gtkwidget.h>
|
||||
#include <gtk/gtkfeatures.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#pragma }
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define GTK_CALENDAR(obj) GTK_CHECK_CAST (obj, gtk_calendar_get_type (), GtkCalendar)
|
||||
#define GTK_CALENDAR_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_calendar_get_type (), GtkCalendarClass)
|
||||
#define GTK_IS_CALENDAR(obj) GTK_CHECK_TYPE (obj, gtk_calendar_get_type ())
|
||||
|
||||
#define GTK_TYPE_CALENDAR (gtk_calendar_get_type ())
|
||||
#define GTK_CALENDAR(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_CALENDAR, GtkCalendar))
|
||||
#define GTK_CALENDAR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_CALENDAR, GtkCalendarClass))
|
||||
#define GTK_IS_CALENDAR(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_CALENDAR))
|
||||
#define GTK_IS_CALENDAR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CALENDAR))
|
||||
|
||||
|
||||
typedef struct _GtkCalendar GtkCalendar;
|
||||
typedef struct _GtkCalendarClass GtkCalendarClass;
|
||||
@ -116,26 +120,30 @@ struct _GtkCalendarClass
|
||||
GtkWidgetClass parent_class;
|
||||
|
||||
/* Signal handlers */
|
||||
void (* gtk_calendar_month_changed) (GtkCalendarClass *);
|
||||
void (* gtk_calendar_day_selected) (GtkCalendarClass *);
|
||||
void (* gtk_calendar_day_selected_double_click) (GtkCalendarClass *);
|
||||
void (* gtk_calendar_prev_month) (GtkCalendarClass *);
|
||||
void (* gtk_calendar_next_month) (GtkCalendarClass *);
|
||||
void (* gtk_calendar_prev_year) (GtkCalendarClass *);
|
||||
void (* gtk_calendar_next_year) (GtkCalendarClass *);
|
||||
void (* month_changed) (GtkCalendarClass *calendar);
|
||||
void (* day_selected) (GtkCalendarClass *calendar);
|
||||
void (* day_selected_double_click) (GtkCalendarClass *calendar);
|
||||
void (* prev_month) (GtkCalendarClass *calendar);
|
||||
void (* next_month) (GtkCalendarClass *calendar);
|
||||
void (* prev_year) (GtkCalendarClass *calendar);
|
||||
void (* next_year) (GtkCalendarClass *calendar);
|
||||
|
||||
};
|
||||
|
||||
|
||||
guint gtk_calendar_get_type (void);
|
||||
GtkType gtk_calendar_get_type (void);
|
||||
GtkWidget* gtk_calendar_new (void);
|
||||
|
||||
gint gtk_calendar_select_month (GtkCalendar *calendar,
|
||||
gint month, gint year);
|
||||
void gtk_calendar_select_day (GtkCalendar *calendar, gint day);
|
||||
guint month,
|
||||
guint year);
|
||||
void gtk_calendar_select_day (GtkCalendar *calendar,
|
||||
guint day);
|
||||
|
||||
gint gtk_calendar_mark_day (GtkCalendar *calendar, gint day);
|
||||
gint gtk_calendar_unmark_day (GtkCalendar *calendar, gint day);
|
||||
gint gtk_calendar_mark_day (GtkCalendar *calendar,
|
||||
guint day);
|
||||
gint gtk_calendar_unmark_day (GtkCalendar *calendar,
|
||||
guint day);
|
||||
void gtk_calendar_clear_marks (GtkCalendar *calendar);
|
||||
|
||||
|
||||
@ -143,10 +151,17 @@ void gtk_calendar_display_options (GtkCalendar *calendar,
|
||||
GtkCalendarDisplayOptions flags);
|
||||
|
||||
void gtk_calendar_get_date (GtkCalendar *calendar,
|
||||
gint *year, gint *month, gint *day);
|
||||
guint *year,
|
||||
guint *month,
|
||||
guint *day);
|
||||
void gtk_calendar_freeze (GtkCalendar *calendar);
|
||||
void gtk_calendar_thaw (GtkCalendar *calendar);
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma {
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
@ -1684,6 +1684,17 @@ gtk_clist_get_selectable (GtkCList *clist,
|
||||
return GTK_CLIST_ROW (g_list_nth (clist->row_list, row))->selectable;
|
||||
}
|
||||
|
||||
gint
|
||||
gtk_clist_prepend (GtkCList *clist,
|
||||
gchar *text[])
|
||||
{
|
||||
g_return_val_if_fail (clist != NULL, -1);
|
||||
g_return_val_if_fail (GTK_IS_CLIST (clist), -1);
|
||||
g_return_val_if_fail (text != NULL, -1);
|
||||
|
||||
return GTK_CLIST_CLASS_FW (clist)->insert_row (clist, 0, text);
|
||||
}
|
||||
|
||||
gint
|
||||
gtk_clist_append (GtkCList *clist,
|
||||
gchar *text[])
|
||||
@ -1700,6 +1711,13 @@ gtk_clist_insert (GtkCList * clist,
|
||||
gint row,
|
||||
gchar *text[])
|
||||
{
|
||||
g_return_val_if_fail (clist != NULL, -1);
|
||||
g_return_val_if_fail (GTK_IS_CLIST (clist), -1);
|
||||
g_return_val_if_fail (text != NULL, -1);
|
||||
|
||||
if (row < 0 || row > clist->rows)
|
||||
row = clist->rows;
|
||||
|
||||
return GTK_CLIST_CLASS_FW (clist)->insert_row (clist, row, text);
|
||||
}
|
||||
|
||||
@ -1924,36 +1942,36 @@ gtk_clist_clear (GtkCList * clist)
|
||||
static void
|
||||
real_clear (GtkCList * clist)
|
||||
{
|
||||
GList *list;
|
||||
GList *list, *free_list;
|
||||
|
||||
g_return_if_fail (clist != NULL);
|
||||
g_return_if_fail (GTK_IS_CLIST (clist));
|
||||
|
||||
/* remove all the rows */
|
||||
for (list = clist->row_list; list; list = list->next)
|
||||
row_delete (clist, GTK_CLIST_ROW (list));
|
||||
|
||||
g_list_free (clist->row_list);
|
||||
|
||||
/* free up the selection list */
|
||||
g_list_free (clist->selection);
|
||||
g_list_free (clist->undo_selection);
|
||||
g_list_free (clist->undo_unselection);
|
||||
|
||||
clist->row_list = NULL;
|
||||
clist->row_list_end = NULL;
|
||||
clist->selection = NULL;
|
||||
clist->selection_end = NULL;
|
||||
clist->undo_selection = NULL;
|
||||
clist->undo_unselection = NULL;
|
||||
clist->voffset = 0;
|
||||
clist->rows = 0;
|
||||
clist->focus_row = -1;
|
||||
clist->anchor = -1;
|
||||
clist->undo_anchor = -1;
|
||||
clist->anchor_state = GTK_STATE_SELECTED;
|
||||
clist->drag_pos = -1;
|
||||
|
||||
/* remove all the rows */
|
||||
free_list = clist->row_list;
|
||||
clist->row_list = NULL;
|
||||
clist->row_list_end = NULL;
|
||||
clist->rows = 0;
|
||||
for (list = free_list; list; list = list->next)
|
||||
row_delete (clist, GTK_CLIST_ROW (list));
|
||||
g_list_free (free_list);
|
||||
|
||||
/* zero-out the scrollbars */
|
||||
if (clist->vscrollbar)
|
||||
{
|
||||
|
||||
@ -526,9 +526,11 @@ void gtk_clist_set_selectable (GtkCList *clist,
|
||||
gboolean gtk_clist_get_selectable (GtkCList *clist,
|
||||
gint row);
|
||||
|
||||
/* append returns the index of the row you just added, making
|
||||
* it easier to append and modify a row
|
||||
/* prepend/append returns the index of the row you just added,
|
||||
* making it easier to append and modify a row
|
||||
*/
|
||||
gint gtk_clist_prepend (GtkCList *clist,
|
||||
gchar *text[]);
|
||||
gint gtk_clist_append (GtkCList *clist,
|
||||
gchar *text[]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user