<Folder Include="src\Input\" />
<Folder Include="src\rsvg\" />
<Folder Include="src\IML\" />
+ <Folder Include="Icons\" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Images\Icons\updown.svg" />
<EmbeddedResource Include="Images\Icons\maximize.svg" />
<EmbeddedResource Include="Images\Icons\minimize.svg" />
<EmbeddedResource Include="Images\Icons\normalize.svg" />
+ <EmbeddedResource Include="Icons\open-file.svg"/>
+ <EmbeddedResource Include="Icons\scissors.svg"/>
+ <EmbeddedResource Include="Icons\copy-file.svg"/>
+ <EmbeddedResource Include="Icons\exit-symbol.svg"/>
+ <EmbeddedResource Include="Icons\paste-on-document.svg"/>
+ <EmbeddedResource Include="Icons\question.svg"/>
</ItemGroup>
<ItemGroup>
<None Include="README.md" />
VerticalAlignment = Top;
}
MenuItem {
- Height = Fit;
- Width = Fit;
Background = Transparent;
Foreground = LightGray;
- Open = {Background = Mantis;Foreground=Jet;}
- Close = {Foreground=LightGray;Background=Transparent;}
+ MouseEnter = {Background = vgradient|0:UnitedNationsBlue|1:Onyx;Foreground=White;}
+ MouseLeave = {Foreground=LightGray;Background=Transparent;}
}
MessageBox {
Width=200;
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generated by IcoMoon.io -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16">
+<path fill="#FFFFFF" d="M13 3h-3l-3-3h-7v13h6v3h10v-10l-3-3zM7 1l2 2h-2v-2zM1 12v-11h5v3h3v8h-8zM15 15h-8v-2h3v-9h2v3h3v8zM13 6v-2l2 2h-2z"></path>
+</svg>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generated by IcoMoon.io -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16">
+<path fill="#FFFFFF" d="M14 6h-1.7c-0.2 0-0.4-0.1-0.6-0.2l-1.3-1.3c-0.2-0.3-0.6-0.5-1.1-0.5h-0.3c1.1 0 2-0.9 2-2s-0.9-2-2-2-2 0.9-2 2c0 0.7 0.4 1.4 1 1.7l-0.2 0.3h-2c-1.1 0-2.3 0.5-3 1.5l-0.6 0.8c-0.4 0.4-0.2 1 0.2 1.3 0.4 0.2 0.9 0.1 1.2-0.3l0.5-0.7c0.3-0.4 0.7-0.6 1.2-0.6h0.8l-0.7 1.6c-0.3 0.6-0.4 1.2-0.4 1.9v2c0 0.3-0.2 0.5-0.5 0.5h-2.5c-0.6 0-1 0.4-1 1s0.4 1 1 1h3.5c0.8 0 1.5-0.7 1.5-1.5v-2.5l3.8 4.5c0.6 0.9 1.7 1.5 2.8 1.5h0.9l-5.4-6.7c-0.3-0.4-0.2-0.8 0-1.3l0.6-1.5 0.7 0.8c0.4 0.4 1 0.7 1.6 0.7h2c0.6 0 1-0.4 1-1s-0.4-1-1-1z"></path>
+</svg>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generated by IcoMoon.io -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16">
+<path fill="#FFFFFF" d="M 4.0527344 0.24023438 L 4.0527344 2.1777344 L 1.9316406 2.1777344 L 0.93164062 4.1777344 L -0.068359375 4.1777344 L -0.068359375 15.177734 L 13.931641 15.177734 L 15.931641 6.1777344 L 13.759766 6.1777344 L 13.759766 3.4746094 L 10.525391 0.24023438 L 4.0527344 0.24023438 z M 4.8613281 1.0488281 L 9.7148438 1.0488281 L 9.7148438 4.2851562 L 12.951172 4.2851562 L 12.951172 6.1777344 L 4.8613281 6.1777344 L 4.8613281 1.0488281 z M 10.525391 1.0488281 L 12.951172 3.4746094 L 10.525391 3.4746094 L 10.525391 1.0488281 z M 2.53125 3.1777344 L 4.0527344 3.1777344 L 4.0527344 6.1777344 L 2.9316406 6.1777344 L 0.93164062 12.078125 L 0.93164062 5.1777344 L 1.53125 5.1777344 L 2.53125 3.1777344 z M 3.6328125 7.1777344 L 14.832031 7.1777344 L 13.232422 14.177734 L 1.3320312 14.078125 L 3.6328125 7.1777344 z "/>
+</svg>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generated by IcoMoon.io -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16">
+<path fill="#FFFFFF" d="M13 4h-3v-4h-10v14h6v2h10v-9l-3-3zM3 1h4v1h-4v-1zM15 15h-8v-10h5v3h3v7zM13 7v-2l2 2h-2z"></path>
+</svg>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generated by IcoMoon.io -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16">
+<path fill="#FFFFFF" d="M9 11h-3c0-3 1.6-4 2.7-4.6 0.4-0.2 0.7-0.4 0.9-0.6 0.5-0.5 0.3-1.2 0.2-1.4-0.3-0.7-1-1.4-2.3-1.4-2.1 0-2.5 1.9-2.5 2.3l-3-0.4c0.2-1.7 1.7-4.9 5.5-4.9 2.3 0 4.3 1.3 5.1 3.2 0.7 1.7 0.4 3.5-0.8 4.7-0.5 0.5-1.1 0.8-1.6 1.1-0.9 0.5-1.2 1-1.2 2z"></path>
+<path fill="#FFFFFF" d="M9.5 14c0 1.105-0.895 2-2 2s-2-0.895-2-2c0-1.105 0.895-2 2-2s2 0.895 2 2z"></path>
+</svg>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generated by IcoMoon.io -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16">
+<path fill="#FFFFFF" d="M16 3.1c0 0-2.1-1.1-3.5-1-0.3 0-0.5 0.1-0.7 0.2l-4.3 3.4-1.8-1.5c0.1-0.3 0.2-0.6 0.3-1 0.1-1.8-1.4-3.4-3.3-3.2-1.2 0.1-2.3 1-2.6 2.2-0.3 1.3 0.2 2.5 1.2 3.2l3.3 2.6-3.3 2.6c-1 0.7-1.5 1.9-1.2 3.2 0.3 1.2 1.4 2 2.6 2.2 1.9 0.2 3.4-1.4 3.2-3.2 0-0.3-0.1-0.7-0.3-1l1.8-1.5 4.3 3.4c0.2 0.1 0.4 0.2 0.7 0.2 1.4 0.1 3.5-1 3.5-1l-5.7-4.9 5.8-4.9zM2.8 4.6c-0.9-0.1-1.6-0.9-1.5-1.8s0.9-1.6 1.8-1.5c0.9 0.1 1.6 0.9 1.5 1.8 0 0.9-0.9 1.6-1.8 1.5zM3.1 14.7c-0.9 0.1-1.7-0.6-1.8-1.5s0.6-1.7 1.5-1.8c0.9-0.1 1.7 0.6 1.8 1.5s-0.6 1.7-1.5 1.8zM12.4 3.2c0 0 0.1 0 0.2 0 0.4 0 0.9 0.1 1.4 0.2l-6.8 5.7-0.9-1.1 6.1-4.8zM14 12.6c-0.5 0.2-1 0.3-1.4 0.2-0.1 0-0.2 0-0.2 0l-4-3.2 1-0.9 4.6 3.9z"></path>
+</svg>
<Image Margin="2" Width="14" Height="14"
Path="#Crow.Images.Icons.file.svg"/>
<Label Text="{Name}" Width="Stretched"
- MouseEnter="{Background=hgradient|0:BlueCrayola|1:Transparent}"
+ MouseEnter="{Background=vgradient|0:White|0.05:UnitedNationsBlue|1:Jet}"
MouseLeave="{Background=Transparent}"/>
</HorizontalStack>
</ItemTemplate>
<Template>
<VerticalStack>
<HorizontalStack Spacing="1" Height="Fit" MouseDoubleClick="./onClickForExpand"
- MouseEnter="{Background=hgradient|0:BlueCrayola|1:Transparent}"
+ MouseEnter="{Background=vgradient|0:White|0.05:UnitedNationsBlue|1:Jet}"
MouseLeave="{Background=Transparent}">
<Container Margin="1" Width="10" Height="10" Focusable="true" MouseClick="./onClickForExpand"
MouseEnter="{Background=LightGray}"
MinimumSize = "60,0"
Foreground="Transparent"
Background="{./Background}">
- <Label Text="{./Caption}"
- Foreground="{./Foreground}"
- Margin="1" HorizontalAlignment="Left"
- Font="{./Font}" />
+ <HorizontalStack>
+ <Image Style="Icon" Picture="{../../../../Icon}"/>
+ <Label Text="{./Caption}"
+ Foreground="{./Foreground}"
+ Margin="3" HorizontalAlignment="Left"
+ Font="{./Font}" />
+ </HorizontalStack>
</Border>
</Template>
<Border Foreground="DimGray" Fit="true">
- <VerticalStack Name="ItemsContainer" Margin="2" Fit="true" Background="Onyx"/>
+ <VerticalStack Name="ItemsContainer" Margin="0" Fit="true" Background="Onyx"/>
</Border>
</Popper>
#endregion
#region CTOR
- public Command ()
+ public Command (Action _executeAction)
{
+ execute = _executeAction;
}
#endregion
+ Action execute;
+
string caption;
+ Picture icon;
bool isEnabled;
-
- [XmlAttributeAttribute()][DefaultValue(true)]
+ #region Public properties
+ [XmlAttributeAttribute][DefaultValue(true)]
public virtual bool IsEnabled {
get { return isEnabled; }
set {
NotifyValueChanged ("IsEnabled", isEnabled);
}
}
- [XmlAttributeAttribute()][DefaultValue("Unamed Command")]
+ [XmlAttributeAttribute][DefaultValue("Unamed Command")]
public virtual string Caption {
get { return caption; }
set {
}
}
+ [XmlAttributeAttribute]
+ public Picture Icon {
+ get { return icon; }
+ set {
+ if (icon == value)
+ return;
+ icon = value;
+ NotifyValueChanged ("Icon", icon);
+ }
+ }
+ #endregion
+
+ public void Execute(){
+ if (execute != null)
+ execute ();
+ }
+ internal void raiseAllValuesChanged(){
+ NotifyValueChanged ("IsEnabled", isEnabled);
+ NotifyValueChanged ("Icon", icon);
+ NotifyValueChanged ("Caption", caption);
+ }
+
}
}
public event EventHandler Pressed;
public event EventHandler Released;
- public event EventHandler Clicked;
#region TemplatedContainer overrides
public override GraphicObject Content {
return _contentContainer == null ? null : _contentContainer.Child;
}
set {
- if (_contentContainer != null)
+ if (_contentContainer != null)
_contentContainer.SetChild(value);
}
}
[XmlAttributeAttribute][DefaultValue("Button")]
public string Caption {
- get { return caption; }
+ get { return caption; }
set {
if (caption == value)
return;
- caption = value;
+ caption = value;
NotifyValueChanged ("Caption", caption);
}
- }
+ }
[XmlAttributeAttribute][DefaultValue("#Crow.Images.button.svg")]
public string Image {
- get { return image; }
+ get { return image; }
set {
if (image == value)
return;
- image = value;
+ image = value;
NotifyValueChanged ("Image", image);
}
- }
+ }
[XmlAttributeAttribute][DefaultValue(false)]
public bool IsPressed
{
{
Picture _pic;
string _svgSub;
- bool scaled;
- [XmlAttributeAttribute()][DefaultValue(true)]
+ bool scaled, keepProps;
+
+ #region Public properties
+ [XmlAttributeAttribute][DefaultValue(true)]
public virtual bool Scaled {
get { return scaled; }
set {
if (scaled == value)
return;
- scaled = value;
+ scaled = value;
NotifyValueChanged ("Scaled", scaled);
if (_pic == null)
return;
_pic.Scaled = scaled;
RegisterForGraphicUpdate ();
}
- }
- bool keepProps;
- [XmlAttributeAttribute()][DefaultValue(true)]
+ }
+ [XmlAttributeAttribute][DefaultValue(true)]
public virtual bool KeepProportions {
get { return keepProps; }
set {
if (keepProps == value)
return;
- keepProps = value;
+ keepProps = value;
NotifyValueChanged ("KeepProportions", keepProps);
if (_pic == null)
return;
_pic.KeepProportions = keepProps;
RegisterForGraphicUpdate ();
}
- }
- [XmlAttributeAttribute("Path")]
+ }
+ [XmlAttributeAttribute]
public string Path {
- get { return _pic == null ? null : _pic.Path; }
- set {
+ get { return _pic == null ? "" : _pic.Path; }
+ set {
+ if (value == Path)
+ return;
try {
- if (string.IsNullOrEmpty(value)){
- _pic = null;
- return;
- }
- lock(CurrentInterface.LayoutMutex){
- LoadImage (value);
- _pic.Scaled = scaled;
- _pic.KeepProportions = keepProps;
+ if (string.IsNullOrEmpty(value))
+ Picture = null;
+ else {
+ lock(CurrentInterface.LayoutMutex){
+ LoadImage (value);
+ }
}
} catch (Exception ex) {
Debug.WriteLine (ex.Message);
_pic = null;
}
+ NotifyValueChanged ("Path", Path);
}
}
-
- [XmlAttributeAttribute()][DefaultValue(null)]
+ [XmlAttributeAttribute]
public string SvgSub {
get { return _svgSub; }
set {
+ if (_svgSub == value)
+ return;
_svgSub = value;
RegisterForGraphicUpdate ();
}
}
-
+ [XmlAttributeAttribute]
+ public Picture Picture {
+ get { return _pic; }
+ set {
+ if (_pic == value)
+ return;
+ _pic = value;
+ NotifyValueChanged ("Picture", _pic);
+ RegisterForGraphicUpdate ();
+ }
+ }
+ #endregion
+
#region CTOR
public Image () : base()
{
#region Image Loading
public void LoadImage (string path)
{
+ Picture pic;
+ if (path.EndsWith (".svg", true, System.Globalization.CultureInfo.InvariantCulture))
+ pic = new SvgPicture ();
+ else
+ pic = new BmpPicture ();
- if (path.EndsWith (".svg", true, System.Globalization.CultureInfo.InvariantCulture))
- _pic = new SvgPicture ();
- else
- _pic = new BmpPicture ();
+ pic.LoadImage (path);
+ pic.Scaled = scaled;
+ pic.KeepProportions = keepProps;
- _pic.LoadImage (path);
- RegisterForGraphicUpdate ();
+ Picture = pic;
}
#endregion
protected override int measureRawSize (LayoutingType lt)
{
if (_pic == null)
- _pic = "#Crow.Images.Icons.IconAlerte.svg";
+ return 2 * Margin;
+ //_pic = "#Crow.Images.Icons.IconAlerte.svg";
//TODO:take scalling in account
if (lt == LayoutingType.Width)
return _pic.Dimensions.Width + 2 * Margin;
else
- return _pic.Dimensions.Height + 2 * Margin;
+ return _pic.Dimensions.Height + 2 * Margin;
}
protected override void onDraw (Context gr)
{
#endregion
Orientation orientation;
+ bool autoOpen = false;
- [XmlAttributeAttribute()][DefaultValue(Orientation.Horizontal)]
+ #region Public properties
+ [XmlAttributeAttribute][DefaultValue(Orientation.Horizontal)]
public Orientation Orientation {
get { return orientation; }
set {
NotifyValueChanged ("Orientation", orientation);
}
}
- bool autoOpen = false;
[XmlIgnore]public bool AutomaticOpenning
{
get { return autoOpen; }
set { autoOpen = value; }
}
+ #endregion
public override void AddItem (GraphicObject g)
{
public event EventHandler Open;
public event EventHandler Close;
- public event EventHandler Execute;
string caption;
- Command command;//TODO
+ Command command;
+ Picture icon;
bool isOpened;
+ Measure popWidth, popHeight;
+ #region Public properties
[XmlAttributeAttribute][DefaultValue(false)]
public bool IsOpened {
get { return isOpened; }
onClose (this, null);
}
}
-
[XmlAttributeAttribute][DefaultValue(null)]
public virtual Command Command {
get { return command; }
set {
if (command == value)
return;
+
+ if (command != null) {
+ command.raiseAllValuesChanged ();
+ command.ValueChanged -= Command_ValueChanged;
+ }
+
command = value;
+
+ if (command != null) {
+ command.ValueChanged += Command_ValueChanged;
+ command.raiseAllValuesChanged ();
+ }
+
NotifyValueChanged ("Command", command);
}
}
-
[XmlAttributeAttribute][DefaultValue("MenuItem")]
public string Caption {
- get { return caption; }
+ get { return Command == null ? caption : Command.Caption; }
set {
if (caption == value)
return;
caption = value;
- NotifyValueChanged ("Caption", caption);
+
+ if (command == null)//raise value changed only if not bound to a command
+ NotifyValueChanged ("Caption", caption);
+ }
+ }
+ [XmlAttributeAttribute]
+ public Picture Icon {
+ get { return Command == null ? icon : Command.Icon;; }
+ set {
+ if (icon == value)
+ return;
+ icon = value;
+ if (command == null)
+ NotifyValueChanged ("Icon", icon);
}
}
-
+ [XmlAttributeAttribute()][DefaultValue("Fit")]
+ public virtual Measure PopWidth {
+ get { return popWidth; }
+ set {
+ if (popWidth == value)
+ return;
+ popWidth = value;
+ NotifyValueChanged ("PopWidth", popWidth);
+ }
+ }
+ [XmlAttributeAttribute()][DefaultValue("Fit")]
+ public virtual Measure PopHeight {
+ get { return popHeight; }
+ set {
+ if (popHeight == value)
+ return;
+ popHeight = value;
+ NotifyValueChanged ("PopHeight", popHeight);
+ }
+ }
+ #endregion
+
public override void AddItem (GraphicObject g)
{
base.AddItem (g);
g.NotifyValueChanged ("PopDirection", Alignment.Right);
}
+ void Command_ValueChanged (object sender, ValueChangeEventArgs e)
+ {
+ NotifyValueChanged (e.MemberName, e.NewValue);
+ }
void onMI_Click (object sender, MouseButtonEventArgs e)
{
- Execute.Raise (this, null);
+ if (command != null)
+ command.Execute ();
if(!IsOpened)
(LogicalParent as Menu).AutomaticOpenning = false;
}
string caption;
Alignment popDirection;
GraphicObject _content;
+ Measure popWidth, popHeight;
public event EventHandler Pop;
public event EventHandler Unpop;
NotifyValueChanged ("Caption", caption);
}
}
+ [XmlAttributeAttribute()][DefaultValue("Fit")]
+ public virtual Measure PopWidth {
+ get { return popWidth; }
+ set {
+ if (popWidth == value)
+ return;
+ popWidth = value;
+ NotifyValueChanged ("PopWidth", popWidth);
+ }
+ }
+ [XmlAttributeAttribute()][DefaultValue("Fit")]
+ public virtual Measure PopHeight {
+ get { return popHeight; }
+ set {
+ if (popHeight == value)
+ return;
+ popHeight = value;
+ NotifyValueChanged ("PopHeight", popHeight);
+ }
+ }
[XmlAttributeAttribute()][DefaultValue(false)]
public bool IsPopped
{
}
#region GraphicObject overrides
- public override void OnLayoutChanges (LayoutingType layoutType)
- {
- base.OnLayoutChanges (layoutType);
-
- if (_content == null)
- return;
-
- if (layoutType == LayoutingType.Width)
- _content.MinimumSize = new Size (this.Slot.Width, _content.MinimumSize.Height);
- }
-
-
public override void onMouseClick (object sender, MouseButtonEventArgs e)
{
if (_canPop)