Re: [gtk-list] GtkCalendar widget



On Tue, 17 Feb 1998, Ondrejicka Stefan wrote:

> Hi all,
> 
> I yesterday rewrote my old Xtoolkit Calendar widget to Gtk.
> If you want to use it, grab it from my homepage.
> 
> Bye,
> Stevo.
> 

This makes the third GtkCalendar widget.  Mine was first about
a year ago, and admittably it was one super-hack and sucked.  
Cesar Miquel and I are working on one now; we started this one
with his code base, and I've put some of the code from mine
into it for the date calculation code and reworked portions 
to make it layout better.  

Ours doesn't quite work fully yet, but promises much more in
the way of flexibility.  We have an initial screenshot up
at http://www.gimp.org/~amundson/aorta/calendar-3.gif.  It is
by no means finished.  This is just an initial version screenshot,
the cool ones are on their way soon.

We have recently gotton permission to use C portions from the 
perl DateCalc module under the LGPL (hurray!), which claims
date calculations complying with ISO/R 2015-1917 and DIN 1355
standards (don't ask me, that's why I'm using his stuff).
This is important because of things years such as 2100 not leap 
years, etc.  (year divisible by 100 is not a leap year unless 
it is also divisible by 400) ;-)

Right now we have the following defined in our .h file (minus
obvious other widget stuff):

typedef enum
{
  GTK_CALENDAR_SHOW_MONTH_HEADING = 1 << 0,
  GTK_CALENDAR_SHOW_WEEKDAY_HEADING = 1 << 1,
} GtkCalendarDisplayOptions;

typedef enum
{
  GTK_CALENDAR_FONT_HEADING,
  GTK_CALENDAR_FONT_DAY_NAME,
  GTK_CALENDAR_FONT_DAY
} GtkCalendarFont;

typedef enum
{
  GTK_CALENDAR_COLOR_HEADING,
  GTK_CALENDAR_COLOR_DAY_NAME,
  GTK_CALENDAR_COLOR_PREV_MONTH,
  GTK_CALENDAR_COLOR_NEXT_MONTH,
  GTK_CALENDAR_COLOR_NORMAL_DAY
} GtkCalendarColor;

guint      gtk_calendar_get_type        (void);
GtkWidget* gtk_calendar_new             (void);

void       gtk_calendar_select_month    (GtkCalendar *calendar, 
                                         gint year, gint month);
void       gtk_calendar_select_day      (GtkCalendar *calendar, gint day);

void       gtk_calendar_mark_day        (GtkCalendar *calendar, gint day);
void       gtk_calendar_unmark_day      (GtkCalendar *calendar, gint day);
void       gtk_calendar_clear_marks     (GtkCalendar *calendar);

void       gtk_calendar_set_font        (GtkCalendar *calendar, 
                                         GtkCalendarFont type, 
                                         GdkFont *font);
void       gtk_calendar_set_color       (GtkCalendar *calendar, 
                                         GtkCalendarColor type, 
                                         GdkColor *color);

void       gtk_calendar_display_options (GtkCalendar *calendar,
                                         gint flags);

Suggestions welcome on the coding interface.  We need at minimum
to add support for changing the day of week and month strings.  

It was suggested we allow making all weekend days seperately marked
with their own color.  (Add GTK_CALENDAR_COLOR_WEEKEND_DAY or similar.)

I am toying with the idea of allowing setting pixmaps for some days via
some method so that things like birthdays can have an image of a cake,
etc.  (This may be needed for gncal I think.)

Also, perhaps expanding it to allow easy creation of a calendar like
in plan, where the calendar is quite large and can contain text in the
day boxes would be very useful.  (Also potentally usable by gncal.)

--
Shawn T. Amundson	
amundson@gimp.org

while (i) { last }
    i, do exist.
    forever;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]