Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / MS / Internal / PtsTable / CalculatedColumn.cs / 1305600 / CalculatedColumn.cs
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
//
// Description: Implementation of calculated column class.
// Calculated columns are created as a result of table
// width calculations. Calculated columns are used internally
// to hold information about table's horizontal geometry
//
// History:
// 06/19/2003 : olego - Created
//
//---------------------------------------------------------------------------
using MS.Internal.PtsHost;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Documents;
using System.Windows.Media;
using MS.Internal.PtsHost.UnsafeNativeMethods;
namespace MS.Internal.PtsTable
{
///
/// Calculated column implementation.
///
internal struct CalculatedColumn
{
//-----------------------------------------------------
//
// Constructors
//
//-----------------------------------------------------
#region Constructors
#endregion Constructors
//------------------------------------------------------
//
// Internal Methods
//
//-----------------------------------------------------
#region Internal Methods
///
/// ValidateAuto
///
/// New min width value
/// New max width value
internal void ValidateAuto(double durMinWidth, double durMaxWidth)
{
Debug.Assert(0 <= durMinWidth && durMinWidth <= durMaxWidth);
_durMinWidth = durMinWidth;
_durMaxWidth = durMaxWidth;
SetFlags(true, Flags.ValidAutofit);
}
#endregion Internal Methods
//------------------------------------------------------
//
// Internal Properties
//
//------------------------------------------------------
#region Internal Properties
///
/// Returns understood by PTS state of cell width dirtiness.
///
internal int PtsWidthChanged { get { return (PTS.FromBoolean(!CheckFlags(Flags.ValidWidth))); } }
///
/// DurMinWidth
///
internal double DurMinWidth { get { return (_durMinWidth); } }
///
/// DurMaxWidth
///
internal double DurMaxWidth { get { return (_durMaxWidth); } }
///
/// UserWidth
///
internal GridLength UserWidth
{
get
{
return (_userWidth);
}
set
{
if (_userWidth != value)
{
SetFlags(false, Flags.ValidAutofit);
}
_userWidth = value;
}
}
///
/// DurWidth
///
internal double DurWidth
{
get
{
return (_durWidth);
}
set
{
if (!DoubleUtil.AreClose(_durWidth, value))
{
SetFlags(false, Flags.ValidWidth);
}
_durWidth = value;
}
}
///
/// UrOffset
///
internal double UrOffset
{
get { return (_urOffset); }
set { _urOffset = value; }
}
#endregion Internal Properties
//-----------------------------------------------------
//
// Private Methods
//
//------------------------------------------------------
#region Private Methods
///
/// SetFlags is used to set or unset one or multiple flags on the cell.
///
private void SetFlags(bool value, Flags flags)
{
_flags = value ? (_flags | flags) : (_flags & (~flags));
}
///
/// CheckFlags returns true if all passed flags in the bitmask are set.
///
private bool CheckFlags(Flags flags)
{
return ((_flags & flags) == flags);
}
#endregion Private Methods
//-----------------------------------------------------
//
// Private Fields
//
//-----------------------------------------------------
#region Private Fields
private GridLength _userWidth; // user specified width for the column
private double _durWidth; // calculated widht for the column
private double _durMinWidth; // calculated minimum width for the column
private double _durMaxWidth; // calculated maximum width for the column
private double _urOffset; // column's offset
private Flags _flags; // state
#endregion Private Fields
//-----------------------------------------------------
//
// Private Structures / Classes
//
//------------------------------------------------------
#region Private Structures Classes
[System.Flags]
private enum Flags
{
ValidWidth = 0x1, // resulting width unchanged
ValidAutofit = 0x2, // auto width unchanged
}
#endregion Private Structures Classes
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
//
// Description: Implementation of calculated column class.
// Calculated columns are created as a result of table
// width calculations. Calculated columns are used internally
// to hold information about table's horizontal geometry
//
// History:
// 06/19/2003 : olego - Created
//
//---------------------------------------------------------------------------
using MS.Internal.PtsHost;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Documents;
using System.Windows.Media;
using MS.Internal.PtsHost.UnsafeNativeMethods;
namespace MS.Internal.PtsTable
{
///
/// Calculated column implementation.
///
internal struct CalculatedColumn
{
//-----------------------------------------------------
//
// Constructors
//
//-----------------------------------------------------
#region Constructors
#endregion Constructors
//------------------------------------------------------
//
// Internal Methods
//
//-----------------------------------------------------
#region Internal Methods
///
/// ValidateAuto
///
/// New min width value
/// New max width value
internal void ValidateAuto(double durMinWidth, double durMaxWidth)
{
Debug.Assert(0 <= durMinWidth && durMinWidth <= durMaxWidth);
_durMinWidth = durMinWidth;
_durMaxWidth = durMaxWidth;
SetFlags(true, Flags.ValidAutofit);
}
#endregion Internal Methods
//------------------------------------------------------
//
// Internal Properties
//
//------------------------------------------------------
#region Internal Properties
///
/// Returns understood by PTS state of cell width dirtiness.
///
internal int PtsWidthChanged { get { return (PTS.FromBoolean(!CheckFlags(Flags.ValidWidth))); } }
///
/// DurMinWidth
///
internal double DurMinWidth { get { return (_durMinWidth); } }
///
/// DurMaxWidth
///
internal double DurMaxWidth { get { return (_durMaxWidth); } }
///
/// UserWidth
///
internal GridLength UserWidth
{
get
{
return (_userWidth);
}
set
{
if (_userWidth != value)
{
SetFlags(false, Flags.ValidAutofit);
}
_userWidth = value;
}
}
///
/// DurWidth
///
internal double DurWidth
{
get
{
return (_durWidth);
}
set
{
if (!DoubleUtil.AreClose(_durWidth, value))
{
SetFlags(false, Flags.ValidWidth);
}
_durWidth = value;
}
}
///
/// UrOffset
///
internal double UrOffset
{
get { return (_urOffset); }
set { _urOffset = value; }
}
#endregion Internal Properties
//-----------------------------------------------------
//
// Private Methods
//
//------------------------------------------------------
#region Private Methods
///
/// SetFlags is used to set or unset one or multiple flags on the cell.
///
private void SetFlags(bool value, Flags flags)
{
_flags = value ? (_flags | flags) : (_flags & (~flags));
}
///
/// CheckFlags returns true if all passed flags in the bitmask are set.
///
private bool CheckFlags(Flags flags)
{
return ((_flags & flags) == flags);
}
#endregion Private Methods
//-----------------------------------------------------
//
// Private Fields
//
//-----------------------------------------------------
#region Private Fields
private GridLength _userWidth; // user specified width for the column
private double _durWidth; // calculated widht for the column
private double _durMinWidth; // calculated minimum width for the column
private double _durMaxWidth; // calculated maximum width for the column
private double _urOffset; // column's offset
private Flags _flags; // state
#endregion Private Fields
//-----------------------------------------------------
//
// Private Structures / Classes
//
//------------------------------------------------------
#region Private Structures Classes
[System.Flags]
private enum Flags
{
ValidWidth = 0x1, // resulting width unchanged
ValidAutofit = 0x2, // auto width unchanged
}
#endregion Private Structures Classes
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FixedDocumentSequencePaginator.cs
- HttpCapabilitiesSectionHandler.cs
- Stylesheet.cs
- ConfigurationPermission.cs
- ComboBoxRenderer.cs
- GlyphInfoList.cs
- ZoneMembershipCondition.cs
- ValidatorUtils.cs
- BuildProvider.cs
- DocumentPageViewAutomationPeer.cs
- MimeMultiPart.cs
- GrammarBuilder.cs
- MouseWheelEventArgs.cs
- CompiledQueryCacheKey.cs
- ServiceHostingEnvironment.cs
- SHA384Managed.cs
- PersistenceTypeAttribute.cs
- Point3D.cs
- Fonts.cs
- OleDbParameter.cs
- XmlLoader.cs
- TraceHandlerErrorFormatter.cs
- VSWCFServiceContractGenerator.cs
- WebPartManagerInternals.cs
- Translator.cs
- MembershipUser.cs
- PriorityItem.cs
- LocationSectionRecord.cs
- ItemCheckEvent.cs
- ItemDragEvent.cs
- ButtonFieldBase.cs
- ProcessManager.cs
- SchemaInfo.cs
- WebPartDisplayMode.cs
- TagMapCollection.cs
- OdbcDataAdapter.cs
- LogReservationCollection.cs
- RawTextInputReport.cs
- ArgumentNullException.cs
- DataGridCommandEventArgs.cs
- DefaultValueConverter.cs
- XmlSchemaSimpleTypeList.cs
- ToolStripRenderEventArgs.cs
- DataServiceRequestOfT.cs
- ComPlusInstanceContextInitializer.cs
- DependencyObjectType.cs
- DifferencingCollection.cs
- WinOEToolBoxItem.cs
- FeatureSupport.cs
- WmlLabelAdapter.cs
- CharStorage.cs
- DataPagerFieldItem.cs
- SpellCheck.cs
- ReachPrintTicketSerializer.cs
- XmlMapping.cs
- BuildResultCache.cs
- Color.cs
- MessageQueuePermissionAttribute.cs
- ProfessionalColors.cs
- XmlSchemaDatatype.cs
- DataGridViewColumnCollection.cs
- HttpContext.cs
- NameTable.cs
- WebPartAuthorizationEventArgs.cs
- PaintEvent.cs
- SendMailErrorEventArgs.cs
- XmlSchemaCollection.cs
- MetadataAssemblyHelper.cs
- SqlMultiplexer.cs
- ThemeableAttribute.cs
- PropertyMappingExceptionEventArgs.cs
- TextSpanModifier.cs
- _NegoStream.cs
- AssemblyAssociatedContentFileAttribute.cs
- GradientStopCollection.cs
- CapabilitiesPattern.cs
- CapabilitiesAssignment.cs
- GrammarBuilderWildcard.cs
- RowToParametersTransformer.cs
- ControlParameter.cs
- StreamMarshaler.cs
- MimePart.cs
- PowerModeChangedEventArgs.cs
- WebBrowserDocumentCompletedEventHandler.cs
- ChannelEndpointElementCollection.cs
- KernelTypeValidation.cs
- CheckBoxStandardAdapter.cs
- RequestTimeoutManager.cs
- StatusBarPanel.cs
- GridViewItemAutomationPeer.cs
- ToolStripDesigner.cs
- SqlDependency.cs
- UnsafeNativeMethodsPenimc.cs
- CodeTypeReferenceCollection.cs
- PolygonHotSpot.cs
- Button.cs
- COM2Enum.cs
- Constants.cs
- WebPartTransformerAttribute.cs
- WsdlImporterElement.cs