*--------------------------------------------------------------------------------------------------------------------------------------------------------
* (EN) AUTOGENERATED - ATTENTION!! - NOT INTENDED FOR EXECUTION!! USE ONLY FOR MERGING CHANGES AND STORING WITH SCM TOOLS!!
*--------------------------------------------------------------------------------------------------------------------------------------------------------
*< FOXBIN2PRG: Version="1.21" SourceFile="_calendar.vcx" CPID="1252" /> (Solo para binarios VFP 9 / Only for VFP 9 binaries)
*
*
DEFINE CLASS _calendar AS control 
 	*< CLASSDATA: Baseclass="control" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Shape2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Shape1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtToday" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtMonth" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtYear" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday1_1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday1_2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday1_3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday1_4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday1_5" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday1_6" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday1_7" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lblDayName2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lblDayName3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lblDayName4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lblDayName5" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lblDayName6" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lblDayName7" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="lblDayName1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday2_1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday2_2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday2_3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday2_4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday2_5" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday2_6" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday2_7" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday3_1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday3_2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday3_3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday3_4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday3_5" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday3_6" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday3_7" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday4_1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday4_2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday4_3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday4_4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday4_5" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday4_6" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday4_7" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday5_1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday5_2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday5_3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday5_4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday5_5" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday5_6" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday5_7" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday6_1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday6_2" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday6_3" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday6_4" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday6_5" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday6_6" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="_lblday6_7" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="imgLeft" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="imgRight" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="imgUp" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="imgDown" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="shpToday" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: dayclick
		*m: firstdayoftheweek_assign
		*m: language_assign
		*m: monthclick
		*m: redraw
		*m: todayclick
		*m: valuechanged
		*m: value_assign
		*m: yearclick
		*p: cdayname1		&&  Sunday
		*p: cdayname2		&&  Monday
		*p: cdayname3		&&  Tuesday
		*p: cdayname4		&&  Wednesday
		*p: cdayname5		&&  Thursday
		*p: cdayname6		&&  Friday
		*p: cdayname7		&&  Saturday
		*p: day
		*p: firstdayoftheweek		&& 1 - Sunday, 2 - Monday
		*p: language
		*p: month
		*p: monthnames
		*p: notherscolour		&& RGB(196,196,255)
		*p: nsunday
		*p: nsundaycolour		&& RGB(255,128,128)
		*p: old_lbl
		*p: showtips		&& Specifies if ToolTips are shown for the controls on the specified Form object or the specified ToolBar object.
		*p: todaystring
		*p: value		&& Specifies the current state of a control.
		*p: year
		*p: _memberdata		&& XML Metadata for customizable properties
	*</DefinedPropArrayMethod>

	HIDDEN _memberdata
	PROTECTED old_lbl
	*<PropValue>
		BackColor = 255,255,255
		BorderColor = 0,0,0
		BorderWidth = 2
		cdayname1 = 
		cdayname2 = 
		cdayname3 = 
		cdayname4 = 
		cdayname5 = 
		cdayname6 = 
		cdayname7 = 
		day = 0
		firstdayoftheweek = 
		Height = 168
		language = EN
		month = 0
		monthnames = 
		Name = "_calendar"
		notherscolour = 16762052
		nsunday = 
		nsundaycolour = 8421631
		old_lbl = .F.
		showtips = .F.
		todaystring = 
		value = {}
		Width = 168
		year = 0
		_memberdata = <VFPData>
			<memberdata name="day" type="property" display="Day"/>
			<memberdata name="month" type="property" display="Month"/>
			<memberdata name="value" type="property" display="Value"/>
			<memberdata name="year" type="property" display="Year"/>
			<memberdata name="redraw" type="method" display="Redraw"/>
			<memberdata name="dayclick" type="method" display="DayClick"/>
			<memberdata name="monthclick" type="method" display="MonthClick"/>
			<memberdata name="todayclick" type="method" display="TodayClick"/>
			<memberdata name="yearclick" type="method" display="YearClick"/>
			<memberdata name="valuechanged" type="method" display="ValueChanged"/>
			<memberdata name="language" type="property" display="Language"/>
			<memberdata name="monthnames" type="property" display="MonthNames"/>
			<memberdata name="todaystring" type="property" display="TodayString"/>
		</VFPData>
	*</PropValue>

	ADD OBJECT '_lblday1_1' AS _lblday WITH ;
		ForeColor = 255,128,128, ;
		Left = 17, ;
		Name = "_lblday1_1", ;
		Top = 46
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday1_2' AS _lblday WITH ;
		Left = 37, ;
		Name = "_lblday1_2", ;
		Top = 46
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday1_3' AS _lblday WITH ;
		Left = 57, ;
		Name = "_lblday1_3", ;
		Top = 46
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday1_4' AS _lblday WITH ;
		Left = 77, ;
		Name = "_lblday1_4", ;
		Top = 46
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday1_5' AS _lblday WITH ;
		Left = 97, ;
		Name = "_lblday1_5", ;
		Top = 46
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday1_6' AS _lblday WITH ;
		Left = 117, ;
		Name = "_lblday1_6", ;
		Top = 46
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday1_7' AS _lblday WITH ;
		Left = 137, ;
		Name = "_lblday1_7", ;
		Top = 46
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday2_1' AS _lblday WITH ;
		ForeColor = 255,128,128, ;
		Left = 17, ;
		Name = "_lblday2_1", ;
		Top = 61
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday2_2' AS _lblday WITH ;
		Left = 37, ;
		Name = "_lblday2_2", ;
		Top = 61
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday2_3' AS _lblday WITH ;
		Left = 57, ;
		Name = "_lblday2_3", ;
		Top = 61
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday2_4' AS _lblday WITH ;
		Left = 77, ;
		Name = "_lblday2_4", ;
		Top = 61
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday2_5' AS _lblday WITH ;
		Left = 97, ;
		Name = "_lblday2_5", ;
		Top = 61
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday2_6' AS _lblday WITH ;
		Left = 117, ;
		Name = "_lblday2_6", ;
		Top = 61
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday2_7' AS _lblday WITH ;
		Left = 137, ;
		Name = "_lblday2_7", ;
		Top = 61
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday3_1' AS _lblday WITH ;
		ForeColor = 255,128,128, ;
		Left = 17, ;
		Name = "_lblday3_1", ;
		Top = 76
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday3_2' AS _lblday WITH ;
		Left = 37, ;
		Name = "_lblday3_2", ;
		Top = 76
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday3_3' AS _lblday WITH ;
		Left = 57, ;
		Name = "_lblday3_3", ;
		Top = 76
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday3_4' AS _lblday WITH ;
		Left = 77, ;
		Name = "_lblday3_4", ;
		Top = 76
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday3_5' AS _lblday WITH ;
		Left = 97, ;
		Name = "_lblday3_5", ;
		Top = 76
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday3_6' AS _lblday WITH ;
		Left = 117, ;
		Name = "_lblday3_6", ;
		Top = 76
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday3_7' AS _lblday WITH ;
		Left = 137, ;
		Name = "_lblday3_7", ;
		Top = 76
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday4_1' AS _lblday WITH ;
		ForeColor = 255,128,128, ;
		Left = 17, ;
		Name = "_lblday4_1", ;
		Top = 91
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday4_2' AS _lblday WITH ;
		Left = 37, ;
		Name = "_lblday4_2", ;
		Top = 91
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday4_3' AS _lblday WITH ;
		Left = 57, ;
		Name = "_lblday4_3", ;
		Top = 91
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday4_4' AS _lblday WITH ;
		Left = 77, ;
		Name = "_lblday4_4", ;
		Top = 91
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday4_5' AS _lblday WITH ;
		Left = 97, ;
		Name = "_lblday4_5", ;
		Top = 91
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday4_6' AS _lblday WITH ;
		Left = 117, ;
		Name = "_lblday4_6", ;
		Top = 91
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday4_7' AS _lblday WITH ;
		Left = 137, ;
		Name = "_lblday4_7", ;
		Top = 91
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday5_1' AS _lblday WITH ;
		ForeColor = 255,128,128, ;
		Left = 17, ;
		Name = "_lblday5_1", ;
		Top = 106
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday5_2' AS _lblday WITH ;
		Left = 37, ;
		Name = "_lblday5_2", ;
		Top = 106
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday5_3' AS _lblday WITH ;
		Left = 57, ;
		Name = "_lblday5_3", ;
		Top = 106
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday5_4' AS _lblday WITH ;
		Left = 77, ;
		Name = "_lblday5_4", ;
		Top = 106
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday5_5' AS _lblday WITH ;
		Left = 97, ;
		Name = "_lblday5_5", ;
		Top = 106
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday5_6' AS _lblday WITH ;
		Left = 117, ;
		Name = "_lblday5_6", ;
		Top = 106
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday5_7' AS _lblday WITH ;
		Left = 137, ;
		Name = "_lblday5_7", ;
		Top = 106
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday6_1' AS _lblday WITH ;
		ForeColor = 255,128,128, ;
		Left = 17, ;
		Name = "_lblday6_1", ;
		Top = 121
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday6_2' AS _lblday WITH ;
		Left = 37, ;
		Name = "_lblday6_2", ;
		Top = 121
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday6_3' AS _lblday WITH ;
		Left = 57, ;
		Name = "_lblday6_3", ;
		Top = 121
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday6_4' AS _lblday WITH ;
		Left = 77, ;
		Name = "_lblday6_4", ;
		Top = 121
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday6_5' AS _lblday WITH ;
		Left = 97, ;
		Name = "_lblday6_5", ;
		Top = 121
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday6_6' AS _lblday WITH ;
		Left = 117, ;
		Name = "_lblday6_6", ;
		Top = 121
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT '_lblday6_7' AS _lblday WITH ;
		Left = 137, ;
		Name = "_lblday6_7", ;
		Top = 121
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="label" />

	ADD OBJECT 'imgDown' AS image WITH ;
		Height = 7, ;
		Left = 153, ;
		MousePointer = 15, ;
		Name = "imgDown", ;
		Picture = cal_arrow_down.png, ;
		Stretch = 0, ;
		Top = 16, ;
		Width = 11
		*< END OBJECT: BaseClass="image" />

	ADD OBJECT 'imgLeft' AS image WITH ;
		Height = 16, ;
		Left = 4, ;
		MousePointer = 15, ;
		Name = "imgLeft", ;
		Picture = cal_arrow_left.png, ;
		Top = 7, ;
		Width = 16
		*< END OBJECT: BaseClass="image" />

	ADD OBJECT 'imgRight' AS image WITH ;
		Height = 16, ;
		Left = 93, ;
		MousePointer = 15, ;
		Name = "imgRight", ;
		Picture = cal_arrow_right.png, ;
		Top = 7, ;
		Width = 16
		*< END OBJECT: BaseClass="image" />

	ADD OBJECT 'imgUp' AS image WITH ;
		Height = 7, ;
		Left = 153, ;
		MousePointer = 15, ;
		Name = "imgUp", ;
		Picture = cal_arrow_up.png, ;
		Stretch = 0, ;
		Top = 7, ;
		Width = 11
		*< END OBJECT: BaseClass="image" />

	ADD OBJECT 'lblDayName1' AS label WITH ;
		Alignment = 2, ;
		BackStyle = 0, ;
		Caption = "M", ;
		FontBold = .T., ;
		FontName = "Tahoma", ;
		FontSize = 8, ;
		ForeColor = 255,128,128, ;
		Height = 15, ;
		Left = 18, ;
		Name = "lblDayName1", ;
		Top = 31, ;
		Width = 14
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'lblDayName2' AS label WITH ;
		Alignment = 2, ;
		BackStyle = 0, ;
		Caption = "S", ;
		FontBold = .T., ;
		FontName = "Tahoma", ;
		FontSize = 8, ;
		ForeColor = 196,196,255, ;
		Height = 15, ;
		Left = 38, ;
		Name = "lblDayName2", ;
		Top = 31, ;
		Width = 14
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'lblDayName3' AS label WITH ;
		Alignment = 2, ;
		BackStyle = 0, ;
		Caption = "S", ;
		FontBold = .T., ;
		FontName = "Tahoma", ;
		FontSize = 8, ;
		ForeColor = 196,196,255, ;
		Height = 15, ;
		Left = 58, ;
		Name = "lblDayName3", ;
		Top = 31, ;
		Width = 14
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'lblDayName4' AS label WITH ;
		Alignment = 2, ;
		BackStyle = 0, ;
		Caption = "R", ;
		FontBold = .T., ;
		FontName = "Tahoma", ;
		FontSize = 8, ;
		ForeColor = 196,196,255, ;
		Height = 15, ;
		Left = 78, ;
		Name = "lblDayName4", ;
		Top = 31, ;
		Width = 14
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'lblDayName5' AS label WITH ;
		Alignment = 2, ;
		BackStyle = 0, ;
		Caption = "K", ;
		FontBold = .T., ;
		FontName = "Tahoma", ;
		FontSize = 8, ;
		ForeColor = 196,196,255, ;
		Height = 15, ;
		Left = 98, ;
		Name = "lblDayName5", ;
		Top = 31, ;
		Width = 14
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'lblDayName6' AS label WITH ;
		Alignment = 2, ;
		BackStyle = 0, ;
		Caption = "J", ;
		FontBold = .T., ;
		FontName = "Tahoma", ;
		FontSize = 8, ;
		ForeColor = 196,196,255, ;
		Height = 15, ;
		Left = 118, ;
		Name = "lblDayName6", ;
		Top = 31, ;
		Width = 14
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'lblDayName7' AS label WITH ;
		Alignment = 2, ;
		BackStyle = 0, ;
		Caption = "S", ;
		FontBold = .T., ;
		FontName = "Tahoma", ;
		FontSize = 8, ;
		ForeColor = 196,196,255, ;
		Height = 15, ;
		Left = 138, ;
		Name = "lblDayName7", ;
		Top = 31, ;
		Width = 14
		*< END OBJECT: BaseClass="label" />

	ADD OBJECT 'Shape1' AS shape WITH ;
		BackColor = 196,196,255, ;
		Height = 28, ;
		Left = 1, ;
		Name = "Shape1", ;
		Top = 1, ;
		Width = 166
		*< END OBJECT: BaseClass="shape" />

	ADD OBJECT 'Shape2' AS shape WITH ;
		BackColor = 196,196,255, ;
		Height = 28, ;
		Left = 1, ;
		Name = "Shape2", ;
		Top = 139, ;
		Width = 166
		*< END OBJECT: BaseClass="shape" />

	ADD OBJECT 'shpToday' AS shape WITH ;
		BackStyle = 0, ;
		BorderStyle = 0, ;
		Height = 28, ;
		Left = 2, ;
		MousePointer = 15, ;
		Name = "shpToday", ;
		Top = 140, ;
		Width = 164
		*< END OBJECT: BaseClass="shape" />

	ADD OBJECT 'txtMonth' AS textbox WITH ;
		Alignment = 2, ;
		BackStyle = 0, ;
		BorderStyle = 0, ;
		FontBold = .T., ;
		FontName = "Tahoma", ;
		FontSize = 8, ;
		ForeColor = 255,255,255, ;
		Height = 23, ;
		Left = 2, ;
		MousePointer = 1, ;
		Name = "txtMonth", ;
		SpecialEffect = 1, ;
		Themes = .F., ;
		Top = 5, ;
		Value = , ;
		Width = 112
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'txtToday' AS textbox WITH ;
		Alignment = 2, ;
		BackStyle = 0, ;
		BorderStyle = 0, ;
		FontBold = .T., ;
		FontName = "Tahoma", ;
		FontSize = 8, ;
		ForeColor = 62,62,255, ;
		Height = 23, ;
		Left = 4, ;
		MousePointer = 1, ;
		Name = "txtToday", ;
		SpecialEffect = 1, ;
		Themes = .F., ;
		Top = 143, ;
		Value = , ;
		Width = 160
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'txtYear' AS textbox WITH ;
		Alignment = 1, ;
		BackStyle = 0, ;
		BorderStyle = 0, ;
		FontBold = .T., ;
		FontName = "Tahoma", ;
		FontSize = 8, ;
		ForeColor = 255,255,255, ;
		Height = 23, ;
		Left = 111, ;
		MousePointer = 1, ;
		Name = "txtYear", ;
		SpecialEffect = 1, ;
		Themes = .F., ;
		Top = 5, ;
		Value = , ;
		Width = 42
		*< END OBJECT: BaseClass="textbox" />
	
	PROCEDURE dayclick
	ENDPROC

	PROCEDURE firstdayoftheweek_assign
		Lparameters vNewVal
		*To do: Modify this routine for the Assign method
		With This
			.FirstDayOfTheWeek = m.vNewVal
			.lblDayName1.ForeColor = .notherscolour
			.lblDayName2.ForeColor = .notherscolour
			.lblDayName3.ForeColor = .notherscolour
			.lblDayName4.ForeColor = .notherscolour
			.lblDayName5.ForeColor = .notherscolour
			.lblDayName6.ForeColor = .notherscolour
			.lblDayName7.ForeColor = .notherscolour
			Do Case
			Case .FirstDayOfTheWeek = 1	&&	Sunday
				.lblDayName1.ForeColor = .nsundaycolour
				.nsunday = 1
				.lblDayName1.Caption = .cdayname1
				.lblDayName2.Caption = .cdayname2
				.lblDayName3.Caption = .cdayname3
				.lblDayName4.Caption = .cdayname4
				.lblDayName5.Caption = .cdayname5
				.lblDayName6.Caption = .cdayname6
				.lblDayName7.Caption = .cdayname7
			Case .FirstDayOfTheWeek = 2	&&	Monday
				.lblDayName7.ForeColor = .nsundaycolour
				.nsunday = 7
				.lblDayName1.Caption = .cdayname2
				.lblDayName2.Caption = .cdayname3
				.lblDayName3.Caption = .cdayname4
				.lblDayName4.Caption = .cdayname5
				.lblDayName5.Caption = .cdayname6
				.lblDayName6.Caption = .cdayname7
				.lblDayName7.Caption = .cdayname1
			Case .FirstDayOfTheWeek = 3	&&	Tuesday
				.lblDayName6.ForeColor = .nsundaycolour
				.nsunday = 6
				.lblDayName1.Caption = .cdayname3
				.lblDayName2.Caption = .cdayname4
				.lblDayName3.Caption = .cdayname5
				.lblDayName4.Caption = .cdayname6
				.lblDayName5.Caption = .cdayname7
				.lblDayName6.Caption = .cdayname1
				.lblDayName7.Caption = .cdayname2
			Case .FirstDayOfTheWeek = 4	&&	Wednesday
				.lblDayName5.ForeColor = .nsundaycolour
				.nsunday = 5
				.lblDayName1.Caption = .cdayname4
				.lblDayName2.Caption = .cdayname5
				.lblDayName3.Caption = .cdayname6
				.lblDayName4.Caption = .cdayname7
				.lblDayName5.Caption = .cdayname1
				.lblDayName6.Caption = .cdayname2
				.lblDayName7.Caption = .cdayname3
			Case .FirstDayOfTheWeek = 5	&&	Thursday
				.lblDayName4.ForeColor = .nsundaycolour
				.nsunday = 4
				.lblDayName1.Caption = .cdayname5
				.lblDayName2.Caption = .cdayname6
				.lblDayName3.Caption = .cdayname7
				.lblDayName4.Caption = .cdayname1
				.lblDayName5.Caption = .cdayname2
				.lblDayName6.Caption = .cdayname3
				.lblDayName7.Caption = .cdayname4
			Case .FirstDayOfTheWeek = 6	&&	Friday
				.lblDayName3.ForeColor = .nsundaycolour
				.nsunday = 3
				.lblDayName1.Caption = .cdayname6
				.lblDayName2.Caption = .cdayname7
				.lblDayName3.Caption = .cdayname1
				.lblDayName4.Caption = .cdayname2
				.lblDayName5.Caption = .cdayname3
				.lblDayName6.Caption = .cdayname4
				.lblDayName7.Caption = .cdayname5
			Otherwise					&&	Saturday
				.lblDayName2.ForeColor = .nsundaycolour
				.nsunday = 2
				.lblDayName1.Caption = .cdayname7
				.lblDayName2.Caption = .cdayname1
				.lblDayName3.Caption = .cdayname2
				.lblDayName4.Caption = .cdayname3
				.lblDayName5.Caption = .cdayname4
				.lblDayName6.Caption = .cdayname5
				.lblDayName7.Caption = .cdayname6
			Endcase
		Endwith
		
	ENDPROC

	PROCEDURE Init
		LPARAMETERS tdValue
		
		WITH this
			.nsundaycolour = RGB(255,128,128)
			.notherscolour = RGB(196,196,255)
			IF VARTYPE(m.tdValue) == 'D'
				.Value = m.tdValue
			ELSE
				.Value = DATE()
			ENDIF
			.Language = .Language
			.Redraw()
		ENDWITH
		
	ENDPROC

	PROTECTED PROCEDURE language_assign
		LPARAMETERS vNewVal
		
		WITH this
			.Language = m.vNewVal
			IF .Language == 'RO'
				.cDayName1 = 'D'
				.cDayName2 = 'L'
				.cDayName3 = 'M'
				.cDayName4 = 'M'
				.cDayName5 = 'J'
				.cDayName6 = 'V'
				.cDayName7 = 'S'
				.MonthNames = "Ianuarie Februarie Martie Aprilie Mai Iunie Iulie August Septembrie Octombrie Noiembrie Decembrie"
				.TodayString = "Azi"
				.FirstDayOfTheWeek = 2
			ELSE
				.cDayName1 = 'S'
				.cDayName2 = 'M'
				.cDayName3 = 'T'
				.cDayName4 = 'W'
				.cDayName5 = 'T'
				.cDayName6 = 'F'
				.cDayName7 = 'S'
				.MonthNames = "January February March April May June July August September October November December"
				.TodayString = "Today"
				.FirstDayOfTheWeek = 1
			ENDIF
			.Redraw()
		ENDWITH
		
	ENDPROC

	PROCEDURE monthclick
	ENDPROC

	PROCEDURE MouseEnter
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		IF this.Enabled
			this.ShowTips = thisform.ShowTips
			thisform.ShowTips = .T.
		ENDIF
		
	ENDPROC

	PROCEDURE MouseLeave
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		IF this.Enabled
			thisform.ShowTips = this.ShowTips
		ENDIF
		
	ENDPROC

	PROCEDURE redraw
		WITH this
			FOR EACH m.loCtl IN .Controls
				IF UPPER(m.loCtl.Class) == '_LBLDAY'
					m.loCtl.ToolTipText = ''
					m.loCtl.Visible = .F.
				ENDIF
			ENDFOR
			
		*!*		IF !USED('holiday')
		*!*			USE holiday IN 0
		*!*		ENDIF
			
		*!*		m.lcSelect = SELECT()
		*!*		SELECT holiday
		*!*		SET ORDER TO TAG hdate
			
			m.lnMonth = MONTH(.Value)
			m.lnYear = YEAR(.Value)
			m.lnDay = DAY(.Value)
			m.lnLastDay = GOMONTH(.Value, 1) - .Value
			m.ldToday = DATE()
			m.lnToday = DAY(m.ldToday)
			.txtMonth.Value = GETWORDNUM(.MonthNames, m.lnMonth)
			.txtYear.Value = TRANSFORM(m.lnYear)
			m.lcDates = DTOS(m.ldToday)
			IF .Language == 'EN'
				.txtToday.Value = .TodayString + ": " + SUBSTR(m.lcDates,5,2)+'/'+RIGHT(m.lcDates,2)+'/'+LEFT(m.lcDates,4)
			ELSE
				.txtToday.Value = .TodayString + ": " + RIGHT(m.lcDates,2)+'-'+SUBSTR(m.lcDates,5,2)+'-'+LEFT(m.lcDates,4)
			ENDIF
			m.lnWeek = 1
			m.ldDate = EVALUATE("{^"+TRANSFORM(LEFT(DTOS(.Value),6)+"01", "@R 9999-99-99")+"}")
			FOR m.lnDays = 1 TO m.lnLastDay
				m.ldCurDate = m.ldDate + (m.lnDays-1)
				m.lnDow = DOW(m.ldCurDate,.firstdayoftheweek)
				m.loLbl = EVALUATE("this._lblday" + TRANSFORM(m.lnWeek) + "_" + TRANSFORM(m.lnDow))
				m.loLbl.Visible = .T.
				m.loLbl.Caption = TRANSFORM(m.lnDays)
				IF m.lnDays == m.lnDay
					m.loLbl.BackColor = This.notherscolour
					m.loLbl.ForeColor = RGB(255, 255, 255)
				ELSE
					m.loLbl.BackColor = RGB(255, 255, 255)
		*!*				IF SEEK (m.ldCurDate)
		*!*					m.loLbl.ForeColor = RGB(255, 128, 128)
		*!*					IF .Language == 'EN'
		*!*						m.loLbl.ToolTipText = ALLTRIM(holiday.hdescen)
		*!*					ELSE
		*!*						m.loLbl.ToolTipText = ALLTRIM(holiday.hdesc)
		*!*					ENDIF
		*!*				ELSE
						IF m.lnDow = This.nSunday
							m.loLbl.ForeColor = This.nsundaycolour
						ELSE
							m.loLbl.ForeColor = RGB(0, 0, 0)
						ENDIF
		*!*				ENDIF
				ENDIF
				IF m.ldCurDate == m.ldToday
					m.loLbl.BackColor = This.nsundaycolour
					m.loLbl.ForeColor = RGB(255, 255, 255)
				ENDIF
				IF m.lnDow == 7
					m.lnWeek = m.lnWeek + 1
				ENDIF
			ENDFOR
			
		*!*		IF !EMPTY(m.lcSelect)
		*!*			SELECT (lcSelect)
		*!*		ENDIF
		
		*!*		IF USED('holiday')
		*!*			USE IN holiday
		*!*		ENDIF
			
		ENDWITH
		
	ENDPROC

	PROCEDURE todayclick
	ENDPROC

	PROCEDURE valuechanged
	ENDPROC

	HIDDEN PROCEDURE value_assign
		LPARAMETERS vNewVal
		
		WITH this
			.Value = m.vNewVal
			.Day = DAY(m.vNewVal)
			.Month = MONTH(m.vNewVal)
			.Year = YEAR(m.vNewVal)
			.ValueChanged()
		ENDWITH
		
	ENDPROC

	PROCEDURE yearclick
	ENDPROC

	PROCEDURE imgDown.MouseDown
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		IF m.nButton == 1
			WITH this.Parent
				IF .Year > 1900
					.Value = GOMONTH(.Value, -12)
					.Redraw()
					.YearClick()
				ENDIF
			ENDWITH
		ENDIF
		
	ENDPROC

	PROCEDURE imgDown.MouseMove
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		this.Parent.MouseMove(nButton, nShift, nXCoord, nYCoord)
		
	ENDPROC

	PROCEDURE imgLeft.MouseDown
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		IF m.nButton == 1
			WITH this.Parent
				IF .Enabled
					.Value = GOMONTH(.Value, -1)
					.Redraw()
					.MonthClick()
				ENDIF
			ENDWITH
		ENDIF
		
	ENDPROC

	PROCEDURE imgLeft.MouseMove
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		IF this.Parent.Enabled
			this.Parent.MouseMove(nButton, nShift, nXCoord, nYCoord)
		ENDIF
		
	ENDPROC

	PROCEDURE imgRight.MouseDown
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		IF m.nButton == 1
			WITH this.Parent
				IF .Enabled
					.Value = GOMONTH(.Value, 1)
					.Redraw()
					.MonthClick()
				ENDIF
			ENDWITH
		ENDIF
		
	ENDPROC

	PROCEDURE imgRight.MouseMove
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		IF this.Parent.Enabled
			this.Parent.MouseMove(nButton, nShift, nXCoord, nYCoord)
		ENDIF
		
	ENDPROC

	PROCEDURE imgUp.MouseDown
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		IF m.nButton == 1
			WITH this.Parent
				IF .Year < 2099
					.Value = GOMONTH(.Value, 12)
					.Redraw()
					.YearClick()
				ENDIF
			ENDWITH
		ENDIF
		
	ENDPROC

	PROCEDURE imgUp.MouseMove
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		this.Parent.MouseMove(nButton, nShift, nXCoord, nYCoord)
		
	ENDPROC

	PROCEDURE lblDayName1.MouseMove
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		this.Parent.MouseMove(nButton, nShift, nXCoord, nYCoord)
		
	ENDPROC

	PROCEDURE lblDayName2.MouseMove
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		this.Parent.MouseMove(nButton, nShift, nXCoord, nYCoord)
		
	ENDPROC

	PROCEDURE lblDayName3.MouseMove
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		this.Parent.MouseMove(nButton, nShift, nXCoord, nYCoord)
		
	ENDPROC

	PROCEDURE lblDayName4.MouseMove
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		this.Parent.MouseMove(nButton, nShift, nXCoord, nYCoord)
		
	ENDPROC

	PROCEDURE lblDayName5.MouseMove
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		this.Parent.MouseMove(nButton, nShift, nXCoord, nYCoord)
		
	ENDPROC

	PROCEDURE lblDayName6.MouseMove
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		this.Parent.MouseMove(nButton, nShift, nXCoord, nYCoord)
		
	ENDPROC

	PROCEDURE lblDayName7.MouseMove
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		this.Parent.MouseMove(nButton, nShift, nXCoord, nYCoord)
		
	ENDPROC

	PROCEDURE Shape1.MouseMove
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		IF this.Parent.Enabled
			this.Parent.MouseMove(nButton, nShift, nXCoord, nYCoord)
		ENDIF
		
	ENDPROC

	PROCEDURE Shape2.MouseMove
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		IF this.Parent.Enabled
			this.Parent.MouseMove(nButton, nShift, nXCoord, nYCoord)
		ENDIF
		
	ENDPROC

	PROCEDURE shpToday.MouseDown
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		IF m.nButton == 1
			WITH this.Parent
				IF .Enabled
					.Value = DATE()
					.Redraw()
					.TodayClick()
				ENDIF
			ENDWITH
		ENDIF
		
	ENDPROC

	PROCEDURE shpToday.MouseMove
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		IF this.Parent.Enabled
			this.Parent.MouseMove(nButton, nShift, nXCoord, nYCoord)
		ENDIF
		
	ENDPROC

	PROCEDURE txtMonth.MouseMove
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		IF this.Parent.Enabled
			this.Parent.MouseMove(nButton, nShift, nXCoord, nYCoord)
		ENDIF
		
	ENDPROC

	PROCEDURE txtMonth.When
		RETURN .F.
		
	ENDPROC

	PROCEDURE txtToday.When
		RETURN .F.
		
	ENDPROC

	PROCEDURE txtYear.MouseMove
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		IF this.Parent.Enabled
			this.Parent.MouseMove(nButton, nShift, nXCoord, nYCoord)
		ENDIF
		
	ENDPROC

	PROCEDURE txtYear.When
		RETURN .F.
		
	ENDPROC

