Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Core / CSharp / System / Windows / Media / textformatting / CharacterHit.cs / 1 / CharacterHit.cs
//---------------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // // Description: The CharacterHit structure represents information about a character hit // within a glyph run - the index of the first character that got hit and the information // about leading or trailing edge. // // See spec at http://team/sites/Avalon/Specs/Glyph%20Run%20hit%20testing%20and%20caret%20placement%20API.htm#CharacterHit // // // History: // 11/30/2004 : mleonov - Created // //--------------------------------------------------------------------------- #region Using directives using System; #endregion namespace System.Windows.Media.TextFormatting { ////// The CharacterHit structure represents information about a character hit within a glyph run /// - the index of the first character that got hit and the information about leading or trailing edge. /// public struct CharacterHit : IEquatable{ /// /// Constructs a new CharacterHit structure. /// /// Index of the first character that got hit. /// In case of leading edge this value is 0. /// In case of trailing edge this value is the number of codepoints until the next valid caret position. public CharacterHit(int firstCharacterIndex, int trailingLength) { _firstCharacterIndex = firstCharacterIndex; _trailingLength = trailingLength; } ////// Index of the first character that got hit. /// public int FirstCharacterIndex { get { return _firstCharacterIndex; } } ////// In case of leading edge this value is 0. /// In case of trailing edge this value is the number of codepoints until the next valid caret position. /// public int TrailingLength { get { return _trailingLength; } } ////// Checks whether two character hit objects are equal. /// /// First object to compare. /// Second object to compare. ///Returns true when the values of FirstCharacterIndex and TrailingLength are equal for both objects, /// and false otherwise. public static bool operator==(CharacterHit left, CharacterHit right) { return left._firstCharacterIndex == right._firstCharacterIndex && left._trailingLength == right._trailingLength; } ////// Checks whether two character hit objects are not equal. /// /// First object to compare. /// Second object to compare. ///Returns false when the values of FirstCharacterIndex and TrailingLength are equal for both objects, /// and true otherwise. public static bool operator!=(CharacterHit left, CharacterHit right) { return !(left == right); } ////// Checks whether an object is equal to another character hit object. /// /// CharacterHit object to compare with. ///Returns true when the object is equal to the input object, /// and false otherwise. public bool Equals(CharacterHit obj) { return this == obj; } ////// Checks whether an object is equal to another character hit object. /// /// CharacterHit object to compare with. ///Returns true when the object is equal to the input object, /// and false otherwise. public override bool Equals(object obj) { if (!(obj is CharacterHit)) return false; return this == (CharacterHit)obj; } ////// Compute hash code for this object. /// ///A 32-bit signed integer hash code. public override int GetHashCode() { return _firstCharacterIndex.GetHashCode() ^ _trailingLength.GetHashCode(); } private int _firstCharacterIndex; private int _trailingLength; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // // // Description: The CharacterHit structure represents information about a character hit // within a glyph run - the index of the first character that got hit and the information // about leading or trailing edge. // // See spec at http://team/sites/Avalon/Specs/Glyph%20Run%20hit%20testing%20and%20caret%20placement%20API.htm#CharacterHit // // // History: // 11/30/2004 : mleonov - Created // //--------------------------------------------------------------------------- #region Using directives using System; #endregion namespace System.Windows.Media.TextFormatting { ////// The CharacterHit structure represents information about a character hit within a glyph run /// - the index of the first character that got hit and the information about leading or trailing edge. /// public struct CharacterHit : IEquatable{ /// /// Constructs a new CharacterHit structure. /// /// Index of the first character that got hit. /// In case of leading edge this value is 0. /// In case of trailing edge this value is the number of codepoints until the next valid caret position. public CharacterHit(int firstCharacterIndex, int trailingLength) { _firstCharacterIndex = firstCharacterIndex; _trailingLength = trailingLength; } ////// Index of the first character that got hit. /// public int FirstCharacterIndex { get { return _firstCharacterIndex; } } ////// In case of leading edge this value is 0. /// In case of trailing edge this value is the number of codepoints until the next valid caret position. /// public int TrailingLength { get { return _trailingLength; } } ////// Checks whether two character hit objects are equal. /// /// First object to compare. /// Second object to compare. ///Returns true when the values of FirstCharacterIndex and TrailingLength are equal for both objects, /// and false otherwise. public static bool operator==(CharacterHit left, CharacterHit right) { return left._firstCharacterIndex == right._firstCharacterIndex && left._trailingLength == right._trailingLength; } ////// Checks whether two character hit objects are not equal. /// /// First object to compare. /// Second object to compare. ///Returns false when the values of FirstCharacterIndex and TrailingLength are equal for both objects, /// and true otherwise. public static bool operator!=(CharacterHit left, CharacterHit right) { return !(left == right); } ////// Checks whether an object is equal to another character hit object. /// /// CharacterHit object to compare with. ///Returns true when the object is equal to the input object, /// and false otherwise. public bool Equals(CharacterHit obj) { return this == obj; } ////// Checks whether an object is equal to another character hit object. /// /// CharacterHit object to compare with. ///Returns true when the object is equal to the input object, /// and false otherwise. public override bool Equals(object obj) { if (!(obj is CharacterHit)) return false; return this == (CharacterHit)obj; } ////// Compute hash code for this object. /// ///A 32-bit signed integer hash code. public override int GetHashCode() { return _firstCharacterIndex.GetHashCode() ^ _trailingLength.GetHashCode(); } private int _firstCharacterIndex; private int _trailingLength; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TreeView.cs
- BaseCAMarshaler.cs
- BitmapData.cs
- SoapCommonClasses.cs
- SafeMILHandle.cs
- AttachmentCollection.cs
- RenderOptions.cs
- LocatorPartList.cs
- FormsAuthenticationModule.cs
- XmlSchemaGroupRef.cs
- SqlUdtInfo.cs
- ScrollableControl.cs
- RangeValueProviderWrapper.cs
- AlternateViewCollection.cs
- DataTableCollection.cs
- XmlNodeComparer.cs
- SafeArrayRankMismatchException.cs
- DataSourceCache.cs
- LexicalChunk.cs
- WebPartConnection.cs
- PasswordBoxAutomationPeer.cs
- ScaleTransform3D.cs
- LogReservationCollection.cs
- ImageSourceValueSerializer.cs
- _SslState.cs
- DataGridAddNewRow.cs
- __Filters.cs
- TextServicesCompartmentContext.cs
- SqlServer2KCompatibilityAnnotation.cs
- NetPeerTcpBinding.cs
- TCPClient.cs
- InvokeWebService.cs
- RelatedPropertyManager.cs
- InternalControlCollection.cs
- Light.cs
- PointLightBase.cs
- WebPartConnectionCollection.cs
- SqlConnectionManager.cs
- DependencyProperty.cs
- DataObject.cs
- DataTableNewRowEvent.cs
- ProcessManager.cs
- OdbcConnectionFactory.cs
- ObjectDataSourceEventArgs.cs
- DockPanel.cs
- DataSourceComponent.cs
- WebPartEditorOkVerb.cs
- GACIdentityPermission.cs
- ToolStripLocationCancelEventArgs.cs
- IntSecurity.cs
- ObfuscateAssemblyAttribute.cs
- BrowserTree.cs
- TextEndOfParagraph.cs
- ReadOnlyCollection.cs
- TypedTableBase.cs
- XmlDictionaryString.cs
- CodeMemberProperty.cs
- PermissionAttributes.cs
- DbParameterCollectionHelper.cs
- Exception.cs
- GeneralTransform2DTo3D.cs
- SiteMapSection.cs
- SpecularMaterial.cs
- AuthenticationModulesSection.cs
- WebBrowserContainer.cs
- Italic.cs
- JsonEncodingStreamWrapper.cs
- InputQueueChannel.cs
- ControlSerializer.cs
- IdnElement.cs
- TiffBitmapEncoder.cs
- ResourcePermissionBase.cs
- _ConnectStream.cs
- SiteMapNodeCollection.cs
- TickBar.cs
- PermissionListSet.cs
- SQLGuid.cs
- RedistVersionInfo.cs
- CustomAttributeFormatException.cs
- SessionStateModule.cs
- DataGridViewRowsAddedEventArgs.cs
- TimeSpan.cs
- RelatedImageListAttribute.cs
- CategoryAttribute.cs
- Semaphore.cs
- SingleSelectRootGridEntry.cs
- NameSpaceExtractor.cs
- _Semaphore.cs
- RecordManager.cs
- StylusDevice.cs
- Helpers.cs
- COM2ComponentEditor.cs
- Container.cs
- TypefaceMap.cs
- EventHandlerList.cs
- XPathDocumentNavigator.cs
- CodeTypeDeclaration.cs
- UserUseLicenseDictionaryLoader.cs
- ScriptDescriptor.cs
- NeutralResourcesLanguageAttribute.cs