]> git.saurik.com Git - wxWidgets.git/blame - include/wx/date.h
Added wxTreeCtrl::SetItemDropHighlight (wxMSW only);
[wxWidgets.git] / include / wx / date.h
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: date.h
3// Purpose: wxDate class
4// Author: Julian Smart, Steve Marcus, Eric Simon, Chris Hill,
5// Charles D. Price
6// Modified by:
7// Created: 01/02/97
8// RCS-ID: $Id$
9// Copyright: (c)
10// Licence: wxWindows licence
11/////////////////////////////////////////////////////////////////////////////
12
34138703
JS
13#ifndef _WX_DATE_H_
14#define _WX_DATE_H_
c801d85f
KB
15
16#ifdef __GNUG__
17#pragma interface "date.h"
18#endif
19
20#include "wx/object.h"
21#include "wx/string.h"
22
9838df2c 23#if wxUSE_TIMEDATE
dbda9e86
JS
24// These lines necessary to stop VC++ 6 being confused about namespaces
25class WXDLLEXPORT wxDate;
26bool WXDLLEXPORT operator<(const wxDate &dt1, const wxDate &dt2);
27bool WXDLLEXPORT operator<(const wxDate &dt1, const wxDate &dt2);
28bool WXDLLEXPORT operator <= (const wxDate &dt1, const wxDate &dt2);
29bool WXDLLEXPORT operator > (const wxDate &dt1, const wxDate &dt2);
30bool WXDLLEXPORT operator >= (const wxDate &dt1, const wxDate &dt2);
31bool WXDLLEXPORT operator == (const wxDate &dt1, const wxDate &dt2);
32bool WXDLLEXPORT operator != (const wxDate &dt1, const wxDate &dt2);
c801d85f
KB
33
34enum wxdate_format_type {wxMDY, wxDAY, wxMONTH, wxFULL, wxEUROPEAN};
35
36#define wxNO_CENTURY 0x02
37#define wxDATE_ABBR 0x04
38
39class WXDLLEXPORT wxDate: public wxObject
40{
41 DECLARE_DYNAMIC_CLASS(wxDate)
42 protected:
43 unsigned long julian; // see julDate(); days since 1/1/4713 B.C.
44 int month; // see NMonth()
45 int day; // see Day()
46 int year; // see NYear4()
47 int day_of_week; // see NDOW(); 1 = Sunday, ... 7 = Saturday
48
49 private:
50 int DisplayFormat;
51 unsigned char DisplayOptions;
52
53 void julian_to_mdy (); // convert julian day to mdy
54 void julian_to_wday (); // convert julian day to day_of_week
55 void mdy_to_julian (); // convert mdy to julian day
56
57 public:
58 wxDate ();
debe6624
JS
59 wxDate (long j);
60 wxDate (int m, int d, int y);
c801d85f
KB
61 wxDate (const wxString& dat);
62 wxDate (const wxDate &dt);
63
ce3ed50d 64#ifndef __SALFORDC__
c801d85f 65 operator wxString (void);
ce3ed50d
JS
66#endif
67
c801d85f
KB
68 void operator = (const wxDate& date);
69 void operator = (const wxString& date);
70
debe6624
JS
71 wxDate operator + (long i);
72 wxDate operator + (int i);
c801d85f 73
debe6624
JS
74 wxDate operator - (long i);
75 wxDate operator - (int i);
c801d85f
KB
76
77 long operator - (const wxDate &dt);
78
debe6624
JS
79 wxDate &operator += (long i);
80 wxDate &operator -= (long i);
c801d85f
KB
81
82 wxDate &operator ++ (); // Prefix increment
83 wxDate &operator ++ (int); // Postfix increment
84 wxDate &operator -- (); // Prefix decrement
85 wxDate &operator -- (int); // Postfix decrement
86
d851f77e
UU
87 friend bool WXDLLEXPORT operator < (const wxDate &dt1, const wxDate &dt2);
88 friend bool WXDLLEXPORT operator <= (const wxDate &dt1, const wxDate &dt2);
89 friend bool WXDLLEXPORT operator > (const wxDate &dt1, const wxDate &dt2);
90 friend bool WXDLLEXPORT operator >= (const wxDate &dt1, const wxDate &dt2);
91 friend bool WXDLLEXPORT operator == (const wxDate &dt1, const wxDate &dt2);
92 friend bool WXDLLEXPORT operator != (const wxDate &dt1, const wxDate &dt2);
93
ba681060 94 friend ostream WXDLLEXPORT & operator << (ostream &os, const wxDate &dt);
c801d85f 95
debe6624
JS
96 wxString FormatDate (int type=-1) const;
97 void SetFormat (int format);
98 int SetOption (int option, bool enable=TRUE);
c801d85f
KB
99
100 long GetJulianDate() const; // returns julian date
101 int GetDayOfYear() const; // returns relative date since Jan. 1
102 bool IsLeapYear() const; // returns TRUE if leap year, FALSE if not
103
104 // Version 4.0 Extension to Public Interface - CDP
105
106 // These 'Set's modify the date object and actually SET it
107 // They all return a reference to self (*this)
108
109 wxDate &Set(); // Sets to current system date
110 wxDate &Set(long lJulian);
111 wxDate &Set(int nMonth, int nDay, int nYear);
112
113 wxDate &AddWeeks(int nCount = 1); //
114 wxDate &AddMonths(int nCount = 1); // May also pass neg# to decrement
115 wxDate &AddYears(int nCount = 1); //
116
117 int GetDay() const; // Numeric Day of date object
118 int GetDaysInMonth(); // Number of days in month (1..31)
119 int GetFirstDayOfMonth() const; // First Day Of Month (1..7)
120
121 wxString GetDayOfWeekName(); // Character Day Of Week ('Sunday'..'Saturday')
122 int GetDayOfWeek() const; // (1..7)
123
124 int GetWeekOfMonth(); // Numeric Week Of Month (1..6)
125 int GetWeekOfYear(); // Numeric Week Of Year (1..52)
126
127 wxString GetMonthName(); // Character Month name
128 int GetMonth() const; // Month Number (1..12)
129 wxDate GetMonthStart(); // First Date Of Month
130 wxDate GetMonthEnd(); // Last Date Of Month
131
132 int GetYear() const; // eg. 1992
133 wxDate GetYearStart(); // First Date Of Year
134 wxDate GetYearEnd(); // Last Date Of Year
135
136 bool IsBetween(const wxDate& first, const wxDate& second) const;
137
debe6624 138 wxDate Previous(int dayOfWeek) const;
c801d85f
KB
139};
140
141#endif
142#endif
34138703 143 // _WX_DATE_H_