ENDDEFINE

DEFINE CLASS _calpopup AS form 
 	*< CLASSDATA: Baseclass="form" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Timer1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="Calendar" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: form_deactivate
		*m: form_moved
		*m: form_resize
		*m: hideform
		*m: language_assign
		*m: showform
		*p: idletime
		*p: is_formshow
		*p: language
		*p: lastactivity
		*p: odatepicker
		*p: oform
		*p: shadowed
		*p: _memberdata		&& XML Metadata for customizable properties
		*p: _originalvalue
	*</DefinedPropArrayMethod>

	*<PropValue>
		BorderStyle = 0
		Caption = ""
		Closable = .F.
		ControlBox = .F.
		DoCreate = .T.
		Height = 168
		idletime = 50
		is_formshow = .F.
		KeyPreview = .T.
		language = RO
		lastactivity = .F.
		Left = 0
		MaxButton = .F.
		MinButton = .F.
		Name = "_calpopup"
		odatepicker = .F.
		oform = .F.
		shadowed = .T.
		ShowInTaskBar = .F.
		TitleBar = 0
		Top = 0
		Width = 168
		_memberdata = <VFPData>
			<memberdata name="shadowed" type="property" display="Shadowed"/>
			<memberdata name="language" type="property" display="Language"/>
			<memberdata name="idletime" type="property" display="IdleTime"/>
		</VFPData>
		_originalvalue = {}
	*</PropValue>

	ADD OBJECT 'Calendar' AS _calendar WITH ;
		Left = 0, ;
		Name = "Calendar", ;
		Top = 0, ;
		Shape2.Name = "Shape2", ;
		Shape1.Name = "Shape1", ;
		txtToday.Name = "txtToday", ;
		txtMonth.Name = "txtMonth", ;
		txtYear.Name = "txtYear", ;
		_lblday1_1.Name = "_lblday1_1", ;
		_lblday1_2.Name = "_lblday1_2", ;
		_lblday1_3.Name = "_lblday1_3", ;
		_lblday1_4.Name = "_lblday1_4", ;
		_lblday1_5.Name = "_lblday1_5", ;
		_lblday1_6.Name = "_lblday1_6", ;
		_lblday1_7.Name = "_lblday1_7", ;
		lblDayName2.Name = "lblDayName2", ;
		lblDayName3.Name = "lblDayName3", ;
		lblDayName4.Name = "lblDayName4", ;
		lblDayName5.Name = "lblDayName5", ;
		lblDayName6.Name = "lblDayName6", ;
		lblDayName7.Name = "lblDayName7", ;
		lblDayName1.Name = "lblDayName1", ;
		_lblday2_1.Name = "_lblday2_1", ;
		_lblday2_2.Name = "_lblday2_2", ;
		_lblday2_3.Name = "_lblday2_3", ;
		_lblday2_4.Name = "_lblday2_4", ;
		_lblday2_5.Name = "_lblday2_5", ;
		_lblday2_6.Name = "_lblday2_6", ;
		_lblday2_7.Name = "_lblday2_7", ;
		_lblday3_1.Name = "_lblday3_1", ;
		_lblday3_2.Name = "_lblday3_2", ;
		_lblday3_3.Name = "_lblday3_3", ;
		_lblday3_4.Name = "_lblday3_4", ;
		_lblday3_5.Name = "_lblday3_5", ;
		_lblday3_6.Name = "_lblday3_6", ;
		_lblday3_7.Name = "_lblday3_7", ;
		_lblday4_1.Name = "_lblday4_1", ;
		_lblday4_2.Name = "_lblday4_2", ;
		_lblday4_3.Name = "_lblday4_3", ;
		_lblday4_4.Name = "_lblday4_4", ;
		_lblday4_5.Name = "_lblday4_5", ;
		_lblday4_6.Name = "_lblday4_6", ;
		_lblday4_7.Name = "_lblday4_7", ;
		_lblday5_1.Name = "_lblday5_1", ;
		_lblday5_2.Name = "_lblday5_2", ;
		_lblday5_3.Name = "_lblday5_3", ;
		_lblday5_4.Name = "_lblday5_4", ;
		_lblday5_5.Name = "_lblday5_5", ;
		_lblday5_6.Name = "_lblday5_6", ;
		_lblday5_7.Name = "_lblday5_7", ;
		_lblday6_1.Name = "_lblday6_1", ;
		_lblday6_2.Name = "_lblday6_2", ;
		_lblday6_3.Name = "_lblday6_3", ;
		_lblday6_4.Name = "_lblday6_4", ;
		_lblday6_5.Name = "_lblday6_5", ;
		_lblday6_6.Name = "_lblday6_6", ;
		_lblday6_7.Name = "_lblday6_7", ;
		imgLeft.Height = 16, ;
		imgLeft.Name = "imgLeft", ;
		imgLeft.Width = 16, ;
		imgRight.Height = 16, ;
		imgRight.Name = "imgRight", ;
		imgRight.Width = 16, ;
		imgUp.Height = 7, ;
		imgUp.Name = "imgUp", ;
		imgUp.Width = 11, ;
		imgDown.Height = 7, ;
		imgDown.Name = "imgDown", ;
		imgDown.Width = 11, ;
		shpToday.Name = "shpToday"
		*< END OBJECT: ClassLib="_calendar.vcx" BaseClass="control" />

	ADD OBJECT 'Timer1' AS timer WITH ;
		Enabled = .F., ;
		Height = 23, ;
		Interval = 50, ;
		Left = 154, ;
		Name = "Timer1", ;
		Top = 154, ;
		Width = 23
		*< END OBJECT: BaseClass="timer" />
	
	PROCEDURE Deactivate
		thisform.HideForm()
		
	ENDPROC

	PROCEDURE form_deactivate
	ENDPROC

	PROCEDURE form_moved
	ENDPROC

	PROCEDURE form_resize
	ENDPROC

	PROCEDURE hideform
		#define GCL_STYLE (-26)
		#define CS_DROPSHADOW 0x00020000
		
		WITH this
			IF .is_formshow
				.Timer1.Enabled = .F.
				.is_formshow = .F.
				UNBINDEVENTS(.oForm, "Resize", this, "HideForm")
		
				DECLARE LONG ReleaseCapture IN WIN32API AS API_ReleaseCapture
				API_ReleaseCapture()
				
				.Visible = .F.
				
				IF .Shadowed
					DECLARE LONG GetClassLong IN WIN32API AS API_GetClassLong LONG, LONG
					DECLARE LONG SetClassLong IN WIN32API AS API_SetClassLong LONG, LONG, LONG
					m.lnStyle = API_GetClassLong(.HWnd, GCL_STYLE)
					API_SetClassLong(.HWnd, GCL_STYLE, BITAND(m.lnStyle, BITNOT(CS_DROPSHADOW)))
				ENDIF
		
				.oDatePicker.SetFocus()
				.Release()
			ENDIF
		ENDWITH
		
	ENDPROC

	PROCEDURE Init
		LPARAMETERS toObject, toForm
		
		WITH this
			.Name = SYS(2015)
			.oDatePicker = m.toObject
			.oForm = m.toForm
			.Calendar.Value = IIF(EMPTY(m.toObject.Value), DATE(), m.toObject.Value)
			._OriginalValue = m.toObject.Value
			.Language = .Language
		ENDWITH
		
	ENDPROC

	PROCEDURE KeyPress
		LPARAMETERS nKeyCode, nShiftAltCtrl
		
		m.llRelease = .F.
		
		WITH thisform
			DO CASE
			CASE m.nKeyCode == 27
				m.llRelease = .T.
				.oDatePicker.Value = ._OriginalValue
			CASE m.nKeyCode == 13
				m.llRelease = .T.
			ENDCASE
			IF m.llRelease
				.HideForm()
			ENDIF
		ENDWITH
		
	ENDPROC

	HIDDEN PROCEDURE language_assign
		LPARAMETERS vNewVal
		
		WITH this
			.Language = m.vNewVal
			.Calendar.Language = m.vNewVal
		ENDWITH
		
	ENDPROC

	PROCEDURE showform
		LPARAMETERS x, y
		
		DECLARE LONG SetWindowPos IN WIN32API AS API_SetWindowPos LONG, LONG, LONG, LONG, LONG, LONG, LONG
		DECLARE LONG ClientToScreen IN WIN32API AS API_ClientToScreen LONG, STRING @
		DECLARE LONG SetWindowLongA IN WIN32API AS API_SetWindowLong LONG, LONG, LONG
		DECLARE LONG GetWindowLongA IN WIN32API AS API_GetWindowLong LONG, LONG
		DECLARE LONG SetParent IN WIN32API AS API_SetParent LONG, LONG
		DECLARE LONG SetFocus IN WIN32API AS API_SetFocus LONG
		DECLARE LONG SetCapture IN WIN32API AS API_SetCapture LONG
		
		#define SWP_SHOWWINDOW 0x0040
		#define GWL_EXSTYLE (-20)
		#define WS_EX_TOOLWINDOW 0x00000080
		#define WS_EX_APPWINDOW 0x00040000
		#define WS_EX_TOPMOST 0x8
		#define GCL_STYLE (-26)
		#define CS_DROPSHADOW 0x00020000
		
		WITH thisform
			ACTIVATE WINDOW (.Name) IN WINDOW (.oForm.Name) NOSHOW
			
			m.lhWnd = .hWnd
		
			m.lStyle = API_GetWindowLong(m.lhWnd, GWL_EXSTYLE) 
			m.lStyle = BITAND(BITOR(m.lStyle, WS_EX_TOOLWINDOW), BITNOT(WS_EX_APPWINDOW))
			API_SetWindowLong(m.lhWnd, GWL_EXSTYLE, m.lStyle)
		
			m.lParentHWnd = .oForm.hWnd
			
			m.lqPt = BINTOC(x, '4RS')+BINTOC(y, '4RS')
			API_ClientToScreen(m.lParentHWnd, @lqPt)
			x = CTOBIN(SUBSTR(m.lqPt, 1, 4), '4RS')
			y = CTOBIN(SUBSTR(m.lqPt, 5, 4), '4RS')
		
			IF ((x + .Width) > SYSMETRIC(1))
				x = SYSMETRIC(1) - .Width - 2
			ENDIF
			
			IF ((y + .Height) > SYSMETRIC(2))
				y = y - .Height - this.oDatePicker.Height + 2
			ENDIF
		
			IF .Shadowed
				DECLARE LONG GetClassLong IN WIN32API AS API_GetClassLong LONG, LONG
				DECLARE LONG SetClassLong IN WIN32API AS API_SetClassLong LONG, LONG, LONG
				m.lnStyle = API_GetClassLong(m.lhWnd, GCL_STYLE)
				API_SetClassLong(m.lhWnd, GCL_STYLE, BITOR(m.lnStyle, CS_DROPSHADOW))
			ENDIF
		
			API_SetParent(m.lhWnd, 0)
			API_SetWindowPos(m.lhWnd, 0, x, y, .Width, .Height, SWP_SHOWWINDOW)
		
			.Visible = .T.
			.ZOrder(0)
			.AlwaysOnTop = .T.
		
			API_SetFocus(m.lhWnd)
			API_SetCapture(m.lhWnd)
		
			.is_formshow = .T.
		
			BINDEVENT(.oForm, "Resize", this, "HideForm")
			
			.LastActivity = SECONDS()
		
			.Timer1.Enabled = .T.
		
		ENDWITH
		
	ENDPROC

	PROCEDURE Calendar.Click
		thisform.LastActivity = SECONDS()
		
	ENDPROC

	PROCEDURE Calendar.dayclick
		WITH thisform
			.oDatePicker.Value = this.Value
			.oDatePicker.SetFocus()
			.HideForm()
		ENDWITH
		
	ENDPROC

	PROCEDURE Calendar.monthclick
		WITH thisform
			.oDatePicker.Value = this.Value
		ENDWITH
		
	ENDPROC

	PROCEDURE Calendar.MouseMove
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		thisform.LastActivity = SECONDS()
		
	ENDPROC

	PROCEDURE Calendar.todayclick
		WITH thisform
			.oDatePicker.Value = this.Value
			.HideForm()
		ENDWITH
		
	ENDPROC

	PROCEDURE Calendar.valuechanged
		thisform.LastActivity = SECONDS()
		
	ENDPROC

	PROCEDURE Calendar.yearclick
		WITH thisform
			.oDatePicker.Value = this.Value
		ENDWITH
		
	ENDPROC

	PROCEDURE Timer1.Timer
		#define VK_LBUTTON 0x01
		#define VK_RBUTTON 0x02
		#define VK_MBUTTON 0x04
		
		DECLARE LONG GetAsyncKeyState IN WIN32API AS API_GetAsyncKeyState LONG
		
		IF BITAND(API_GetAsyncKeyState(VK_LBUTTON), 0x8000) != 0 OR ;
				BITAND(API_GetAsyncKeyState(VK_RBUTTON), 0x8000) != 0 OR ;
				BITAND(API_GetAsyncKeyState(VK_MBUTTON), 0x8000) != 0
		
			DECLARE LONG GetCursorPos IN WIN32API AS API_GetCursorPos STRING @
			DECLARE LONG GetWindowRect IN WIN32API AS API_GetWindowRect LONG, STRING @
				
			m.lqPos = REPLICATE(0h00, 8)
			API_GetCursorPos(@lqPos)
			m.lnX = CTOBIN(LEFT(m.lqPos, 4), '4RS')
			m.lnY = CTOBIN(RIGHT(m.lqPos, 4), '4RS')
				
			m.lqRect = REPLICATE(0h00, 16)
			API_GetWindowRect(thisform.HWnd, @lqRect)
			m.lnLeft = CTOBIN(SUBSTR(m.lqRect, 1, 4), '4RS')
			m.lnTop = CTOBIN(SUBSTR(m.lqRect, 5, 4), '4RS')
			m.lnRight = CTOBIN(SUBSTR(m.lqRect, 9, 4), '4RS')
			m.lnBottom = CTOBIN(SUBSTR(m.lqRect, 13, 4), '4RS')
				
			IF !BETWEEN(m.lnX, m.lnLeft, m.lnRight) OR !BETWEEN(m.lnY, m.lnTop, m.lnBottom)
				this.Enabled = .F.
				thisform.HideForm()
			ENDIF
		
		ELSE
			IF thisform.IdleTime > 0
				m.lnSeconds = SECONDS() - thisform.LastActivity
				IF m.lnSeconds >= thisform.IdleTime
					this.Enabled = .F.
					thisform.HideForm()
				ENDIF
			ENDIF
		ENDIF
		
	ENDPROC

