-
Notifications
You must be signed in to change notification settings - Fork 913
Expand file tree
/
Copy pathLayoutPositionableGroup.cs
More file actions
371 lines (312 loc) · 11.5 KB
/
Copy pathLayoutPositionableGroup.cs
File metadata and controls
371 lines (312 loc) · 11.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
/*************************************************************************************
Extended WPF Toolkit
Copyright (C) 2007-2013 Xceed Software Inc.
This program is provided to you under the terms of the Microsoft Public
License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
For more features, controls, and fast professional support,
pick up the Plus Edition at http://xceed.com/wpf_toolkit
Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids
***********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Globalization;
namespace Xceed.Wpf.AvalonDock.Layout
{
[Serializable]
public abstract class LayoutPositionableGroup<T> : LayoutGroup<T>, ILayoutPositionableElement, ILayoutPositionableElementWithActualSize where T : class, ILayoutElement
{
public LayoutPositionableGroup()
{ }
GridLength _dockWidth = new GridLength(1.0, GridUnitType.Star);
public GridLength DockWidth
{
get
{
return _dockWidth;
}
set
{
if (DockWidth != value)
{
RaisePropertyChanging("DockWidth");
_dockWidth = value;
RaisePropertyChanged("DockWidth");
OnDockWidthChanged();
}
}
}
protected virtual void OnDockWidthChanged()
{
}
GridLength _dockHeight = new GridLength(1.0, GridUnitType.Star);
public GridLength DockHeight
{
get
{
return _dockHeight;
}
set
{
if (DockHeight != value)
{
RaisePropertyChanging("DockHeight");
_dockHeight = value;
RaisePropertyChanged("DockHeight");
OnDockHeightChanged();
}
}
}
protected virtual void OnDockHeightChanged()
{
}
bool _forceFixedDockSize;
public bool ForceFixedDockSize
{
get {
return _forceFixedDockSize;
}
set {
if (ForceFixedDockSize != value) {
RaisePropertyChanging("ForceFixedDockSize");
_forceFixedDockSize = value;
RaisePropertyChanging("ForceFixedDockSize");
OnForceFixedDockSizeChanged();
}
}
}
protected virtual void OnForceFixedDockSizeChanged()
{
}
#region AllowDuplicateContent
private bool _allowDuplicateContent = true;
/// <summary>
/// Gets or sets the AllowDuplicateContent property.
/// When this property is true, then the LayoutDocumentPane or LayoutAnchorablePane allows dropping
/// duplicate content (according to its Title and ContentId). When this dependency property is false,
/// then the LayoutDocumentPane or LayoutAnchorablePane hides the OverlayWindow.DropInto button to prevent dropping of duplicate content.
/// </summary>
public bool AllowDuplicateContent
{
get
{
return _allowDuplicateContent;
}
set
{
if( _allowDuplicateContent != value )
{
RaisePropertyChanging( "AllowDuplicateContent" );
_allowDuplicateContent = value;
RaisePropertyChanged( "AllowDuplicateContent" );
}
}
}
#endregion
#region CanRepositionItems
private bool _canRepositionItems = true;
public bool CanRepositionItems
{
get
{
return _canRepositionItems;
}
set
{
if( _canRepositionItems != value )
{
RaisePropertyChanging( "CanRepositionItems" );
_canRepositionItems = value;
RaisePropertyChanged( "CanRepositionItems" );
}
}
}
#endregion
#region DockMinWidth
private double _dockMinWidth = 25.0;
public double DockMinWidth
{
get { return _dockMinWidth; }
set
{
if (_dockMinWidth != value)
{
MathHelper.AssertIsPositiveOrZero(value);
RaisePropertyChanging("DockMinWidth");
_dockMinWidth = value;
RaisePropertyChanged("DockMinWidth");
}
}
}
#endregion
#region DockMinHeight
private double _dockMinHeight = 25.0;
public double DockMinHeight
{
get { return _dockMinHeight; }
set
{
if (_dockMinHeight != value)
{
MathHelper.AssertIsPositiveOrZero(value);
RaisePropertyChanging("DockMinHeight");
_dockMinHeight = value;
RaisePropertyChanged("DockMinHeight");
}
}
}
#endregion
#region FloatingWidth
private double _floatingWidth = 0.0;
public double FloatingWidth
{
get { return _floatingWidth; }
set
{
if (_floatingWidth != value)
{
RaisePropertyChanging("FloatingWidth");
_floatingWidth = value;
RaisePropertyChanged("FloatingWidth");
}
}
}
#endregion
#region FloatingHeight
private double _floatingHeight = 0.0;
public double FloatingHeight
{
get { return _floatingHeight; }
set
{
if (_floatingHeight != value)
{
RaisePropertyChanging("FloatingHeight");
_floatingHeight = value;
RaisePropertyChanged("FloatingHeight");
}
}
}
#endregion
#region FloatingLeft
private double _floatingLeft = 0.0;
public double FloatingLeft
{
get { return _floatingLeft; }
set
{
if (_floatingLeft != value)
{
RaisePropertyChanging("FloatingLeft");
_floatingLeft = value;
RaisePropertyChanged("FloatingLeft");
}
}
}
#endregion
#region FloatingTop
private double _floatingTop = 0.0;
public double FloatingTop
{
get { return _floatingTop; }
set
{
if (_floatingTop != value)
{
RaisePropertyChanging("FloatingTop");
_floatingTop = value;
RaisePropertyChanged("FloatingTop");
}
}
}
#endregion
#region IsMaximized
private bool _isMaximized = false;
public bool IsMaximized
{
get { return _isMaximized; }
set
{
if (_isMaximized != value)
{
_isMaximized = value;
RaisePropertyChanged("IsMaximized");
}
}
}
#endregion
[NonSerialized]
double _actualWidth;
double ILayoutPositionableElementWithActualSize.ActualWidth
{
get
{
return _actualWidth;
}
set
{
_actualWidth = value;
}
}
[NonSerialized]
double _actualHeight;
double ILayoutPositionableElementWithActualSize.ActualHeight
{
get
{
return _actualHeight;
}
set
{
_actualHeight = value;
}
}
public override void WriteXml(System.Xml.XmlWriter writer)
{
if (DockWidth.Value != 1.0 || !DockWidth.IsStar)
writer.WriteAttributeString("DockWidth", _gridLengthConverter.ConvertToInvariantString(DockWidth));
if (DockHeight.Value != 1.0 || !DockHeight.IsStar)
writer.WriteAttributeString("DockHeight", _gridLengthConverter.ConvertToInvariantString(DockHeight));
if (DockMinWidth != 25.0)
writer.WriteAttributeString("DocMinWidth", DockMinWidth.ToString(CultureInfo.InvariantCulture));
if (DockMinHeight != 25.0)
writer.WriteAttributeString("DockMinHeight", DockMinHeight.ToString(CultureInfo.InvariantCulture));
if (FloatingWidth != 0.0)
writer.WriteAttributeString("FloatingWidth", FloatingWidth.ToString(CultureInfo.InvariantCulture));
if (FloatingHeight != 0.0)
writer.WriteAttributeString("FloatingHeight", FloatingHeight.ToString(CultureInfo.InvariantCulture));
if (FloatingLeft != 0.0)
writer.WriteAttributeString("FloatingLeft", FloatingLeft.ToString(CultureInfo.InvariantCulture));
if (FloatingTop != 0.0)
writer.WriteAttributeString("FloatingTop", FloatingTop.ToString(CultureInfo.InvariantCulture));
if( IsMaximized )
writer.WriteAttributeString( "IsMaximized", IsMaximized.ToString() );
base.WriteXml(writer);
}
static GridLengthConverter _gridLengthConverter = new GridLengthConverter();
public override void ReadXml(System.Xml.XmlReader reader)
{
if (reader.MoveToAttribute("DockWidth"))
_dockWidth = (GridLength)_gridLengthConverter.ConvertFromInvariantString(reader.Value);
if (reader.MoveToAttribute("DockHeight"))
_dockHeight = (GridLength)_gridLengthConverter.ConvertFromInvariantString(reader.Value);
if (reader.MoveToAttribute("DocMinWidth"))
_dockMinWidth = double.Parse(reader.Value, CultureInfo.InvariantCulture);
if (reader.MoveToAttribute("DocMinHeight"))
_dockMinHeight = double.Parse(reader.Value, CultureInfo.InvariantCulture);
if (reader.MoveToAttribute("FloatingWidth"))
_floatingWidth = double.Parse(reader.Value, CultureInfo.InvariantCulture);
if (reader.MoveToAttribute("FloatingHeight"))
_floatingHeight = double.Parse(reader.Value, CultureInfo.InvariantCulture);
if (reader.MoveToAttribute("FloatingLeft"))
_floatingLeft = double.Parse(reader.Value, CultureInfo.InvariantCulture);
if (reader.MoveToAttribute("FloatingTop"))
_floatingTop = double.Parse(reader.Value, CultureInfo.InvariantCulture);
if( reader.MoveToAttribute( "IsMaximized" ) )
_isMaximized = bool.Parse( reader.Value );
base.ReadXml(reader);
}
}
}