Exemple #1
0
        /// <summary>
        /// Occurs when a control got focus
        /// </summary>
        /// <param name="hWnd">hwnd</param>
        /// <returns>hwnd of the control that got focus</returns>
        private void OnControlGotFocus(IntPtr hWnd)
        {
            EventHandler <TemplateEventArgs <IntPtr> > handle = ControlGotFocus;

            if (handle != null)
            {
                TemplateEventArgs <IntPtr> arg = new TemplateEventArgs <IntPtr>(hWnd);
                handle(this, arg);
            }
        }
Exemple #2
0
        /// <summary>
        /// Filter message
        /// </summary>
        /// <param name="m">message to filter</param>
        /// <returns>true if message was filtered</returns>
        public bool PreFilterMessage(ref Message m)
        {
            switch (m.Msg)
            {
            case WM_SETFOCUS:
            case WM_LBUTTONDOWN:
            case WM_LBUTTONUP:
            case WM_LBUTTONDBLCLK:
            case WM_RBUTTONDOWN:
            case WM_RBUTTONUP:
            case WM_RBUTTONDBLCLK:
            case WM_MBUTTONDOWN:
            case WM_MBUTTONUP:
            case WM_MBUTTONDBLCLK:
            case WM_NCLBUTTONDOWN:
            case WM_NCLBUTTONUP:
            case WM_NCLBUTTONDBLCLK:
            case WM_NCRBUTTONDOWN:
            case WM_NCRBUTTONUP:
            case WM_NCRBUTTONDBLCLK:
            case WM_NCMBUTTONDOWN:
            case WM_NCMBUTTONUP:
            case WM_NCMBUTTONDBLCLK:
            case WM_KEYDOWN:

                EventHandler <TemplateEventArgs <Message> > handler = MessageFiltered;
                if (handler != null)
                {
                    TemplateEventArgs <Message> args = new TemplateEventArgs <Message>(m);
                    handler(this, args);
                }

                LastFocusedControl = m.HWnd;
                break;

            default:
                break;
            }

            return(false);
        }
Exemple #3
0
        /// <summary>
        /// Occurs when control got focus
        /// </summary>
        /// <param name="sender">sender of the event</param>
        /// <param name="e">event argument</param>
        private void OnControlGotFocus(object sender, TemplateEventArgs <IntPtr> e)
        {
            Control control = Control.FromHandle(e.Data);

            while (control != null)
            {
                if (control as Form != null)
                {
                    break;
                }

                if (control as FormsTabbedView != null)
                {
                    control = ((FormsTabbedView)control).SelectedForm;
                    break;
                }

                control = control.Parent;
            }

            Form focusedForm = control as Form;

            if (focusedForm != null)
            {
                foreach (DockableFormInfo info in _dockableForms)
                {
                    if (info.DockableForm == focusedForm)
                    {
                        SelectedFormInfo = info;
                        break;
                    }
                }
            }

            return;
        }
Exemple #4
0
 /// <summary>
 /// Occurs when focus message was filtered
 /// </summary>
 /// <param name="sender">sender of the event</param>
 /// <param name="e">event argument</param>
 private void OnMessageFiltered(object sender, TemplateEventArgs <Message> e)
 {
     CheckSwitcherFocus();
 }