GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
datecell.h
1 /********************************************************************\
2  * datecell.h -- Date entry/handling/display cell *
3  * *
4  * This program is free software; you can redistribute it and/or *
5  * modify it under the terms of the GNU General Public License as *
6  * published by the Free Software Foundation; either version 2 of *
7  * the License, or (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License*
15  * along with this program; if not, contact: *
16  * *
17  * Free Software Foundation Voice: +1-617-542-5942 *
18  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
19  * Boston, MA 02110-1301, USA [email protected] *
20  * *
21 \********************************************************************/
22 
23 /*
24  * FILE:
25  * datecell.h
26  *
27  * FUNCTION:
28  * The DateCell object implements a date handling cell. It
29  * is able to display dates in several formats, it is also
30  * able to accept date input, and also supports a number of accelerator
31  * keys.
32  *
33  * On output, this cell will display a date as mm/dd/yy
34  * The actual date formate is compile-time configurable.
35  *
36  * hack alert -- make the display format run-time configurable, and
37  * appropriately internationalized.
38  *
39  * One input, this cell is able to parse dates that are entered.
40  * It rejects any input that is not in the form of a date. Input
41  * also includes a number of accelerators:
42  *
43  * '+':
44  * '=': increment day
45  *
46  * '_':
47  * '-': decrement day
48  *
49  * '}':
50  * ']': increment month
51  *
52  * '{':
53  * '[': decrment month
54  *
55  * 'M':
56  * 'm': begining of month
57  *
58  * 'H':
59  * 'h': end of month
60  *
61  * 'Y':
62  * 'y': begining of year
63  *
64  * 'R':
65  * 'r': end of year
66  *
67  * 'T':
68  * 't': today
69  *
70  *
71  * METHODS:
72  * The xaccSetDateCellValue() method accepts a numeric date and
73  * sets the contents of the date cell to that value. The
74  * value day, month, year should follow the regular written
75  * conventions, i.e. day==(1..31), mon==(1..12), year==4 digits
76  *
77  * The xaccCommitDateCell() method commits any pending changes to the
78  * value of the cell. That is, it will take the cells current string
79  * value, and parse it into a month-day-year value.
80  *
81  * Why is this needed? Basically, while the user is typing into the
82  * cell, we do not even try to parse the date, lest we confuse things
83  * royally. Normally, when the user leaves this cell, and moves to
84  * another, we parse the date and print it nicely and cleanly into
85  * the cell. But it can happen that we want to get the accurate contents
86  * of the date cell before we've left it, e.g. if the user has clicked
87  * on the "commit" button. This is the routine to call for that.
88  *
89  * HISTORY:
90  * Copyright (c) 1998, 1999, 2000 Linas Vepstas <[email protected]>
91  * Copyright (c) 2000 Dave Peticolas
92  */
93 
94 #ifndef DATE_CELL_H
95 #define DATE_CELL_H
96 
97 #include <time.h>
98 
99 #include "basiccell.h"
100 #include "qof.h"
101 
102 
103 typedef struct date_cell
104 {
105  BasicCell cell;
106 } DateCell;
107 
108 /* installs a callback to handle date recording */
109 BasicCell * gnc_date_cell_new (void);
110 
111 /* days are 1-31, mon is 1-12, year 1900 == 1900 */
112 void gnc_date_cell_set_value (DateCell *cell,
113  int day, int mon, int year);
114 void gnc_date_cell_set_value_secs (DateCell *cell, time64 secs);
115 
116 void gnc_date_cell_commit (DateCell *cell);
117 
118 void gnc_date_cell_get_date (DateCell *cell, Timespec *ts);
119 
120 void gnc_date_cell_get_date_gdate (DateCell *cell, GDate *date);
121 
122 #endif
Use a 64-bit unsigned int timespec.
Definition: gnc-date.h:299
gint64 time64
Definition: gnc-date.h:83