/*
Copyright (C) 2014-2019 de4dot@gmail.com
This file is part of dnSpy
dnSpy is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
dnSpy is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with dnSpy. If not, see .
*/
using System;
using System.Collections.Generic;
namespace dnSpy.Contracts.Menus {
///
/// context
///
public interface IMenuItemContext {
///
/// Gets the guid of the top-level menu, eg. or
///
///
Guid MenuGuid { get; }
///
/// true if it was opened from the keyboard, else mouse. If it's the main menu (and not
/// a context menu), this will always be true.
///
bool OpenedFromKeyboard { get; }
///
/// Creator object
///
GuidObject CreatorObject { get; }
///
/// All objects. is always the first one
///
IEnumerable GuidObjects { get; }
///
/// Gets or creates user state that can be saved in the context to prevent re-generating the
/// same state when various methods get called.
///
/// State type
/// Key, eg. a guid or a static key in some base command class
/// Delegate that creates a new value if it hasn't been created yet
///
T? GetOrCreateState(object key, Func createState) where T : class;
///
/// Finds the first object of a certain type. Returns default({T}) if none was found
///
/// Type
///
T Find();
}
}