/// <summary>
 /// Determines if this collection contains the provided option.
 /// </summary>
 public bool Contains( MenuOption option )
 {
     return InnerList.Contains( option );
 }
        /// <summary>
        /// Creates a new menu option and adds it to the list.  Returns the
        /// created option.
        /// </summary>
        public MenuOption Add()
        {
            MenuOption newOption = new MenuOption();
            Add( newOption );

            return newOption;
        }
 /// <summary>
 /// Adds a menu option to the collection.
 /// </summary>
 /// <remarks>
 /// Null options are ignored.
 /// </remarks>
 public int Add( MenuOption option )
 {
     return InnerList.Add( option );
 }
 /// <summary>
 /// Creates a new instance of the menu event arguments class.
 /// </summary>
 /// <param name="menuPos">
 /// The position of the shown menu, in screen coordinates.
 /// </param>
 /// <param name="selectedOption">
 /// The option from the menu that was selected.  Can be <c>null</c> if
 /// not applicable or if no option was selected.
 /// </param>
 public MenuEventArgs(
     Point menuPos,
     MenuOption selectedOption
     )
 {
     m_menuPos = menuPos;
     m_selectedOption = selectedOption;
 }
Example #5
0
        /// <summary>
        /// Initializes a new final frame option data set.
        /// </summary>
        /// <param name="centerPixelLocation">
        /// The location of the bitmap's central pixel.
        /// </param>
        /// <param name="option">
        /// The menu option associated with this frame.  Cannot be null.
        /// </param>
        /// <exception cref="NullReferenceException">
        /// Thrown if the provided option is a null reference.
        /// </exception>
        public FinalFrameOptionData(
            Point centerPixelLocation,
            MenuOption option
            )
            : base(centerPixelLocation, option.CachedPrimaryImage)
        {
            if( option == null )
                throw new ArgumentNullException(
                    "option",
                    "The menu option for the final frame cannot be null"
                    );

            else
            {
                m_option = option;

                m_boundingBox = new Rectangle(
                    new Point(
                        centerPixelLocation.X - OptionBitmap.Width / 2,
                        centerPixelLocation.Y - OptionBitmap.Height / 2
                        ),
                    OptionBitmap.Size
                    );
            }
        }
        public void InitializeComponent()
        {
            ObjWindowFile owf                   = lips.getOwf();
            ObjBattery ob                       = lips.getObtry();

            //moBrw = createMenuOption(owf.ico_brw, new System.EventHandler(this.btnRssBrw_Click), true);
            //moWid = createMenuOption(owf.ico_wid, new System.EventHandler(this.btnWidget_Clickbtn), true);
            moEnd = createMenuOption(owf.ico_pow, new System.EventHandler(this.btnEnd_Click), true);
            moMin = createMenuOption(owf.ico_tray, new System.EventHandler(this.btnMinimize_Click), true);
            moChr = createMenuOption(owf.ico_char, new System.EventHandler(this.btnChar_Click), true);
            moRss = createMenuOption(owf.ico_rss, new System.EventHandler(this.btnRss_Click), true);
            moMen = createMenuOption(owf.ico_setting, new System.EventHandler(this.btnMenu_Clickbtn), true);
            moNex = createMenuOption(owf.ico_next, new System.EventHandler(this.btnNext_Click), false);
            moLog = createMenuOption(owf.ico_log, new System.EventHandler(this.btnLog_Click), true);
            moBat = createMenuOption(ob.nowBatteryImage, new System.EventHandler(this.btnBat_Click), true);
            //moDwn = createMenuOption(owf.ico_down, new System.EventHandler(this.btnDown_Clickbtn), true);

            if (sleepMode == 1)
            {
                moSlp = createMenuOption(owf.ico_waikUp, new System.EventHandler(this.btnSleep_Click), true);
            }
            else
            {
                moSlp = createMenuOption(owf.ico_zzz, new System.EventHandler(this.btnSleep_Click), true);
            }
        }
 /// <summary>
 /// Invokes the OptionSelected event.
 /// �I�v�V�����Z���N�g�̃C�x���g
 /// </summary>
 private void RaiseOptionSelected( MenuOption selected )
 {
     if( OptionSelected != null )
         OptionSelected.DynamicInvoke(
             new object[] {
                              this,
                              new MenuEventArgs(
                                 m_menuScreenPos,
                                 selected
                              )
                          }
             );
 }
        /// <summary>
        /// Tracks mouse movement and determines if the window needs to be
        /// redrawn.
        /// </summary>
        private void TrackMouseMove(
            object sender, 
            System.Windows.Forms.MouseEventArgs e
            )
        {
            if( !m_isReady ) return;

            m_mouseX = e.X;
            m_mouseY = e.Y;

            MenuOption current = m_animation.FinalFrame.HitTest(
                m_centerX,
                m_centerY,
                e.X,
                e.Y
                );

            if( current != m_lastHoverOption )
            {
                // Events.
                if( m_lastHoverOption != null )
                    m_lastHoverOption.RaiseEndHover();
                if( current != null )
                    current.RaiseStartHover();

                m_lastHoverOption = current;
                RepaintMenu();
            }
        }
        /// <summary>
        /// Tracks mouse ups.  If the user mouse-ups over the same item they
        /// mouse down'd over, that option is selected and the menu closes.
        /// </summary>
        private void TrackMouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            //����OK�H
            if( !m_isReady ) return;

            //�v���b�V���O�t�H���X
            m_pressing = false;

            if( m_pressedOption == m_lastHoverOption )
            {
                //�����ꂽ���j���[�I�v�V�����̎擾
                m_selectedOption = m_pressedOption;

                //�����ꂽ���j���[�I�v�V�����̃��C�Y�G���h�z�[�o�[
                m_selectedOption.RaiseEndHover();

                //�����ꂽ���j���[�I�v�V�����̃��C�Y�N���b�N
                m_selectedOption.RaiseClick();

                // ������‚���I
                m_lastHoverOption = null;

                //�‚���I�v�V�������L���ȃ��j���[�̏ꍇ�‚���
                if (m_selectedOption.m_click_close)
                {
                    TriggerClose();
                }
                //TriggerClose();
            }
            else
            {
                // They canceled the selection.
                //RepaintMenu();
            }
        }
        /// <summary>
        /// Tracks mouse depressions.  Clicking anywhere on the window that
        /// isn't an option automatically closes the window.
        /// </summary>
        private void TrackMouseDown(
            object sender, 
            System.Windows.Forms.MouseEventArgs e
            )
        {
            if (!m_isReady) return;

            m_pressing = true;
            m_downX = e.X;
            m_downY = e.Y;

            m_pressedOption = m_animation.FinalFrame.HitTest(
                m_centerX,
                m_centerY,
                e.X,
                e.Y
                );

            if (m_pressedOption == null)
            {
                // Immediately close the window.
                //TriggerClose();
            }
            else
            {
                //RepaintMenu();
            }
        }
        /// <summary>
        /// Indicates that no option should be highlighted.
        /// </summary>
        private void TrackMouseLeave(
            object sender, 
            System.EventArgs e
            )
        {
            if( !m_isReady ) return;

            m_mouseX = this.Width + 1;
            m_mouseY = this.Height + 1;

            if( m_lastHoverOption != null ) m_lastHoverOption.RaiseEndHover();
            m_lastHoverOption = null;
            RepaintMenu();
        }
        public void Dispose()
        {
            cmp.Dispose();
            moEnd.Dispose();
            moMin.Dispose();
            moChr.Dispose();
            moRss.Dispose();
            moMen.Dispose();
            moNex.Dispose();
            moSlp.Dispose();
            moLog.Dispose();

            cmp = null;
            moEnd = null;
            moMin = null;
            moChr = null;
            moRss = null;
            moMen = null;
            moNex = null;
            moSlp = null;
            moLog = null;
        }
        private MenuOption createMenuOptionNonAdd(Bitmap bmp, EventHandler eh, bool clickClose)
        {
            MenuOption opt = new MenuOption();
            //初期化
            opt.DisabledImage.DropShadow.ShadowColor = System.Drawing.Color.Black;
            opt.DisabledImage.TransparencyKey = TRANS_COLOR;
            opt.HoverImage.DropShadow.ShadowColor = System.Drawing.Color.Black;
            opt.HoverImage.TransparencyKey = TRANS_COLOR;
            opt.Image.DropShadow.ShadowColor = System.Drawing.Color.Black;
            opt.Image.TransparencyKey = TRANS_COLOR;
            opt.PressedImage.DropShadow.ShadowColor = System.Drawing.Color.Black;
            opt.PressedImage.TransparencyKey = TRANS_COLOR;

            //アイコン設定
            opt.DisabledImage.Image = bmp;
            opt.HoverImage.Image = bmp;
            opt.Image.Image = bmp;
            opt.PressedImage.Image = bmp;

            //イベントの追加
            opt.Click += eh;

            //クリッククローズの設定
            opt.m_click_close = clickClose;

            return opt;
        }
        private MenuOption createMenuOption(Bitmap bmp, EventHandler eh, bool clickClose)
        {
            MenuOption opt = new MenuOption();
            //初期化
            opt.DisabledImage.DropShadow.ShadowColor = System.Drawing.Color.Black;
            opt.DisabledImage.TransparencyKey        = TRANS_COLOR;
            opt.HoverImage.DropShadow.ShadowColor    = System.Drawing.Color.Black;
            opt.HoverImage.TransparencyKey           = TRANS_COLOR;
            opt.Image.DropShadow.ShadowColor         = System.Drawing.Color.Black;
            opt.Image.TransparencyKey                = TRANS_COLOR;
            opt.PressedImage.DropShadow.ShadowColor  = System.Drawing.Color.Black;
            opt.PressedImage.TransparencyKey         = TRANS_COLOR;

            //アイコンのサイズ調整
            //Liplis2.1.0 改善
            Bitmap fixIcon = fixIconSize(bmp);

            //アイコン設定
            opt.DisabledImage.Image = fixIcon;
            opt.HoverImage.Image    = fixIcon;
            opt.Image.Image         = fixIcon;
            opt.PressedImage.Image  = fixIcon;

            //イベントの追加
            opt.Click += eh;

            //クリッククローズの設定
            opt.m_click_close = clickClose;

            //コントロールに追加
            this.cmp.MenuOptions.Add(opt);

            return opt;
        }
 /// <summary>
 /// Determines the index of the provided option. 
 /// </summary>
 public int IndexOf( MenuOption option )
 {
     return InnerList.IndexOf( option );
 }
        /// <summary>
        /// Indicates that a the popup window has been closed, and provides the
        /// selected option.
        /// </summary>
        internal void PopupComplete( MenuOption selectedOption )
        {
            m_currentPopup = null;

            if( selectedOption == null )
                RaiseMenuCanceled();
            else
                RaiseOptionSelected( selectedOption );

            RaiseMenuClosed( selectedOption );
        }
 /// <summary>
 /// Removes the provided option.
 /// </summary>
 public void Remove( MenuOption option )
 {
     InnerList.Remove( option );
 }
        /// <summary>
        /// Tracks mouse ups.  If the user mouse-ups over the same item they
        /// mouse down'd over, that option is selected and the menu closes.
        /// </summary>
        private void TrackMouseUp(
            object sender, 
            System.Windows.Forms.MouseEventArgs e
            )
        {
            if( !m_isReady ) return;

            m_pressing = false;

            if( m_pressedOption == m_lastHoverOption )
            {
                // They selected an option.  Deal with events.
                m_selectedOption = m_pressedOption;
                m_selectedOption.RaiseEndHover();
                m_selectedOption.RaiseClick();

                // Close us!
                m_lastHoverOption = null;
                TriggerClose();
            }
            else
            {
                // They canceled the selection.
                RepaintMenu();
            }
        }