// Returns a Proxy element corresponding to the specified screen coordinates. internal override ProxySimple ElementProviderFromPoint(int x, int y) { // Loop through all the panes for (int item = 0, count = Count; item < count; item++) { NativeMethods.Win32Rect rc = new NativeMethods.Win32Rect(WindowsStatusBarPane.GetBoundingRectangle(_hwnd, item)); if (Misc.PtInRect(ref rc, x, y)) { return(CreateStatusBarPane(item)); } } // Try the Grip if (_fHasGrip) { NativeMethods.Win32Rect rc = StatusBarGrip.GetBoundingRectangle(_hwnd); if (Misc.PtInRect(ref rc, x, y)) { ProxySimple grip = StatusBarGrip.Create(_hwnd, this, -1); return((ProxySimple)(grip != null ? grip : this)); } } return(this); }
// Returns the last child element in the raw hierarchy. internal override ProxySimple GetLastChild() { // Grip is the last Element if (_fHasGrip) { return(StatusBarGrip.Create(_hwnd, this, GripItemID)); } int count = Count; return(count > 0 ? CreateStatusBarPane(count - 1): null); }
// Returns the next sibling element in the raw hierarchy. // Peripheral controls have always negative values. // Returns null if no next child internal override ProxySimple GetNextSibling(ProxySimple child) { int item = child._item; int count = Count; // Next for an item that does not exist in the list if (item >= count) { throw new ElementNotAvailableException(); } // The grip is the last item. Exit when we see it. if (item == GripItemID) { return(null); } // Eventually add the Grip as the last element in the list return(item + 1 < count?CreateStatusBarPane(item + 1) : (_fHasGrip ? StatusBarGrip.Create(_hwnd, this, -1) : null)); }
// Returns the first child element in the raw hierarchy. internal override ProxySimple GetFirstChild() { // Grip is the last Element return(Count > 0 ? CreateStatusBarPane(0) : (_fHasGrip ? StatusBarGrip.Create(_hwnd, this, GripItemID) : null)); }