diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-02 12:19:06 +0100 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-02 12:19:06 +0100 |
| commit | 2b087282dd73152d21140ea7312a90e046c84f61 (patch) | |
| tree | 5d03225090e39c1d14465bdbaf1882e87026402b /src/GraphicObjects/Button.cs | |
| parent | 73b7c1d82226e4d10708e858a011991e3f598655 (diff) | |
Fix CRLF
Diffstat (limited to 'src/GraphicObjects/Button.cs')
| -rw-r--r-- | src/GraphicObjects/Button.cs | 210 |
1 files changed, 105 insertions, 105 deletions
diff --git a/src/GraphicObjects/Button.cs b/src/GraphicObjects/Button.cs index 17fbe328..5bf11f68 100644 --- a/src/GraphicObjects/Button.cs +++ b/src/GraphicObjects/Button.cs @@ -1,105 +1,105 @@ -using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-//using OpenTK.Graphics.OpenGL;
-
-using System.Diagnostics;
-
-using System.Xml.Serialization;
-using Cairo;
-using OpenTK.Input;
-using System.ComponentModel;
-
-namespace Crow
-{
- [DefaultTemplate("#Crow.Templates.Button.crow")]
- public class Button : TemplatedContainer
- {
- #region CTOR
- public Button() : base()
- {
- //MouseEnter += delegate { Background = Color.RedDevil;};
- //MouseLeave += delegate { Background = Color.Transparent;};
-// MouseButtonDown += delegate { BackImgSub = "pressed"; registerForGraphicUpdate();};
-// MouseButtonUp += delegate { BackImgSub = "normal";registerForGraphicUpdate();};
- }
- #endregion
-
- string caption;
- string image;
- Container _contentContainer;
-
- public override GraphicObject Content {
- get {
- return _contentContainer == null ? null : _contentContainer.Child;
- }
- set {
- if (_contentContainer != null)
- _contentContainer.SetChild(value);
- }
- }
- protected override void loadTemplate(GraphicObject template = null)
- {
- base.loadTemplate (template);
-
- _contentContainer = this.child.FindByName ("Content") as Container;
- }
-
- #region GraphicObject Overrides
-// [XmlAttributeAttribute()][DefaultValue(50)]
-// public override int Width {
-// get { return base.Width; }
-// set { base.Width = value; }
-// }
-// [XmlAttributeAttribute()][DefaultValue(20)]
-// public override int Height {
-// get { return base.Height; }
-// set { base.Height = value; }
-// }
- [XmlAttributeAttribute()][DefaultValue(true)]
- public override bool Focusable
- {
- get { return base.Focusable; }
- set { base.Focusable = value; }
- }
- public override void ResolveBindings ()
- {
- base.ResolveBindings ();
- if (Content != null)
- Content.ResolveBindings ();
- }
- public override void onMouseDown (object sender, MouseButtonEventArgs e)
- {
- base.onMouseDown (sender, e);
- NotifyValueChanged ("State", "pressed");
- }
- public override void onMouseUp (object sender, MouseButtonEventArgs e)
- {
- base.onMouseUp (sender, e);
- NotifyValueChanged ("State", "normal");
- }
- #endregion
-
- [XmlAttributeAttribute()][DefaultValue("Button")]
- public string Caption {
- get { return caption; }
- set {
- if (caption == value)
- return;
- caption = value;
- NotifyValueChanged ("Caption", caption);
- }
- }
- [XmlAttributeAttribute()][DefaultValue("#Crow.Images.button.svg")]
- public string Image {
- get { return image; }
- set {
- if (image == value)
- return;
- image = value;
- NotifyValueChanged ("Image", image);
- }
- }
- }
-}
+using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +//using OpenTK.Graphics.OpenGL; + +using System.Diagnostics; + +using System.Xml.Serialization; +using Cairo; +using OpenTK.Input; +using System.ComponentModel; + +namespace Crow +{ + [DefaultTemplate("#Crow.Templates.Button.crow")] + public class Button : TemplatedContainer + { + #region CTOR + public Button() : base() + { + //MouseEnter += delegate { Background = Color.RedDevil;}; + //MouseLeave += delegate { Background = Color.Transparent;}; +// MouseButtonDown += delegate { BackImgSub = "pressed"; registerForGraphicUpdate();}; +// MouseButtonUp += delegate { BackImgSub = "normal";registerForGraphicUpdate();}; + } + #endregion + + string caption; + string image; + Container _contentContainer; + + public override GraphicObject Content { + get { + return _contentContainer == null ? null : _contentContainer.Child; + } + set { + if (_contentContainer != null) + _contentContainer.SetChild(value); + } + } + protected override void loadTemplate(GraphicObject template = null) + { + base.loadTemplate (template); + + _contentContainer = this.child.FindByName ("Content") as Container; + } + + #region GraphicObject Overrides +// [XmlAttributeAttribute()][DefaultValue(50)] +// public override int Width { +// get { return base.Width; } +// set { base.Width = value; } +// } +// [XmlAttributeAttribute()][DefaultValue(20)] +// public override int Height { +// get { return base.Height; } +// set { base.Height = value; } +// } + [XmlAttributeAttribute()][DefaultValue(true)] + public override bool Focusable + { + get { return base.Focusable; } + set { base.Focusable = value; } + } + public override void ResolveBindings () + { + base.ResolveBindings (); + if (Content != null) + Content.ResolveBindings (); + } + public override void onMouseDown (object sender, MouseButtonEventArgs e) + { + base.onMouseDown (sender, e); + NotifyValueChanged ("State", "pressed"); + } + public override void onMouseUp (object sender, MouseButtonEventArgs e) + { + base.onMouseUp (sender, e); + NotifyValueChanged ("State", "normal"); + } + #endregion + + [XmlAttributeAttribute()][DefaultValue("Button")] + public string Caption { + get { return caption; } + set { + if (caption == value) + return; + caption = value; + NotifyValueChanged ("Caption", caption); + } + } + [XmlAttributeAttribute()][DefaultValue("#Crow.Images.button.svg")] + public string Image { + get { return image; } + set { + if (image == value) + return; + image = value; + NotifyValueChanged ("Image", image); + } + } + } +} |