|
Packit |
15f964 |
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
/*
|
|
Packit |
15f964 |
* Author :
|
|
Packit |
15f964 |
* Damon Chaplin <damon@ximian.com>
|
|
Packit |
15f964 |
*
|
|
Packit |
15f964 |
* Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
|
|
Packit |
15f964 |
*
|
|
Packit |
15f964 |
* Based on the GnomeDateEdit, part of the Gnome Library.
|
|
Packit |
15f964 |
* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
|
|
Packit |
15f964 |
*
|
|
Packit |
15f964 |
* This program is free software; you can redistribute it and/or modify it
|
|
Packit |
15f964 |
* under the terms of the GNU Lesser General Public License as published by
|
|
Packit |
15f964 |
* published by the Free Software Foundation; either the
|
|
Packit |
15f964 |
*
|
|
Packit |
15f964 |
* This program is distributed in the hope that it will be useful, but
|
|
Packit |
15f964 |
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
Packit |
15f964 |
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
Packit |
15f964 |
* for more details.
|
|
Packit |
15f964 |
*
|
|
Packit |
15f964 |
* You should have received a copy of the GNU Lesser General Public License
|
|
Packit |
15f964 |
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
Packit |
15f964 |
*/
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
/*
|
|
Packit |
15f964 |
* EDateEdit - a widget based on GnomeDateEdit to provide a date & optional
|
|
Packit |
15f964 |
* time field with popups for entering a date.
|
|
Packit |
15f964 |
*
|
|
Packit |
15f964 |
* It emits a "changed" signal when the date and/or time has changed.
|
|
Packit |
15f964 |
* You can check if the last date or time entered was invalid by
|
|
Packit |
15f964 |
* calling e_date_edit_date_is_valid() and e_date_edit_time_is_valid().
|
|
Packit |
15f964 |
*
|
|
Packit |
15f964 |
* Note that when the user types in a date or time, it will only emit the
|
|
Packit |
15f964 |
* signals when the user presses the return key or switches the keyboard
|
|
Packit |
15f964 |
* focus to another widget, or you call one of the _get_time/date functions.
|
|
Packit |
15f964 |
*/
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
#if !defined (__E_UTIL_H_INSIDE__) && !defined (LIBEUTIL_COMPILATION)
|
|
Packit |
15f964 |
#error "Only <e-util/e-util.h> should be included directly."
|
|
Packit |
15f964 |
#endif
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
#ifndef E_DATE_EDIT_H
|
|
Packit |
15f964 |
#define E_DATE_EDIT_H
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
#include <time.h>
|
|
Packit |
15f964 |
#include <gtk/gtk.h>
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
/* Standard GObject macros */
|
|
Packit |
15f964 |
#define E_TYPE_DATE_EDIT \
|
|
Packit |
15f964 |
(e_date_edit_get_type ())
|
|
Packit |
15f964 |
#define E_DATE_EDIT(obj) \
|
|
Packit |
15f964 |
(G_TYPE_CHECK_INSTANCE_CAST \
|
|
Packit |
15f964 |
((obj), E_TYPE_DATE_EDIT, EDateEdit))
|
|
Packit |
15f964 |
#define E_DATE_EDIT_CLASS(cls) \
|
|
Packit |
15f964 |
(G_TYPE_CHECK_CLASS_CAST \
|
|
Packit |
15f964 |
((cls), E_TYPE_DATE_EDIT, EDateEditClass))
|
|
Packit |
15f964 |
#define E_IS_DATE_EDIT(obj) \
|
|
Packit |
15f964 |
(G_TYPE_CHECK_INSTANCE_TYPE \
|
|
Packit |
15f964 |
((obj), E_TYPE_DATE_EDIT))
|
|
Packit |
15f964 |
#define E_IS_DATE_EDIT_CLASS(cls) \
|
|
Packit |
15f964 |
(G_TYPE_CHECK_CLASS_TYPE \
|
|
Packit |
15f964 |
((cls), E_TYPE_DATE_EDIT))
|
|
Packit |
15f964 |
#define E_DATE_EDIT_GET_CLASS(obj) \
|
|
Packit |
15f964 |
(G_TYPE_INSTANCE_GET_CLASS \
|
|
Packit |
15f964 |
((obj), E_TYPE_DATE_EDIT, EDateEditClass))
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
G_BEGIN_DECLS
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
typedef struct _EDateEdit EDateEdit;
|
|
Packit |
15f964 |
typedef struct _EDateEditClass EDateEditClass;
|
|
Packit |
15f964 |
typedef struct _EDateEditPrivate EDateEditPrivate;
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
/* The type of the callback function optionally used to get the current time.
|
|
Packit |
15f964 |
*/
|
|
Packit |
15f964 |
typedef struct tm (*EDateEditGetTimeCallback)
|
|
Packit |
15f964 |
(EDateEdit *dedit,
|
|
Packit |
15f964 |
gpointer data);
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
struct _EDateEdit {
|
|
Packit |
15f964 |
GtkBox hbox;
|
|
Packit |
15f964 |
EDateEditPrivate *priv;
|
|
Packit |
15f964 |
};
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
struct _EDateEditClass {
|
|
Packit |
15f964 |
GtkBoxClass parent_class;
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
/* Signals */
|
|
Packit |
15f964 |
void (*changed) (EDateEdit *dedit);
|
|
Packit |
15f964 |
};
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
GType e_date_edit_get_type (void) G_GNUC_CONST;
|
|
Packit |
15f964 |
GtkWidget * e_date_edit_new (void);
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
/* Analogous to gtk_editable_set_editable. disable editing, while still
|
|
Packit |
15f964 |
* allowing selection. */
|
|
Packit |
15f964 |
void e_date_edit_set_editable (EDateEdit *dedit,
|
|
Packit |
15f964 |
gboolean editable);
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
/* Returns TRUE if the last date and time set were valid. The date and time
|
|
Packit |
15f964 |
* are only set when the user hits Return or switches keyboard focus, or
|
|
Packit |
15f964 |
* selects a date or time from the popup. */
|
|
Packit |
15f964 |
gboolean e_date_edit_date_is_valid (EDateEdit *dedit);
|
|
Packit |
15f964 |
gboolean e_date_edit_time_is_valid (EDateEdit *dedit);
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
/* Returns the last valid date & time set, or -1 if the date & time was set to
|
|
Packit |
15f964 |
* 'None' and this is permitted via e_date_edit_set_allow_no_date_set. */
|
|
Packit |
15f964 |
time_t e_date_edit_get_time (EDateEdit *dedit);
|
|
Packit |
15f964 |
void e_date_edit_set_time (EDateEdit *dedit,
|
|
Packit |
15f964 |
time_t the_time);
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
/* This returns the last valid date set, without the time. It returns TRUE
|
|
Packit |
15f964 |
* if a date is set, or FALSE if the date is set to 'None' and this is
|
|
Packit |
15f964 |
* permitted via e_date_edit_set_allow_no_date_set. (Month is 1 - 12). */
|
|
Packit |
15f964 |
gboolean e_date_edit_get_date (EDateEdit *dedit,
|
|
Packit |
15f964 |
gint *year,
|
|
Packit |
15f964 |
gint *month,
|
|
Packit |
15f964 |
gint *day);
|
|
Packit |
15f964 |
void e_date_edit_set_date (EDateEdit *dedit,
|
|
Packit |
15f964 |
gint year,
|
|
Packit |
15f964 |
gint month,
|
|
Packit |
15f964 |
gint day);
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
/* This returns the last valid time set, without the date. It returns TRUE
|
|
Packit |
15f964 |
* if a time is set, or FALSE if the time is set to 'None' and this is
|
|
Packit |
15f964 |
* permitted via e_date_edit_set_allow_no_date_set. */
|
|
Packit |
15f964 |
gboolean e_date_edit_get_time_of_day (EDateEdit *dedit,
|
|
Packit |
15f964 |
gint *hour,
|
|
Packit |
15f964 |
gint *minute);
|
|
Packit |
15f964 |
/* Set the time. Pass -1 as hour to set to empty. */
|
|
Packit |
15f964 |
void e_date_edit_set_time_of_day (EDateEdit *dedit,
|
|
Packit |
15f964 |
gint hour,
|
|
Packit |
15f964 |
gint minute);
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
void e_date_edit_set_date_and_time_of_day
|
|
Packit |
15f964 |
(EDateEdit *dedit,
|
|
Packit |
15f964 |
gint year,
|
|
Packit |
15f964 |
gint month,
|
|
Packit |
15f964 |
gint day,
|
|
Packit |
15f964 |
gint hour,
|
|
Packit |
15f964 |
gint minute);
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
/* Whether we show the date field. */
|
|
Packit |
15f964 |
gboolean e_date_edit_get_show_date (EDateEdit *dedit);
|
|
Packit |
15f964 |
void e_date_edit_set_show_date (EDateEdit *dedit,
|
|
Packit |
15f964 |
gboolean show_date);
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
/* Whether we show the time field. */
|
|
Packit |
15f964 |
gboolean e_date_edit_get_show_time (EDateEdit *dedit);
|
|
Packit |
15f964 |
void e_date_edit_set_show_time (EDateEdit *dedit,
|
|
Packit |
15f964 |
gboolean show_time);
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
/* The week start day, used in the date popup. */
|
|
Packit |
15f964 |
GDateWeekday e_date_edit_get_week_start_day (EDateEdit *dedit);
|
|
Packit |
15f964 |
void e_date_edit_set_week_start_day (EDateEdit *dedit,
|
|
Packit |
15f964 |
GDateWeekday week_start_day);
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
/* Whether we show week numbers in the date popup. */
|
|
Packit |
15f964 |
gboolean e_date_edit_get_show_week_numbers
|
|
Packit |
15f964 |
(EDateEdit *dedit);
|
|
Packit |
15f964 |
void e_date_edit_set_show_week_numbers
|
|
Packit |
15f964 |
(EDateEdit *dedit,
|
|
Packit |
15f964 |
gboolean show_week_numbers);
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
/* Whether we use 24 hour format in the time field & popup. */
|
|
Packit |
15f964 |
gboolean e_date_edit_get_use_24_hour_format
|
|
Packit |
15f964 |
(EDateEdit *dedit);
|
|
Packit |
15f964 |
void e_date_edit_set_use_24_hour_format
|
|
Packit |
15f964 |
(EDateEdit *dedit,
|
|
Packit |
15f964 |
gboolean use_24_hour_format);
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
/* Whether we allow the date to be set to 'None'. e_date_edit_get_time() will
|
|
Packit |
15f964 |
* return (time_t) -1 in this case. */
|
|
Packit |
15f964 |
gboolean e_date_edit_get_allow_no_date_set
|
|
Packit |
15f964 |
(EDateEdit *dedit);
|
|
Packit |
15f964 |
void e_date_edit_set_allow_no_date_set
|
|
Packit |
15f964 |
(EDateEdit *dedit,
|
|
Packit |
15f964 |
gboolean allow_no_date_set);
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
/* The range of time to show in the time combo popup. */
|
|
Packit |
15f964 |
void e_date_edit_get_time_popup_range
|
|
Packit |
15f964 |
(EDateEdit *dedit,
|
|
Packit |
15f964 |
gint *lower_hour,
|
|
Packit |
15f964 |
gint *upper_hour);
|
|
Packit |
15f964 |
void e_date_edit_set_time_popup_range
|
|
Packit |
15f964 |
(EDateEdit *dedit,
|
|
Packit |
15f964 |
gint lower_hour,
|
|
Packit |
15f964 |
gint upper_hour);
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
/* Whether the time field is made insensitive rather than hiding it. */
|
|
Packit |
15f964 |
gboolean e_date_edit_get_make_time_insensitive
|
|
Packit |
15f964 |
(EDateEdit *dedit);
|
|
Packit |
15f964 |
void e_date_edit_set_make_time_insensitive
|
|
Packit |
15f964 |
(EDateEdit *dedit,
|
|
Packit |
15f964 |
gboolean make_insensitive);
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
/* Whether two-digit years in date could be modified as in future; default is TRUE */
|
|
Packit |
15f964 |
gboolean e_date_edit_get_twodigit_year_can_future
|
|
Packit |
15f964 |
(EDateEdit *dedit);
|
|
Packit |
15f964 |
void e_date_edit_set_twodigit_year_can_future
|
|
Packit |
15f964 |
(EDateEdit *dedit,
|
|
Packit |
15f964 |
gboolean value);
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
/* Sets a callback to use to get the current time. This is useful if the
|
|
Packit |
15f964 |
* application needs to use its own timezone data rather than rely on the
|
|
Packit |
15f964 |
* Unix timezone. */
|
|
Packit |
15f964 |
void e_date_edit_set_get_time_callback
|
|
Packit |
15f964 |
(EDateEdit *dedit,
|
|
Packit |
15f964 |
EDateEditGetTimeCallback cb,
|
|
Packit |
15f964 |
gpointer data,
|
|
Packit |
15f964 |
GDestroyNotify destroy);
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
GtkWidget * e_date_edit_get_entry (EDateEdit *dedit);
|
|
Packit |
15f964 |
|
|
Packit Service |
3af3fd |
gboolean e_date_edit_has_focus (EDateEdit *dedit);
|
|
Packit Service |
3af3fd |
|
|
Packit |
15f964 |
G_END_DECLS
|
|
Packit |
15f964 |
|
|
Packit |
15f964 |
#endif /* E_DATE_EDIT_H */
|