Пример #1
0
        /// <summary>
        /// 触摸点击方法
        /// </summary>
        /// <param name="touchInfo">触摸信息</param>
        public void onClick(FCTouchInfo touchInfo)
        {
            FCPoint mp = touchInfo.m_firstPoint;
            int     yearButtonsSize = m_yearButtons.size();

            for (int i = 0; i < yearButtonsSize; i++)
            {
                YearButton yearButton = m_yearButtons.get(i);
                if (yearButton.Visible)
                {
                    FCRect bounds = yearButton.Bounds;
                    if (mp.x >= bounds.left && mp.x <= bounds.right && mp.y >= bounds.top && mp.y <= bounds.bottom)
                    {
                        yearButton.onClick(touchInfo);
                        return;
                    }
                }
            }
            int yearButtonAmSize = m_yearButtons_am.size();

            for (int i = 0; i < yearButtonAmSize; i++)
            {
                YearButton yearButton = m_yearButtons_am.get(i);
                if (yearButton.Visible)
                {
                    FCRect bounds = yearButton.Bounds;
                    if (mp.x >= bounds.left && mp.x <= bounds.right && mp.y >= bounds.top && mp.y <= bounds.bottom)
                    {
                        yearButton.onClick(touchInfo);
                        return;
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// 重绘方法
        /// </summary>
        /// <param name="paint">绘图对象</param>
        /// <param name="clipRect">裁剪区域</param>
        public virtual void onPaint(FCPaint paint, FCRect clipRect)
        {
            int yearButtonsSize = m_yearButtons.size();

            for (int i = 0; i < yearButtonsSize; i++)
            {
                YearButton yearButton = m_yearButtons.get(i);
                if (yearButton.Visible)
                {
                    FCRect bounds = yearButton.Bounds;
                    yearButton.onPaintBackGround(paint, bounds);
                    yearButton.onPaintForeground(paint, bounds);
                    yearButton.onPaintBorder(paint, bounds);
                }
            }
            int yearButtonAmSize = m_yearButtons_am.size();

            for (int i = 0; i < yearButtonAmSize; i++)
            {
                YearButton yearButton = m_yearButtons_am.get(i);
                if (yearButton.Visible)
                {
                    FCRect bounds = yearButton.Bounds;
                    yearButton.onPaintBackGround(paint, bounds);
                    yearButton.onPaintForeground(paint, bounds);
                    yearButton.onPaintBorder(paint, bounds);
                }
            }
        }
Пример #3
0
        /// <summary>
        /// 隐藏
        /// </summary>
        public virtual void hide()
        {
            int yearButtonSize = m_yearButtons.size();

            for (int i = 0; i < yearButtonSize; i++)
            {
                YearButton yearButton = m_yearButtons.get(i);
                yearButton.Visible = false;
            }
        }
Пример #4
0
 /// <summary>
 /// 添加控件方法
 /// </summary>
 public virtual void onLoad()
 {
     if (m_calendar != null)
     {
         FCHost host = m_calendar.Native.Host;
         if (m_yearButtons.size() == 0 || m_yearButtons_am.size() == 0)
         {
             m_yearButtons.clear();
             m_yearButtons_am.clear();
             for (int i = 0; i < 12; i++)
             {
                 YearButton yearButton = new YearButton(m_calendar);
                 m_yearButtons.add(yearButton);
                 YearButton yearButtonAm = new YearButton(m_calendar);
                 yearButtonAm.Visible = false;
                 m_yearButtons_am.add(yearButtonAm);
             }
         }
     }
 }
Пример #5
0
 /// <summary>
 /// 重置日期图层
 /// </summary>
 /// <param name="state">状态</param>
 public virtual void onResetDiv(int state)
 {
     if (m_calendar != null)
     {
         int thisStartYear = m_startYear;
         int lastStartYear = m_startYear - 12;
         int nextStartYear = m_startYear + 12;
         int left          = 0;
         int headHeight    = m_calendar.HeadDiv.Height;
         int top           = headHeight;
         int width         = m_calendar.Width;
         int height        = m_calendar.Height;
         height -= m_calendar.TimeDiv.Height;
         int yearButtonHeight = height - top;
         if (yearButtonHeight < 1)
         {
             yearButtonHeight = 1;
         }
         int toY = 0;
         ArrayList <YearButton> yearButtons = new ArrayList <YearButton>();
         if (m_am_Direction == 1)
         {
             toY = yearButtonHeight * m_am_Tick / m_am_TotalTick;
             if (state == 1)
             {
                 thisStartYear = nextStartYear;
                 lastStartYear = thisStartYear - 12;
                 nextStartYear = thisStartYear + 12;
             }
         }
         else if (m_am_Direction == 2)
         {
             toY = -yearButtonHeight * m_am_Tick / m_am_TotalTick;
             if (state == 1)
             {
                 thisStartYear = lastStartYear;
                 lastStartYear = thisStartYear - 12;
                 nextStartYear = thisStartYear + 12;
             }
         }
         if (state == 0)
         {
             yearButtons = m_yearButtons;
         }
         else if (state == 1)
         {
             yearButtons = m_yearButtons_am;
         }
         int dheight    = yearButtonHeight / 3;
         int buttonSize = yearButtons.size();
         for (int i = 0; i < buttonSize; i++)
         {
             if (i == 8)
             {
                 dheight = height - top;
             }
             YearButton yearButton = yearButtons.get(i);
             yearButton.Year = thisStartYear + i;
             int vOffSet = 0;
             if (state == 1)
             {
                 if (m_am_Tick > 0)
                 {
                     yearButton.Visible = true;
                     if (m_am_Direction == 1)
                     {
                         vOffSet = toY - yearButtonHeight;
                     }
                     else if (m_am_Direction == 2)
                     {
                         vOffSet = toY + yearButtonHeight;
                     }
                 }
                 else
                 {
                     yearButton.Visible = false;
                     continue;
                 }
             }
             else
             {
                 vOffSet = toY;
             }
             if ((i + 1) % 4 == 0)
             {
                 FCPoint dp = new FCPoint(left, top + vOffSet);
                 FCSize  ds = new FCSize(width - left, dheight);
                 yearButton.Bounds = new FCRect(dp.x, dp.y, dp.x + ds.cx, dp.y + ds.cy);
                 left = 0;
                 if (i != 0 && i != buttonSize - 1)
                 {
                     top += dheight;
                 }
             }
             else
             {
                 FCPoint dp = new FCPoint(left, top + vOffSet);
                 FCSize  ds = new FCSize(width / 4 + ((i + 1) % 4) % 2, dheight);
                 yearButton.Bounds = new FCRect(dp.x, dp.y, dp.x + ds.cx, dp.y + ds.cy);
                 left += ds.cx;
             }
         }
     }
 }