<Border CornerRadius="6" 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.Icons.exit2.svg"
- MouseClick="./butQuitPress"/>
+ MouseClick="./onQuitPress"/>
</Border>
<Widget Width="5"/>
</HorizontalStack>
- <Container Name="Content" MinimumSize="50,50" Background="0.5,0.5,0.5,0.5"/>
+ <Container Name="Content" MinimumSize="50,50"/>
</VerticalStack>
</Border>
</Border>
<Border BorderWidth="1" Style="WindowIconBorder">
<Image Focusable="true" Path="#Crow.Icons.exit2.svg"
- MouseClick="./butQuitPress"/>
+ MouseClick="./onQuitPress"/>
</Border>
<Widget Width="5"/>
</HorizontalStack>
/// <summary>
/// Target the template's root node, expression was in the form './name[.name[...]]' or '/name[.name[...]]'
/// </summary>
- public bool IsTemplateBinding { get { return LevelsUp < 0; }}
+ public bool IsTemplateBinding => LevelsUp < 0;
/// <summary>
/// No level change and expression was '.name'
/// <summary>
/// no level change, and only a single name in Tokens[], that's dataSource member if property binding
/// </summary>
- public bool IsSingleName { get { return LevelsUp == 0 && Tokens.Length == 1; }}
+ public bool IsSingleName => LevelsUp == 0 && Tokens.Length == 1;
#region CTOR
/// <summary>
NotifyValueChanged ("CurrentColor2", Color.FromHSV (currentColor.Hue, currentColor.Value, currentColor.Saturation, currentColor.A));
}
}
+ public IList<Colors> AvailableColors => //Enum.GetValues (typeof (Color)).ToList<Color> ();// Colors. ColorDic.Values.OrderBy (c => c.Hue).ToList ();
+ FastEnumUtility.FastEnum.GetValues<Colors> ().ToList<Colors> ();
- //public IList<Color> ColorList => Enum.GetValues (typeof (Color)).ToList<Color> ();// Colors. ColorDic.Values.OrderBy (c => c.Hue).ToList ();
+ public void onSelectedItemChanged(object sender, SelectionChangeEventArgs e) {
+ CurrentColor = (Color)(Colors)e.NewValue;
+ }
}
}
public virtual void onPop(object sender, EventArgs e)
{
if (Content != null) {
- Content.Visible = true;
+ Content.IsVisible = true;
if (Content.Parent == null)
IFace.AddWidget (Content);
//if (Content.LogicalParent != this)
public virtual void onUnpop(object sender, EventArgs e)
{
if (Content != null) {
- Content.Visible = false;
+ Content.IsVisible = false;
}
Unpoped.Raise (this, e);
}
--- /dev/null
+// Copyright (c) 2013-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+namespace Crow
+{
+ public class TabView2 : TemplatedGroup
+ {
+ #region CTOR
+ protected TabView2 () {}
+ public TabView2 (Interface iface, string style = null) : base (iface, style) { }
+ #endregion
+
+
+ }
+}
+
}
#endregion
- void update (TextChange change) {
+ protected void update (TextChange change) {
lock (linesMutex) {
Span<char> tmp = stackalloc char[Text.Length + (change.ChangedText.Length - change.Length)];
//Console.WriteLine ($"{Text.Length,-4} {change.Start,-4} {change.Length,-4} {change.ChangedText.Length,-4} tmp:{tmp.Length,-4}");
-// Copyright (c) 2013-2019 Bruyère Jean-Philippe jp_bruyere@hotmail.com
+// Copyright (c) 2013-2021 Bruyère Jean-Philippe jp_bruyere@hotmail.com
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
string _icon;
bool resizable;
bool movable;
- bool modal;
- protected bool hoverBorder = false;
+ bool modal;
bool alwaysOnTop = false;
Rectangle savedBounds;
#region public properties
[DefaultValue("#Crow.Icons.crow.svg")]
public string Icon {
- get { return _icon; }
+ get => _icon;
set {
if (_icon == value)
return;
}
[DefaultValue(true)]
public bool Resizable {
- get {
- return resizable;
- }
+ get => resizable;
set {
if (resizable == value)
return;
}
[DefaultValue(true)]
public bool Movable {
- get {
- return movable;
- }
+ get => movable;
set {
if (movable == value)
return;
}
[DefaultValue(false)]
public bool Modal {
- get {
- return modal;
- }
+ get => modal;
set {
if (modal == value)
return;
}
[DefaultValue(false)]
public bool IsMinimized {
- get { return _minimized; }
+ get => _minimized;
set{
if (value == IsMinimized)
return;
_minimized = value;
- _contentContainer.Visible = !_minimized;
+ _contentContainer.IsVisible = !_minimized;
NotifyValueChangedAuto (_minimized);
}
}
- [XmlIgnore]public bool IsMaximized {
- get { return Width == Measure.Stretched & Height == Measure.Stretched & !_minimized; }
- }
- [XmlIgnore]public bool IsNormal {
- get { return !(IsMaximized|_minimized); }
- }
+ [XmlIgnore]public bool IsMaximized =>
+ Width == Measure.Stretched & Height == Measure.Stretched & !_minimized;
+ [XmlIgnore]public bool IsNormal => !(IsMaximized|_minimized);
[DefaultValue(false)]
public bool AlwaysOnTop {
- get {
- return modal ? true : alwaysOnTop;
- }
+ get => modal ? true : alwaysOnTop;
set {
if (alwaysOnTop == value)
return;
Minimize.Raise (sender, e);
}
- protected void butQuitPress (object sender, MouseButtonEventArgs e)
+ public void onQuitPress (object sender, MouseButtonEventArgs e)
{
IFace.MouseCursor = MouseCursor.top_left_arrow;
close ();
--- /dev/null
+// Copyright (c) 2013-2019 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+using Glfw;
+using Crow.Text;
+
+namespace Crow
+{
+ public class Editor : TextBox {
+ public override void onKeyDown(object sender, KeyEventArgs e)
+ {
+ TextSpan selection = Selection;
+ if (e.Key == Key.Tab && !selection.IsEmpty) {
+ int lineStart = lines.GetLocation (selection.Start).Line;
+ int lineEnd = lines.GetLocation (selection.End).Line;
+
+ if (IFace.Shift) {
+ for (int l = lineStart; l <= lineEnd; l++) {
+ if (Text[lines[l].Start] == '\t')
+ update (new TextChange (lines[l].Start, 1, ""));
+ else if (Char.IsWhiteSpace (Text[lines[l].Start])) {
+ int i = 1;
+ while (i < lines[l].Length && i < Interface.TAB_SIZE && Char.IsWhiteSpace (Text[i]))
+ i++;
+ update (new TextChange (lines[l].Start, i, ""));
+ }
+ }
+
+ }else{
+ for (int l = lineStart; l <= lineEnd; l++)
+ update (new TextChange (lines[l].Start, 0, "\t"));
+ }
+
+ selectionStart = new CharLocation (lineStart, 0);
+ CurrentLoc = new CharLocation (lineEnd, lines[lineEnd].Length);
+
+ return;
+ }
+ base.onKeyDown(sender, e);
+ }
+ }
+}
\ No newline at end of file
<Label Text="{../../tb.CurrentColumn}" Margin="2"/>
</HorizontalStack>
<HorizontalStack>
- <TextBox Name="tb" Text="{Source}" Multiline="true" Font="consolas, 12" Focusable="true" Height="Stretched" Width="Stretched"
- TextChanged="onTextChanged" KeyDown="textView_KeyDown" ContextCommands="{EditorCommands}"/>
+ <Editor Name="tb" Text="{Source}" Multiline="true" Font="consolas, 12" Focusable="true" Height="Stretched" Width="Stretched"
+ TextChanged="onTextChanged" KeyDown="textView_KeyDown" ContextCommands="{EditorCommands}"
+ Foreground="DarkGrey" Background="White"/>
<!--SelectionChanged="onSelectedTextChanged"-->
<ScrollBar Value="{²../tb.ScrollY}"
LargeIncrement="{../tb.PageHeight}" SmallIncrement="1"
<?xml version="1.0"?>
-<TabView SelectedTab="0">
- <TabItem Caption="HSV">
- <Border Background="{./Background}" Foreground="{./Foreground}" Width="Stretched"
- CornerRadius="{./CornerRadius}" BorderWidth="1">
- <VerticalStack Margin="2">
- <Widget Width="30" Height="16" Background="{./CurrentColor}"/>
- <HorizontalStack Height="Fit">
- <Label Style="labColor" Text="R:"/>
- <ColorSlider Name="cs" Component="Red" CurrentColor="{²../../../../../../CurrentColor}"/>
- <Label Style="labColorV" Text="{../cs.CurrentValue}" />
- </HorizontalStack>
- <HorizontalStack Height="Fit">
- <Label Style="labColor" Text="G:"/>
- <ColorSlider Name="cs" Component="Green" CurrentColor="{²../../../../../../CurrentColor}"/>
- <Label Style="labColorV" Text="{../cs.CurrentValue}" />
- </HorizontalStack>
- <HorizontalStack Height="Fit">
- <Label Style="labColor" Text="B:"/>
- <ColorSlider Name="cs" Component="Blue" CurrentColor="{²../../../../../../CurrentColor}"/>
- <Label Style="labColorV" Text="{../cs.CurrentValue}" />
- </HorizontalStack>
- <HorizontalStack Height="Fit">
- <Label Style="labColor" Text="A:"/>
- <ColorSlider Name="cs" Component="Alpha" CurrentColor="{²../../../../../../CurrentColor}"/>
- <Label Style="labColorV" Text="{../cs.CurrentValue}" />
- </HorizontalStack>
- <HorizontalStack Height="Fit">
- <Label Style="labColor" Text="H:"/>
- <ColorSlider Name="cs" Component="Hue" CurrentColor="{²../../../../../../CurrentColor}"/>
- <Label Style="labColorV" Text="{../cs.CurrentValue}" />
- </HorizontalStack>
- <HorizontalStack Height="Fit">
- <Label Style="labColor" Text="S:"/>
- <ColorSlider Name="cs" Component="Saturation" CurrentColor="{²../../../../../../CurrentColor}"/>
- <Label Style="labColorV" Text="{../cs.CurrentValue}" />
- </HorizontalStack>
- <HorizontalStack Height="Fit">
- <Label Style="labColor" Text="V:"/>
- <ColorSlider Name="cs" Component="Value" CurrentColor="{²../../../../../../CurrentColor}"/>
- <Label Style="labColorV" Text="{../cs.CurrentValue}" />
- </HorizontalStack>
- </VerticalStack>
- </Border>
- </TabItem>
- <TabItem Caption="List" Height="Stretched">
- <ListBox Data="{../../../ColorList}" SelectedItem="{²../../../CurrentColor}">
+<Popper Margin="0" Caption="{./CurrentColor}" Background="{./Background}" >
+ <Template>
+ <CheckBox Margin="0" Caption="{./Caption}" IsChecked="{²./IsPopped}" Background="{./Background}">
<Template>
- <Scroller Name="scroller1" Margin="5">
- <Wrapper Name="ItemsContainer" Height="Fit" VerticalAlignment="Top"/>
- </Scroller>
+ <HorizontalStack Margin="3" Spacing="3" Background="{./Background}">
+ <Border Width="18" Height="12" CornerRadius="3"
+ Background="{../../../../CurrentColor}">
+ </Border>
+ <Label Width="Stretched" Text="{./Caption}" />
+ </HorizontalStack>
</Template>
- <ItemTemplate>
- <Border Width="16" Height="16" Background="{}" Foreground="Transparent" Tooltip="{}"
- MouseEnter="{Foreground=Black}"
- MouseLeave="{Foreground=Transparent}"/>
- </ItemTemplate>
- </ListBox>
- </TabItem>
-</TabView>
\ No newline at end of file
+ </CheckBox>
+ </Template>
+ <TabView MinimumSize="{../../MinimumPopupSize}" Width="Fit" Height="Fit" ActivateNewTab="false">
+ <TabItem Template="#ui.TabItem.template" Caption="HSV" Width="Fit" Height="Fit">
+ <ColorPicker CurrentColor="{²../../../../CurrentColor}" />
+ </TabItem>
+ <TabItem Template="#ui.TabItem.template" Caption="Colors names" SelectedBackground="Jet" Width="Stretched" Height="Stretched">
+ <ColorPicker CurrentColor="{²../../../../CurrentColor}" >
+ <Template>
+ <ListBox Data="{./AvailableColors}" SelectedItem="{²./CurrentColor}" Width="200" Height="200">
+ <!--<Template>
+ <Scroller Name="scroller1" Margin="5">
+ <Wrapper Name="ItemsContainer" Height="Fit" VerticalAlignment="Top"/>
+ </Scroller>
+ </Template>
+ <ItemTemplate>
+ <Border Width="16" Height="16" Background="{}" Foreground="Transparent" Tooltip="{}"
+ MouseEnter="{Foreground=Black}"
+ MouseLeave="{Foreground=Transparent}"/>
+ </ItemTemplate>-->
+ </ListBox>
+ </Template>
+ </ColorPicker>
+ </TabItem>
+ </TabView>
+</Popper>
+
--- /dev/null
+<?xml version="1.0"?>
+<GenericStack Orientation="Vertical" Spacing="0"
+ Background="{./Background}"
+ MouseEnter="{/caption.Foreground=White}"
+ MouseLeave="{/caption.Foreground=Grey}">
+ <HorizontalStack Margin="2" Left="{./TabOffset}"
+ Name="TabTitle"
+ HorizontalAlignment="Left"
+ Height="{./TabHeight}"
+ Width="{./TabWidth}">
+ <Label Name="caption" Text="{./Caption}" Foreground="Grey" Width="Stretched"/>
+ <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.Icons.exit2.svg"
+ MouseClick="./butCloseTabClick"/>
+ </Border>
+ </HorizontalStack>
+ <Container Name="Content"/>
+</GenericStack>
+