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/Expandable.cs | |
| parent | 73b7c1d82226e4d10708e858a011991e3f598655 (diff) | |
Fix CRLF
Diffstat (limited to 'src/GraphicObjects/Expandable.cs')
| -rw-r--r-- | src/GraphicObjects/Expandable.cs | 260 |
1 files changed, 130 insertions, 130 deletions
diff --git a/src/GraphicObjects/Expandable.cs b/src/GraphicObjects/Expandable.cs index f1e2bdeb..f44e5e27 100644 --- a/src/GraphicObjects/Expandable.cs +++ b/src/GraphicObjects/Expandable.cs @@ -1,130 +1,130 @@ -using System;
-
-
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-//using OpenTK.Graphics.OpenGL;
-
-using Cairo;
-
-using winColors = System.Drawing.Color;
-using System.Diagnostics;
-using System.Xml.Serialization;
-using OpenTK.Input;
-using System.ComponentModel;
-using System.Xml;
-using System.IO;
-
-namespace Crow
-{
- [DefaultTemplate("#Crow.Templates.Expandable.goml")]
- public class Expandable : TemplatedContainer
- {
- bool _isExpanded;
- string caption;
- string image;
- Container _contentContainer;
-
- public event EventHandler Expand;
- public event EventHandler Collapse;
-
- public override GraphicObject Content {
- get {
- return _contentContainer == null ? null : _contentContainer.Child;
- }
- set {
- _contentContainer.SetChild(value);
- }
- }
-
- public Expandable() : base()
- {
- }
-
- protected override void loadTemplate(GraphicObject template = null)
- {
- base.loadTemplate (template);
-
- _contentContainer = this.child.FindByName ("Content") as Container;
- }
-
- [XmlAttributeAttribute()][DefaultValue(true)]//overiden to get default to true
- public override bool Focusable
- {
- get { return base.Focusable; }
- set { base.Focusable = value; }
- }
- [XmlAttributeAttribute()][DefaultValue(-1)]
- public override int Height {
- get { return base.Height; }
- set { base.Height = value; }
- }
-
- [XmlAttributeAttribute()][DefaultValue("Expandable")]
- public string Caption {
- get { return caption; }
- set {
- if (caption == value)
- return;
- caption = value;
- NotifyValueChanged ("Caption", caption);
- }
- }
- [XmlAttributeAttribute()][DefaultValue("#Crow.Images.Icons.expandable.svg")]
- public string Image {
- get { return image; }
- set {
- if (image == value)
- return;
- image = value;
- NotifyValueChanged ("Image", image);
- }
- }
- [XmlAttributeAttribute()][DefaultValue(false)]
- public bool IsExpanded
- {
- get { return _isExpanded; }
- set
- {
- _isExpanded = value;
-
- if (_isExpanded) {
- onExpand (this, null);
- NotifyValueChanged ("SvgSub", "expanded");
- return;
- }
-
- onCollapse (this, null);
- NotifyValueChanged ("SvgSub", "collapsed");
- }
- }
-
- public virtual void onExpand(object sender, EventArgs e)
- {
- if (_contentContainer != null)
- _contentContainer.Visible = true;
-
- Expand.Raise (this, e);
- }
- public virtual void onCollapse(object sender, EventArgs e)
- {
- if (_contentContainer != null)
- _contentContainer.Visible = false;
-
- Collapse.Raise (this, e);
- }
-
- public override void onMouseClick (object sender, MouseButtonEventArgs e)
- {
- IsExpanded = !IsExpanded;
- base.onMouseClick (sender, e);
- }
- public override void ResolveBindings ()
- {
- base.ResolveBindings ();
- if (Content != null)
- Content.ResolveBindings ();
- }
- }
-}
+using System; + + +using System.Collections.Generic; +using System.Linq; +using System.Text; +//using OpenTK.Graphics.OpenGL; + +using Cairo; + +using winColors = System.Drawing.Color; +using System.Diagnostics; +using System.Xml.Serialization; +using OpenTK.Input; +using System.ComponentModel; +using System.Xml; +using System.IO; + +namespace Crow +{ + [DefaultTemplate("#Crow.Templates.Expandable.goml")] + public class Expandable : TemplatedContainer + { + bool _isExpanded; + string caption; + string image; + Container _contentContainer; + + public event EventHandler Expand; + public event EventHandler Collapse; + + public override GraphicObject Content { + get { + return _contentContainer == null ? null : _contentContainer.Child; + } + set { + _contentContainer.SetChild(value); + } + } + + public Expandable() : base() + { + } + + protected override void loadTemplate(GraphicObject template = null) + { + base.loadTemplate (template); + + _contentContainer = this.child.FindByName ("Content") as Container; + } + + [XmlAttributeAttribute()][DefaultValue(true)]//overiden to get default to true + public override bool Focusable + { + get { return base.Focusable; } + set { base.Focusable = value; } + } + [XmlAttributeAttribute()][DefaultValue(-1)] + public override int Height { + get { return base.Height; } + set { base.Height = value; } + } + + [XmlAttributeAttribute()][DefaultValue("Expandable")] + public string Caption { + get { return caption; } + set { + if (caption == value) + return; + caption = value; + NotifyValueChanged ("Caption", caption); + } + } + [XmlAttributeAttribute()][DefaultValue("#Crow.Images.Icons.expandable.svg")] + public string Image { + get { return image; } + set { + if (image == value) + return; + image = value; + NotifyValueChanged ("Image", image); + } + } + [XmlAttributeAttribute()][DefaultValue(false)] + public bool IsExpanded + { + get { return _isExpanded; } + set + { + _isExpanded = value; + + if (_isExpanded) { + onExpand (this, null); + NotifyValueChanged ("SvgSub", "expanded"); + return; + } + + onCollapse (this, null); + NotifyValueChanged ("SvgSub", "collapsed"); + } + } + + public virtual void onExpand(object sender, EventArgs e) + { + if (_contentContainer != null) + _contentContainer.Visible = true; + + Expand.Raise (this, e); + } + public virtual void onCollapse(object sender, EventArgs e) + { + if (_contentContainer != null) + _contentContainer.Visible = false; + + Collapse.Raise (this, e); + } + + public override void onMouseClick (object sender, MouseButtonEventArgs e) + { + IsExpanded = !IsExpanded; + base.onMouseClick (sender, e); + } + public override void ResolveBindings () + { + base.ResolveBindings (); + if (Content != null) + Content.ResolveBindings (); + } + } +} |