<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
- <DefineConstants>DEBUG_UPDATE0;DEBUG_FOCUS0;DEBUG_LAYOUTING0;TRACE0;DEBUG;MEASURE_TIME;DEBUG_LOAD0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0</DefineConstants>
+ <DefineConstants>DEBUG_UPDATE0;DEBUG_FOCUS0;DEBUG_LAYOUTING0;TRACE0;DEBUG;MEASURE_TIME;DEBUG_LOAD0;DEBUG_BINDING;DEBUG_CLIP_RECTANGLE0</DefineConstants>
<Optimize>false</Optimize>
+ <OutputPath>$(SolutionDir)build\Debug</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
<DefineConstants>__linux__</DefineConstants>
+ <OutputPath>$(SolutionDir)build\Release</OutputPath>
</PropertyGroup>
<ItemGroup>
<Compile Include="src\Colors.cs" />
<Compile Include="src\IML\IMLContext.cs" />
<Compile Include="src\Mono.Cairo\MeshPattern.cs" />
<Compile Include="src\GraphicObjects\Shape.cs" />
+ <Compile Include="src\GraphicObjects\MDIContainer.cs" />
+ <Compile Include="src\IListChanged.cs" />
+ <Compile Include="src\ObservableList.cs" />
+ <Compile Include="src\GraphicObjects\IMLContainer.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CrowIDE", "CrowIDE\CrowIDE.csproj", "{B6D911CD-1D09-42FC-B300-9187190F2AE1}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Crow.Coding", "..\gts\CrowEdit\Crow.Coding\Crow.Coding.csproj", "{78842EE4-8A2F-4C75-AEC6-C95F15AD3994}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
{74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{74289092-9F70-4941-AFCB-DFD7BE2140B6}.Release|Any CPU.Build.0 = Release|Any CPU
{B6D911CD-1D09-42FC-B300-9187190F2AE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B6D911CD-1D09-42FC-B300-9187190F2AE1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B6D911CD-1D09-42FC-B300-9187190F2AE1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B6D911CD-1D09-42FC-B300-9187190F2AE1}.Release|Any CPU.Build.0 = Release|Any CPU
{C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C2980F9B-4798-4C05-99E2-E174810F7C7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C2980F9B-4798-4C05-99E2-E174810F7C7B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {78842EE4-8A2F-4C75-AEC6-C95F15AD3994}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {78842EE4-8A2F-4C75-AEC6-C95F15AD3994}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {78842EE4-8A2F-4C75-AEC6-C95F15AD3994}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {78842EE4-8A2F-4C75-AEC6-C95F15AD3994}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
Policies = $0
$0.StandardHeader = $1
$1.Text = @\n${FileName}\n \nAuthor:\n ${AuthorName} <${AuthorEmail}>\n\nCopyright (c) 2013-2017 Jean-Philippe Bruyère\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the "Software"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.
- $1.IncludeInNewFiles = True
$0.DotNetNamingPolicy = $2
- $2.DirectoryNamespaceAssociation = None
- $2.ResourceNamePolicy = FileFormatDefault
$0.TextStylePolicy = $3
- $3.FileWidth = 120
- $3.TabsToSpaces = False
$3.EolMarker = Unix
- $3.inheritsSet = VisualStudio
- $3.inheritsScope = text/plain
$3.scope = text/x-csharp
$0.CSharpFormattingPolicy = $4
$4.AfterDelegateDeclarationParameterComma = True
- $4.inheritsSet = Mono
- $4.inheritsScope = text/x-csharp
$4.scope = text/x-csharp
+ $4.IndentSwitchSection = False
+ $4.NewLinesForBracesInProperties = False
+ $4.NewLinesForBracesInAccessors = False
+ $4.NewLinesForBracesInAnonymousMethods = False
+ $4.NewLinesForBracesInControlBlocks = False
+ $4.NewLinesForBracesInAnonymousTypes = False
+ $4.NewLinesForBracesInObjectCollectionArrayInitializers = False
+ $4.NewLinesForBracesInLambdaExpressionBody = False
+ $4.NewLineForElse = False
+ $4.NewLineForCatch = False
+ $4.NewLineForFinally = False
+ $4.NewLineForMembersInObjectInit = False
+ $4.NewLineForMembersInAnonymousTypes = False
+ $4.NewLineForClausesInQuery = False
+ $4.SpacingAfterMethodDeclarationName = True
+ $4.SpaceAfterMethodCallName = True
+ $4.SpaceBeforeOpenSquareBracket = True
$0.VersionControlPolicy = $5
$5.CommitMessageStyle = $6
$6.Indent = @\t
$6.LastFilePostfix = "@:\n "
$6.LineAlign = 0
$6.Wrap = False
- $5.inheritsSet = Mono
description = @C.R.O.W. c# Rapid Open Widgets\n\nCrow is a pure c# widget toolkit with XML definition of interface, bindings, styling...\n
version = 0.5
EndGlobalSection
Focusable=true;
Foreground=Jet;
Background=hgradient|0:Gray|1:Jet;
- MouseDown={Background=hgradient|0:White|0.2:BlueCrayola|1:Jet};
+ MouseDown={Background=hgradient|0:White|0.4:BlueCrayola|1:Jet};
MouseUp={Background=hgradient|0:Gray|1:Jet};
MouseEnter={Foreground=Black};
MouseLeave={Foreground=Jet};
Width="128" Height="128"/>
<HueSelector Hue="{²./H}" Focusable="true" Name="hueSelector" Margin="0" Width="128" Height="20"/>
</VerticalStack>
- <VerticalStack Margin="5" Spacing="0">
+ <VerticalStack Margin="5" Spacing="1">
<GraphicObject Width="34" Height="21" Background="{./SelectedColor}"/>
<Label Focusable="true" Selectable="true" Width="Stretched" Text="{./HexColor}" />
<HorizontalStack Height="Fit">
<?xml version="1.0"?>
-<HorizontalStack MinimumSize="40,10" Name="hstack" Margin="0" Spacing="0">
- <Border BorderWidth="1" Width="80%" Background="White"
+<HorizontalStack MinimumSize="40,13" Name="hstack" Margin="0" Spacing="0">
+ <Border BorderWidth="1" Width="75%" Background="White"
Foreground="{./Foreground}" Margin="0">
<TextBox Foreground="{./Foreground}" Font="{./Font}" Width="Stretched"
Text="{²./Value}" TextAlignment="Right" Margin="0"/>
</Border>
- <VerticalStack MinimumSize="8,10" Width="20%" Height="Stretched" Spacing="0" Margin="0" Background="Red">
- <Button MouseRepeat="true" Width="Stretched" Height="50%" Margin="0" MouseClick="./onUp"
- Template="#Crow.Templates.ArrowBut.template">
- <Image Path="#Crow.Images.Icons.updown.svg" SvgSub="up" Margin="0"/>
- </Button>
- <Button MouseRepeat="true" Width="Stretched" Height="50%" Margin="0" MouseClick="./onDown"
- Template="#Crow.Templates.ArrowBut.template">
- <Image Path="#Crow.Images.Icons.updown.svg" SvgSub="down" Margin="0"/>
- </Button>
+ <VerticalStack MinimumSize="13,13" Width="25%" Height="Stretched" Spacing="0" Margin="0">
+ <Shape Style="ArrowBut" Height="50%" MouseClick="./onUp" Path="M 5.5,0.5 L 10.5,6.5 L 0.5,6.5 Z"/>
+ <Shape Style="ArrowBut" Height="50%" MouseClick="./onDown" Path="M 0.5,0.5 L 10.5,0.5 L 5.5,6.5 Z"/>
</VerticalStack>
</HorizontalStack>
//testFiles = new string [] { @"Interfaces/Unsorted/testFileDialog.crow" };
//testFiles = new string [] { @"Interfaces/Divers/colorPicker.crow" };
- testFiles = new string [] { @"Interfaces/Divers/welcome.crow" };
+ //testFiles = new string [] { @"Interfaces/Divers/welcome.crow" };
+ //testFiles = new string [] { @"Interfaces/TemplatedContainer/testTabView.crow" };
+ testFiles = new string [] { @"Interfaces/TemplatedControl/testSpinner.crow" };
testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/GraphicObject", "*.crow")).ToArray ();
testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Container", "*.crow")).ToArray ();
testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Group", "*.crow")).ToArray ();
GraphicObject obj = Load (testFiles[idx]);
obj.DataSource = this;
} catch (Exception ex) {
- MessageBox.Show (MessageBox.Type.Error, ex.Message + "\n" + ex.InnerException);
+ MessageBox.Show (CurrentInterface, MessageBox.Type.Error, ex.Message + "\n" + ex.InnerException);
}
}
// void Tv_SelectedItemChanged (object sender, SelectionChangeEventArgs e)
addInterfaceControler (tmp);
return tmp;
}
+ public GraphicObject AddWidget (string path)
+ {
+ GraphicObject tmp = Load (path);
+ return tmp;
+ }
public GraphicObject AddWidget (GraphicObject g, int interfaceIdx = 0){
- if (ifaceControl.Count == 0)//create default orthogonal interface
- addInterfaceControler (new InterfaceControler (
- new Rectangle (0, 0, this.ClientRectangle.Width, this.ClientRectangle.Height)));
+ checkDefaultIFace ();
ifaceControl [interfaceIdx].CrowInterface.AddWidget (g);
return g;
}
--- /dev/null
+<?xml version="1.0"?>
+<GenericStack Orientation="Vertical" Spacing="0"
+ Background="Onyx"
+ MouseEnter="{caption.Foreground=White}"
+ MouseLeave="{caption.Foreground=Gray}">
+ <HorizontalStack Margin="2" Left="{./TabOffset}"
+ Name="TabTitle"
+ HorizontalAlignment="Left"
+ Height="{./TabThickness}"
+ Width="Fit">
+ <Label Name="caption" Text="{./Caption}" Foreground="Gray"/>
+ <Label Text="{./ViewIndex}" Foreground="Green"/>
+ <Label Text="{./TabOffset}" Foreground="Red"/>
+ <Border CornerRadius="5" BorderWidth="1" Foreground="Transparent" Height="12" Width="12"
+ MouseEnter="{Foreground=White}" MouseLeave="{Foreground=Transparent}">
+ <Image Focusable="true" Name="Image" Margin="0" Width="Stretched" Height="Stretched" Path="#Crow.Images.Icons.exit2.svg"
+ MouseClick="./butCloseTabClick"/>
+ </Border>
+ </HorizontalStack>
+ <Container Name="Content"/>
+</GenericStack>
+
<?xml version="1.0" encoding="UTF-8" ?>
<VerticalStack Height="50%" Width="80%">
+ <HorizontalStack Height="Fit">
+ <Label Text="Selected Tab:"/>
+ <Label Text="{../../tabview1.SelectedTab}"/>
+ </HorizontalStack>
<TabView Name="tabview1" Orientation="Horizontal" Spacing="24">
<TabItem Name="TabItem1" Caption="tab item 1">
<VerticalStack Margin="20">
<RadioButton/>
</VerticalStack>
</TabItem>
- <TabItem Name="TabItem2" Caption="tab item 3" Background="Gray">
+ <TabItem Name="TabItem3" Caption="tab item 3" Background="Gray">
<Container Margin="5" CornerRadius="2" >
<TextBox Margin="5" Multiline="true" TextAlignment="TopLeft"/>
</Container>
</TabItem>
- <TabItem Name="TabItem2" Caption="tab item 4" Margin="0" Background="Gray">
+ <TabItem Name="TabItem4" Caption="tab item 4" Margin="0" Background="Gray">
<TextBox/>
</TabItem>
</TabView>
<Spinner Value="5"/>
<Button/>
</HorizontalStack>
+ <IMLContainer Path="Interfaces/Divers/colorPicker.crow"/>
</VerticalStack>
\ No newline at end of file
<OutputType>Exe</OutputType>
<RootNamespace>Tests</RootNamespace>
<AssemblyName>Tests</AssemblyName>
- <StartupObject>Tests.Showcase</StartupObject>
+ <StartupObject>Tests.BasicTests</StartupObject>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ReleaseVersion>0.5</ReleaseVersion>
<StartWorkingDirectory>%24{SolutionDir}\build\%24{ProjectConfigName}</StartWorkingDirectory>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
+ <PropertyGroup Condition=" '$(RunConfiguration)' == 'Custom Command' ">
+ <StartAction>Program</StartAction>
+ <StartProgram>%24{TargetName}</StartProgram>
+ <StartWorkingDirectory>%24{SolutionDir}\build\%24{ProjectConfigName}</StartWorkingDirectory>
+ <ConsolePause>false</ConsolePause>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(RunConfiguration)' == 'Custom Command' ">
+ <StartAction>Program</StartAction>
+ <StartProgram>%24{TargetName}</StartProgram>
+ <StartWorkingDirectory>%24{SolutionDir}\build\%24{ProjectConfigName}</StartWorkingDirectory>
+ <ConsolePause>false</ConsolePause>
+ </PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<EmbeddedResource Include="Tutorials\test.crow">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
+ <EmbeddedResource Include="Interfaces\TabItem.template">
+ <LogicalName>Crow.TabItem.template</LogicalName>
+ </EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Crow.csproj">
this.RegisterForRedraw ();
}
}
+ #if DEBUG
+ [XmlIgnore]public string TreePath {
+ get { return this.GetType().Name + uid.ToString (); }
+ }
+ #endif
/// <summary>
/// Name is used in binding to reference other GraphicObjects inside the graphic tree
/// and by template controls to find special element in their template implementation such
OnDataSourceChanged (this, e);
}
internal bool localDataSourceIsNull { get { return dataSource == null; } }
- internal bool localLogicalParentIsNull { get { return logicalParent == null; } }
+ public bool localLogicalParentIsNull { get { return logicalParent == null; } }
public virtual void OnDataSourceChanged(object sender, DataSourceChangeEventArgs e){
DataSourceChanged.Raise (this, e);
public class Group : GraphicObject
{
#region CTOR
- protected Group () : base(){}
+ public Group () : base() {}
public Group(Interface iface) : base(iface){}
#endregion
this.RegisterForLayouting (LayoutingType.Sizing | LayoutingType.ArrangeChildren);
}
+ public virtual void InsertChild (int idx, GraphicObject g) {
+ lock (children) {
+ g.Parent = this;
+ Children.Insert (idx, g);
+ }
+ g.RegisteredLayoutings = LayoutingType.None;
+ g.LayoutChanged += OnChildLayoutChanges;
+ g.RegisterForLayouting (LayoutingType.Sizing | LayoutingType.ArrangeChildren);
+ }
+ public virtual void RemoveChild (int idx) {
+ RemoveChild (children[idx]);
+ }
public virtual void ClearChildren()
{
lock (children) {
--- /dev/null
+//
+// IMLContainer.cs
+//
+// Author:
+// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// Copyright (c) 2013-2017 Jean-Philippe Bruyère
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+
+namespace Crow
+{
+ public class IMLContainer : PrivateContainer
+ {
+ public IMLContainer () : base()
+ {
+ }
+
+ string path;
+
+ public string Path {
+ get { return path; }
+ set {
+ if (path == value)
+ return;
+ path = value;
+ this.SetChild (CurrentInterface.Load (path));
+ NotifyValueChanged ("Path", path);
+ }
+ }
+ }
+}
+
--- /dev/null
+//
+// MDIContainer.cs
+//
+// Author:
+// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// Copyright (c) 2013-2017 Jean-Philippe Bruyère
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+
+namespace Crow
+{
+ public class MDIContainer : Group
+ {
+ #region CTOR
+ public MDIContainer () : base()
+ {
+ }
+ #endregion
+
+ }
+}
+
Cancel.Raise (this, null);
close ();
}
- public static MessageBox Show (Type msgBoxType, string message, string okMsg = "", string cancelMsg = ""){
+ public static MessageBox Show (Interface iface, Type msgBoxType, string message, string okMsg = "", string cancelMsg = ""){
//lock (Interface.CurrentInterface.UpdateMutex) {
- MessageBox mb = new MessageBox (Interface.CurrentInterface);
+ MessageBox mb = new MessageBox (iface);
mb.CurrentInterface.AddWidget (mb);
mb.MsgType = msgBoxType;
mb.Message = message;
protected GraphicObject child;
- internal virtual void SetChild(GraphicObject _child)
+ protected virtual void SetChild(GraphicObject _child)
{
if (child != null) {
public override void checkHoverWidget (MouseMoveEventArgs e)
{
base.checkHoverWidget (e);
+
if (child != null)
if (child.MouseIsIn (e.Position))
child.checkHoverWidget (e);
using System.ComponentModel;
using System.Diagnostics;
using Cairo;
+using System.Linq;
namespace Crow
{
public TabItem (Interface iface) : base(iface){}
#endregion
+ public event EventHandler QueryClose;
+
#region Private fields
GraphicObject titleWidget;
int tabOffset;
internal GraphicObject TabTitle { get { return titleWidget; }}
#endregion
+ /// <summary>
+ /// order of redrawing, items can't be reordered in TemplatedGroup due to data linked, so we need another index
+ /// instead of children list order
+ /// </summary>
+ public int viewIndex = 0;
+ public virtual int ViewIndex {
+ get { return viewIndex; }
+ set {
+ if (viewIndex == value)
+ return;
+ viewIndex = value;
+ NotifyValueChanged ("ViewIndex", viewIndex);
+ }
+ }
+
[XmlAttributeAttribute][DefaultValue("18")]
public virtual Measure TabThickness {
get { return tabThickness; }
gr.LineTo (Slot.Width-0.5, Slot.Height-0.5);
gr.LineTo (0.5, Slot.Height-0.5);
gr.ClosePath ();
- gr.LineWidth = 2;
+ gr.LineWidth = 1;
Foreground.SetAsSource (gr);
gr.StrokePreserve ();
}
#region Mouse Handling
+ public bool HoldCursor = false;
+
public override bool MouseIsIn (Point m)
{
if (!(Visible & IsEnabled) || IsDragged)
return _contentContainer.ScreenCoordinates (_contentContainer.Slot).ContainsOrIsEqual (m)
|| mouseIsInTitle;
}
- bool holdCursor = false;
public override void onMouseDown (object sender, MouseButtonEventArgs e)
{
base.onMouseDown (sender, e);
- holdCursor = true;
+ HoldCursor = true;
}
public override void onMouseUp (object sender, MouseButtonEventArgs e)
{
base.onMouseUp (sender, e);
- holdCursor = false;
+ HoldCursor = false;
(Parent as TabView).UpdateLayout (LayoutingType.ArrangeChildren);
}
public override void onMouseMove (object sender, MouseMoveEventArgs e)
{
base.onMouseMove (sender, e);
- if (!(HasFocus&&holdCursor))
+ if (!(HasFocus && HoldCursor))
return;
TabView tv = Parent as TabView;
TabItem previous = null, next = null;
else if (tmp > Parent.getSlot ().Width - TabTitle.Slot.Width - tv.Spacing)
TabOffset = Parent.getSlot ().Width - TabTitle.Slot.Width - tv.Spacing;
else{
- int idx = tv.Children.IndexOf (this);
- if (idx > 0 && e.XDelta < 0) {
- previous = tv.Children [idx - 1] as TabItem;
-
+ TabItem[] tabItms = tv.Children.Cast<TabItem>().OrderBy (t=>t.ViewIndex).ToArray();
+ if (ViewIndex > 0 && e.XDelta < 0) {
+ previous = tabItms [ViewIndex - 1];
if (tmp < previous.TabOffset + previous.TabTitle.Slot.Width / 2) {
- tv.Children.RemoveAt (idx);
- tv.Children.Insert (idx - 1, this);
- tv.SelectedTab = idx - 1;
+ previous.ViewIndex = ViewIndex;
+ ViewIndex--;
tv.UpdateLayout (LayoutingType.ArrangeChildren);
}
- }else if (idx < tv.Children.Count - 1 && e.XDelta > 0) {
- next = tv.Children [idx + 1] as TabItem;
+ }else if (ViewIndex < tabItms.Length - 1 && e.XDelta > 0) {
+ next = tabItms [ViewIndex + 1];
if (tmp > next.TabOffset - next.TabTitle.Slot.Width / 2){
- tv.Children.RemoveAt (idx);
- tv.Children.Insert (idx + 1, this);
- tv.SelectedTab = idx + 1;
+ next.ViewIndex = ViewIndex;
+ ViewIndex++;
tv.UpdateLayout (LayoutingType.ArrangeChildren);
}
}
TabOffset = tmp;
}
}
- public void butCloseTabClick (object sender, MouseButtonEventArgs e){
- (Parent as TabView).RemoveChild(this);
+ public void butCloseTabClick (object sender, MouseButtonEventArgs e){
+ QueryClose.Raise (this, null);
}
#endregion
using System.ComponentModel;
using Cairo;
using System.Diagnostics;
+using System.Linq;
namespace Crow
{
public class TabView : Group
{
#region CTOR
- protected TabView() : base(){}
+ public TabView() : base(){}
public TabView (Interface iface) : base(iface){}
#endregion
int selectedTab = 0;
#endregion
-
#region public properties
[XmlAttributeAttribute()][DefaultValue(Orientation.Horizontal)]
public virtual Orientation Orientation
}
#endregion
+ void Ti_TabTitle_LayoutChanged (object sender, LayoutingEventArgs e)
+ {
+ if (e.LayoutType == LayoutingType.Width)
+ this.RegisterForLayouting (LayoutingType.ArrangeChildren);
+ }
+
public override void AddChild (GraphicObject child)
{
TabItem ti = child as TabItem;
throw new Exception ("TabView control accept only TabItem as child.");
ti.MouseDown += Ti_MouseDown;
-
- if (Children.Count == 0) {
- ti.IsSelected = true;
- SelectedTab = 0;
- }
+ ti.TabTitle.LayoutChanged += Ti_TabTitle_LayoutChanged;
base.AddChild (child);
+
+ SelectedTab = ti.ViewIndex = Children.Count - 1;
}
+
public override void RemoveChild (GraphicObject child)
{
- base.RemoveChild (child);
- if (selectedTab > Children.Count - 1)
+ TabItem ti = child as TabItem;
+ if (ti == null)
+ throw new Exception ("TabView control accept only TabItem as child.");
+
+ ti.MouseDown -= Ti_MouseDown;
+ ti.TabTitle.LayoutChanged -= Ti_TabTitle_LayoutChanged;
+
+ if (selectedTab > Children.Count - 2)
SelectedTab--;
- else
- SelectedTab = selectedTab;
+
+ base.RemoveChild (child);
}
+
public override bool ArrangeChildren { get { return true; } }
public override bool UpdateLayout (LayoutingType layoutType)
{
if (layoutType == LayoutingType.ArrangeChildren) {
int curOffset = Spacing;
- for (int i = 0; i < Children.Count; i++) {
- if (!Children [i].Visible)
+ TabItem[] tabItms = Children.Cast<TabItem>().OrderBy (t=>t.ViewIndex).ToArray();
+ for (int i = 0; i < tabItms.Length; i++) {
+ if (!tabItms [i].Visible)
continue;
- TabItem ti = Children [i] as TabItem;
- ti.TabOffset = curOffset;
+ if (!tabItms [i].HoldCursor)
+ tabItms [i].TabOffset = curOffset;
if (Orientation == Orientation.Horizontal) {
- if (ti.TabTitle.RegisteredLayoutings.HasFlag (LayoutingType.Width))
+ if (tabItms [i].TabTitle.RegisteredLayoutings.HasFlag (LayoutingType.Width))
return false;
- curOffset += ti.TabTitle.Slot.Width + Spacing;
+ curOffset += tabItms [i].TabTitle.Slot.Width + Spacing;
} else {
- if (ti.TabTitle.RegisteredLayoutings.HasFlag (LayoutingType.Height))
+ if (tabItms [i].TabTitle.RegisteredLayoutings.HasFlag (LayoutingType.Height))
return false;
- curOffset += ti.TabTitle.Slot.Height + Spacing;
+ curOffset += tabItms [i].TabTitle.Slot.Height + Spacing;
}
}
gr.Clip ();
}
- for (int i = 0; i < Children.Count; i++) {
- if (i == SelectedTab)
- continue;
- Children [i].Paint (ref gr);
- }
-
- if (SelectedTab < Children.Count && SelectedTab >= 0)
- Children [SelectedTab].Paint (ref gr);
+ lock (Children) {
+ TabItem[] tabItms = Children.Cast<TabItem> ().OrderBy (t => t.ViewIndex).ToArray ();
+ for (int i = 0; i < tabItms.Length; i++) {
+ if (tabItms [i] == Children [SelectedTab])
+ continue;
+ tabItms [i].Paint (ref gr);
+ }
+ if (SelectedTab < tabItms.Length && SelectedTab >= 0)
+ Children [SelectedTab].Paint (ref gr);
+ }
gr.Restore ();
}
Children[SelectedTab].checkHoverWidget (e);
return;
}
- for (int i = Children.Count - 1; i >= 0; i--) {
- TabItem ti = Children [i] as TabItem;
- if (ti.TabTitle.MouseIsIn(e.Position))
+ TabItem[] tabItms = Children.Cast<TabItem>().OrderBy (t=>t.ViewIndex).ToArray();
+ for (int i = tabItms.Length - 1; i >= 0; i--) {
+ if (tabItms [i].TabTitle.MouseIsIn(e.Position))
{
- Children[i].checkHoverWidget (e);
+ tabItms [i].checkHoverWidget (e);
return;
}
}
cancelLoadingThread ();
+ if (data is IObservableList) {
+ IObservableList ol = data as IObservableList;
+ ol.ListAdd -= Ol_ListAdd;
+ ol.ListRemove -= Ol_ListRemove;
+ }
+
data = value;
+ if (data is IObservableList) {
+ IObservableList ol = data as IObservableList;
+ ol.ListAdd += Ol_ListAdd;
+ ol.ListRemove += Ol_ListRemove;
+ }
+
NotifyValueChanged ("Data", data);
lock (CurrentInterface.LayoutMutex)
}
}
+ void Ol_ListRemove (object sender, ListChangedEventArg e)
+ {
+ if (this.isPaged) {
+ int p = e.Index / itemPerPage;
+ int i = e.Index % itemPerPage;
+ (items.Children [p] as Group).RemoveChild (i);
+ } else
+ items.RemoveChild (e.Index);
+ }
+
+ void Ol_ListAdd (object sender, ListChangedEventArg e)
+ {
+ if (this.isPaged) {
+ throw new NotImplementedException();
+// int p = e.Index / itemPerPage;
+// int i = e.Index % itemPerPage;
+// (items.Children [p] as Group).InsertChild (i, e.Element);
+ } else
+ loadItem (e.Index, items);
+ }
+
[XmlAttributeAttribute][DefaultValue("SteelBlue")]
public virtual Color SelectionBackground {
get { return selBackground; }
#endif
Group page;
- if (typeof(Wrapper).IsAssignableFrom (items.GetType ())) {
+ if (typeof(TabView).IsAssignableFrom (items.GetType ())||typeof(Wrapper).IsAssignableFrom (items.GetType ())) {
page = items;
itemPerPage = int.MaxValue;
} else if (typeof(GenericStack).IsAssignableFrom (items.GetType ())) {
isPaged = true;
} else {
page = Activator.CreateInstance (items.GetType ()) as Group;
+ page.CurrentInterface = items.CurrentInterface;
+ page.Initialize ();
page.Name = "page" + pageNum;
isPaged = true;
}
--- /dev/null
+//
+// IListChanged.cs
+//
+// Author:
+// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// Copyright (c) 2013-2017 Jean-Philippe Bruyère
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+
+namespace Crow
+{
+ public class ListChangedEventArg : EventArgs {
+ public int Index;
+ public object Element;
+ public ListChangedEventArg (int index, object element) {
+ Index = index;
+ Element = element;
+ }
+ }
+ public interface IObservableList {
+ event EventHandler<ListChangedEventArg> ListAdd;
+ event EventHandler<ListChangedEventArg> ListRemove;
+ }
+}
+
System.Reflection.Emit.Label finish = il.DefineLabel ();
il.Emit (OpCodes.Br, finish);
il.MarkLabel (cancel);
- il.EmitWriteLine (string.Format ("Handler method '{0}' for '{1}' not found in new dataSource", bindingDef.TargetMember, sourceEvent.Name));
+ #if DEBUG_BINDING
+ il.EmitWriteLine (string.Format ("Handler method '{0}' for '{1}' NOT FOUND in new dataSource", bindingDef.TargetMember, sourceEvent.Name));
+ #endif
il.MarkLabel (finish);
+ #if DEBUG_BINDING
+ il.EmitWriteLine (string.Format ("Handler method '{0}' for '{1}' FOUND in new dataSource", bindingDef.TargetMember, sourceEvent.Name));
+ #endif
il.Emit (OpCodes.Ret);
//store dschange delegate in instatiator instance for access while instancing graphic object
/// <summary>
/// search for graphic object type in crow assembly, if not found,
- /// search for type independently of namespace in entry assembly
+ /// search for type independently of namespace in all the loaded assemblies
/// </summary>
+ /// <remarks>
+ /// </remarks>
/// <returns>the corresponding type object</returns>
/// <param name="typeName">graphic object type name without its namespace</param>
Type tryGetGOType (string typeName){
Type t = Type.GetType ("Crow." + typeName);
if (t != null)
- return t;
- Assembly a = Assembly.GetEntryAssembly ();
- foreach (Type expT in a.GetExportedTypes ()) {
- if (expT.Name == typeName)
- return expT;
+ return t;
+ foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies()) {
+ if (a.IsDynamic)
+ continue;
+ foreach (Type expT in a.GetExportedTypes ()) {
+ if (expT.Name == typeName)
+ return expT;
+ }
}
return null;
}
/// Each control need a ref to the root interface containing it, if not set in GraphicObject.currentInterface,
/// the ref of this one will be stored in GraphicObject.currentInterface
/// </summary>
- internal static Interface CurrentInterface;
+ protected static Interface CurrentInterface;
internal Stopwatch clickTimer = new Stopwatch();
internal GraphicObject eligibleForDoubleClick = null;
#endregion
/// <param name="path">path of the iml file to load</param>
public GraphicObject Load (string path)
{
- try {
+ //try {
return GetInstantiator (path).CreateInstance (this);
- } catch (Exception ex) {
- throw new Exception ("Error loading <" + path + ">:", ex);
- }
+ //} catch (Exception ex) {
+ // throw new Exception ("Error loading <" + path + ">:", ex);
+ //}
}
/// <summary>
/// Fetch instantiator from cache or create it.
}
}
/// <summary>Pointer is over the widget</summary>
- public GraphicObject HoverWidget
+ public virtual GraphicObject HoverWidget
{
get { return _hoverWidget; }
set {
/// <summary>Processes mouse move events from the root container, this function
/// should be called by the host on mouse move event to forward events to crow interfaces</summary>
/// <returns>true if mouse is in the interface</returns>
- public bool ProcessMouseMove(int x, int y)
+ public virtual bool ProcessMouseMove(int x, int y)
{
int deltaX = x - Mouse.X;
int deltaY = y - Mouse.Y;
--- /dev/null
+//
+// IListChanged.cs
+//
+// Author:
+// Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// Copyright (c) 2013-2017 Jean-Philippe Bruyère
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using System.Collections.Generic;
+
+namespace Crow
+{
+ public class ObservableList<T> : List<T> , IObservableList {
+ public event EventHandler<ListChangedEventArg> ListAdd;
+ public event EventHandler<ListChangedEventArg> ListRemove;
+
+ public void AddElement (T elem) {
+ this.Add(elem);
+ ListAdd.Raise (this, new ListChangedEventArg (this.Count - 1, elem));
+ }
+ public void RemoveElement (T elem) {
+ int idx = this.IndexOf (elem);
+ this.RemoveAt (idx);
+ ListRemove.Raise (this, new ListChangedEventArg (idx, elem));
+ }
+ }
+}
+