Esempio n. 1
0
            //------------------------------------------------------
            //
            //  Internal Methods
            //
            //------------------------------------------------------

            #region Internal Methods

            // Retrieves the bounding rectangle of the Status Bar Pane.
            static internal Rect GetBoundingRectangle(IntPtr hwnd, int item)
            {
                if (!WindowsFormsHelper.IsWindowsFormsControl(hwnd))
                {
                    return(XSendMessage.GetItemRect(hwnd, NativeMethods.SB_GETRECT, item));
                }
                else
                {
                    Accessible acc = null;
                    if (Accessible.AccessibleObjectFromWindow(hwnd, NativeMethods.OBJID_CLIENT, ref acc) != NativeMethods.S_OK || acc == null)
                    {
                        return(Rect.Empty);
                    }
                    else
                    {
                        // OLEACC's Win32 proxy does use a 1, 2, 3... scheme, but the [....]
                        // controls in some cases supply their own children, using a different scheme.
                        // Using the "ByIndex" approach avoids having to know what the underlying
                        // object's idChild scheme is.
                        acc = Accessible.GetFullAccessibleChildByIndex(acc, item);
                        if (acc == null)
                        {
                            return(Rect.Empty);
                        }
                        else
                        {
                            return(acc.Location);
                        }
                    }
                }
            }
Esempio n. 2
0
        internal ProxySimple CreateStatusBarPane(int index)
        {
            // Use the Accessible object if this is a [....] control.  Only [....] StatusBars
            // can have children.
            Accessible accChild = null;

            if (_acc != null)
            {
                // OLEACC's Win32 proxy does use a 1, 2, 3... scheme, but the [....]
                // controls in some cases supply their own children, using a different scheme.
                // Using the "ByIndex" approach avoids having to know what the underlying
                // object's idChild scheme is.
                accChild = Accessible.GetFullAccessibleChildByIndex(_acc, index);
                if (accChild != null && accChild.Role != AccessibleRole.PushButton)
                {
                    // [....] toolbars have full IAccessibles for their children, but
                    // return the overall hwnd; treat those same as regular items.
                    // We only want to special-case actual child hwnds for overriding.
                    IntPtr hwndChild = accChild.Window;
                    if (hwndChild == IntPtr.Zero || hwndChild == _hwnd)
                    {
                        hwndChild = GetChildHwnd(_hwnd, accChild.Location);
                    }

                    if (hwndChild != IntPtr.Zero && hwndChild != _hwnd)
                    {
                        // We have an actual child hwnd.
                        return(new WindowsStatusBarPaneChildOverrideProxy(hwndChild, this, index));
                    }
                }
            }
            return(new WindowsStatusBarPane(_hwnd, this, index, accChild));
        }