// ------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructors // This is the default contructor that calls the base class constructor. // This function determines the type of the edit control and then calls the default constructor. internal WindowsEditBox (IntPtr hwnd, ProxyFragment parent, int item) : base( hwnd, parent, item) { _type = GetEditboxtype (hwnd); if (IsMultiline) { _cControlType = ControlType.Document; } else { _cControlType = ControlType.Edit; } // When embedded inside of the combobox, hide the edit portion in the content element tree _fIsContent = !IsInsideOfCombo(); _fIsKeyboardFocusable = true; if (IsInsideOfListView(hwnd)) { _sAutomationId = "edit"; } // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
//------------------------------------------------------ // // Protected Methods // //------------------------------------------------------ #region Protected Methods // This method will return the leaf element that lives in ProxyFragment at Point(x,y) static internal ProxySimple DrillDownFragment(ProxyFragment fragment, int x, int y) { System.Diagnostics.Debug.Assert(fragment != null, "DrillDownFragment: starting point is null"); // drill down ProxySimple fromPoint = fragment.ElementProviderFromPoint(x, y); System.Diagnostics.Debug.Assert(fromPoint != null, @"DrillDownFragment: calling ElementProviderFromPoint on Fragment should not return null"); // Check if we got back a new fragment // do this check before trying to cast to ProxyFragment if (fragment == fromPoint || Misc.Compare(fragment, fromPoint)) { // Point was on the fragment // but not on any element that lives inside of the fragment return(fragment); } fragment = fromPoint as ProxyFragment; if (fragment == null) { // we got back a simple element return(fromPoint); } // Got a new fragment, continue drilling return(DrillDownFragment(fragment, x, y)); }
internal static IRawElementProviderSimple Create(IntPtr hwnd, int idChild) { IRawElementProviderSimple rawElementProviderSimple = null; try { ProxyFragment parent = null; WindowsAltTab altTab = new WindowsAltTab(hwnd, parent, 0); if (idChild == 0) { rawElementProviderSimple = altTab; } else { rawElementProviderSimple = altTab.CreateAltTabItem(idChild - 1); } } catch (ElementNotAvailableException) { rawElementProviderSimple = null; } return(rawElementProviderSimple); }
//------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructors public TitleBarButton(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { _fNonClientAreaElement = true; _cControlType = ControlType.Button; _fIsContent = false; }
/// <summary> /// Go through the list of all element chidren and exclude them from the list of /// visible/clickable rectangles. /// The element children may be listed in any order. A check on all of them must /// be performed. There is no easy way out. /// </summary> /// <param name="fragment"></param> /// <param name="alIn"></param> /// <param name="alOut"></param> internal static void ExcludeChildren(ProxyFragment fragment, ArrayList alIn, ArrayList alOut) { // First go through all the children to exclude whatever is on top for (ProxySimple simple = fragment.GetFirstChild(); simple != null; simple = fragment.GetNextSibling(simple)) { // The exclusion for hwnd children is done by the GetPoint routine if (simple is ProxyHwnd) { continue; } // Copy the output bits alIn.Clear(); alIn.AddRange(alOut); NativeMethods.Win32Rect rc = new NativeMethods.Win32Rect(simple.BoundingRectangle); CPRect rcp = new CPRect(ref rc, false); ClickablePoint.SplitRect(alIn, ref rcp, alOut, true); // recurse on the children if (simple is ProxyFragment) { ExcludeChildren((ProxyFragment)simple, alIn, alOut); } } }
// ------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructors // This is the default contructor that calls the base class constructor. // This function determines the type of the edit control and then calls the default constructor. internal WindowsEditBox(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { _type = GetEditboxtype(hwnd); if (IsMultiline) { _cControlType = ControlType.Document; } else { _cControlType = ControlType.Edit; } // When embedded inside of the combobox, hide the edit portion in the content element tree _fIsContent = !IsInsideOfCombo(); _fIsKeyboardFocusable = true; if (IsInsideOfListView(hwnd)) { _sAutomationId = "edit"; } // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// Returns an item corresponding to the focused element (if there is one), or null otherwise. internal override ProxySimple GetFocus() { if (WindowsMenu.IsInSystemMenuMode()) { // Since in system menu mode try to find point on the SystemMenu WindowsTitleBar titleBar = (WindowsTitleBar)CreateNonClientChild(NonClientItem.TitleBar); if (titleBar != null) { ProxyFragment systemMenu = (ProxyFragment)titleBar.CreateTitleBarChild(WindowsTitleBar._systemMenu); if (systemMenu != null) { // need to drill down ourself, since the FragmentRoot of the System Menu Bar will // be NonClient area hence UIAutomation will not drill down ProxySimple proxy = systemMenu.GetFocus(); if (proxy != null) { return(proxy); } } } } return(base.GetFocus()); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors internal RebarBandItem(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { // Set the strings to return properly the properties. _sType = ST.Get(STID.LocalizedControlTypeRebarBand); _fIsContent = false; }
private bool Select(bool fMultipleSelection) { int sendMessageResult = 0; bool success = true; if (!((WindowsListBox)_parent).IsParentedByCombo()) { if (fMultipleSelection) { sendMessageResult = Misc.ProxySendMessageInt(_hwnd, NativeMethods.LB_SETSEL, new IntPtr(1), new IntPtr(_item)); } else { sendMessageResult = Misc.ProxySendMessageInt(_hwnd, NativeMethods.LB_SETCURSEL, new IntPtr(_item), IntPtr.Zero); } success = (NativeMethods.LB_ERR != sendMessageResult); if (success) { // Whether multiple selection or not, send LBN_SELCHANGE. // This is normally sent when a user presses an arrow key, but // NOT when LB_SETCURSEL is sent programmatically. We need to // mimic the action of a user, including all side effects. int listBoxStyle = Misc.GetWindowStyle(_hwnd); if (Misc.IsBitSet(listBoxStyle, NativeMethods.LBS_NOTIFY)) { // Get the child ID of the listbox in its parent hwnd. int idListBox = Misc.GetWindowId(_hwnd); IntPtr wParam = new IntPtr(NativeMethods.Util.MAKELONG( idListBox, NativeMethods.LBN_SELCHANGE)); IntPtr hwndListBoxParent = Misc.GetParent(_hwnd); // The return value indicates whether the WM_COMMAND was processed, // which is irrelevant, so ignore the return value here. Misc.ProxySendMessageInt( hwndListBoxParent, NativeMethods.WM_COMMAND, wParam, _hwnd); } } } else { ProxyFragment combo = (WindowsComboBox)_parent._parent; sendMessageResult = Misc.ProxySendMessageInt(_hwnd, NativeMethods.LB_SETCURSEL, new IntPtr(_item), IntPtr.Zero); success = (NativeMethods.LB_ERR != sendMessageResult); if (success) { int id = Misc.GetWindowId(_hwnd); IntPtr wParam = new IntPtr(NativeMethods.Util.MAKELONG(id, NativeMethods.LBN_SELCHANGE)); // The return value indicates whether the WM_COMMAND was processed, // which is irrelevant, so ignore the return value here. Misc.ProxySendMessageInt(combo._hwnd, NativeMethods.WM_COMMAND, wParam, _hwnd); } } return(success); }
// ------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructors internal ListViewSubItem(IntPtr hwnd, ProxyFragment parent, int item, int itemParent) : base(hwnd, parent, item) { // Is used to discriminate between items in a collection. _itemParent = itemParent; _cControlType = WindowsListView.ListViewEditable(hwnd) ? ControlType.Edit : ControlType.Text; }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors WindowsProgressBar(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { _cControlType = ControlType.ProgressBar; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors WindowsProgressBar (IntPtr hwnd, ProxyFragment parent, int item) : base( hwnd, parent, item ) { _cControlType = ControlType.ProgressBar; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
// ------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructors internal ListViewSubItem (IntPtr hwnd, ProxyFragment parent, int item, int itemParent) : base (hwnd, parent, item) { // Is used to discriminate between items in a collection. _itemParent = itemParent; _cControlType = WindowsListView.ListViewEditable(hwnd) ? ControlType.Edit : ControlType.Text; }
// ------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructors internal WindowsStatusBarPane(IntPtr hwnd, ProxyFragment parent, int item, Accessible acc) : base(hwnd, parent, item) { _acc = acc; _cControlType = ControlType.Edit; _sAutomationId = "StatusBar.Pane" + item.ToString(CultureInfo.CurrentCulture); // This string is a non-localizable string }
//------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructor internal ListViewGroupSubsetLink(IntPtr hwnd, ProxyFragment parent, int item, int groupId) : base(hwnd, parent, item) { _cControlType = ControlType.Button; _sAutomationId = "ListviewGroupSubsetLink" + groupId; // This string is a non-localizable string _groupId = groupId; _fIsKeyboardFocusable = true; }
// ------------------------------------------------------ // // Construction/destruction // // ------------------------------------------------------ #region Constructors internal FormsLink (IntPtr hwnd, ProxyFragment parent, int item) : base( hwnd, parent, item) { // Set the strings to return properly the properties. _cControlType = ControlType.Hyperlink; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors // Constructor. // Param "hwnd" is the handle to underlying window // Param "parent" is the Parent, must be a ProxyFragment // Param "item" is the ID of item to represent internal ProxySimple(IntPtr hwnd, ProxyFragment parent, int item) { _hwnd = hwnd; _item = item; _parent = parent; // is element a leaf? _fSubTree = (_parent != null); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors // Constructor. internal ListboxItem(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { // Set the strings to return properly the properties. _cControlType = ControlType.ListItem; _fHasPersistentID = false; _fIsKeyboardFocusable = true; _listBox = (WindowsListBox)parent; }
// ------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructor internal WindowsListViewGroup(IntPtr hwnd, ProxyFragment parent, int groupID) : base(hwnd, parent, groupID) { _cControlType = ControlType.Group; _groupID = groupID; _sAutomationId = "Group " + (groupID + 1).ToString(CultureInfo.InvariantCulture); // This string is a non-localizable string _isComctrlV6OnOsVerV6orHigher = Misc.IsComctrlV6OnOsVerV6orHigher(hwnd); }
//------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructor WindowsComboBox (IntPtr hwnd, ProxyFragment parent, IntPtr hwndEx, int item) : base(hwnd, parent, item) { _cControlType = ControlType.ComboBox; _hwndEx = hwndEx; _comboType = GetComboType (); _fIsKeyboardFocusable = true; _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors // Contructor for the tooltip proxy class. WindowsTooltip (IntPtr hwnd, ProxyFragment parent, int item) : base( hwnd, parent, item) { // Set the control type string to return properly the properties. _cControlType = ControlType.ToolTip; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
//------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructor internal ListViewGroupSubsetLink (IntPtr hwnd, ProxyFragment parent, int item, int groupId) : base(hwnd, parent, item) { _cControlType = ControlType.Button; _sAutomationId = "ListviewGroupSubsetLink" + groupId; // This string is a non-localizable string _groupId = groupId; _fIsKeyboardFocusable = true; }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors // Contructor for the tooltip proxy class. WindowsTooltip(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { // Set the control type string to return properly the properties. _cControlType = ControlType.ToolTip; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
//------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructor WindowsComboBox(IntPtr hwnd, ProxyFragment parent, IntPtr hwndEx, int item) : base(hwnd, parent, item) { _cControlType = ControlType.ComboBox; _hwndEx = hwndEx; _comboType = GetComboType(); _fIsKeyboardFocusable = true; _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors WindowsRebar (IntPtr hwnd, ProxyFragment parent, int item) : base( hwnd, parent, item ) { _sType = ST.Get(STID.LocalizedControlTypeRebar); _fIsContent = false; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors WindowsRebar(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { _sType = ST.Get(STID.LocalizedControlTypeRebar); _fIsContent = false; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors // Constructor. // Param "hwnd" is the handle to underlying window // Param "parent" is the Parent, must be a ProxyFragment // Param "item" is the ID of item to represent internal ProxySimple(IntPtr hwnd, ProxyFragment parent, int item) { _hwnd = hwnd; _item = item; _parent = parent; // is element a leaf? _fSubTree = (_parent != null); }
// ------------------------------------------------------ // // Construction/destruction // // ------------------------------------------------------ #region Constructors internal FormsLink(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { // Set the strings to return properly the properties. _cControlType = ControlType.Hyperlink; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors internal WindowsTabItem(IntPtr hwnd, ProxyFragment parent, int item, bool fIsWinform) : base(hwnd, parent, item) { // Set the strings to return properly the properties. _cControlType = ControlType.TabItem; _fIsKeyboardFocusable = true; _fIsWinform = fIsWinform; _fIsContent = !string.IsNullOrEmpty(GetName(_hwnd, _item, true)); }
// Returns a Proxy element corresponding to the specified screen coordinates. internal override ProxySimple ElementProviderFromPoint(int x, int y) { int hit = Misc.ProxySendMessageInt(_hwnd, NativeMethods.WM_NCHITTEST, IntPtr.Zero, NativeMethods.Util.MAKELPARAM(x, y)); switch (hit) { case NativeMethods.HTHSCROLL: { ProxyFragment ret = CreateNonClientChild(NonClientItem.HScrollBar); return(ret.ElementProviderFromPoint(x, y)); } case NativeMethods.HTVSCROLL: { ProxyFragment ret = CreateNonClientChild(NonClientItem.VScrollBar); return(ret.ElementProviderFromPoint(x, y)); } case NativeMethods.HTCAPTION: case NativeMethods.HTMINBUTTON: case NativeMethods.HTMAXBUTTON: case NativeMethods.HTHELP: case NativeMethods.HTCLOSE: case NativeMethods.HTSYSMENU: WindowsTitleBar tb = new WindowsTitleBar(_hwnd, this, 0); return(tb.ElementProviderFromPoint(x, y)); case NativeMethods.HTGROWBOX: return(CreateNonClientChild(NonClientItem.Grip)); case NativeMethods.HTBOTTOMRIGHT: return(FindGrip(x, y)); case NativeMethods.HTBOTTOMLEFT: return(FindGripMirrored(x, y)); case NativeMethods.HTMENU: return(FindMenus(x, y)); case NativeMethods.HTLEFT: case NativeMethods.HTRIGHT: case NativeMethods.HTTOP: case NativeMethods.HTTOPLEFT: case NativeMethods.HTTOPRIGHT: case NativeMethods.HTBOTTOM: case NativeMethods.HTBORDER: // We do not handle the borders so return null here and let the // HWNDProvider handle them as the whole window. return(null); default: // Leave all other cases (especially including HTCLIENT) alone... return(null); } }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors internal ToolbarItem(IntPtr hwnd, ProxyFragment parent, int item, int idCommand) : base(hwnd, parent, item) { _idCommand = idCommand; NativeMethods.TBBUTTON tbb = new NativeMethods.TBBUTTON(); int buttonStyle = 0; if (XSendMessage.GetItem(_hwnd, _item, ref tbb)) { buttonStyle = tbb.fsStyle; } // Set the strings to return properly the properties. bool hasImageList = Misc.ProxySendMessageInt(_hwnd, NativeMethods.TB_GETIMAGELIST, IntPtr.Zero, IntPtr.Zero) != 0; int exStyle = Misc.ProxySendMessageInt(_hwnd, NativeMethods.TB_GETEXTENDEDSTYLE, IntPtr.Zero, IntPtr.Zero); _isToggleButton = false; _cControlType = ControlType.Button; // If a separator, say so if (Misc.IsBitSet(buttonStyle, NativeMethods.BTNS_SEP)) { _cControlType = ControlType.Separator; } else if (Misc.IsBitSet(buttonStyle, NativeMethods.BTNS_CHECK)) { // Special case for task list - they use the checked style, but only for visuals... IntPtr hwndParent = Misc.GetParent(_hwnd); if (Misc.GetClassName(hwndParent) != "MSTaskSwWClass") { _isToggleButton = true; } } else if (Misc.IsBitSet(buttonStyle, NativeMethods.BTNS_DROPDOWN) && Misc.IsBitSet(exStyle, NativeMethods.TBSTYLE_EX_DRAWDDARROWS)) { // if its a drop down and it has an arrow its a split button _cControlType = ControlType.SplitButton; } else if (!hasImageList || tbb.iBitmap == NativeMethods.I_IMAGENONE) { // Text-only, no bitmap, so it's effectively a menu item. // (eg. as used in MMC) _cControlType = ControlType.MenuItem; } _fIsContent = _cControlType != ControlType.Separator; // The Start Menu's "Shut Down" and "Log Off" buttons are toolbar items. They need to have the // KeyboardFocusable property be set to true. _fIsKeyboardFocusable = (bool)parent.GetElementProperty(AutomationElement.IsKeyboardFocusableProperty); GetItemId(ref _sAutomationId); }
// ------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructors WindowsIPAddress(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { // IP Address control itself is custom so need to also return LocalizedControlType property _cControlType = ControlType.Custom; _sType = SR.Get(SRID.LocalizedControlTypeIPAddress);; _fIsKeyboardFocusable = true; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors internal WindowsAltTab(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { _fIsKeyboardFocusable = true; _cControlType = ControlType.List; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); GetAltTabInfo(_hwnd, 0, ref _altTabInfo, null); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors internal WindowsAltTab(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { _fIsKeyboardFocusable = true; _cControlType = ControlType.List; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); GetAltTabInfo(_hwnd, 0, ref _altTabInfo, null); }
// ------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructors WindowsIPAddress (IntPtr hwnd, ProxyFragment parent, int item) : base( hwnd, parent, item ) { // IP Address control itself is custom so need to also return LocalizedControlType property _cControlType = ControlType.Custom; _sType = ST.Get( STID.LocalizedControlTypeIPAddress ); ; _fIsKeyboardFocusable = true; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
// ------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructor internal WindowsListViewGroup (IntPtr hwnd, ProxyFragment parent, int groupID) : base (hwnd, parent, groupID) { _cControlType = ControlType.Group; _groupID = groupID; _sAutomationId = "Group " + (groupID + 1).ToString(CultureInfo.InvariantCulture); // This string is a non-localizable string _isComctrlV6OnOsVerV6orHigher = Misc.IsComctrlV6OnOsVerV6orHigher(hwnd); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors WindowsSlider (IntPtr hwnd, ProxyFragment parent, int item) : base (hwnd, parent, item ) { _fHorizontal = IsHorizontalSlider (); _fIsKeyboardFocusable = true; // Set the strings to return properly the properties. _cControlType = ControlType.Slider; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors // Contructor for SpinControlProxy class. Calls the base class constructor. internal WindowsUpDown(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { // Set the strings to return properly the properties. _cControlType = ControlType.Spinner; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); // if spin is embedded in a tab control exclude from the content view. _fIsContent = !IsInsideOfTab(); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors public WindowsTitleBar (IntPtr hwnd, ProxyFragment parent, int item) : base( hwnd, parent, item ) { // Set the strings to return properly the properties. _cControlType = ControlType.TitleBar; _sAutomationId = "TitleBar"; // This string is a non-localizable string // _cControlType = ControlType.TitleBar; _fNonClientAreaElement = true; _fIsContent = false; }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors // Contructor for SpinControlProxy class. Calls the base class constructor. internal WindowsUpDown (IntPtr hwnd, ProxyFragment parent, int item) : base (hwnd, parent, item) { // Set the strings to return properly the properties. _cControlType = ControlType.Spinner; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); // if spin is embedded in a tab control exclude from the content view. _fIsContent = !IsInsideOfTab(); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors internal WindowsTreeView (IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { // Set the strings to return properly the properties. _cControlType = ControlType.Tree; // Can be focused _fIsKeyboardFocusable = true; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
//------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ #region Internal Methods internal static ProxySimple ElementProviderFromPoint(IntPtr hwnd, ProxyFragment parent, int item, int x, int y) { NativeMethods.LVHITTESTINFO_INTERNAL hitTest = WindowsListView.SubitemHitTest(hwnd, item, new NativeMethods.Win32Point(x, y)); if (hitTest.iSubItem >= 0) { return(new ListViewSubItem(hwnd, parent, hitTest.iSubItem, item)); } // subitems do not exist return(parent); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors public WindowsTitleBar(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { // Set the strings to return properly the properties. _cControlType = ControlType.TitleBar; _sAutomationId = "TitleBar"; // This string is a non-localizable string // _cControlType = ControlType.TitleBar; _fNonClientAreaElement = true; _fIsContent = false; }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors WindowsSlider(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { _fHorizontal = IsHorizontalSlider(); _fIsKeyboardFocusable = true; // Set the strings to return properly the properties. _cControlType = ControlType.Slider; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors // Contructor for WindownsSpinner class. Calls the base class constructor. internal WindowsSpinner(IntPtr hwndUpDown, IntPtr hwndEdit, ProxyFragment parent, int item) : base(hwndUpDown, parent, item) { _elEdit = new WindowsEditBox(hwndEdit, this, 0); _elUpDown = new WindowsUpDown(hwndUpDown, this, 0); // Set the strings to return properly the properties. _cControlType = ControlType.Spinner; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors // Contructor for WindownsSpinner class. Calls the base class constructor. internal WindowsSpinner(IntPtr hwndUpDown, IntPtr hwndEdit, ProxyFragment parent, int item) : base(hwndUpDown, parent, item) { _elEdit = new WindowsEditBox(hwndEdit, this, 0); _elUpDown = new WindowsUpDown(hwndUpDown, this, 0); // Set the strings to return properly the properties. _cControlType = ControlType.Spinner; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors internal WindowsStatusBar(IntPtr hwnd, ProxyFragment parent, int item, Accessible acc) : base(hwnd, parent, item) { _acc = acc; _cControlType = ControlType.StatusBar; _fHasGrip = StatusBarGrip.HasGrip(hwnd); _sAutomationId = "StatusBar"; // This string is a non-localizable string // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors public WindowsTab(IntPtr hwnd, ProxyFragment parent, int item) : base(hwnd, parent, item) { // Set the strings to return properly the properties. _cControlType = ControlType.Tab; // force initialisation of this so it can be used later _windowsForms = WindowsFormsHelper.GetControlState(hwnd); // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents); _fIsContent = IsValidControl(_hwnd); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors public WindowsTab (IntPtr hwnd, ProxyFragment parent, int item) : base( hwnd, parent, item ) { // Set the strings to return properly the properties. _cControlType = ControlType.Tab; // force initialisation of this so it can be used later _windowsForms = WindowsFormsHelper.GetControlState (hwnd); // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); _fIsContent = IsValidControl(_hwnd); }
// ------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructors internal ListViewItem (IntPtr hwnd, ProxyFragment parent, int item) : base (hwnd, parent, item) { // Set the strings to return properly the properties. if (WindowsListView.IsDetailMode(hwnd)) { _cControlType = ControlType.DataItem; } else { _cControlType = ControlType.ListItem; } _fHasPersistentID = false; _fIsKeyboardFocusable = true; _isComctrlV6OnOsVerV6orHigher = Misc.IsComctrlV6OnOsVerV6orHigher(hwnd); }
// ------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructors // Contructor for Button Proxy class. // param "hwnd", Windows handle // param "parent", Proxy Parent. Null if it is a root fragment // param "type", Button / Checkbox / Radio / Group // param "style", Button Style (BS_*) also used as the Proxy ID // Made internal so that WinFormsHelper.CreateButton can use. internal WindowsButton (IntPtr hwnd, ProxyFragment parent, ButtonType type, int style, Accessible acc) : base( hwnd, parent, 0) { _type = type; _fIsKeyboardFocusable = true; _style = style; _acc = acc; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); // Set ControlType based on type // Note: Do not call LocalizedName() within the constructor // since it is a virtual method. Calling a virtual method // in a constructor would have unintended consequences for // derived classes. if(type == ButtonType.PushButton) { _cControlType = ControlType.Button; _fControlHasLabel = false; } else if(type == ButtonType.CheckBox) { _cControlType = ControlType.CheckBox; // If a check box has non-empty text, it has no associated label. _fControlHasLabel = string.IsNullOrEmpty(GetLocalizedName()); } else if(type == ButtonType.RadioButton) { _cControlType = ControlType.RadioButton; // If a radio button has non-empty text, it has no associated label. _fControlHasLabel = string.IsNullOrEmpty(GetLocalizedName()); } else if (type == ButtonType.GroupBox) { _cControlType = ControlType.Group; _fIsKeyboardFocusable = false; // If a group box has non-empty text, it has no associated label. _fControlHasLabel = string.IsNullOrEmpty(GetLocalizedName()); } else { _cControlType = ControlType.Custom; } }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors internal WindowsListBox (IntPtr hwnd, ProxyFragment parent, int item, bool parentedByCombo) : base(hwnd, parent, item) { // Set the strings to return properly the properties. _parentedByCombo = parentedByCombo; _fIsKeyboardFocusable = true; _cControlType = ControlType.List; _fIsContent = !_parentedByCombo; if (parentedByCombo) { _sAutomationId = "ListBox"; // This string is a non-localizable string } // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors WindowsRichEdit (IntPtr hwnd, ProxyFragment parent, int style) : base( hwnd, parent, style ) { _type = WindowsEditBox.GetEditboxtype(hwnd); if (IsMultiline) { _cControlType = ControlType.Document; } else { _cControlType = ControlType.Edit; } _fIsKeyboardFocusable = true; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors WindowsStatic (IntPtr hwnd, ProxyFragment parent, StaticType type, int style) : base( hwnd, parent, 0) { _type = type; _style = style; if (type == StaticType.Text) { _cControlType = ControlType.Text; _fIsContent = false; _fControlHasLabel = false; } else { _cControlType = ControlType.Image; } // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors internal ToolbarItemAsMenuItem(IntPtr hwnd, ProxyFragment parent, int item, int idCommand, Accessible acc) : base(hwnd, parent, item, idCommand) { _acc = acc; // Set the control type based on the IAccessible role. AccessibleRole role = acc.Role; if (role == AccessibleRole.MenuItem) { _cControlType = ControlType.MenuItem; } else { System.Diagnostics.Debug.Assert(false, "Unexpected role " + role); } // MenuItems are by default KeyboardFocusable. _fIsKeyboardFocusable = true; }
// ------------------------------------------------------ // // Constructors // //------------------------------------------------------ #region Constructors internal ListViewItemStartMenu(IntPtr hwnd, ProxyFragment parent, int item, IAccessible acc) : base (hwnd, parent, item) { // The items are zero based, i.e. the first listview item is item 0. The // zero item in MSAA is self, so need to add one to the item to get the // correct Accessible child. AccessibleRole role = Accessible.GetRole(acc, item + 1); // Normal Listview items should be of control type listitem. But // the Listview items in the Start Menu act like menuitems. Get the Role // from IAccessible interface implemented by the Shell team and set the // control type. if (role == AccessibleRole.MenuItem) { _cControlType = ControlType.MenuItem; } else { System.Diagnostics.Debug.Assert(false, "The listview item on the Start Menu has an unexpected IAccessible role!"); } }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors // Contructor for the pieces that a acroll bar is made of. // Up Arrow, Down Arrow, Large Increment, Large Decrement and thmub. // param "hwnd", Windows handle // param "parent", Proxy Parent. Null if it is a root fragment // param "item", Proxy ID // param "sbFlag", CTL or (Vertical or Horizon non clent scroll bar) internal WindowsScrollBarBits (IntPtr hwnd, ProxyFragment parent, int item, int sbFlag) : base( hwnd, parent, item ) { _item = (int) item; _sbFlag = sbFlag; _fIsContent = false; // Never do any non client area cliping when dealing with the scroll bar and // scroll bar bits _fNonClientAreaElement = true; switch ((WindowsScrollBar.ScrollBarItem)_item) { case WindowsScrollBar.ScrollBarItem.UpArrow: _cControlType = ControlType.Button; _sAutomationId = "SmallDecrement"; // This string is a non-localizable string break; case WindowsScrollBar.ScrollBarItem.LargeDecrement: _cControlType = ControlType.Button; _sAutomationId = "LargeDecrement"; // This string is a non-localizable string break; case WindowsScrollBar.ScrollBarItem.LargeIncrement: _cControlType = ControlType.Button; _sAutomationId = "LargeIncrement"; // This string is a non-localizable string break; case WindowsScrollBar.ScrollBarItem.DownArrow: _cControlType = ControlType.Button; _sAutomationId = "SmallIncrement"; // This string is a non-localizable string break; case WindowsScrollBar.ScrollBarItem.Thumb: _cControlType = ControlType.Thumb; _sAutomationId = "Thumb"; // This string is a non-localizable string _fIsKeyboardFocusable = parent._fIsKeyboardFocusable; break; } }
internal WindowsListView (IntPtr hwnd, ProxyFragment parent, int item) : base( hwnd, parent, item ) { // Set the strings to return properly the properties. if (IsDetailMode(hwnd)) { _cControlType = ControlType.DataGrid; } else { _cControlType = ControlType.List; } // Can be focused _fIsKeyboardFocusable = true; // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); // internally track some of the lv events WinEventTracker.AddToNotificationList (_hwnd, new WinEventTracker.ProxyRaiseEvents (WindowsListView.GroupSpecificEvents), _groupEvents, 3); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors internal WindowsScrollBar (IntPtr hwnd, ProxyFragment parent, int item, int sbFlag) : base( hwnd, parent, item) { _sbFlag = sbFlag; // Never do any non client area cliping when dealing with the scroll bar and // scroll bar bits _fNonClientAreaElement = true; // Control Type _cControlType = ControlType.ScrollBar; // Only Focusable if it is a stand alone scroll bar _fIsKeyboardFocusable = IsStandAlone(); if (!IsStandAlone()) { _sAutomationId = sbFlag == NativeMethods.SB_VERT ? "Vertical ScrollBar" : "Horizontal ScrollBar"; // This string is a non-localizable string } // support for events _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents); }
// ------------------------------------------------------ // // Constructors // // ------------------------------------------------------ #region Constructors internal WindowsToolbarAsMenu(IntPtr hwnd, ProxyFragment parent, int item, Accessible acc) : base( hwnd, parent, item ) { _acc = acc; // Set the control type based on the IAccessible role. AccessibleRole role = acc.Role; if (role == AccessibleRole.MenuBar) { _cControlType = ControlType.MenuBar; _sAutomationId = "MenuBar"; // This string is a non-localizable string } else if (role == AccessibleRole.MenuPopup) { _cControlType = ControlType.Menu; _sAutomationId = "MenuPopup"; // This string is a non-localizable string } else { System.Diagnostics.Debug.Assert(false, "Unexpected role " + role); } }