1 /* 2 * gnc-dateedit.c -- Date editor widget 3 * 4 * Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation 5 * All rights reserved. 6 * 7 * This file was part of the Gnome Library. It was modified by 8 * Dave Peticolas <dave@krondo.com> for use in GnuCash. 9 * 10 * GnuCash is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU Library General Public License as 12 * published by the Free Software Foundation; either version 2 of 13 * the License, or (at your option) any later version. 14 * 15 * Gnucash is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 * Library General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License 21 * along with this program; if not, contact: 22 * 23 * Free Software Foundation Voice: +1-617-542-5942 24 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 25 * Boston, MA 02110-1301, USA gnu@gnu.org 26 * */ 27 /* 28 @NOTATION@ 29 */ 30 31 #ifndef GNC_DATE_EDIT_H 32 #define GNC_DATE_EDIT_H 33 34 #include <glib.h> 35 #include <time.h> 36 #include "gnc-date.h" 37 38 typedef enum 39 { 40 GNC_DATE_EDIT_SHOW_TIME = 1 << 0, 41 GNC_DATE_EDIT_24_HR = 1 << 1, 42 } GNCDateEditFlags; 43 44 #define GNC_TYPE_DATE_EDIT (gnc_date_edit_get_type ()) 45 #define GNC_DATE_EDIT(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, gnc_date_edit_get_type(), GNCDateEdit) 46 #define GNC_DATE_EDIT_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, gnc_date_edit_get_type(), GNCDateEditClass) 47 #define GNC_IS_DATE_EDIT(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, gnc_date_edit_get_type ()) 48 49 /** 50 * \verbatim 51 * * 2001.05.13T1647 [PDT], #gnucash: 52 * <jsled> dave_p: So the header for gnc-dateedit.h is a bit light 53 * on _why_ such a thing was done... any help? 54 * <dave_p> jsled: gnome date edit isn't i18n'd properly. also, we 55 * added the register date hotkeys. 56 * \endverbatim 57 **/ 58 typedef struct 59 { 60 GtkBox hbox; 61 62 GtkWidget *date_entry; 63 GtkWidget *date_button; 64 65 GtkWidget *time_entry; 66 GtkWidget *time_combo; 67 68 GtkWidget *cal_label; 69 GtkWidget *cal_popup; 70 GtkWidget *calendar; 71 72 time64 initial_time; 73 74 int lower_hour; 75 int upper_hour; 76 77 int flags; 78 79 int disposed; 80 81 gboolean popup_in_progress; 82 gboolean in_selected_handler; 83 } GNCDateEdit; 84 85 typedef struct 86 { 87 GtkBoxClass parent_class; 88 void (*date_changed) (GNCDateEdit *gde); 89 void (*time_changed) (GNCDateEdit *gde); 90 } GNCDateEditClass; 91 92 GType gnc_date_edit_get_type (void); 93 94 GtkWidget *gnc_date_edit_new (time64 the_time, 95 int show_time, int use_24_format); 96 97 /** 98 * Create a new GncDateEdit widget from a glade file. The widget 99 * generated is set to today's date, and will not show a time as part 100 * of the date. This function does not use any of the arguments 101 * passed by glade. 102 * 103 * @param widget_name This parameter is unused. The actual widget 104 * name will be set by glade so it does not need to be done here. 105 * 106 * @param string1 Unused. 107 * @param string2 Unused. 108 * @param int1 Unused. 109 * @param int2 Unused. 110 * 111 * @return A pointer to the newly created GncDateEdit widget. 112 */ 113 GtkWidget *gnc_date_edit_new_glade (gchar *widget_name, 114 gchar *string1, gchar *string2, 115 gint int1, gint int2); 116 117 GtkWidget *gnc_date_edit_new_flags (time64 the_time, 118 GNCDateEditFlags flags); 119 120 void gnc_date_edit_set_gdate (GNCDateEdit *gde, const GDate *date); 121 void gnc_date_edit_set_time (GNCDateEdit *gde, time64 the_time); 122 123 void gnc_date_edit_set_popup_range (GNCDateEdit *gde, 124 int low_hour, int up_hour); 125 126 void gnc_date_edit_get_gdate (GNCDateEdit *gde, GDate *date); 127 time64 gnc_date_edit_get_date (GNCDateEdit *gde); 128 time64 gnc_date_edit_get_date_end (GNCDateEdit *gde); 129 130 void gnc_date_edit_set_flags (GNCDateEdit *gde, 131 GNCDateEditFlags flags); 132 int gnc_date_edit_get_flags (GNCDateEdit *gde); 133 134 void gnc_date_activates_default (GNCDateEdit *gde, gboolean state); 135 void gnc_date_grab_focus (GNCDateEdit *gde); 136 137 void gnc_date_make_mnemonic_target (GNCDateEdit *gde, GtkWidget *label); 138 #endif 139