diff options
| author | jp <jp_bruyere@hotmail.com> | 2016-02-28 19:03:23 +0100 |
|---|---|---|
| committer | jp <jp_bruyere@hotmail.com> | 2016-02-28 19:03:23 +0100 |
| commit | dc2ac1f53a079a8daa7c1342b17a8dcefcc62362 (patch) | |
| tree | 2b8a01557da7c94947ece3a2be92dac26e652f1e | |
| parent | 1d5a24313cd20b97bf9a852e30bade904cb4b95c (diff) | |
message box events ok cancel
| -rw-r--r-- | Crow.csproj | 1 | ||||
| -rw-r--r-- | Styles/MessageBox.style | 4 | ||||
| -rw-r--r-- | Templates/MessageBox.goml | 4 | ||||
| -rw-r--r-- | src/GraphicObjects/MessageBox.cs | 42 |
4 files changed, 17 insertions, 34 deletions
diff --git a/Crow.csproj b/Crow.csproj index 6c98dc12..366d2ee8 100644 --- a/Crow.csproj +++ b/Crow.csproj @@ -242,6 +242,7 @@ <EmbeddedResource Include="Styles\ComboBox.style" /> <EmbeddedResource Include="Styles\Label.style" /> <EmbeddedResource Include="Styles\Spinner.style" /> + <EmbeddedResource Include="Styles\MessageBox.style" /> </ItemGroup> <ItemGroup> <None Include="README.md" /> diff --git a/Styles/MessageBox.style b/Styles/MessageBox.style new file mode 100644 index 00000000..046db0e0 --- /dev/null +++ b/Styles/MessageBox.style @@ -0,0 +1,4 @@ +Width=260 +Title=MessageBox +Focusable=true +MinimumSize=150;80 diff --git a/Templates/MessageBox.goml b/Templates/MessageBox.goml index fe6ce620..68d1fa82 100644 --- a/Templates/MessageBox.goml +++ b/Templates/MessageBox.goml @@ -23,8 +23,8 @@ </HorizontalStack> <HorizontalStack Height="-1" Width="{../../../WidthPolicy}" Margin="3"> <GraphicObject Height="5"/> - <Button Caption="Ok"/> - <Button Caption="Cancel"/> + <Button Caption="Ok" MouseClick="onOkButtonClick"/> + <Button Caption="Cancel" MouseClick="onCancelButtonClick"/> </HorizontalStack> </VerticalStack> </Border> diff --git a/src/GraphicObjects/MessageBox.cs b/src/GraphicObjects/MessageBox.cs index 18c4afb3..cae43d9f 100644 --- a/src/GraphicObjects/MessageBox.cs +++ b/src/GraphicObjects/MessageBox.cs @@ -23,25 +23,17 @@ using System.ComponentModel; namespace Crow { + [DefaultStyle("#Crow.Styles.MessageBox.style")] [DefaultTemplate("#Crow.Templates.MessageBox.goml")] public class MessageBox : Window { public MessageBox ():base(){} - string title; string message; - [XmlAttributeAttribute][DefaultValue("Message box")] - public virtual string Title - { - get { return title; } - set { - if (title == value) - return; - title = value; - NotifyValueChanged ("Title", title); - } - } + public event EventHandler Ok; + public event EventHandler Cancel; + [XmlAttributeAttribute][DefaultValue("Informations")] public virtual string Message { @@ -53,30 +45,16 @@ namespace Crow NotifyValueChanged ("Message", message); } } - #region GraphicObject overrides - [XmlAttributeAttribute][DefaultValue(250)] - public override int Width { - get { return base.Width; } - set { base.Width = value; } - } -// [XmlAttributeAttribute][DefaultValue(80)] -// public override int Height { -// get { return base.Height; } -// set { base.Height = value; } -// } - [XmlAttributeAttribute()][DefaultValue(true)] - public override bool Focusable + + void onOkButtonClick (object sender, EventArgs e) { - get { return base.Focusable; } - set { base.Focusable = value; } + Ok.Raise (this, null); } - [XmlAttributeAttribute()][DefaultValue("150;80")] - public override Size MinimumSize + void onCancelButtonClick (object sender, EventArgs e) { - get { return base.MinimumSize; } - set { base.MinimumSize = value; } + Ok.Raise (this, null); } - #endregion + } } |