ENDDEFINE

DEFINE CLASS _datepicker AS control 
 	*< CLASSDATA: Baseclass="control" Timestamp="" Scale="Pixels" Uniqueid="" />

	*-- OBJECTDATA items order determines ZOrder / El orden de los items OBJECTDATA determina el ZOrder 
	*< OBJECTDATA: ObjPath="Text1" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="txtDate" UniqueID="" Timestamp="" />
	*< OBJECTDATA: ObjPath="cmdPick" UniqueID="" Timestamp="" />

	*<DefinedPropArrayMethod>
		*m: controlsource_assign
		*m: loadcalendar
		*m: value_access
		*m: value_assign
		*p: controlsource		&& Specifies the source of data to which an object is bound.
		*p: idletime
		*p: language
		*p: opopup
		*p: value		&& Specifies the current state of a control.
		*p: _memberdata		&& XML Metadata for customizable properties
	*</DefinedPropArrayMethod>

	HIDDEN _memberdata
	PROTECTED opopup
	*<PropValue>
		BorderWidth = 0
		controlsource = 
		Height = 23
		idletime = 50
		language = EN
		Name = "_datepicker"
		opopup = .F.
		value = {}
		Width = 98
		_memberdata = <VFPData>
			<memberdata name="controlsource" type="property" display="ControlSource"/>
			<memberdata name="value" type="property" display="Value"/>
			<memberdata name="language" type="property" display="Language"/>
			<memberdata name="idletime" type="property" display="IdleTime"/>
		</VFPData>
	*</PropValue>

	ADD OBJECT 'cmdPick' AS commandbutton WITH ;
		BackColor = 255,255,255, ;
		Caption = "", ;
		Height = 21, ;
		Left = 76, ;
		Name = "cmdPick", ;
		Picture = caldropdown.bmp, ;
		SpecialEffect = 2, ;
		TabStop = .F., ;
		Top = 1, ;
		Width = 21
		*< END OBJECT: BaseClass="commandbutton" />

	ADD OBJECT 'Text1' AS textbox WITH ;
		Height = 23, ;
		Left = 0, ;
		Name = "Text1", ;
		TabStop = .F., ;
		Top = 0, ;
		Width = 98
		*< END OBJECT: BaseClass="textbox" />

	ADD OBJECT 'txtDate' AS textbox WITH ;
		Alignment = 3, ;
		Format = "K", ;
		Height = 23, ;
		Left = 0, ;
		Name = "txtDate", ;
		Top = 0, ;
		Value = {}, ;
		Width = 76
		*< END OBJECT: BaseClass="textbox" />
	
	HIDDEN PROCEDURE controlsource_assign
		LPARAMETERS vNewVal
		
		WITH this
			.ControlSource = m.vNewVal
			.txtDate.ControlSource = m.vNewVal
		ENDWITH
		
	ENDPROC

	PROCEDURE Init
		WITH this
			.txtDate.ControlSource = .ControlSource
		ENDWITH
		
	ENDPROC

	PROCEDURE loadcalendar
		this.oPopup = CREATEOBJECT("_calpopup", this, thisform)
		IF !ISNULL(this.oPopup)
			this.oPopup.IdleTime = this.IdleTime
			this.oPopup.Language = this.Language
		*	this.oPopup.ShowForm(this.Left, this.Top + this.Height - 1)
			this.oPopup.ShowForm(OBJTOCLIENT(this, 2), OBJTOCLIENT(this,1) + this.Height - 1)
		ENDIF
		
	ENDPROC

	HIDDEN PROCEDURE value_access
		WITH this
			RETURN .txtDate.Value
		ENDWITH
		
	ENDPROC

	HIDDEN PROCEDURE value_assign
		LPARAMETERS vNewVal
		
		WITH this
			.txtDate.Value = m.vNewVal
		ENDWITH
		
	ENDPROC

	PROCEDURE cmdPick.Click
		this.Parent.LoadCalendar()
		
	ENDPROC

	PROCEDURE Text1.When
		RETURN .F.
		
	ENDPROC

	PROCEDURE txtDate.Init
		WITH this
			IF EMPTY(.Value)
				.Value = DATE()
			ENDIF
		ENDWITH
		
	ENDPROC

