⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 calendar_framewnd.cpp

📁 一个完整的桌面日历程序
💻 CPP
字号:
// ------------------------------------------------------------------------------------------------------------------------------------------------------
// -																																					-
// - File:			calendar_framewnd.cpp.																												-
// -																																					-
// - Contents: 		Implementation of class CCalFrameWnd.																								-
// -																																					-
// - Purpose:  		-																																	-
// -																																					-
// - Remarks:    	A general note is the same a a cardinal note.																						-
// -				Methods in the calendar to make an 'time-offset' begins with 'Offset' and															-
// -				methods to go to a specific time begins with 'Go2'.																					-
// -																																					-
// - Originator: 	Michael Mogensen, MM-IT Consult 2003.																								-
// -																																					-
// - Compiler:		MS Visual C++ ver6.0.																											    -
// -																																					-
// - Period:		29.04.03 - 00.00.00.																											    -
// -																																					-
// - Version:		1.21. 																																-
// -																																					-
// ------------------------------------------------------------------------------------------------------------------------------------------------------

// ------------------------------------------------------------------------------------------------------------------------------------------------------
// - Miscellaneous.																																		-
// ------------------------------------------------------------------------------------------------------------------------------------------------------

// ------------------------------------------------------------------------------------------------------------------------------------------------------
// - Header(s).																																			-
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#pragma once
#include "stdafx.h"
#include "calendar_framewnd.h" // Self.

// ------------------------------------------------------------------------------------------------------------------------------------------------------
// - Miscellaneous.																																		-
// ------------------------------------------------------------------------------------------------------------------------------------------------------
#define new DEBUG_NEW

// ------------------------------------------------------------------------------------------------------------------------------------------------------
// - CCalFrameWnd::CCalendar.																															-
// ------------------------------------------------------------------------------------------------------------------------------------------------------

// 1. Object. (alphabetical).
CCalFrameWnd::CCalendar::CCalendar(CCalFrameWnd *pParent) : 
	m_bIsCardinalNoteVisible(false), 	
	m_pBtn_Active_DayNew(NULL), 
	m_pBtn_Active_DayOld(NULL), 
	m_pBtn_NoteCardinal(NULL), 
	m_pEdit_Note(NULL), 
	m_pArray_Notes(NULL), 
	m_pParent(pParent)
	// Create.
	{
		int iId = 0;
		// All the buttons are made NULL.
		for(iId = BTN_ID_FIRST; iId <= BTN_ID_LAST; iId++)
			m_pBtn[iId] = NULL;
		// All the radio buttons are made NULL.
		for(iId = BTN_RADIO_ID_DAY_FIRST; iId <= BTN_RADIO_ID_DAY_LAST; iId++)
			m_pBtnDay[iId] = NULL;
		ResourcesCreate();
	}

CCalFrameWnd::CCalendar::~CCalendar()
// Kill.
{
	ResourcesDestroy();
}

// 4. Slaves. (alphabetical).
const void CCalFrameWnd::CCalendar::Ask(const CString &cstrQuestionOrNoQuestion)
// Using the 3 buttons at the bottom of the wnd. we ask this question. On empty question we
// just cleanup.
{
	m_pBtn[BTN_ID_NOTE_DELETE]->SetState(CCalBtn::eST_Normal);
	m_pBtn[BTN_ID_NOTE_DELETE_ALL]->SetState(CCalBtn::eST_Normal);
	if(cstrQuestionOrNoQuestion.IsEmpty())
	{
		// Bring the 3 btn's back into their normal caption-state.
		m_pBtn[BTN_ID_NOTE_QUESTION]->SetCaption();
		m_pBtn[BTN_ID_NOTE_DELETE]->SetCaption(I_TXT_BTN_DEL);
		m_pBtn[BTN_ID_NOTE_DELETE_ALL]->SetCaption(I_TXT_BTN_DEL_ALL);
		// Restore states.
		Note_EditChange();
	}
	else
	{
		// Bring the 3 btn's into a question-state.
		m_pBtn[BTN_ID_NOTE_QUESTION]->SetCaption(cstrQuestionOrNoQuestion);
		m_pBtn[BTN_ID_NOTE_DELETE]->SetCaption(I_TXT_BTN_YES);
		m_pBtn[BTN_ID_NOTE_DELETE_ALL]->SetCaption(I_TXT_BTN_NO);
	}

}

const bool CCalFrameWnd::CCalendar::BrowseBtn_EnableNote_Next()
// Enable browse btn. '>>' for next note. Return T if left enabled and F if not.
{
	bool bIsEnabled = false;
	if(!m_pArray_Notes->IsEmpty())
	{
		const CNote Note(get_file_info_filetitle(Note_GetName(NULL)));
		const CNote Note_Last(m_pArray_Notes->GetNeighbourObj(NULL, CSingletonArrayEx<CNote, CNote>::eDir_Last));
		bIsEnabled = (Note < Note_Last);
	}
	m_pBtn[BTN_ID_NOTE_NEXT]->SetState(bIsEnabled ? CCalBtn::eST_Normal : CCalBtn::eST_Disabled);
	return bIsEnabled;
}

const bool CCalFrameWnd::CCalendar::BrowseBtn_EnableNote_Previous()
// Enable browse btn. '<<' for previous note. Return T if left enabled and F if not.
{
	bool bIsEnabled = false;
	if(!m_pArray_Notes->IsEmpty())
	{
		const CNote Note(get_file_info_filetitle(Note_GetName(NULL)));
		const CNote Note_First(m_pArray_Notes->GetNeighbourObj(NULL, CSingletonArrayEx<CNote, CNote>::eDir_First));
		bIsEnabled = (Note > Note_First);
	}
	m_pBtn[BTN_ID_NOTE_PREV]->SetState(bIsEnabled ? CCalBtn::eST_Normal : CCalBtn::eST_Disabled);
	return bIsEnabled;
}

const int CCalFrameWnd::CCalendar::GetDay(CCalBtn_Radio *pBtn_Active_Day)
// Return day found on this button.
{
	if(!pBtn_Active_Day)
		// On error.
		return 0;
	CString cstrCaption(pBtn_Active_Day->GetCaption());
	cstrCaption.TrimLeft();
	const int iDay = ::_ttoi(cstrCaption);
	return iDay;
}

const CString CCalFrameWnd::CCalendar::GetCopyrightText()
// Return 'mm it-consult...'
{
	CString cstrInfo(_T(""));
	CTimeEx t;
	cstrInfo.Format(TEXT("mm it-consult dk 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -