Browse Source
Use UniformGridWithSpacing for layout of OK and Cancel buttons (these should have the same size even in languages where the OK button needs more space than 75 pixels). Option Panels: give check boxes a bit more space git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@6147 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61pull/1/head
43 changed files with 572 additions and 351 deletions
@ -1,72 +1,63 @@
@@ -1,72 +1,63 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<gui:OptionPanel |
||||
x:Class="ICSharpCode.Profiler.AddIn.OptionPanels.General" |
||||
xmlns:sd="http://icsharpcode.net/sharpdevelop/core" |
||||
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:addin="clr-namespace:ICSharpCode.Profiler.AddIn.OptionPanels;assembly=ICSharpCode.Profiler.AddIn"> |
||||
<StackPanel |
||||
Orientation="Vertical"> |
||||
<GroupBox |
||||
Header="{sd:Localize AddIns.Profiler.Options.General.DataCollection.Header}"> |
||||
<StackPanel |
||||
Orientation="Vertical"> |
||||
<CheckBox |
||||
Margin="3" |
||||
IsChecked="{sd:OptionBinding addin:OptionWrapper.EnableDC}" |
||||
VerticalAlignment="Top"> |
||||
<TextBlock |
||||
TextWrapping="Wrap" |
||||
Text="{sd:Localize AddIns.Profiler.Options.General.DataCollection.EnableDC}" /> |
||||
</CheckBox> |
||||
<CheckBox |
||||
Margin="3" |
||||
IsChecked="{sd:OptionBinding addin:OptionWrapper.EnableDCAtStart}" |
||||
VerticalAlignment="Top"> |
||||
<TextBlock |
||||
TextWrapping="Wrap" |
||||
Text="{sd:Localize AddIns.Profiler.Options.General.DataCollection.EnableDCAtStartup}" /> |
||||
</CheckBox> |
||||
<Label |
||||
Margin="3" |
||||
HorizontalAlignment="Left" |
||||
VerticalAlignment="Top" |
||||
Content="{sd:Localize AddIns.Profiler.Options.General.DataCollection.SizeOfStorageDescription}" /> |
||||
<StackPanel |
||||
Margin="3" |
||||
Orientation="Horizontal"> |
||||
<Slider |
||||
Name="sharedMemorySize" |
||||
Margin="3" |
||||
Width="100" |
||||
IsDirectionReversed="False" |
||||
TickPlacement="Both" |
||||
Minimum="64" |
||||
Maximum="512" |
||||
TickFrequency="64" |
||||
SmallChange="64" |
||||
Value="{sd:OptionBinding addin:OptionWrapper.SharedMemorySize}" |
||||
LargeChange="128" |
||||
IsSnapToTickEnabled="True" |
||||
VerticalAlignment="Top" /> |
||||
<TextBlock |
||||
Margin="3" |
||||
HorizontalAlignment="Left" |
||||
Text="{Binding Value, ElementName=sharedMemorySize, StringFormat=\{0\} MB}" |
||||
VerticalAlignment="Center" /> |
||||
</StackPanel> |
||||
<CheckBox |
||||
Margin="3" |
||||
IsChecked="{sd:OptionBinding addin:OptionWrapper.DoNotProfileNetInternals}" |
||||
VerticalAlignment="Top" |
||||
Content="{sd:Localize AddIns.Profiler.Options.General.DataCollection.DoNotProfileNetInternals}" /> |
||||
<CheckBox |
||||
Margin="3" |
||||
IsChecked="{sd:OptionBinding addin:OptionWrapper.CombineRecursiveCalls}" |
||||
VerticalAlignment="Top" |
||||
Content="{sd:Localize AddIns.Profiler.Options.General.DataCollection.CombineRecursiveCalls}" /> |
||||
</StackPanel> |
||||
</GroupBox> |
||||
</StackPanel> |
||||
x:Class="ICSharpCode.Profiler.AddIn.OptionPanels.General" |
||||
xmlns:sd="http://icsharpcode.net/sharpdevelop/core" |
||||
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets" |
||||
xmlns:gui="clr-namespace:ICSharpCode.SharpDevelop.Gui;assembly=ICSharpCode.SharpDevelop" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:addin="clr-namespace:ICSharpCode.Profiler.AddIn.OptionPanels;assembly=ICSharpCode.Profiler.AddIn"> |
||||
<StackPanel |
||||
Orientation="Vertical"> |
||||
<GroupBox |
||||
Header="{sd:Localize AddIns.Profiler.Options.General.DataCollection.Header}"> |
||||
<widgets:StackPanelWithSpacing |
||||
Margin="3" |
||||
SpaceBetweenItems="5" |
||||
Orientation="Vertical"> |
||||
<CheckBox |
||||
IsChecked="{sd:OptionBinding addin:OptionWrapper.EnableDC}" |
||||
VerticalAlignment="Top" |
||||
Content="{sd:Localize AddIns.Profiler.Options.General.DataCollection.EnableDC}" /> |
||||
<CheckBox |
||||
IsChecked="{sd:OptionBinding addin:OptionWrapper.EnableDCAtStart}" |
||||
VerticalAlignment="Top" |
||||
Content="{sd:Localize AddIns.Profiler.Options.General.DataCollection.EnableDCAtStartup}" /> |
||||
<Label |
||||
HorizontalAlignment="Left" |
||||
VerticalAlignment="Top" |
||||
Content="{sd:Localize AddIns.Profiler.Options.General.DataCollection.SizeOfStorageDescription}" /> |
||||
<StackPanel |
||||
Orientation="Horizontal"> |
||||
<Slider |
||||
Name="sharedMemorySize" |
||||
Margin="3" |
||||
Width="100" |
||||
IsDirectionReversed="False" |
||||
TickPlacement="Both" |
||||
Minimum="64" |
||||
Maximum="512" |
||||
TickFrequency="64" |
||||
SmallChange="64" |
||||
Value="{sd:OptionBinding addin:OptionWrapper.SharedMemorySize}" |
||||
LargeChange="128" |
||||
IsSnapToTickEnabled="True" |
||||
VerticalAlignment="Top" /> |
||||
<TextBlock |
||||
Margin="3" |
||||
HorizontalAlignment="Left" |
||||
Text="{Binding Value, ElementName=sharedMemorySize, StringFormat=\{0\} MB}" |
||||
VerticalAlignment="Center" /> |
||||
</StackPanel> |
||||
<CheckBox |
||||
IsChecked="{sd:OptionBinding addin:OptionWrapper.DoNotProfileNetInternals}" |
||||
VerticalAlignment="Top" |
||||
Content="{sd:Localize AddIns.Profiler.Options.General.DataCollection.DoNotProfileNetInternals}" /> |
||||
<CheckBox |
||||
IsChecked="{sd:OptionBinding addin:OptionWrapper.CombineRecursiveCalls}" |
||||
VerticalAlignment="Top" |
||||
Content="{sd:Localize AddIns.Profiler.Options.General.DataCollection.CombineRecursiveCalls}" /> |
||||
</widgets:StackPanelWithSpacing> |
||||
</GroupBox> |
||||
</StackPanel> |
||||
</gui:OptionPanel> |
@ -1,15 +1,15 @@
@@ -1,15 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Window x:Class="Debugger.AddIn.Service.EditBreakpointScriptWindow" xmlns:sd="http://icsharpcode.net/sharpdevelop/core" xmlns:avalonedit="http://icsharpcode.net/sharpdevelop/avalonedit" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="{sd:Localize MainWindow.Windows.Debug.Conditional.Breakpoints.ScriptingWindow.Title}" Width="500" Style="{x:Static sd:GlobalStyles.DialogWindowStyle}" WindowStartupLocation="CenterScreen" Height="400"> |
||||
<Window x:Class="Debugger.AddIn.Service.EditBreakpointScriptWindow" xmlns:sd="http://icsharpcode.net/sharpdevelop/core" xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets" xmlns:avalonedit="http://icsharpcode.net/sharpdevelop/avalonedit" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="{sd:Localize MainWindow.Windows.Debug.Conditional.Breakpoints.ScriptingWindow.Title}" Width="500" Style="{x:Static sd:GlobalStyles.DialogWindowStyle}" WindowStartupLocation="CenterScreen" Height="400"> |
||||
<DockPanel> |
||||
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal"> |
||||
<Label Margin="3" Content="{sd:Localize MainWindow.Windows.Debug.Conditional.Breakpoints.ScriptingWindow.ScriptingLanguage}" /> |
||||
<ComboBox Margin="3" Name="cmbLanguage" SelectionChanged="CmbLanguageSelectionChanged" /> |
||||
<Button Margin="3" Name="btnCheckSyntax" Click="BtnCheckSyntaxClick" Content="{sd:Localize MainWindow.Windows.Debug.Conditional.Breakpoints.ScriptingWindow.CheckSyntax}" /> |
||||
</StackPanel> |
||||
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Center"> |
||||
<Button Name="btnOK" Margin="3" Content="{sd:Localize Global.OKButtonText}" Click="BtnOKClick" /> |
||||
<Button Name="btnCancel" Margin="3" Content="{sd:Localize Global.CancelButtonText}" Click="BtnCancelClick" /> |
||||
</StackPanel> |
||||
<widgets:UniformGridWithSpacing DockPanel.Dock="Bottom" Columns="2" HorizontalAlignment="Center" Margin="3"> |
||||
<Button Name="btnOK" Content="{sd:Localize Global.OKButtonText}" Click="BtnOKClick" IsDefault="True" Style="{x:Static sd:GlobalStyles.ButtonStyle}" /> |
||||
<Button Name="btnCancel" Content="{sd:Localize Global.CancelButtonText}" Click="BtnCancelClick" IsCancel="True" Style="{x:Static sd:GlobalStyles.ButtonStyle}" /> |
||||
</widgets:UniformGridWithSpacing> |
||||
<avalonedit:TextEditor x:Name="codeEditor" /> |
||||
</DockPanel> |
||||
</Window> |
@ -1,58 +1,54 @@
@@ -1,58 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Window |
||||
x:Class="ICSharpCode.AvalonEdit.AddIn.Commands.SortOptionsDialog" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:core="http://icsharpcode.net/sharpdevelop/core" xmlns:local="clr-namespace:ICSharpCode.AvalonEdit.AddIn.Commands" |
||||
Title="{core:Localize ICSharpCode.SharpDevelop.Gui.Dialogs.SortOptionsDialog.DialogName}" |
||||
Width="335" |
||||
SizeToContent="Height" |
||||
ResizeMode="NoResize" |
||||
WindowStartupLocation="CenterOwner" |
||||
Style="{x:Static core:GlobalStyles.DialogWindowStyle}"> |
||||
<StackPanel |
||||
Margin="4"> |
||||
<GroupBox |
||||
Header="{core:Localize ICSharpCode.SharpDevelop.Gui.Dialogs.SortOptionsDialog.SortDirectionGroupBox}"> |
||||
<core:RadioButtonGroup |
||||
SelectedValue="{core:OptionBinding local:SortOptions.SortDirection}"> |
||||
<RadioButton |
||||
Margin="4" |
||||
Tag="{x:Static local:SortDirection.Ascending}" |
||||
Content="{core:Localize ICSharpCode.SharpDevelop.Gui.Dialogs.SortOptionsDialog.SortDirectionGroupBox.Ascending}" /> |
||||
<RadioButton |
||||
Margin="4" |
||||
Tag="{x:Static local:SortDirection.Descending}" |
||||
Content="{core:Localize ICSharpCode.SharpDevelop.Gui.Dialogs.SortOptionsDialog.SortDirectionGroupBox.Descending}" /> |
||||
</core:RadioButtonGroup> |
||||
</GroupBox> |
||||
<CheckBox |
||||
Margin="4" |
||||
IsChecked="{core:OptionBinding local:SortOptions.RemoveDuplicates}" |
||||
Content="{core:Localize ICSharpCode.SharpDevelop.Gui.Dialogs.SortOptionsDialog.RemoveDuplicateLinesCheckBox}" /> |
||||
<CheckBox |
||||
Margin="4" |
||||
IsChecked="{core:OptionBinding local:SortOptions.CaseSensitive}" |
||||
Content="{core:Localize ICSharpCode.SharpDevelop.Gui.Dialogs.SortOptionsDialog.CaseSensitiveCheckBox}" /> |
||||
<CheckBox |
||||
Margin="4" |
||||
IsChecked="{core:OptionBinding local:SortOptions.IgnoreTrailingWhitespaces}" |
||||
Content="{core:Localize ICSharpCode.SharpDevelop.Gui.Dialogs.SortOptionsDialog.IgnoreTrailingWhitespacesCheckBox}" /> |
||||
<StackPanel |
||||
Orientation="Horizontal" |
||||
HorizontalAlignment="Right"> |
||||
<Button |
||||
Content="{core:Localize Global.OKButtonText}" |
||||
Width="75" |
||||
Height="23" |
||||
Name="okButton" |
||||
IsDefault="True" |
||||
Margin="4" |
||||
Click="okButton_Click" /> |
||||
<Button |
||||
Content="{core:Localize Global.CancelButtonText}" |
||||
Width="75" |
||||
Height="23" |
||||
Name="cancelButton" |
||||
IsCancel="True" |
||||
Margin="4" /> |
||||
</StackPanel> |
||||
</StackPanel> |
||||
x:Class="ICSharpCode.AvalonEdit.AddIn.Commands.SortOptionsDialog" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:core="http://icsharpcode.net/sharpdevelop/core" xmlns:local="clr-namespace:ICSharpCode.AvalonEdit.AddIn.Commands" xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets" |
||||
Title="{core:Localize ICSharpCode.SharpDevelop.Gui.Dialogs.SortOptionsDialog.DialogName}" |
||||
Width="335" |
||||
SizeToContent="Height" |
||||
ResizeMode="NoResize" |
||||
WindowStartupLocation="CenterOwner" |
||||
Style="{x:Static core:GlobalStyles.DialogWindowStyle}"> |
||||
<StackPanel |
||||
Margin="4"> |
||||
<GroupBox |
||||
Padding="3, 3, 3, 7" |
||||
Header="{core:Localize ICSharpCode.SharpDevelop.Gui.Dialogs.SortOptionsDialog.SortDirectionGroupBox}"> |
||||
<widgets:RadioButtonGroup |
||||
SelectedValue="{core:OptionBinding local:SortOptions.SortDirection}"> |
||||
<RadioButton |
||||
Tag="{x:Static local:SortDirection.Ascending}" |
||||
Content="{core:Localize ICSharpCode.SharpDevelop.Gui.Dialogs.SortOptionsDialog.SortDirectionGroupBox.Ascending}" /> |
||||
<RadioButton |
||||
Tag="{x:Static local:SortDirection.Descending}" |
||||
Content="{core:Localize ICSharpCode.SharpDevelop.Gui.Dialogs.SortOptionsDialog.SortDirectionGroupBox.Descending}" /> |
||||
</widgets:RadioButtonGroup> |
||||
</GroupBox> |
||||
<CheckBox |
||||
Margin="4" |
||||
IsChecked="{core:OptionBinding local:SortOptions.RemoveDuplicates}" |
||||
Content="{core:Localize ICSharpCode.SharpDevelop.Gui.Dialogs.SortOptionsDialog.RemoveDuplicateLinesCheckBox}" /> |
||||
<CheckBox |
||||
Margin="4" |
||||
IsChecked="{core:OptionBinding local:SortOptions.CaseSensitive}" |
||||
Content="{core:Localize ICSharpCode.SharpDevelop.Gui.Dialogs.SortOptionsDialog.CaseSensitiveCheckBox}" /> |
||||
<CheckBox |
||||
Margin="4" |
||||
IsChecked="{core:OptionBinding local:SortOptions.IgnoreTrailingWhitespaces}" |
||||
Content="{core:Localize ICSharpCode.SharpDevelop.Gui.Dialogs.SortOptionsDialog.IgnoreTrailingWhitespacesCheckBox}" /> |
||||
<widgets:UniformGridWithSpacing |
||||
Columns="2" |
||||
Margin="4" |
||||
HorizontalAlignment="Right"> |
||||
<Button |
||||
Content="{core:Localize Global.OKButtonText}" |
||||
Style="{x:Static core:GlobalStyles.ButtonStyle}" |
||||
Name="okButton" |
||||
IsDefault="True" |
||||
Click="okButton_Click" /> |
||||
<Button |
||||
Content="{core:Localize Global.CancelButtonText}" |
||||
Style="{x:Static core:GlobalStyles.ButtonStyle}" |
||||
Name="cancelButton" |
||||
IsCancel="True" /> |
||||
</widgets:UniformGridWithSpacing> |
||||
</StackPanel> |
||||
</Window> |
@ -1,22 +1,23 @@
@@ -1,22 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Window |
||||
x:Class="ICSharpCode.UsageDataCollector.CollectedDataView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:core="http://icsharpcode.net/sharpdevelop/core" xmlns:avalonEdit="http://icsharpcode.net/sharpdevelop/avalonedit" |
||||
Style="{x:Static core:GlobalStyles.DialogWindowStyle}" |
||||
Title="Collected Data" |
||||
Width="649" |
||||
Height="418"> |
||||
<DockPanel> |
||||
<TextBlock |
||||
DockPanel.Dock="Top">This window shows the data that was collected but not yet uploaded.</TextBlock> |
||||
<Button |
||||
DockPanel.Dock="Bottom" |
||||
Width="75" |
||||
Height="23" |
||||
Content="{core:Localize Global.CloseButtonText}" |
||||
Margin="16,8,16,8" |
||||
Click="Button_Click" /> |
||||
<avalonEdit:TextEditor |
||||
x:Name="textEditor" |
||||
IsReadOnly="True" /> |
||||
</DockPanel> |
||||
x:Class="ICSharpCode.UsageDataCollector.CollectedDataView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:core="http://icsharpcode.net/sharpdevelop/core" xmlns:avalonEdit="http://icsharpcode.net/sharpdevelop/avalonedit" |
||||
Style="{x:Static core:GlobalStyles.DialogWindowStyle}" |
||||
Title="Collected Data" |
||||
Width="649" |
||||
Height="418"> |
||||
<DockPanel> |
||||
<TextBlock |
||||
TextWrapping="WrapWithOverflow" |
||||
DockPanel.Dock="Top">This window shows the data that was collected but not yet uploaded.</TextBlock> |
||||
<Button |
||||
DockPanel.Dock="Bottom" |
||||
Style="{x:Static core:GlobalStyles.ButtonStyle}" |
||||
IsCancel="True" |
||||
Content="{core:Localize Global.CloseButtonText}" |
||||
Margin="16,8,16,8" |
||||
Click="Button_Click" /> |
||||
<avalonEdit:TextEditor |
||||
x:Name="textEditor" |
||||
IsReadOnly="True" /> |
||||
</DockPanel> |
||||
</Window> |
@ -0,0 +1,101 @@
@@ -0,0 +1,101 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <author name="Daniel Grunwald"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Widgets |
||||
{ |
||||
/// <summary>
|
||||
/// StackPanel with spacing between elements.
|
||||
/// Unlike actual StackPanel, this one does not support virtualized scrolling.
|
||||
/// </summary>
|
||||
public class StackPanelWithSpacing : Panel |
||||
{ |
||||
public static readonly DependencyProperty OrientationProperty = |
||||
DependencyProperty.Register("Orientation", typeof(Orientation), typeof(StackPanelWithSpacing), |
||||
new FrameworkPropertyMetadata(Orientation.Vertical, FrameworkPropertyMetadataOptions.AffectsMeasure)); |
||||
|
||||
public Orientation Orientation { |
||||
get { return (Orientation)GetValue(OrientationProperty); } |
||||
set { SetValue(OrientationProperty, value); } |
||||
} |
||||
|
||||
public static readonly DependencyProperty SpaceBetweenItemsProperty = |
||||
DependencyProperty.Register("SpaceBetweenItems", typeof(double), typeof(StackPanelWithSpacing), |
||||
new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.AffectsMeasure)); |
||||
|
||||
public double SpaceBetweenItems { |
||||
get { return (double)GetValue(SpaceBetweenItemsProperty); } |
||||
set { SetValue(SpaceBetweenItemsProperty, value); } |
||||
} |
||||
|
||||
protected override bool HasLogicalOrientation { |
||||
get { return true; } |
||||
} |
||||
|
||||
protected override Orientation LogicalOrientation { |
||||
get { return this.Orientation; } |
||||
} |
||||
|
||||
protected override Size MeasureOverride(Size availableSize) |
||||
{ |
||||
Orientation orientation = this.Orientation; |
||||
if (orientation == Orientation.Horizontal) { |
||||
availableSize.Width = double.PositiveInfinity; |
||||
} else { |
||||
availableSize.Height = double.PositiveInfinity; |
||||
} |
||||
double spaceBetweenItems = this.SpaceBetweenItems; |
||||
double pos = 0; |
||||
double maxWidth = 0; |
||||
bool hasVisibleItems = false; |
||||
foreach (UIElement element in this.InternalChildren) { |
||||
element.Measure(availableSize); |
||||
Size desiredSize = element.DesiredSize; |
||||
if (orientation == Orientation.Horizontal) { |
||||
maxWidth = Math.Max(maxWidth, desiredSize.Height); |
||||
pos += desiredSize.Width; |
||||
} else { |
||||
maxWidth = Math.Max(maxWidth, desiredSize.Width); |
||||
pos += desiredSize.Height; |
||||
} |
||||
if (element.Visibility != Visibility.Collapsed) { |
||||
pos += spaceBetweenItems; |
||||
hasVisibleItems = true; |
||||
} |
||||
} |
||||
if (hasVisibleItems) |
||||
pos -= spaceBetweenItems; |
||||
if (orientation == Orientation.Horizontal) |
||||
return new Size(pos, maxWidth); |
||||
else |
||||
return new Size(maxWidth, pos); |
||||
} |
||||
|
||||
protected override Size ArrangeOverride(Size finalSize) |
||||
{ |
||||
Orientation orientation = this.Orientation; |
||||
double spaceBetweenItems = this.SpaceBetweenItems; |
||||
double pos = 0; |
||||
foreach (UIElement element in this.InternalChildren) { |
||||
if (orientation == Orientation.Horizontal) { |
||||
element.Arrange(new Rect(pos, 0, element.DesiredSize.Width, finalSize.Height)); |
||||
pos += element.DesiredSize.Width; |
||||
} else { |
||||
element.Arrange(new Rect(0, pos, finalSize.Width, element.DesiredSize.Height)); |
||||
pos += element.DesiredSize.Height; |
||||
} |
||||
if (element.Visibility != Visibility.Collapsed) { |
||||
pos += spaceBetweenItems; |
||||
} |
||||
} |
||||
return finalSize; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,70 @@
@@ -0,0 +1,70 @@
|
||||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <author name="Daniel Grunwald"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
|
||||
using System; |
||||
using System.Windows; |
||||
using System.Windows.Controls.Primitives; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Widgets |
||||
{ |
||||
/// <summary>
|
||||
/// UniformGrid that has spacing between columns/rows.
|
||||
/// </summary>
|
||||
public class UniformGridWithSpacing : UniformGrid |
||||
{ |
||||
public static readonly DependencyProperty SpaceBetweenColumnsProperty = |
||||
DependencyProperty.Register("SpaceBetweenColumns", typeof(double), typeof(UniformGridWithSpacing), |
||||
new FrameworkPropertyMetadata(7.0, FrameworkPropertyMetadataOptions.AffectsMeasure)); |
||||
|
||||
public double SpaceBetweenColumns { |
||||
get { return (double)GetValue(SpaceBetweenColumnsProperty); } |
||||
set { SetValue(SpaceBetweenColumnsProperty, value); } |
||||
} |
||||
|
||||
public static readonly DependencyProperty SpaceBetweenRowsProperty = |
||||
DependencyProperty.Register("SpaceBetweenRows", typeof(double), typeof(UniformGridWithSpacing), |
||||
new FrameworkPropertyMetadata(5.0, FrameworkPropertyMetadataOptions.AffectsMeasure)); |
||||
|
||||
public double SpaceBetweenRows { |
||||
get { return (double)GetValue(SpaceBetweenRowsProperty); } |
||||
set { SetValue(SpaceBetweenRowsProperty, value); } |
||||
} |
||||
|
||||
protected override Size MeasureOverride(Size constraint) |
||||
{ |
||||
Size s = base.MeasureOverride(constraint); |
||||
return new Size(s.Width + Math.Max(0, this.Columns - 1) * this.SpaceBetweenColumns, |
||||
s.Height + Math.Max(0, this.Rows - 1) * this.SpaceBetweenRows); |
||||
} |
||||
|
||||
protected override Size ArrangeOverride(Size arrangeSize) |
||||
{ |
||||
double spaceBetweenColumns = this.SpaceBetweenColumns; |
||||
double spaceBetweenRows = this.SpaceBetweenRows; |
||||
int rows = Math.Max(1, this.Rows); |
||||
int columns = Math.Max(1, this.Columns); |
||||
Rect rect = new Rect(0, 0, |
||||
(arrangeSize.Width - spaceBetweenColumns * (columns - 1)) / columns, |
||||
(arrangeSize.Height - spaceBetweenRows * (rows - 1)) / rows); |
||||
int currentColumn = this.FirstColumn; |
||||
rect.X += currentColumn * (rect.Width + spaceBetweenColumns); |
||||
foreach (UIElement element in this.InternalChildren) { |
||||
element.Arrange(rect); |
||||
if (element.Visibility != Visibility.Collapsed) { |
||||
if (++currentColumn >= columns) { |
||||
currentColumn = 0; |
||||
rect.X = 0; |
||||
rect.Y += rect.Height + spaceBetweenRows; |
||||
} else { |
||||
rect.X += rect.Width + spaceBetweenColumns; |
||||
} |
||||
} |
||||
} |
||||
return arrangeSize; |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue