Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » CalendarCtrl » Little improvement of Caledar & DropDate controls
Re: Little improvement of Caledar & DropDate controls [message #40096 is a reply to message #40095] Mon, 10 June 2013 01:02 Go to previous messageGo to previous message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

I propose to make this changes in DateTimeCtrl.cpp & DateTimeCtrl.h

DateTimeCtrl.h have 3 changes:

1. After line 212 add line

Callback3 <Date , Color&, Color& > WhenPaintDay;
result:
public:
	Calendar();
	Callback1<Time &> WhenTime;
	Callback3 <Date , Color&, Color& > WhenPaintDay; // <== Inserted line

	static const Style& StyleDefault();

	void Reset();



2. After line 491 add line

Callback3 <Date , Color&, Color& > WhenPaintDay;

3. After line 501 add line

cc.calendar.WhenPaintDay = Proxy(WhenPaintDay);

result of items 2 & 3 will be:
public:
	typedef DateTimeCtrl CLASSNAME;
	Callback3 <Date , Color&, Color& > WhenPaintDay; // <== Inserted line
	DateTimeCtrl(int m) : cc(m) {
		drop.AddTo(*this);
		drop.AddButton().Main() <<= THISBACK(OnDrop);
		drop.NoDisplay();
		drop.SetStyle(drop.StyleFrame());
		drop.GetButton(0).SetMonoImage(Grayscale(CtrlsImg::DA()));
		cc.calendar   <<= THISBACK(OnCalendarChoice);
		cc.clock      <<= THISBACK(OnClockChoice);
		cc.WhenPopDown  = THISBACK(OnClose);
		cc.calendar.WhenSelect = Proxy(WhenSelect);
		cc.calendar.WhenPaintDay = Proxy(WhenPaintDay); // <== Inserted line
	}
	virtual void GotFocus()  { T::GotFocus(); drop.RefreshFrame(); }
	virtual void LostFocus() { T::LostFocus(); drop.RefreshFrame(); }
	virtual Size GetMinSize() const { return drop.GetMinSize(); }


DateTimeCtrl.cpp have 1 changes:

1. After line 530 add lines:
					if (!WhenPaintDay.Empty()){
						WhenPaintDay(Date(y,m,d),fg,bg);
					}


result code:

					if(d == today.day && m == today.month && y == today.year)
					{
						fg = st.fgtoday;
						bg = st.bgtoday;
						fnt.Bold();
						special = true;

						curday.x = j;
						curday.y = i;
					}
					if(d == sel.day && m == sel.month && y == sel.year)
					{
						fg = st.fgselect;
						bg = st.bgselect;
						fnt.Bold();
						special = true;

						prevday.x = j;
						prevday.y = i;
					}
					if (!WhenPaintDay.Empty()){              // <== Inserted line
						WhenPaintDay(Date(y,m,d),fg,bg); // <== Inserted line
					}                                        // <== Inserted line

				}
				else
				{
					fg = st.outofmonth;
					sd = d > 0 ? -d : d;
					Day(j, i) = sd;
				}


In attachment these 2 files based on 6113svn

PS
Please include my addition into standard code.


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}

[Updated on: Mon, 10 June 2013 08:06]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [Minor bug & patch] CalendarCtrl should offer support for native cursor icon.
Next Topic: Clock bug?
Goto Forum:
  


Current Time: Fri Jul 18 03:42:31 CEST 2025

Total time taken to generate the page: 0.04292 seconds