ENDDEFINE

DEFINE CLASS _lblday AS label 
 	*< CLASSDATA: Baseclass="label" Timestamp="" Scale="Pixels" Uniqueid="" />

	*<PropValue>
		Alignment = 2
		BackColor = 255,255,255
		Caption = "00"
		FontName = "Tahoma"
		FontSize = 8
		Height = 15
		Name = "_lblday"
		Width = 15
	*</PropValue>
	
	PROCEDURE Click
		WITH this.Parent
			IF .Enabled
				.Value = EVALUATE("{^"+TRANSFORM(LEFT(DTOS(.Value),6)+ALLTRIM(this.Caption), "@R 9999-99-99")+"}")
				.Redraw()
				.DayClick()
			ENDIF
		ENDWITH
		
	ENDPROC

	PROCEDURE MouseDown
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		IF m.nButton == 1
			IF this.Parent.Enabled
				this.BorderStyle = 1
			ENDIF
		ENDIF
		
	ENDPROC

	PROCEDURE MouseMove
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		IF this.Parent.Enabled
			this.Parent.MouseMove(nButton, nShift, nXCoord, nYCoord)
		ENDIF
		
	ENDPROC

	PROCEDURE MouseUp
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		
		IF m.nButton == 1
			IF this.Parent.Enabled
				this.BorderStyle = 0
			ENDIF
		ENDIF
		
	ENDPROC

ENDDEFINE
