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

📄 ppcalendar.h

📁 基于ARM平台的控制系统,自己带有MINIGUI,可以直接在VC下运行界面演示程序
💻 H
字号:
#ifndef __GUIPP_CALENDAR_H__
#define __GUIPP_CALENDAR_H__

#if _USE_GUI == 1

////////////////////////////////////////////////////
// Calendar 是一个5行×7列的表格
//			目前默认第一列为星期天
#define CAL_DAY_STYLE_WHITE				0x00000000
#define CAL_DAY_STYLE_WHITE_FRAME		0x00000001
#define CAL_DAY_STYLE_NEG				0x00000002
#define CAL_DAY_STYLE_NEG_FRAME			0x00000003
#define CAL_DAY_STYLE_DOUBLE_FRAME		0x00000004

#define CAL_STYLE_THIN_FRAME			0x00000001
#define CAL_STYLE_THICK_FRAME			0x00000002
#define CAL_STYLE_SEL_BLINK				0x00000004
#define CAL_STYLE_ROUND_FRAME			0x00000008

#include "ppButton.h"

class NANACalendar : public NANAWnd
{
private:

	NANATimer	w_CalTimer;	
	NANAButton	w_btnNextYear;
	NANAButton	w_btnPrevYear;

	NANAButton	w_btnNextMonth;
	NANAButton	w_btnPrevMonth;
	
	int w_nYear;
	int w_nMonth;
	int w_nMonthTotalDay;
	int w_style;
	int w_nWidth;
	int w_nHeight;
	int w_bPaintSelected;
	int w_bSelectedShow;
	NANA_FONT w_Font;
	int w_day_style[31];	  // 只有4种风格 空白无框,空白有框,反白无框,反白有框
	int	w_selday_style;
	char w_naGridDay[5][7]; //每个网格显示的日期,-1代表该网格没有日期需要显示
	int w_day_selected_date;//选中的日期不停闪烁代表被选择
	
	
	int w_CALENDAR_MARGIN_LEFT;
	int w_CALENDAR_MARGIN_TOP;

	int w_CALENDAR_BLOCK_WIDTH;
	int w_CALENDAR_BLOCK_HEIGHT;
	
	int w_CALENDAR_BLOCK_MARGIN_LEFT;
	int w_CALENDAR_BLOCK_MARGIN_TOP;

	int w_CALENDAR_TITLE_MARGIN_LEFT;


	NANARect GetGridRc(int line,int column,NANARect rc);
	void DrawGirdCell(NANARect rcBlock,int nDay,NANA_FONT font,int day_style);
	void SetGrid(void);

public:

	virtual void OnPaint();
	virtual void OnTimer(NANATimer *pTimer);

	int Set(int nYear,int nMonth,int nSelDay);
	void SetDayStyle(int nDay,int nDayStyle);
	
	void SetSelDayStyle(int nSelDayStyle)
	{
		w_selday_style = nSelDayStyle;
	}
	
	int Modify(int delta_Year,int delta_Month);
	
	void MoveSelectedDay(int delta_select_day);
	
	

	
	int GetCurYear(void) { return w_nYear; }
	int GetCurMonth(void) { return w_nMonth; }
	int GetCurDay(void) { return w_day_selected_date + 1; }
	int GetMonthTotalDays(void) { return w_nMonthTotalDay; }
	
	
	
	
	NANACalendar():w_CalTimer(this)
	{
		int i;
		//初始化全部日期为空白背景样式
		for(i=0; i<31; i++)
		{
			SetDayStyle(i,CAL_DAY_STYLE_WHITE);
		}
		Set(2000,1,1);
	}
	virtual void CreateWnd(
				NANAWnd * pParentWnd,
				int x1,int y1,
				int width,int height,
				int nWndStyle,
				int nExtendedStyle,
				NANA_FONT font
				);
	
	virtual void OnNotify(NANAWnd *pSrcWnd,int nMessageCode,int nParam1,int nParam2);

	virtual void OnMouseDown(int x,int y);

	virtual void OnMouseUp(int x,int y);

};

#endif
#endif

⌨️ 快捷键说明

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