-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
83b3b12
commit 7780680
Showing
75 changed files
with
6,900 additions
and
705 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team | ||
// | ||
// 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; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Windows; | ||
using System.Windows.Markup; | ||
using System.Windows.Data; | ||
using System.Globalization; | ||
|
||
namespace ICSharpCode.TreeView | ||
{ | ||
public class CollapsedWhenFalse : MarkupExtension, IValueConverter | ||
{ | ||
public static CollapsedWhenFalse Instance = new CollapsedWhenFalse(); | ||
|
||
public override object ProvideValue(IServiceProvider serviceProvider) | ||
{ | ||
return Instance; | ||
} | ||
|
||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
return (bool)value ? Visibility.Visible : Visibility.Collapsed; | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team | ||
// | ||
// 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; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Windows.Controls; | ||
using System.Windows.Input; | ||
using System.Windows.Data; | ||
using System.Windows; | ||
|
||
namespace ICSharpCode.TreeView | ||
{ | ||
class EditTextBox : TextBox | ||
{ | ||
static EditTextBox() | ||
{ | ||
DefaultStyleKeyProperty.OverrideMetadata(typeof(EditTextBox), | ||
new FrameworkPropertyMetadata(typeof(EditTextBox))); | ||
} | ||
|
||
public EditTextBox() | ||
{ | ||
Loaded += delegate { Init(); }; | ||
} | ||
|
||
public SharpTreeViewItem Item { get; set; } | ||
|
||
public SharpTreeNode Node { | ||
get { return Item.Node; } | ||
} | ||
|
||
void Init() | ||
{ | ||
Text = Node.LoadEditText(); | ||
Focus(); | ||
SelectAll(); | ||
} | ||
|
||
protected override void OnKeyDown(KeyEventArgs e) | ||
{ | ||
if (e.Key == Key.Enter) { | ||
Commit(); | ||
} else if (e.Key == Key.Escape) { | ||
Node.IsEditing = false; | ||
} | ||
} | ||
|
||
protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e) | ||
{ | ||
if (Node.IsEditing) { | ||
Commit(); | ||
} | ||
} | ||
|
||
bool commiting; | ||
|
||
void Commit() | ||
{ | ||
if (!commiting) { | ||
commiting = true; | ||
|
||
Node.IsEditing = false; | ||
if (!Node.SaveEditText(Text)) { | ||
Item.Focus(); | ||
} | ||
Node.RaisePropertyChanged("Text"); | ||
|
||
//if (Node.SaveEditText(Text)) { | ||
// Node.IsEditing = false; | ||
// Node.RaisePropertyChanged("Text"); | ||
//} | ||
//else { | ||
// Init(); | ||
//} | ||
|
||
commiting = false; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team | ||
// | ||
// 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; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Windows.Media; | ||
using System.Windows; | ||
using System.Collections; | ||
using System.Windows.Input; | ||
|
||
namespace ICSharpCode.TreeView | ||
{ | ||
static class ExtensionMethods | ||
{ | ||
public static T FindAncestor<T>(this DependencyObject d) where T : class | ||
{ | ||
return AncestorsAndSelf(d).OfType<T>().FirstOrDefault(); | ||
} | ||
|
||
public static IEnumerable<DependencyObject> AncestorsAndSelf(this DependencyObject d) | ||
{ | ||
while (d != null) { | ||
yield return d; | ||
d = VisualTreeHelper.GetParent(d); | ||
} | ||
} | ||
|
||
public static void AddOnce(this IList list, object item) | ||
{ | ||
if (!list.Contains(item)) { | ||
list.Add(item); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.