示例#1
0
        /// <summary>
        /// 下拉菜单显示方法
        /// </summary>
        public virtual void onDropDownOpening()
        {
            //创建下拉菜单及日历
            if (m_dropDownMenu == null)
            {
                FCHost host = Native.Host;
                m_dropDownMenu = host.createInternalControl(this, "dropdownmenu") as FCMenu;
                Native.addControl(m_dropDownMenu);
                if (m_calendar == null)
                {
                    m_calendar = CreateCalendar();
                    m_dropDownMenu.addControl(m_calendar);
                    m_calendar.Size = m_dropDownMenu.Size;
                    m_calendar.addEvent(m_selectedTimeChangedEvent, FCEventID.SELECTEDTIMECHANGED);
                }
            }
            if (m_calendar != null && !m_showTime)
            {
                m_calendar.TimeDiv.Height = 0;
            }
            m_dropDownMenu.Native = Native;
            FCPoint nativePoint = pointToNative(new FCPoint(0, Height));

            m_dropDownMenu.Location = nativePoint;
            m_dropDownMenu.Visible  = true;
            if (m_calendar != null)
            {
                m_calendar.Mode = FCCalendarMode.Day;
            }
            m_dropDownMenu.bringToFront();
            m_dropDownMenu.invalidate();
        }
示例#2
0
        /// <summary>
        /// 添加项
        /// </summary>
        /// <param name="index">行索引</param>
        public virtual void onAddingItem(int index)
        {
            FCMenu dropDownMenu = null;

            if (m_parentItem != null)
            {
                dropDownMenu = m_parentItem.DropDownMenu;
                if (dropDownMenu == null)
                {
                    dropDownMenu              = m_parentMenu.createDropDownMenu();
                    dropDownMenu.Visible      = false;
                    m_parentItem.DropDownMenu = dropDownMenu;
                    dropDownMenu.ParentItem   = m_parentItem;
                    m_parentMenu.Native.addControl(dropDownMenu);
                }
            }
            else
            {
                dropDownMenu = m_parentMenu;
            }
            if (dropDownMenu != null)
            {
                if (index != -1)
                {
                    //插入行
                    dropDownMenu.insertControl(index, this);
                }
                else
                {
                    //添加行
                    dropDownMenu.addControl(this);
                }
                //添加子节点
                int itemSize = m_items.size();
                for (int i = 0; i < itemSize; i++)
                {
                    m_items.get(i).onAddingItem(-1);
                }
            }
        }