Exemple #1
0
        internal void MouseClick(Point mouseLocation, MouseButtons button, mcClickMode mode)
        {
            GregorianCalendar gCalendar = new GregorianCalendar();

            if (m_region.IsVisible(mouseLocation))
            {
                int week = 0;

                int i = ((mouseLocation.Y - m_rect.Top) / (int)m_calendar.Month.DayHeight);
                week = gCalendar.GetWeekOfYear(m_calendar.Month.m_days[i * 7].Date, m_calendar.m_dateTimeFormat.CalendarWeekRule, m_calendar.m_dateTimeFormat.FirstDayOfWeek);
                if (mode == mcClickMode.Single)
                {
                    if (this.Click != null)
                    {
                        this.Click(this, new WeeknumberClickEventArgs(week, button));
                    }
                }
                else
                {
                    if (this.DoubleClick != null)
                    {
                        this.DoubleClick(this, new WeeknumberClickEventArgs(week, button));
                    }
                }
            }
        }
Exemple #2
0
 internal void MouseClick(Point mouseLocation, MouseButtons button, mcClickMode mode)
 {
     if (m_region.IsVisible(mouseLocation))
     {
         if (mode == mcClickMode.Single)
         {
             if (this.Click != null)
             {
                 this.Click(this, new ClickEventArgs(button));
             }
         }
         else
         {
             if (this.DoubleClick != null)
             {
                 this.DoubleClick(this, new ClickEventArgs(button));
             }
         }
     }
 }
Exemple #3
0
 internal void MouseClick(Point mouseLocation, MouseButtons button, mcClickMode mode)
 {
     if (m_region.IsVisible(mouseLocation))
     {
         int day;
         day = (mouseLocation.X / (int)m_calendar.Month.DayWidth);
         if (mode == mcClickMode.Single)
         {
             if (this.Click != null)
             {
                 this.Click(this, new WeekdayClickEventArgs(day, button));
             }
         }
         else
         {
             if (this.DoubleClick != null)
             {
                 this.DoubleClick(this, new WeekdayClickEventArgs(day, button));
             }
         }
     }
 }
Exemple #4
0
        internal void MouseClick(Point mouseLocation, MouseButtons button, mcClickMode mode)
        {
            Region       leftBtnRgn      = new Region(m_prevBtnRect);
            Region       rightBtnRgn     = new Region(m_nextBtnRect);
            Region       leftYearBtnRgn  = new Region(m_prevYearBtnRect);
            Region       rightYearBtnRgn = new Region(m_nextYearBtnRect);
            MouseButtons selectButton;

            if (SystemInformation.MouseButtonsSwapped)
            {
                selectButton = MouseButtons.Right;
            }
            else
            {
                selectButton = MouseButtons.Left;
            }

            bool btnClick = false;

            if (m_region.IsVisible(mouseLocation))
            {
                if (button == selectButton)
                {
                    if (m_monthSelector)
                    {
                        if ((leftBtnRgn.IsVisible(mouseLocation)) && (m_prevBtnState != mcButtonState.Inactive) &&
                            (m_prevBtnState != mcButtonState.Pushed))
                        {
                            m_prevBtnState = mcButtonState.Pushed;
                            if (this.PrevMonthButtonClick != null)
                            {
                                this.PrevMonthButtonClick(this, new EventArgs());
                            }
                            btnClick = true;
                        }
                        if ((rightBtnRgn.IsVisible(mouseLocation)) && (m_nextBtnState != mcButtonState.Inactive) &&
                            (m_nextBtnState != mcButtonState.Pushed))
                        {
                            m_nextBtnState = mcButtonState.Pushed;
                            if (this.NextMonthButtonClick != null)
                            {
                                this.NextMonthButtonClick(this, new EventArgs());
                            }
                            btnClick = true;
                        }
                    }
                    if (m_yearSelector)
                    {
                        if ((leftYearBtnRgn.IsVisible(mouseLocation)) && (m_prevYearBtnState != mcButtonState.Inactive) &&
                            (m_prevYearBtnState != mcButtonState.Pushed))
                        {
                            m_prevYearBtnState = mcButtonState.Pushed;
                            if (this.PrevYearButtonClick != null)
                            {
                                this.PrevYearButtonClick(this, new EventArgs());
                            }
                            btnClick = true;
                        }
                        if ((rightYearBtnRgn.IsVisible(mouseLocation)) && (m_nextYearBtnState != mcButtonState.Inactive) &&
                            (m_nextYearBtnState != mcButtonState.Pushed))
                        {
                            m_nextYearBtnState = mcButtonState.Pushed;
                            if (this.NextYearButtonClick != null)
                            {
                                this.NextYearButtonClick(this, new EventArgs());
                            }
                            btnClick = true;
                        }
                    }
                }
                else
                {
                    if (m_contextMenu)
                    {
                        DisplayMonthContextMenu(mouseLocation);
                    }
                }

                if (mode == mcClickMode.Single)
                {
                    if ((this.Click != null) && (!btnClick))
                    {
                        this.Click(this, new ClickEventArgs(button));
                    }
                }
                else
                {
                    if ((this.DoubleClick != null) && (!btnClick))
                    {
                        this.DoubleClick(this, new ClickEventArgs(button));
                    }
                }
            }

            leftBtnRgn.Dispose();
            rightBtnRgn.Dispose();
            leftYearBtnRgn.Dispose();
            rightYearBtnRgn.Dispose();
        }
