-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
236 additions
and
126 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,14 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
|
||
namespace Codist.Controls | ||
{ | ||
interface IContextMenuHost | ||
{ | ||
void ShowContextMenu(RoutedEventArgs args); | ||
} | ||
} |
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
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
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
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,39 @@ | ||
using System; | ||
using System.Windows.Controls; | ||
using System.Windows.Input; | ||
using Codist.Controls; | ||
using Microsoft.VisualStudio.Shell; | ||
using Microsoft.VisualStudio.Text.Editor; | ||
using System.Windows; | ||
|
||
namespace Codist.NaviBar | ||
{ | ||
public abstract class NaviBar : ToolBar, INaviBar | ||
{ | ||
protected NaviBar(IWpfTextView textView) { | ||
View = textView; | ||
ListContainer = View.Properties.GetOrCreateSingletonProperty(() => new ExternalAdornment(textView)); | ||
this.SetBackgroundForCrispImage(ThemeHelper.TitleBackgroundColor); | ||
textView.Properties.AddProperty(nameof(NaviBar), this); | ||
Resources = SharedDictionaryManager.Menu; | ||
SetResourceReference(BackgroundProperty, VsBrushes.CommandBarMenuBackgroundGradientKey); | ||
SetResourceReference(ForegroundProperty, VsBrushes.CommandBarTextInactiveKey); | ||
} | ||
|
||
public abstract void ShowActiveItemMenu(); | ||
public abstract void ShowRootItemMenu(); | ||
protected IWpfTextView View { get; } | ||
internal ExternalAdornment ListContainer { get; } | ||
|
||
protected override void OnPreviewMouseRightButtonUp(MouseButtonEventArgs e) { | ||
var h = WpfHelper.GetParentOrSelf<DependencyObject>(e.Source as DependencyObject, o => o is IContextMenuHost) as IContextMenuHost; | ||
if (h != null) { | ||
h.ShowContextMenu(e); | ||
e.Handled = true; | ||
} | ||
//else { | ||
// base.OnPreviewMouseRightButtonUp(e); | ||
//} | ||
} | ||
} | ||
} |