Click here to Skip to main content
15,886,199 members
Articles / Desktop Programming / MFC

Calendar Plug-in for .dan.g.'s ToDoList - In 10 Easy Steps™

Rate me:
Please Sign up or sign in to vote.
4.99/5 (63 votes)
10 Jun 2008CC (ASA 2.5)12 min read 1.1M   7.7K   252  
A Calendar UI extension component for the ToDoList, giving you a timeline view of your tasks
//Written for the ToDoList (http://www.codeproject.com/KB/applications/todolist2.aspx)
//Design and latest version - http://www.codeproject.com/KB/applications/TDL_Calendar.aspx
//by demon.code.monkey@googlemail.com

#ifndef _CALENDARUTILS_H_
#define _CALENDARUTILS_H_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


//CCalendarUtils: a collection of static utils used by the Calendar DLL
class CCalendarUtils
{
//construction
public:
	CCalendarUtils()	{ ASSERT(FALSE); }	//don't instantiate me
	~CCalendarUtils()	{ ASSERT(FALSE); }	//don't instantiate me

//static functions
public:
	static CString	LongToString(long lValue);
	static time_t	DateToTime(const COleDateTime& _dt);
	static time_t	TimeToTime(const time_t& _t);
#ifdef _DEBUG
	static CString	DateToString(const COleDateTime& _dt);
#endif

	static void GetDateOnly(COleDateTime& _dt);
	static void GetToday(COleDateTime& _dt);
	static CString GetWeekday(int _iDayOfWeek, BOOL _bShort);
	static void	GetWeekdays(CStringList& _listDays, BOOL _bShort, BOOL _bWeekendsHidden);

	static int	CompareDates(const COleDateTime& _dt1, const COleDateTime& _dt2);

	static BOOL IsDateValid(const COleDateTime& _dt);
	static int	GetDaysInMonth(int _iMonth, int _iYear);

	static void	AddDay(COleDateTime& _dt, int _nNumDays=1);
	static void	SubtractDay(COleDateTime& _dt, int _nNumDays=1);
	static void AddMonth(COleDateTime& _dt, int _nNumMonths=1);
	static void SubtractMonth(COleDateTime& _dt, int _nNumMonths=1);
};


#endif//_CALENDARUTILS_H_

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Creative Commons Attribution-ShareAlike 2.5 License


Written By
Software Developer (Senior)
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions