GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gnc-date-edit.h
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 modifed by
8  * Dave Peticolas <[email protected]> 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 [email protected]
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  GNC_DATE_EDIT_WEEK_STARTS_ON_MONDAY = 1 << 2,
43 } GNCDateEditFlags;
44 
45 #define GNC_TYPE_DATE_EDIT (gnc_date_edit_get_type ())
46 #define GNC_DATE_EDIT(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, gnc_date_edit_get_type(), GNCDateEdit)
47 #define GNC_DATE_EDIT_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, gnc_date_edit_get_type(), GNCDateEditClass)
48 #define GNC_IS_DATE_EDIT(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, gnc_date_edit_get_type ())
49 
59 typedef struct
60 {
61  GtkHBox hbox;
62 
63  GtkWidget *date_entry;
64  GtkWidget *date_button;
65 
66  GtkWidget *time_entry;
67  GtkWidget *time_combo;
68 
69  GtkWidget *cal_label;
70  GtkWidget *cal_popup;
71  GtkWidget *calendar;
72 
73  time64 initial_time;
74 
75  int lower_hour;
76  int upper_hour;
77 
78  int flags;
79 
80  int disposed;
81 
82  gboolean popup_in_progress;
83  gboolean in_selected_handler;
84 } GNCDateEdit;
85 
86 typedef struct
87 {
88  GtkHBoxClass parent_class;
89  void (*date_changed) (GNCDateEdit *gde);
90  void (*time_changed) (GNCDateEdit *gde);
92 
93 GType gnc_date_edit_get_type (void);
94 
95 GtkWidget *gnc_date_edit_new (time64 the_time,
96  int show_time, int use_24_format);
97 GtkWidget *gnc_date_edit_new_ts (Timespec the_time,
98  int show_time, int use_24_format);
99 
116 GtkWidget *gnc_date_edit_new_glade (gchar *widget_name,
117  gchar *string1, gchar *string2,
118  gint int1, gint int2);
119 
120 GtkWidget *gnc_date_edit_new_flags (time64 the_time,
121  GNCDateEditFlags flags);
122 
123 void gnc_date_edit_set_gdate (GNCDateEdit *gde, const GDate *date);
124 void gnc_date_edit_set_time (GNCDateEdit *gde, time64 the_time);
125 void gnc_date_edit_set_time_ts (GNCDateEdit *gde, Timespec the_time);
126 
127 void gnc_date_edit_set_popup_range (GNCDateEdit *gde,
128  int low_hour, int up_hour);
129 
130 void gnc_date_edit_get_gdate (GNCDateEdit *gde, GDate *date);
131 time64 gnc_date_edit_get_date (GNCDateEdit *gde);
132 Timespec gnc_date_edit_get_date_ts (GNCDateEdit *gde);
133 time64 gnc_date_edit_get_date_end (GNCDateEdit *gde);
134 Timespec gnc_date_edit_get_date_end_ts (GNCDateEdit *gde);
135 
136 void gnc_date_edit_set_flags (GNCDateEdit *gde,
137  GNCDateEditFlags flags);
138 int gnc_date_edit_get_flags (GNCDateEdit *gde);
139 
140 void gnc_date_activates_default (GNCDateEdit *gde, gboolean state);
141 void gnc_date_grab_focus (GNCDateEdit *gde);
142 
143 void gnc_date_make_mnemonic_target (GNCDateEdit *gde, GtkWidget *label);
144 #endif
Date and Time handling routines.
Use a 64-bit unsigned int timespec.
Definition: gnc-date.h:299
gint64 time64
Definition: gnc-date.h:83