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:
Tim Janik 1998-10-01 13:24:42 +00:00 committed by Tim Janik
parent fa5c68f7c6
commit b89ed0c35f
11 changed files with 875 additions and 593 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -11,39 +11,43 @@
*
* 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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* 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 ())
typedef struct _GtkCalendar GtkCalendar;
#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;
typedef enum
{
GTK_CALENDAR_SHOW_HEADING = 1 << 0,
GTK_CALENDAR_SHOW_DAY_NAMES = 1 << 1,
GTK_CALENDAR_NO_MONTH_CHANGE = 1 << 2,
GTK_CALENDAR_SHOW_WEEK_NUMBERS = 1 << 3,
GTK_CALENDAR_SHOW_HEADING = 1 << 0,
GTK_CALENDAR_SHOW_DAY_NAMES = 1 << 1,
GTK_CALENDAR_NO_MONTH_CHANGE = 1 << 2,
GTK_CALENDAR_SHOW_WEEK_NUMBERS = 1 << 3,
GTK_CALENDAR_WEEK_START_MONDAY = 1 << 4
} GtkCalendarDisplayOptions;
@ -51,47 +55,47 @@ struct _GtkCalendar
{
/* This widget is derived from GtkWidget */
GtkWidget widget;
GdkWindow *header_win, *day_name_win, *main_win, *week_win;
gint header_h, day_name_h, main_h;
GtkStyle *header_style;
GtkStyle *label_style;
gint month;
gint year;
gint selected_day;
gint day_month[6][7];
gint day[6][7];
gint num_marked_dates;
gint marked_date[31];
GtkCalendarDisplayOptions display_flags;
GdkColor marked_date_color[31];
/* Header Information */
GdkWindow *arrow_win[4];
gint arrow_state[4];
gint arrow_width;
gint max_month_width;
gint max_year_width;
gint arrow_state[4];
gint arrow_width;
gint max_month_width;
gint max_year_width;
/* Other info */
gint calstarty, calnumrows;
/* Style parameters for this widget */
GdkGC *gc;
GdkCursor *cross;
gint day_width;
gint week_width;
GdkRectangle header_button[4];
GdkRectangle rect_days[6][7];
gint highlight_row;
gint highlight_col;
gint min_day_width;
gint max_day_char_width;
gint max_day_char_ascent;
@ -105,7 +109,7 @@ struct _GtkCalendar
unsigned int dirty_main:1;
unsigned int dirty_week:1;
unsigned int frozen;
gint week_num_w;
gint font_width_day_name, font_width_day;
char grow_space [32];
@ -114,39 +118,50 @@ struct _GtkCalendar
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);
GtkWidget* gtk_calendar_new (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);
gint gtk_calendar_select_month (GtkCalendar *calendar,
guint month,
guint year);
void gtk_calendar_select_day (GtkCalendar *calendar,
guint 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);
void gtk_calendar_display_options (GtkCalendar *calendar,
GtkCalendarDisplayOptions flags);
void gtk_calendar_get_date (GtkCalendar *calendar,
guint *year,
guint *month,
guint *day);
void gtk_calendar_freeze (GtkCalendar *calendar);
void gtk_calendar_thaw (GtkCalendar *calendar);
gint gtk_calendar_mark_day (GtkCalendar *calendar, gint day);
gint gtk_calendar_unmark_day (GtkCalendar *calendar, gint day);
void gtk_calendar_clear_marks (GtkCalendar *calendar);
void gtk_calendar_display_options (GtkCalendar *calendar,
GtkCalendarDisplayOptions flags);
void gtk_calendar_get_date (GtkCalendar *calendar,
gint *year, gint *month, gint *day);
void gtk_calendar_freeze (GtkCalendar *calendar);
void gtk_calendar_thaw (GtkCalendar *calendar);
#ifdef __cplusplus
#pragma {
}
#endif /* __cplusplus */

View File

@ -1685,8 +1685,19 @@ gtk_clist_get_selectable (GtkCList *clist,
}
gint
gtk_clist_append (GtkCList * clist,
gchar * text[])
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[])
{
g_return_val_if_fail (clist != NULL, -1);
g_return_val_if_fail (GTK_IS_CLIST (clist), -1);
@ -1696,17 +1707,24 @@ gtk_clist_append (GtkCList * clist,
}
gint
gtk_clist_insert (GtkCList * clist,
gint row,
gchar * text[])
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);
}
static gint
real_insert_row (GtkCList * clist,
gint row,
gchar * text[])
real_insert_row (GtkCList *clist,
gint row,
gchar *text[])
{
gint i;
GtkCListRow *clist_row;
@ -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)
{

View File

@ -526,11 +526,13 @@ 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_append (GtkCList *clist,
gchar *text[]);
gint gtk_clist_prepend (GtkCList *clist,
gchar *text[]);
gint gtk_clist_append (GtkCList *clist,
gchar *text[]);
/* inserts a row at index row and returns the row where it was actually
* inserted (may be different from "row" in auto_sort mode)