Permalink
Browse files

Merge branch 'origin-develop' into cw-develop

Conflicts:
	Source/Eto.Test/Eto.Test/Sections/Controls/ButtonSection.cs
	Source/Eto/Forms/Layout/DockLayout.cs
  • Loading branch information...
2 parents 74dbf8f + 24167f5 commit ef699308cad544318b0fa4224e8e9e76129ef513 @cwensley cwensley committed Sep 9, 2013
Showing with 357 additions and 281 deletions.
  1. +1 −1 Source/Eto.Platform.Mac/Forms/MacWindow.cs
  2. +1 −7 Source/Eto.Platform.Windows/BubbleEventFilter.cs
  3. +0 −2 Source/Eto.Platform.Windows/Forms/Controls/ButtonHandler.cs
  4. +0 −2 Source/Eto.Platform.Windows/Forms/Controls/GroupBoxHandler.cs
  5. +0 −7 Source/Eto.Platform.Windows/Forms/Controls/PanelHandler.cs
  6. +0 −1 Source/Eto.Platform.Windows/Forms/Menu/MenuBarHandler.cs
  7. +0 −7 Source/Eto.Platform.Windows/Forms/TableLayoutHandler.cs
  8. +0 −1 Source/Eto.Platform.Windows/Forms/ToolBar/ToolBarHandler.cs
  9. +1 −1 Source/Eto.Platform.Windows/Forms/WindowHandler.cs
  10. +13 −27 Source/Eto.Platform.Windows/Forms/WindowsContainer.cs
  11. +1 −1 Source/Eto.Platform.Windows/Win32.cs
  12. +1 −2 Source/Eto.Platform.Wpf/Conversions.cs
  13. +16 −2 Source/Eto.Platform.Wpf/CustomControls/SelectableTreeView.cs
  14. +1 −1 Source/Eto.Platform.Wpf/Forms/Controls/ButtonHandler.cs
  15. +2 −2 Source/Eto.Platform.Wpf/Forms/Controls/CheckBoxHandler.cs
  16. +4 −1 Source/Eto.Platform.Wpf/Forms/Controls/GroupBoxHandler.cs
  17. +20 −6 Source/Eto.Platform.Wpf/Forms/Controls/LabelHandler.cs
  18. +2 −2 Source/Eto.Platform.Wpf/Forms/Controls/RadioButtonHandler.cs
  19. +2 −2 Source/Eto.Platform.Wpf/Forms/Controls/TabPageHandler.cs
  20. +4 −2 Source/Eto.Platform.Wpf/Forms/Controls/WpfListItemHelper.cs
  21. +2 −2 Source/Eto.Platform.Wpf/Forms/Menu/WpfMenuItem.cs
  22. +9 −1 Source/Eto.Platform.Wpf/Forms/TableLayoutHandler.cs
  23. +2 −2 Source/Eto.Platform.Wpf/Forms/ToolBar/CheckToolBarButtonHandler.cs
  24. +2 −2 Source/Eto.Platform.Wpf/Forms/ToolBar/ToolBarButtonHandler.cs
  25. +55 −45 Source/Eto.Test/Eto.Test/Sections/Controls/ButtonSection.cs
  26. +14 −0 Source/Eto/Drawing/Size.cs
  27. +14 −0 Source/Eto/Drawing/SizeF.cs
  28. +2 −2 Source/Eto/Eto.csproj
  29. +1 −1 Source/Eto/Forms/Container.cs
  30. +0 −1 Source/Eto/Forms/Controls/Control.cs
  31. +1 −1 Source/Eto/{Interface → Forms}/IKeyboardInputSource.cs
  32. +1 −1 Source/Eto/{Interface → Forms}/IMouseInputSource.cs
  33. +17 −18 Source/Eto/Forms/Layout/DockLayout.cs
  34. +6 −3 Source/Eto/Forms/Layout/PixelLayout.cs
  35. +162 −125 Source/Eto/Forms/Layout/TableLayout.cs
