Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / UIAutomation / Win32Providers / MS / Internal / AutomationProxies / WindowsToolbarItemAsMenuItem.cs / 1305600 / WindowsToolbarItemAsMenuItem.cs
//---------------------------------------------------------------------------- // //// Copyright (C) Microsoft Corporation. All rights reserved. // // // // Description: Some applications implement menus with toolbars. This proxy // will used the IAccessible to expose these toolbar items as // menu items. This proxy is derived from ToolbarItem since // the underlying control really is a toolbar and ToolbarItem // knows how to communicate with a toolbars to get information for // toolbar items already. // // History: // 01/31/2005 : [....] Created //--------------------------------------------------------------------------- using System; using System.Windows.Automation; using MS.Win32; namespace MS.Internal.AutomationProxies { class ToolbarItemAsMenuItem : ToolbarItem { // ----------------------------------------------------- // // 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; } #endregion // ------------------------------------------------------ // // Patterns Implementation // // ----------------------------------------------------- #region ProxySimple Interface // Returns a pattern interface if supported. internal override object GetPatternProvider (AutomationPattern iid) { // Treate these toolbar items as menuitems and only support Invoke or Expand/Collapse patterns. // Invoke Pattern needs to be supported when the item has no children. When the item does have // children it needs to support ExpandCollapse Pattern. // Check if button is a separator if (IsSeparator()) { return null; } // Check if button is disabled if (Misc.ProxySendMessageInt(_hwnd, NativeMethods.TB_ISBUTTONENABLED, new IntPtr(_idCommand), IntPtr.Zero) == 0) { return null; } // Check if button is hidden if (Misc.ProxySendMessageInt(_hwnd, NativeMethods.TB_ISBUTTONHIDDEN, new IntPtr(_idCommand), IntPtr.Zero) != 0) { return null; } // if (iid == InvokePattern.Pattern) { // button is enabled and not hidden and not a separator return this; } // return null; } // Process all the Element Properties internal override object GetElementProperty(AutomationProperty idProp) { if (idProp == AutomationElement.HasKeyboardFocusProperty) { return IsFocused(); } return base.GetElementProperty(idProp); } #endregion // ------------------------------------------------------ // // Private Fields // // ------------------------------------------------------ #region Private Fields Accessible _acc; #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PersonalizationAdministration.cs
- RtfControls.cs
- WebBrowserSiteBase.cs
- TriState.cs
- DataGridViewColumnTypePicker.cs
- AuthorizationRuleCollection.cs
- Crc32Helper.cs
- _BasicClient.cs
- ExpandCollapsePatternIdentifiers.cs
- RequestCachePolicy.cs
- MatrixAnimationUsingKeyFrames.cs
- CachedFontFace.cs
- SqlCommandBuilder.cs
- DoubleAnimationUsingPath.cs
- SrgsDocumentParser.cs
- KeyTime.cs
- PenThread.cs
- ApplicationException.cs
- RC2.cs
- WebPartConnectionsDisconnectVerb.cs
- __Error.cs
- CheckoutException.cs
- DataMisalignedException.cs
- DescendantOverDescendantQuery.cs
- RoutedEventValueSerializer.cs
- BinHexEncoding.cs
- CodeMethodInvokeExpression.cs
- Error.cs
- ClientBuildManagerTypeDescriptionProviderBridge.cs
- SoapTypeAttribute.cs
- DesignerTextWriter.cs
- CubicEase.cs
- HostExecutionContextManager.cs
- Imaging.cs
- ProfileEventArgs.cs
- DBCommand.cs
- DictionaryContent.cs
- ToolboxItemCollection.cs
- DefaultTraceListener.cs
- DetailsViewAutoFormat.cs
- CacheDependency.cs
- ErrorTableItemStyle.cs
- WsrmTraceRecord.cs
- Unit.cs
- FileLoadException.cs
- ConfigXmlWhitespace.cs
- RadioButtonFlatAdapter.cs
- NamespaceDecl.cs
- TextDecorationCollectionConverter.cs
- StatusBarPanelClickEvent.cs
- COAUTHIDENTITY.cs
- PhysicalFontFamily.cs
- CachedTypeface.cs
- GlyphingCache.cs
- EntityKeyElement.cs
- Merger.cs
- Regex.cs
- ConfigurationPropertyCollection.cs
- StreamingContext.cs
- SqlCommandBuilder.cs
- MembershipPasswordException.cs
- UserNameServiceElement.cs
- Image.cs
- RecommendedAsConfigurableAttribute.cs
- SynthesizerStateChangedEventArgs.cs
- TextTrailingCharacterEllipsis.cs
- CustomAttributeSerializer.cs
- TableParagraph.cs
- SafeNativeMethodsCLR.cs
- PointAnimation.cs
- CookielessData.cs
- OleDbMetaDataFactory.cs
- SQLString.cs
- ValueProviderWrapper.cs
- TypeSystemProvider.cs
- XamlReader.cs
- StructuredCompositeActivityDesigner.cs
- XmlSchemaSubstitutionGroup.cs
- ManipulationVelocities.cs
- RepeatBehavior.cs
- SqlFormatter.cs
- XmlEncoding.cs
- MessageBox.cs
- TabletCollection.cs
- SessionParameter.cs
- DataGridView.cs
- WebPartConnectionsCloseVerb.cs
- DesignerDataView.cs
- EventLogConfiguration.cs
- DecoderFallback.cs
- ButtonBaseDesigner.cs
- LinkArea.cs
- PerfCounterSection.cs
- TextSimpleMarkerProperties.cs
- TextTreeRootTextBlock.cs
- _TransmitFileOverlappedAsyncResult.cs
- CngProperty.cs
- BitVector32.cs
- TransactionTraceIdentifier.cs
- ProvidersHelper.cs