Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / InterOp / HwndSourceParameters.cs / 1305600 / HwndSourceParameters.cs
//------------------------------------------------------------------------------ // Microsoft Avalon // Copyright (c) Microsoft Corporation, 2004 // // File: HwndSourceParameter.cs //----------------------------------------------------------------------------- using MS.Win32; using System.Windows.Media; using System.Windows.Input; namespace System.Windows.Interop { ////// Base class for HwndSource Creation Parameters. /// This allows flexibility and control of parameters to HwndSource's /// Constructor without many different overloaded constructors. /// public struct HwndSourceParameters { ////// Simple Ctor w/ just a WindowName /// public HwndSourceParameters(string name): this() { // Initialize some fields to useful default values _styleBits = NativeMethods.WS_VISIBLE; _styleBits |= NativeMethods.WS_CAPTION; _styleBits |= NativeMethods.WS_SYSMENU; _styleBits |= NativeMethods.WS_THICKFRAME; _styleBits |= NativeMethods.WS_MINIMIZEBOX; _styleBits |= NativeMethods.WS_MAXIMIZEBOX; _styleBits |= NativeMethods.WS_CLIPCHILDREN; // The Visual Manager has a hard time creating // a surface with zero pixels. _width = 1; _height = 1; _x = NativeMethods.CW_USEDEFAULT; _y = NativeMethods.CW_USEDEFAULT; WindowName = name; } ////// Ctor. w/ WindowName and Size. /// /// Name of the window /// Width of the window /// Height of the window public HwndSourceParameters(string name, int width, int height): this(name) { Width = width; Height = height; } ////// Returns the hashcode for this struct. /// ///hashcode public override int GetHashCode( ) { return base.GetHashCode(); } ////// The Window Class Style Property /// public int WindowClassStyle { get{ return _classStyleBits; } set{ _classStyleBits = value; } } ////// Allow the app to set the Style bits. /// The Clip Children bit must always be set on a Standard Window. /// public int WindowStyle { get{ return _styleBits; } set{ _styleBits = value | NativeMethods.WS_CLIPCHILDREN; } } ////// The Extended Style bits. /// public int ExtendedWindowStyle { get{ return _extendedStyleBits; } set{ _extendedStyleBits = value; } } ////// Set the X,Y Position of HwndSource Creation Parameters. /// public void SetPosition(int x, int y) { _x = x; _y = y; } ////// The X position of the HwndSource Property. /// public int PositionX { get{ return _x; } set{ _x = value; } } ////// The Y position of the HwndSource Property. /// public int PositionY { get{ return _y; } set{ _y = value; } } ////// Set the Width and Height of HwndSource Creation Parameters. /// public void SetSize(int width, int height) { _width = width; _height = height; _hasAssignedSize = true; } ////// The Width Property of the HwndSource. /// public int Width { get{ return _width; } set{ _width = value; _hasAssignedSize = true; } } ////// The Height Property of the HwndSource. /// public int Height { get{ return _height; } set{ _height = value; _hasAssignedSize = true; } } ////// Was the Size assigned or did we just default. /// public bool HasAssignedSize { get { return _hasAssignedSize; } } ////// The Window Name Property. /// public string WindowName { get{ return _name; } set{ _name = value; } } ////// The ParentWindow Property. /// public IntPtr ParentWindow { get{ return _parent; } set{ _parent = value; } } ////// The HwndSourceHook Property. This allows a message hook to /// process window messages to the window. A Hook provided in the /// HwndSourceParameters will be installed before the call to /// CreateWindow and this hook will see the window creation msgs. /// public HwndSourceHook HwndSourceHook { get{ return _hwndSourceHook; } set{ this._hwndSourceHook = value; } } ////// The AdjustSizingForNonClientArea Property. /// public bool AdjustSizingForNonClientArea { get { return _adjustSizingForNonClientArea; } set { _adjustSizingForNonClientArea = value; } } // ///// /// Specifies the color to display as transparent. // /// // ///// /// Use null to indicate that no color should be transparent. // /// // public NullableColorKey // { // get {return _colorKey;} // set {_colorKey = value;} // } // /// // /// Specifies the constant opacity to apply to the window. // /// // ///// /// The valid values range from [0..1]. Values outside of this range are clamped. // /// // public double Opacity // { // get {return _opacitySpecified ? _opacity : 1.0;} // set // { // if(value < 0) value = 0; // if(value > 1) value = 1; // _opacitySpecified = true; // _opacity = value; // } // } ////// Specifies whether or not the per-pixel opacity of the window content /// is respected. /// ////// By enabling per-pixel opacity, the system will no longer draw the non-client area. /// public bool UsesPerPixelOpacity { get {return _usesPerPixelOpacity;} set {_usesPerPixelOpacity = value;} } ////// The RestoreFocusMode for the window. /// public RestoreFocusMode RestoreFocusMode { get { return _restoreFocusMode ?? Keyboard.DefaultRestoreFocusMode; } set { _restoreFocusMode = value; } } ////// The AcquireHwndFocusInMenuMode setting for the window. /// public bool AcquireHwndFocusInMenuMode { get { return _acquireHwndFocusInMenuMode ?? HwndSource.DefaultAcquireHwndFocusInMenuMode; } set { _acquireHwndFocusInMenuMode = value; } } ////// Whether an HwndSource should be given messages straight off the message loop to preprocess, /// like top-level ones do normally. /// ///Used for RootBrowserWindow. internal bool TreatAsInputRoot { get { return _treatAsInputRoot ?? ((uint)_styleBits & NativeMethods.WS_CHILD) == 0; } set { _treatAsInputRoot = value; } } ////// == operator /// /// /// ///public static bool operator==(HwndSourceParameters a, HwndSourceParameters b) { return a.Equals(b); } /// /// != operator /// /// /// ///public static bool operator!=(HwndSourceParameters a, HwndSourceParameters b) { return !a.Equals(b); } /// /// Compare two HwndSourceParameters blocks. /// /// ///public override bool Equals(object obj) { if (obj == null) { return false; } return Equals( (HwndSourceParameters)obj ); } /// /// Compare two HwndSourceParameters blocks. /// /// ///public bool Equals(HwndSourceParameters obj) { return ((this._classStyleBits == obj._classStyleBits) && (this._styleBits == obj._styleBits) && (this._extendedStyleBits == obj._extendedStyleBits) && (this._x == obj._x) && (this._y == obj._y) && (this._width == obj._width) && (this._height == obj._height) && (this._name == obj._name) && (this._parent == obj._parent) && (this._hwndSourceHook == obj._hwndSourceHook) && (this._adjustSizingForNonClientArea == obj._adjustSizingForNonClientArea) && (this._hasAssignedSize == obj._hasAssignedSize) // && (this._colorKey == obj._colorKey) // && (this._opacity == obj._opacity) // && (this._opacitySpecified == obj._opacitySpecified) && (this._usesPerPixelOpacity == obj._usesPerPixelOpacity) ); } private int _classStyleBits; private int _styleBits; private int _extendedStyleBits; private int _x; private int _y; private int _width; private int _height; private string _name; private IntPtr _parent; private HwndSourceHook _hwndSourceHook; private bool _adjustSizingForNonClientArea; private bool _hasAssignedSize; // private Nullable _colorKey; // private double _opacity; // private bool _opacitySpecified; // default value for opacity needs to be 1.0 private bool _usesPerPixelOpacity; private bool? _treatAsInputRoot; private RestoreFocusMode? _restoreFocusMode; private bool? _acquireHwndFocusInMenuMode; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------------ // Microsoft Avalon // Copyright (c) Microsoft Corporation, 2004 // // File: HwndSourceParameter.cs //----------------------------------------------------------------------------- using MS.Win32; using System.Windows.Media; using System.Windows.Input; namespace System.Windows.Interop { /// /// Base class for HwndSource Creation Parameters. /// This allows flexibility and control of parameters to HwndSource's /// Constructor without many different overloaded constructors. /// public struct HwndSourceParameters { ////// Simple Ctor w/ just a WindowName /// public HwndSourceParameters(string name): this() { // Initialize some fields to useful default values _styleBits = NativeMethods.WS_VISIBLE; _styleBits |= NativeMethods.WS_CAPTION; _styleBits |= NativeMethods.WS_SYSMENU; _styleBits |= NativeMethods.WS_THICKFRAME; _styleBits |= NativeMethods.WS_MINIMIZEBOX; _styleBits |= NativeMethods.WS_MAXIMIZEBOX; _styleBits |= NativeMethods.WS_CLIPCHILDREN; // The Visual Manager has a hard time creating // a surface with zero pixels. _width = 1; _height = 1; _x = NativeMethods.CW_USEDEFAULT; _y = NativeMethods.CW_USEDEFAULT; WindowName = name; } ////// Ctor. w/ WindowName and Size. /// /// Name of the window /// Width of the window /// Height of the window public HwndSourceParameters(string name, int width, int height): this(name) { Width = width; Height = height; } ////// Returns the hashcode for this struct. /// ///hashcode public override int GetHashCode( ) { return base.GetHashCode(); } ////// The Window Class Style Property /// public int WindowClassStyle { get{ return _classStyleBits; } set{ _classStyleBits = value; } } ////// Allow the app to set the Style bits. /// The Clip Children bit must always be set on a Standard Window. /// public int WindowStyle { get{ return _styleBits; } set{ _styleBits = value | NativeMethods.WS_CLIPCHILDREN; } } ////// The Extended Style bits. /// public int ExtendedWindowStyle { get{ return _extendedStyleBits; } set{ _extendedStyleBits = value; } } ////// Set the X,Y Position of HwndSource Creation Parameters. /// public void SetPosition(int x, int y) { _x = x; _y = y; } ////// The X position of the HwndSource Property. /// public int PositionX { get{ return _x; } set{ _x = value; } } ////// The Y position of the HwndSource Property. /// public int PositionY { get{ return _y; } set{ _y = value; } } ////// Set the Width and Height of HwndSource Creation Parameters. /// public void SetSize(int width, int height) { _width = width; _height = height; _hasAssignedSize = true; } ////// The Width Property of the HwndSource. /// public int Width { get{ return _width; } set{ _width = value; _hasAssignedSize = true; } } ////// The Height Property of the HwndSource. /// public int Height { get{ return _height; } set{ _height = value; _hasAssignedSize = true; } } ////// Was the Size assigned or did we just default. /// public bool HasAssignedSize { get { return _hasAssignedSize; } } ////// The Window Name Property. /// public string WindowName { get{ return _name; } set{ _name = value; } } ////// The ParentWindow Property. /// public IntPtr ParentWindow { get{ return _parent; } set{ _parent = value; } } ////// The HwndSourceHook Property. This allows a message hook to /// process window messages to the window. A Hook provided in the /// HwndSourceParameters will be installed before the call to /// CreateWindow and this hook will see the window creation msgs. /// public HwndSourceHook HwndSourceHook { get{ return _hwndSourceHook; } set{ this._hwndSourceHook = value; } } ////// The AdjustSizingForNonClientArea Property. /// public bool AdjustSizingForNonClientArea { get { return _adjustSizingForNonClientArea; } set { _adjustSizingForNonClientArea = value; } } // ///// /// Specifies the color to display as transparent. // /// // ///// /// Use null to indicate that no color should be transparent. // /// // public NullableColorKey // { // get {return _colorKey;} // set {_colorKey = value;} // } // /// // /// Specifies the constant opacity to apply to the window. // /// // ///// /// The valid values range from [0..1]. Values outside of this range are clamped. // /// // public double Opacity // { // get {return _opacitySpecified ? _opacity : 1.0;} // set // { // if(value < 0) value = 0; // if(value > 1) value = 1; // _opacitySpecified = true; // _opacity = value; // } // } ////// Specifies whether or not the per-pixel opacity of the window content /// is respected. /// ////// By enabling per-pixel opacity, the system will no longer draw the non-client area. /// public bool UsesPerPixelOpacity { get {return _usesPerPixelOpacity;} set {_usesPerPixelOpacity = value;} } ////// The RestoreFocusMode for the window. /// public RestoreFocusMode RestoreFocusMode { get { return _restoreFocusMode ?? Keyboard.DefaultRestoreFocusMode; } set { _restoreFocusMode = value; } } ////// The AcquireHwndFocusInMenuMode setting for the window. /// public bool AcquireHwndFocusInMenuMode { get { return _acquireHwndFocusInMenuMode ?? HwndSource.DefaultAcquireHwndFocusInMenuMode; } set { _acquireHwndFocusInMenuMode = value; } } ////// Whether an HwndSource should be given messages straight off the message loop to preprocess, /// like top-level ones do normally. /// ///Used for RootBrowserWindow. internal bool TreatAsInputRoot { get { return _treatAsInputRoot ?? ((uint)_styleBits & NativeMethods.WS_CHILD) == 0; } set { _treatAsInputRoot = value; } } ////// == operator /// /// /// ///public static bool operator==(HwndSourceParameters a, HwndSourceParameters b) { return a.Equals(b); } /// /// != operator /// /// /// ///public static bool operator!=(HwndSourceParameters a, HwndSourceParameters b) { return !a.Equals(b); } /// /// Compare two HwndSourceParameters blocks. /// /// ///public override bool Equals(object obj) { if (obj == null) { return false; } return Equals( (HwndSourceParameters)obj ); } /// /// Compare two HwndSourceParameters blocks. /// /// ///public bool Equals(HwndSourceParameters obj) { return ((this._classStyleBits == obj._classStyleBits) && (this._styleBits == obj._styleBits) && (this._extendedStyleBits == obj._extendedStyleBits) && (this._x == obj._x) && (this._y == obj._y) && (this._width == obj._width) && (this._height == obj._height) && (this._name == obj._name) && (this._parent == obj._parent) && (this._hwndSourceHook == obj._hwndSourceHook) && (this._adjustSizingForNonClientArea == obj._adjustSizingForNonClientArea) && (this._hasAssignedSize == obj._hasAssignedSize) // && (this._colorKey == obj._colorKey) // && (this._opacity == obj._opacity) // && (this._opacitySpecified == obj._opacitySpecified) && (this._usesPerPixelOpacity == obj._usesPerPixelOpacity) ); } private int _classStyleBits; private int _styleBits; private int _extendedStyleBits; private int _x; private int _y; private int _width; private int _height; private string _name; private IntPtr _parent; private HwndSourceHook _hwndSourceHook; private bool _adjustSizingForNonClientArea; private bool _hasAssignedSize; // private Nullable _colorKey; // private double _opacity; // private bool _opacitySpecified; // default value for opacity needs to be 1.0 private bool _usesPerPixelOpacity; private bool? _treatAsInputRoot; private RestoreFocusMode? _restoreFocusMode; private bool? _acquireHwndFocusInMenuMode; } } // 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
- TextEndOfParagraph.cs
- LocalizationComments.cs
- EntityCommandDefinition.cs
- FontFamilyIdentifier.cs
- storepermission.cs
- AspProxy.cs
- DirectoryNotFoundException.cs
- ExpressionBuilderContext.cs
- SynchronizationValidator.cs
- AsyncCallback.cs
- XmlName.cs
- Container.cs
- ValidationEventArgs.cs
- TextEditorSpelling.cs
- Models.cs
- UnionExpr.cs
- LinqDataSourceView.cs
- ExceptionWrapper.cs
- ControlBuilder.cs
- IsolatedStoragePermission.cs
- PtsHost.cs
- OpenTypeCommon.cs
- documentsequencetextview.cs
- ProfilePropertyMetadata.cs
- DataGridViewImageCell.cs
- ListViewTableRow.cs
- LineInfo.cs
- IncrementalHitTester.cs
- FilteredXmlReader.cs
- PenContext.cs
- LongCountAggregationOperator.cs
- coordinator.cs
- CellTreeNodeVisitors.cs
- CodeGroup.cs
- CaretElement.cs
- NamedPipeTransportBindingElement.cs
- WindowsFormsHostAutomationPeer.cs
- KeyInstance.cs
- TextBounds.cs
- FormViewInsertEventArgs.cs
- CompositeDataBoundControl.cs
- SecurityUniqueId.cs
- QilInvokeEarlyBound.cs
- TextLineResult.cs
- HwndSubclass.cs
- NativeMethods.cs
- OleDbDataAdapter.cs
- DocumentGridContextMenu.cs
- BrowserCapabilitiesFactory.cs
- ConfigXmlElement.cs
- StartUpEventArgs.cs
- MessageQueueInstaller.cs
- CaretElement.cs
- CompilationLock.cs
- WriteableOnDemandPackagePart.cs
- RtfToken.cs
- KeyboardDevice.cs
- UndoManager.cs
- WebPartConnectionCollection.cs
- HMACRIPEMD160.cs
- HttpPostProtocolImporter.cs
- StringFunctions.cs
- InheritanceAttribute.cs
- FixedStringLookup.cs
- HelpKeywordAttribute.cs
- StreamProxy.cs
- XmlCodeExporter.cs
- TextBounds.cs
- TextEditor.cs
- RegexCapture.cs
- RegexGroup.cs
- Preprocessor.cs
- PowerStatus.cs
- NegotiateStream.cs
- ContractMapping.cs
- ModelTreeEnumerator.cs
- PrivilegeNotHeldException.cs
- ListCardsInFileRequest.cs
- MemberInfoSerializationHolder.cs
- DynamicQueryableWrapper.cs
- NotSupportedException.cs
- SkipStoryboardToFill.cs
- WindowsSolidBrush.cs
- Stackframe.cs
- SQLMembershipProvider.cs
- LowerCaseStringConverter.cs
- DbProviderSpecificTypePropertyAttribute.cs
- DataGridDetailsPresenter.cs
- ADMembershipProvider.cs
- Transform3D.cs
- UnsafeNativeMethodsMilCoreApi.cs
- EntityTemplateFactory.cs
- PipeStream.cs
- SqlComparer.cs
- WebCategoryAttribute.cs
- BindingsCollection.cs
- ApplicationException.cs
- SessionStateModule.cs
- TemplatedEditableDesignerRegion.cs
- MemberDomainMap.cs