@@ -115,7 +115,7 @@ public abstract class MacWindow<T, W> : MacObject<T, W>, IWindow, IMacContainer,
public virtual Size GetPreferredSize (Size availableSize)
{
- if (Widget.Layout != null) {
+ if (Widget.Layout != null && Widget.Layout.InnerLayout != null) {
var layout = Widget.Layout.InnerLayout.Handler as IMacLayout;
if (layout != null)
return layout.GetPreferredSize (availableSize);
@@ -110,20 +110,14 @@ static bool MouseEvent (BubbleEventArgs be, Action<Control, MouseEventArgs> acti
{
var modifiers = swf.Control.ModifierKeys.ToEto ();
var delta = new SizeF (0, Win32.GetWheelDeltaWParam (be.Message.WParam) / Conversions.WHEEL_DELTA);
- var position = new Point (Win32.SignedLOWORD (be.Message.LParam), Win32.SignedHIWORD (be.Message.LParam));
var buttons = Win32.GetMouseButtonWParam (be.Message.WParam).ToEto ();
if (modifyButtons != null)
buttons = modifyButtons (buttons);
- var me = new MouseEventArgs (buttons, modifiers, position, delta);
var handler = be.WindowsControl;
var mousePosition = swf.Control.MousePosition.ToEto ();
var ret = false;
- var first = true;
foreach (var control in be.Parents) {
- if (!first)
- me = new MouseEventArgs (me.Buttons, modifiers, control.PointFromScreen (mousePosition), delta);
- else
- first = false;
+ var me = new MouseEventArgs(buttons, modifiers, control.PointFromScreen(mousePosition), delta);
action (control, me);
if (me.Handled) {
ret = true;
@@ -17,8 +17,6 @@ public class ButtonHandler : WindowsControl<ButtonHandler.EtoButton, Button>, IB
Image image;
Size defaultSize;
- public override swf.DockStyle DockStyle { get { return swf.DockStyle.None; } }
-
public class EtoButton : swf.Button
{
public override sd.Size GetPreferredSize (sd.Size proposedSize)
@@ -16,7 +16,6 @@ public GroupBoxHandler()
AutoSize = true,
AutoSizeMode = SWF.AutoSizeMode.GrowAndShrink
};
- Control.SuspendLayout ();
content = new SWF.Panel {
Font = SD.SystemFonts.DefaultFont,
Dock = SWF.DockStyle.Fill,
@@ -34,7 +33,6 @@ public override Size DesiredSize
public override void OnLoad (EventArgs e)
{
base.OnLoad (e);
- Control.ResumeLayout ();
}
public override SWF.Control ContentContainer
@@ -29,17 +29,10 @@ protected override bool IsInputKey (swf.Keys keyData)
public PanelHandler ()
{
Control = new EtoPanel ();
- this.Control.SuspendLayout ();
this.Control.Size = sd.Size.Empty;
this.Control.MinimumSize = sd.Size.Empty;
this.Control.AutoSize = true;
this.Control.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
}
-
- public override void OnLoad (EventArgs e)
- {
- base.OnLoad (e);
- Control.ResumeLayout ();
- }
}
}
@@ -12,7 +12,6 @@ public class MenuBarHandler : WidgetHandler<SWF.MenuStrip, MenuBar>, IMenuBar, I
public MenuBarHandler()
{
Control = new SWF.MenuStrip();
- Control.SuspendLayout ();
}
#region IMenu Members
@@ -29,7 +29,6 @@ public override Size DesiredSize
public TableLayoutHandler()
{
Control = new SWF.TableLayoutPanel();
- this.Control.SuspendLayout ();
this.Control.Margin = SWF.Padding.Empty;
this.Control.Dock = SWF.DockStyle.Fill;
this.Control.Size = SD.Size.Empty;
@@ -40,12 +39,6 @@ public TableLayoutHandler()
this.Padding = TableLayout.DefaultPadding;
}
- public override void OnLoad ()
- {
- base.OnLoad ();
- this.Control.ResumeLayout ();
- }
-
public override void Update ()
{
this.Control.Update();
@@ -13,7 +13,6 @@ public class ToolBarHandler : WidgetHandler<SWF.ToolStrip, ToolBar>, IToolBar
public ToolBarHandler()
{
Control = new SWF.ToolStrip();
- Control.SuspendLayout ();
Control.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.StackWithOverflow;
Control.AutoSize = true;
}
@@ -189,7 +189,7 @@ public override void AttachEvent (string handler)
protected virtual swf.FormBorderStyle DefaultWindowStyle
{
- get { return swf.FormBorderStyle.Fixed3D; }
+ get { return swf.FormBorderStyle.Sizable; }
}
public virtual bool Resizable
@@ -13,6 +13,11 @@ public abstract class WindowsContainer<T, W> : WindowsControl<T, W>, IContainer
{
Size? minimumSize;
+ public WindowsContainer()
+ {
+ EnableRedrawDuringSuspend = false;
+ }
+
protected IWindowsLayout WindowsLayout
{
get { return Widget.Layout != null && Widget.Layout.InnerLayout != null ? Widget.Layout.InnerLayout.Handler as IWindowsLayout : null; }
@@ -80,44 +85,25 @@ public override Size ClientSize
set { base.ClientSize = value; }
}
+ bool restoreRedraw;
public override void SuspendLayout ()
{
base.SuspendLayout ();
- if (Widget.Layout != null)
+ if (!EnableRedrawDuringSuspend && Control.IsHandleCreated)
{
- var layout = Widget.Layout.Handler as IWindowsLayout;
- if (layout != null)
- {
- var control = layout.LayoutObject as SWF.Control;
- if (control != null)
- {
- control.SuspendLayout ();
- if (!EnableRedrawDuringSuspend && control.IsHandleCreated)
- Win32.SendMessage (control.Handle, Win32.WM.SETREDRAW, IntPtr.Zero, IntPtr.Zero);
- }
- }
-
+ restoreRedraw = (int)Win32.SendMessage(Control.Handle, Win32.WM.SETREDRAW, IntPtr.Zero, IntPtr.Zero) == 0;
}
}
public override void ResumeLayout ()
{
- base.ResumeLayout ();
- if (Widget.Layout != null)
+ base.ResumeLayout();
+ if (restoreRedraw)
{
- var layout = Widget.Layout.Handler as IWindowsLayout;
- if (layout != null)
- {
- var control = layout.LayoutObject as SWF.Control;
- if (control != null)
- {
- if (!EnableRedrawDuringSuspend && control.IsHandleCreated)
- Win32.SendMessage (control.Handle, Win32.WM.SETREDRAW, new IntPtr(1), IntPtr.Zero);
- control.ResumeLayout ();
- }
- }
-
+ Win32.SendMessage(Control.Handle, Win32.WM.SETREDRAW, new IntPtr(1), IntPtr.Zero);
+ Control.Refresh();
+ restoreRedraw = false;
}
}
@@ -161,6 +161,6 @@ public static MouseButtons GetMouseButtonWParam (IntPtr wParam)
public static extern int SetWindowLong (IntPtr hWnd, GWL nIndex, uint dwNewLong);
[DllImport("user32.dll")]
- public static extern int SendMessage(IntPtr hWnd, WM wMsg, IntPtr wParam, IntPtr lParam);
+ public static extern IntPtr SendMessage(IntPtr hWnd, WM wMsg, IntPtr wParam, IntPtr lParam);
}
}
@@ -120,9 +120,8 @@ public static string ToWpfMneumonic (this string value)
return value.Replace ("&&", "&");
}
- public static string ConvertMneumonicFromWPF (object obj)
+ public static string ToEtoMneumonic (this string value)
{
- var value = obj as string;
if (value == null)
return null;
var match = Regex.Match (value, @"(?<=([^_](?:[_]{2})*)|^)[_](?![_])");
@@ -12,6 +12,7 @@ namespace Eto.Platform.Wpf.CustomControls
{
public class SelectableTreeView : TreeView
{
+
static SelectableTreeView ()
{
}
@@ -89,13 +90,26 @@ public void RefreshData ()
refreshing = true;
Items.Refresh ();
refreshing = false;
- FindItem (selectedItem, this).ContinueWith (t => {
+ if (this.IsLoaded)
+ {
+ SetSelected(selectedItem);
+ }
+ else
+ {
+ this.Loaded += (sender, e) => SetSelected(selectedItem);
+ }
+ //this.CurrentItem = selectedItem;
+ }
+
+ void SetSelected(object selectedItem)
+ {
+ FindItem(selectedItem, this).ContinueWith(t =>
+ {
if (t.Result != null)
{
t.Result.IsSelected = true;
}
}, TaskScheduler.FromCurrentSynchronizationContext());
- //this.CurrentItem = selectedItem;
}
protected override void OnItemsChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
@@ -65,7 +65,7 @@ public ButtonHandler ()
public string Text
{
- get { return Conversions.ConvertMneumonicFromWPF ((string)label.Content); }
+ get { return (label.Content as string).ToEtoMneumonic(); }
set {
label.Content = value.ToWpfMneumonic ();
SetImagePosition ();
@@ -33,8 +33,8 @@ public CheckBoxHandler ()
public string Text
{
- get { return Control.Content as string; }
- set { Control.Content = value; }
+ get { return (Control.Content as string).ToEtoMneumonic(); }
+ set { Control.Content = value.ToWpfMneumonic(); }
}
public bool ThreeState
@@ -17,7 +17,7 @@ public class GroupBoxHandler : WpfContainer<swc.GroupBox, GroupBox>, IGroupBox
public GroupBoxHandler ()
{
- Control = new swc.GroupBox ();
+ Control = new swc.GroupBox();
}
public override Size ClientSize
@@ -38,6 +38,9 @@ public override object ContainerObject
public override void SetLayout (Layout layout)
{
Control.Content = (System.Windows.UIElement)layout.ControlObject;
+ var tableLayout = layout.Handler as TableLayoutHandler;
+ if (tableLayout != null)
+ tableLayout.Adjust = new Size(0, -1);
}
public override Color BackgroundColor
@@ -5,21 +5,35 @@
using Eto.Forms;
using Eto.Drawing;
using Eto.Platform.Wpf.Drawing;
+using swc = System.Windows.Controls;
using swm = System.Windows.Media;
+using swi = System.Windows.Input;
+using sw = System.Windows;
namespace Eto.Platform.Wpf.Forms.Controls
{
- public class LabelHandler : WpfControl<System.Windows.Controls.Label, Label>, ILabel
+ public class LabelHandler : WpfControl<swc.Label, Label>, ILabel
{
- System.Windows.Controls.TextBlock text;
+ swc.AccessText text;
+
+ public class EtoLabel : swc.Label
+ {
+ protected override void OnAccessKey(swi.AccessKeyEventArgs e)
+ {
+ // move focus to the next control after the label
+ var tRequest = new swi.TraversalRequest(swi.FocusNavigationDirection.Next);
+ this.MoveFocus(tRequest);
+ }
+ }
public LabelHandler ()
{
- Control = new System.Windows.Controls.Label ();
- text = new System.Windows.Controls.TextBlock ();
+ Control = new EtoLabel();
+ text = new swc.AccessText();
Control.Content = text;
HorizontalAlign = HorizontalAlign.Left;
VerticalAlign = VerticalAlign.Top;
+ Control.Target = Control;
}
public HorizontalAlign HorizontalAlign
@@ -135,8 +149,8 @@ public Color TextColor
public string Text
{
- get { return text.Text; }
- set { text.Text = value; }
+ get { return text.Text.ToEtoMneumonic(); }
+ set { text.Text = value.ToWpfMneumonic(); ; }
}
}
}
@@ -37,8 +37,8 @@ public bool Checked
public string Text
{
- get { return Control.Content as string; }
- set { Control.Content = value; }
+ get { return (Control.Content as string).ToEtoMneumonic(); }
+ set { Control.Content = value.ToWpfMneumonic(); }
}
}
}
@@ -33,8 +33,8 @@ public TabPageHandler ()
public string Text
{
- get { return headerText.Text; }
- set { headerText.Text = value; }
+ get { return headerText.Text.ToEtoMneumonic(); }
+ set { headerText.Text = value.ToWpfMneumonic(); }
}
public Eto.Drawing.Image Image
@@ -37,18 +37,20 @@ public object ConvertBack(object value, Type targetType, object parameter, Syste
}
}
+ static sw.PropertyPath TextPath = PropertyPathHelper.Create("(Eto.Forms.IListItem,Eto.Text)");
+
public static sw.FrameworkElementFactory TextBlock()
{
var factory = new sw.FrameworkElementFactory(typeof(swc.TextBlock));
- factory.SetBinding(swc.TextBlock.TextProperty, new sw.Data.Binding { Path = new sw.PropertyPath("Text") });
+ factory.SetBinding(swc.TextBlock.TextProperty, new sw.Data.Binding { Path = TextPath });
factory.SetValue(swc.TextBlock.MarginProperty, new sw.Thickness(2));
return factory;
}
public static sw.FrameworkElementFactory EditableBlock()
{
var factory = new sw.FrameworkElementFactory(typeof(EditableTextBlock));
- factory.SetBinding(EditableTextBlock.TextProperty, new sw.Data.Binding { Path = new sw.PropertyPath("Text") });
+ factory.SetBinding(EditableTextBlock.TextProperty, new sw.Data.Binding { Path = TextPath });
return factory;
}
@@ -39,8 +39,8 @@ public Image Image
public string Text
{
- get { return Conversions.ConvertMneumonicFromWPF (Control.Header); }
- set { Control.Header = value.ToWpfMneumonic (); }
+ get { return (Control.Header as string).ToEtoMneumonic(); }
+ set { Control.Header = value.ToWpfMneumonic(); }
}
public string ToolTip
Oops, something went wrong. Retry.

0 comments on commit ef69930

Please sign in to comment.