aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2018-01-31 14:27:38 +0100
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2018-01-31 14:57:11 +0100
commite3a586148d084b7eea974bae4fa00a19fc547c28 (patch)
tree8b79dc07b700047b7bf541a8770ac40ec94f569d /src/GraphicObjects
parenteed1c7a49ada2b8146083b14ad2b568d503291af (diff)
:memo:
Diffstat (limited to 'src/GraphicObjects')
-rw-r--r--src/GraphicObjects/Border.cs18
-rw-r--r--src/GraphicObjects/Button.cs1
-rw-r--r--src/GraphicObjects/Expandable.cs17
-rw-r--r--src/GraphicObjects/GroupBox.cs6
-rw-r--r--src/GraphicObjects/Popper.cs28
-rw-r--r--src/GraphicObjects/PrivateContainer.cs2
-rw-r--r--src/GraphicObjects/TabItem.cs8
-rw-r--r--src/GraphicObjects/TemplatedContainer.cs2
-rw-r--r--src/GraphicObjects/TemplatedControl.cs27
-rw-r--r--src/GraphicObjects/Window.cs1
10 files changed, 79 insertions, 31 deletions
diff --git a/src/GraphicObjects/Border.cs b/src/GraphicObjects/Border.cs
index 6ac97d7f..a7c039c3 100644
--- a/src/GraphicObjects/Border.cs
+++ b/src/GraphicObjects/Border.cs
@@ -31,12 +31,18 @@ using System.Diagnostics;
namespace Crow
{
+ /// <summary>
+ /// provide an easy way to get 3d border for buttons
+ /// </summary>
public enum BorderStyle {
Normal,
Raised,
Sunken
};
+ /// <summary>
+ /// simple container with border
+ /// </summary>
public class Border : Container
{
#region CTOR
@@ -52,6 +58,9 @@ namespace Crow
#endregion
#region public properties
+ /// <summary>
+ /// use to define the colors of the 3d border
+ /// </summary>
[XmlAttributeAttribute]
public virtual Fill RaisedColor {
get { return raisedColor; }
@@ -63,6 +72,9 @@ namespace Crow
RegisterForRedraw ();
}
}
+ /// <summary>
+ /// use to define the colors of the 3d border
+ /// </summary>
[XmlAttributeAttribute]
public virtual Fill SunkenColor {
get { return sunkenColor; }
@@ -74,6 +86,9 @@ namespace Crow
RegisterForRedraw ();
}
}
+ /// <summary>
+ /// border width in pixels
+ /// </summary>
[XmlAttributeAttribute()][DefaultValue(1)]
public virtual int BorderWidth {
get { return _borderWidth; }
@@ -82,6 +97,9 @@ namespace Crow
RegisterForGraphicUpdate ();
}
}
+ /// <summary>
+ /// allow 3d border effects
+ /// </summary>
[XmlAttributeAttribute][DefaultValue(BorderStyle.Normal)]
public virtual BorderStyle BorderStyle {
get { return _borderStyle; }
diff --git a/src/GraphicObjects/Button.cs b/src/GraphicObjects/Button.cs
index 4f791ed9..f8697f91 100644
--- a/src/GraphicObjects/Button.cs
+++ b/src/GraphicObjects/Button.cs
@@ -47,7 +47,6 @@ namespace Crow
string image;
bool isPressed;
- Container _contentContainer;
public event EventHandler Pressed;
public event EventHandler Released;
diff --git a/src/GraphicObjects/Expandable.cs b/src/GraphicObjects/Expandable.cs
index 243caf06..2328fd5f 100644
--- a/src/GraphicObjects/Expandable.cs
+++ b/src/GraphicObjects/Expandable.cs
@@ -30,6 +30,9 @@ using System.Xml.Serialization;
namespace Crow
{
+ /// <summary>
+ /// templated control whose content can be hidden and shown on demand
+ /// </summary>
public class Expandable : TemplatedContainer
{
#region CTOR
@@ -40,21 +43,31 @@ namespace Crow
#region Private fields
bool _isExpanded;
string image;
- Container _contentContainer;
#endregion
#region Event Handlers
+ /// <summary>
+ /// Occurs when control is expanded.
+ /// </summary>
public event EventHandler Expand;
+ /// <summary>
+ /// Occurs when control is collapsed.
+ /// </summary>
public event EventHandler Collapse;
#endregion
public BooleanTestOnInstance GetIsExpandable;
+ /// <summary>
+ /// mouse click event handler for easy expand triggering in IML
+ /// </summary>
public void onClickForExpand (object sender, MouseButtonEventArgs e)
{
IsExpanded = !IsExpanded;
}
-
+ /// <summary>
+ /// Implement the abstract Content property of TemplatedControl
+ /// </summary>
public override GraphicObject Content {
get {
return _contentContainer == null ? null : _contentContainer.Child;
diff --git a/src/GraphicObjects/GroupBox.cs b/src/GraphicObjects/GroupBox.cs
index ad79231e..d843f993 100644
--- a/src/GraphicObjects/GroupBox.cs
+++ b/src/GraphicObjects/GroupBox.cs
@@ -31,15 +31,13 @@ using System.ComponentModel;
namespace Crow
{
public class GroupBox : TemplatedContainer
- {
- Container _contentContainer;
-
+ {
#region CTOR
public GroupBox () : base(){}
public GroupBox(Interface iface) : base(iface){}
#endregion
- #region Template overrides
+ #region TemplatedContainer implementation
public override GraphicObject Content {
get {
return _contentContainer == null ? null : _contentContainer.Child;
diff --git a/src/GraphicObjects/Popper.cs b/src/GraphicObjects/Popper.cs
index 9f60aa40..175c99fd 100644
--- a/src/GraphicObjects/Popper.cs
+++ b/src/GraphicObjects/Popper.cs
@@ -39,7 +39,7 @@ namespace Crow
bool _isPopped, _canPop;
Alignment popDirection;
- GraphicObject _content;
+ GraphicObject _contentContainer;
Measure popWidth, popHeight;
public event EventHandler Popped;
@@ -111,22 +111,22 @@ namespace Crow
#endregion
public override GraphicObject Content {
- get { return _content; }
+ get { return _contentContainer; }
set {
- if (_content != null) {
- _content.LogicalParent = null;
- _content.LayoutChanged -= _content_LayoutChanged;
+ if (_contentContainer != null) {
+ _contentContainer.LogicalParent = null;
+ _contentContainer.LayoutChanged -= _content_LayoutChanged;
}
- _content = value;
+ _contentContainer = value;
- if (_content == null)
+ if (_contentContainer == null)
return;
- _content.LogicalParent = this;
- _content.HorizontalAlignment = HorizontalAlignment.Left;
- _content.VerticalAlignment = VerticalAlignment.Top;
- _content.LayoutChanged += _content_LayoutChanged;
+ _contentContainer.LogicalParent = this;
+ _contentContainer.HorizontalAlignment = HorizontalAlignment.Left;
+ _contentContainer.VerticalAlignment = VerticalAlignment.Top;
+ _contentContainer.LayoutChanged += _content_LayoutChanged;
}
}
void positionContent(LayoutingType lt){
@@ -242,9 +242,9 @@ namespace Crow
protected override void Dispose (bool disposing)
{
- if (_content != null && disposing) {
- if (_content.Parent == null)
- _content.Dispose ();
+ if (_contentContainer != null && disposing) {
+ if (_contentContainer.Parent == null)
+ _contentContainer.Dispose ();
}
base.Dispose (disposing);
}
diff --git a/src/GraphicObjects/PrivateContainer.cs b/src/GraphicObjects/PrivateContainer.cs
index f25190ea..6eb5e95e 100644
--- a/src/GraphicObjects/PrivateContainer.cs
+++ b/src/GraphicObjects/PrivateContainer.cs
@@ -33,7 +33,7 @@ namespace Crow
{
/// <summary>
/// Implement drawing and layouting for a single child, but
- /// does not implement IXmlSerialisation to allow reuse of container
+ /// does not expose child to allow reuse of container
/// behaviour for widgets that have other xml hierarchy: example
/// TemplatedControl may have 3 children (template,templateItem,content) but
/// behave exactely as a container for layouting and drawing
diff --git a/src/GraphicObjects/TabItem.cs b/src/GraphicObjects/TabItem.cs
index 2b578d18..afafb0f1 100644
--- a/src/GraphicObjects/TabItem.cs
+++ b/src/GraphicObjects/TabItem.cs
@@ -39,9 +39,7 @@ namespace Crow
#endregion
#region Private fields
- string caption;
- Container _contentContainer;
- GraphicObject _tabTitle;
+ GraphicObject titleWidget;
int tabOffset;
bool isSelected;
Measure tabThickness;
@@ -67,9 +65,9 @@ namespace Crow
base.loadTemplate (template);
_contentContainer = this.child.FindByName ("Content") as Container;
- _tabTitle = this.child.FindByName ("TabTitle");
+ titleWidget = this.child.FindByName ("TabTitle");
}
- internal GraphicObject TabTitle { get { return _tabTitle; }}
+ internal GraphicObject TabTitle { get { return titleWidget; }}
#endregion
[XmlAttributeAttribute][DefaultValue("18")]
diff --git a/src/GraphicObjects/TemplatedContainer.cs b/src/GraphicObjects/TemplatedContainer.cs
index c219f9b6..02c14d38 100644
--- a/src/GraphicObjects/TemplatedContainer.cs
+++ b/src/GraphicObjects/TemplatedContainer.cs
@@ -38,6 +38,8 @@ namespace Crow
public TemplatedContainer (Interface iface) : base(iface){}
#endregion
+ protected Container _contentContainer;
+
[XmlAttributeAttribute]public virtual GraphicObject Content{ get; set;}
#region GraphicObject overrides
diff --git a/src/GraphicObjects/TemplatedControl.cs b/src/GraphicObjects/TemplatedControl.cs
index 6476265a..01ba22c2 100644
--- a/src/GraphicObjects/TemplatedControl.cs
+++ b/src/GraphicObjects/TemplatedControl.cs
@@ -37,6 +37,9 @@ using System.Reflection;
namespace Crow
{
+ /// <summary>
+ /// Base class for all templated widget
+ /// </summary>
public abstract class TemplatedControl : PrivateContainer
{
#region CTOR
@@ -64,6 +67,9 @@ namespace Crow
loadTemplate (CurrentInterface.Load (_template));
}
}
+ /// <summary>
+ /// caption property being recurrent in templated widget, it is declared here.
+ /// </summary>
[XmlAttributeAttribute()][DefaultValue("Templated Control")]
public virtual string Caption {
get { return caption; }
@@ -74,22 +80,33 @@ namespace Crow
NotifyValueChanged ("Caption", caption);
}
}
+
#region GraphicObject overrides
+
public override void Initialize ()
{
loadTemplate ();
base.Initialize ();
}
+ /// <summary>
+ /// override search method from GraphicObject to prevent
+ /// searching inside template
+ /// </summary>
+ /// <returns>widget identified by name, or null if not found</returns>
+ /// <param name="nameToFind">widget's name to find</param>
public override GraphicObject FindByName (string nameToFind)
{
//prevent name searching in template
return nameToFind == this.Name ? this : null;
}
+ /// <summary>
+ ///onDraw is overrided to prevent default drawing of background, template top container
+ ///may have a binding to root background or a fixed one.
+ ///this allow applying root background to random template's component
+ /// </summary>
+ /// <param name="gr">Backend context</param>
protected override void onDraw (Cairo.Context gr)
{
- //onDraw is overrided to prevent default drawing of background, template top container
- //may have a binding to root background or a fixed one.
- //this allow applying root background to random template's component
gr.Save ();
if (ClipToClientRect) {
@@ -104,6 +121,10 @@ namespace Crow
}
#endregion
+ /// <summary>
+ /// Loads the template.
+ /// </summary>
+ /// <param name="template">Optional template instance</param>
protected virtual void loadTemplate(GraphicObject template = null)
{
if (this.child != null)//template change, bindings has to be reset
diff --git a/src/GraphicObjects/Window.cs b/src/GraphicObjects/Window.cs
index d4087d02..336784e2 100644
--- a/src/GraphicObjects/Window.cs
+++ b/src/GraphicObjects/Window.cs
@@ -55,7 +55,6 @@ namespace Crow
Rectangle savedBounds;
bool _minimized = false;
- Container _contentContainer;
Direction currentDirection = Direction.None;
#region Events