Ejemplo n.º 1
0
        /// <summary>
        /// Overrides the <c>MouseDown</c> handler on this <c>YataPanelCols</c>.
        /// Accepts or cancels the editor based on
        /// <c><see cref="Settings._acceptedit">Settings._acceptedit</see></c>.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseDown(MouseEventArgs e)
        {
#if Clicks
            logfile.Log("YataPanelCols.OnMouseDown() e.Button= " + e.Button);
#endif
            // Don't bother checking MouseButton or ModifierKeys.

            if (_grid._editor.Visible)
            {
#if Clicks
                logfile.Log(". _grid._editor.Visible");
#endif
                _grid._editor.Visible = false;
            }
            else if (_grid.Propanel != null && _grid.Propanel._editor.Visible)
            {
#if Clicks
                logfile.Log(". _grid.Propanel._editor.Visible");
#endif
                _grid.Propanel._editor.Visible = false;
            }
            _grid.Select();


            switch (e.Button)
            {
            case MouseButtons.Left:
                IsGrab = ModifierKeys == Keys.None && IsCursorSplit;
#if Clicks
                logfile.Log(". IsGrab= " + IsGrab + " _grabCol= " + _grabCol);
#endif
                break;

            case MouseButtons.Right:
                if (ModifierKeys == Keys.None && IsCursorSplit)
                {
                    Col col = _grid.Cols[_grabCol];
                    if (col.UserSized)
                    {
#if Clicks
                        logfile.Log(". reset col-width _grabCol= " + _grabCol);
#endif
                        col.UserSized = false;
                        _grid.Colwidth(_grabCol);
                        _grid.Invalidator(YataGrid.INVALID_GRID | YataGrid.INVALID_COLS);
                    }
                }
                break;
            }

            _grid.click_ColheadPanel(e);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Overrides the <c>MouseDown</c> handler on this <c>YataPanelRows</c>.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseDown(MouseEventArgs e)
        {
#if Clicks
            logfile.Log("YataPanelRows.OnMouseDown() e.Button= " + e.Button);
#endif
            // Don't bother checking MouseButton or ModifierKeys.

            if (_grid._editor.Visible)
            {
#if Clicks
                logfile.Log(". _grid._editor.Visible");
#endif
                _grid._editor.Visible = false;
            }
            else if (_grid.Propanel != null && _grid.Propanel._editor.Visible)
            {
#if Clicks
                logfile.Log(". _grid.Propanel._editor.Visible");
#endif
                _grid.Propanel._editor.Visible = false;
            }
            _grid.Select();

            _grid.click_RowheadPanel(e);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Hides the <c><see cref="_editor"/></c> when this <c>Propanel</c> is
 /// scrolled.
 /// </summary>
 /// <param name="sender"><c><see cref="_scroll"/></c></param>
 /// <param name="e"></param>
 void scroll_valuechanged(object sender, EventArgs e)
 {
     if (_editor.Visible)
     {
         _editor.Visible = false;
         _grid.Select();
     }
     Invalidate();             // not sure why this is suddenly needed now ...
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Overrides the <c>MouseDown</c> handler on this
        /// <c>YataPanelFrozen</c>. Accepts or cancels an active edit.
        /// <list type="bullet">
        /// <item><c>LMB</c> - accept edit</item>
        /// <item><c>RMB</c> - cancel edit</item>
        /// <item><c>MMB</c> - accept or cancel based on
        /// <c><see cref="Settings._acceptedit">Settings._acceptedit</see></c></item>
        /// </list>
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseDown(MouseEventArgs e)
        {
#if Clicks
            logfile.Log("YataPanelFrozen.OnMouseDown() e.Button= " + e.Button);
#endif
            if (ModifierKeys == Keys.None)
            {
                if (_grid._editor.Visible)
                {
#if Clicks
                    logfile.Log(". _grid._editor.Visible");
#endif
                    switch (e.Button)
                    {
                    case MouseButtons.Left:                             // accept edit
#if Clicks
                        logfile.Log(". . accept edit");
#endif
                        _grid._bypassleaveditor = true;
                        _grid.editresultaccept();
                        break;

                    case MouseButtons.Right:                             // cancel edit
#if Clicks
                        logfile.Log(". . cancel edit");
#endif
                        _grid._bypassleaveditor = true;
                        _grid.editresultcancel(YataGrid.INVALID_GRID);
                        break;

                    default:
#if Clicks
                        logfile.Log(". . default edit result");
#endif
                        _grid._editor.Visible = false;                                 // do this or else the leave event fires twice.
                        break;
                    }
                }
                else
                {
                    Propanel propanel = _grid.Propanel;
                    if (propanel != null && propanel._editor.Visible)
                    {
#if Clicks
                        logfile.Log(". _grid.Propanel._editor.Visible");
#endif
                        switch (e.Button)
                        {
                        case MouseButtons.Left:                                 // accept edit
#if Clicks
                            logfile.Log(". . accept edit");
#endif
                            propanel._bypassleaveditor = true;
                            propanel.editresultaccept();
                            break;

                        case MouseButtons.Right:                                 // cancel edit
#if Clicks
                            logfile.Log(". . cancel edit");
#endif
                            propanel._bypassleaveditor = true;
                            propanel.editresultcancel();
                            break;

                        default:
#if Clicks
                            logfile.Log(". . default edit result");
#endif
                            propanel._editor.Visible = false;                                     // do this or else the leave event fires twice.
                            break;
                        }
                    }
                }
            }

            _grid.Select();
        }