Exemple #5
0
		internal void MouseClick(Point mouseLocation, MouseButtons button, mcClickMode mode)
		{
			Region leftBtnRgn = new Region(m_prevBtnRect);
			Region rightBtnRgn = new Region(m_nextBtnRect);
			Region leftYearBtnRgn = new Region(m_prevYearBtnRect);
			Region rightYearBtnRgn = new Region(m_nextYearBtnRect);
			MouseButtons selectButton;
			
			if (SystemInformation.MouseButtonsSwapped)
				selectButton = MouseButtons.Right;
			else
				selectButton = MouseButtons.Left;

			bool btnClick = false;
			
			if (m_region.IsVisible(mouseLocation))
			{
				if (button == selectButton)
				{
					if (m_monthSelector)
					{
						if ( (leftBtnRgn.IsVisible(mouseLocation)) &&  (m_prevBtnState!=mcButtonState.Inactive) &&
							(m_prevBtnState!=mcButtonState.Pushed) )
						{
							m_prevBtnState = mcButtonState.Pushed;
							if (this.PrevMonthButtonClick!=null)
								this.PrevMonthButtonClick(this,new EventArgs());			
							btnClick = true;
						}
						if ( (rightBtnRgn.IsVisible(mouseLocation)) && (m_nextBtnState!=mcButtonState.Inactive) &&
							(m_nextBtnState!=mcButtonState.Pushed) )
						{
							m_nextBtnState = mcButtonState.Pushed;
							if (this.NextMonthButtonClick!=null)
								this.NextMonthButtonClick(this,new EventArgs());
							btnClick = true;
						}
					}
					if (m_yearSelector)
					{
						if ( (leftYearBtnRgn.IsVisible(mouseLocation)) &&  (m_prevYearBtnState!=mcButtonState.Inactive) &&
							(m_prevYearBtnState!=mcButtonState.Pushed) )
						{
							m_prevYearBtnState = mcButtonState.Pushed;
							if (this.PrevYearButtonClick!=null)
								this.PrevYearButtonClick(this,new EventArgs());			
							btnClick = true;
						}
						if ( (rightYearBtnRgn.IsVisible(mouseLocation)) && (m_nextYearBtnState!=mcButtonState.Inactive) &&
							(m_nextYearBtnState!=mcButtonState.Pushed) )
						{
							m_nextYearBtnState = mcButtonState.Pushed;
							if (this.NextYearButtonClick!=null)
								this.NextYearButtonClick(this,new EventArgs());
							btnClick = true;
						}
					}
				}
				else
				{
					if (m_contextMenu)
					{
						DisplayMonthContextMenu(mouseLocation);
					}
				}
				
				if (mode == mcClickMode.Single)
				{
					if ((this.Click!=null) && (!btnClick))
						this.Click(this,new ClickEventArgs(button));
				}
				else
				{
					if ((this.DoubleClick!=null) && (!btnClick))
						this.DoubleClick(this,new ClickEventArgs(button));	
				}
			}
			
			leftBtnRgn.Dispose();
			rightBtnRgn.Dispose();
			leftYearBtnRgn.Dispose();
			rightYearBtnRgn.Dispose();
		}
Exemple #6
0
		internal void MouseClick(Point mouseLocation,MouseButtons button, mcClickMode mode)
		{
			if (m_region.IsVisible(mouseLocation))
			{
				int day;
				day = (mouseLocation.X / (int)m_calendar.Month.DayWidth);
				if (mode == mcClickMode.Single)
				{
					if (this.Click!=null)
						this.Click(this,new WeekdayClickEventArgs(day,button)); 
				}
				else
				{
					if (this.DoubleClick!=null)
						this.DoubleClick(this,new WeekdayClickEventArgs(day,button));
				}
		
			}

		}
Exemple #7
0
		internal void MouseClick(Point mouseLocation, MouseButtons button,mcClickMode mode)
		{
			if (m_region.IsVisible(mouseLocation))
			{
				if (mode == mcClickMode.Single)
				{
					if (this.Click!=null)
						this.Click(this,new ClickEventArgs(button));
				}
				else
				{
					if (this.DoubleClick!=null)
						this.DoubleClick(this,new ClickEventArgs(button));
				}
			}
		}
Exemple #8
0
		internal void MouseClick(Point mouseLocation,MouseButtons button, mcClickMode mode)
		{
			GregorianCalendar gCalendar = new GregorianCalendar();
	
			if (m_region.IsVisible(mouseLocation))
			{
				int week = 0;
				
				int i = ((mouseLocation.Y-m_rect.Top) / (int)m_calendar.Month.DayHeight);				
				week = gCalendar.GetWeekOfYear(m_calendar.Month.m_days[i*7].Date,m_calendar.m_dateTimeFormat.CalendarWeekRule,m_calendar.m_dateTimeFormat.FirstDayOfWeek);
				if (mode == mcClickMode.Single)
				{
					if (this.Click!=null)
						this.Click(this,new WeeknumberClickEventArgs(week,button));
				}
				else
				{
					if (this.DoubleClick!=null)
						this.DoubleClick(this,new WeeknumberClickEventArgs(week,button));
				}
		
			}
		}