Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13628


Ignore:
Timestamp:
02/19/16 11:08:00 (8 years ago)
Author:
pfleck
Message:

#1235
Added an AllowContexMenu property in the DockingMainForm to be able to enable/disable the context menu.
Changing the property will only affect DockForms after the change.

Location:
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/MainForms
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/DockForm.cs

    r13614 r13628  
    3232  /// </summary>
    3333  internal partial class DockForm : DockContent {
    34     public DockForm(IView view) {
     34    public DockForm(IView view, bool allowContextMenu) {
    3535      InitializeComponent();
    3636      this.view = view;
     37      this.allowContextMenu = allowContextMenu;
     38
    3739      if (view != null) {
    3840        if (view is UserControl) {
     
    9092      get { return this.view; }
    9193    }
     94    private readonly bool allowContextMenu;
    9295
    9396    private void UpdateText() {
     
    117120    #region Context Menu Events
    118121    private void contextMenuStrip_Opening(object sender, System.ComponentModel.CancelEventArgs e) {
     122      if (!allowContextMenu) {
     123        e.Cancel = true;
     124        return;
     125      }
     126
    119127      var contentView = View as IContentView;
    120128      var content = contentView != null ? contentView.Content : null;
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.3/MainForms/DockingMainForm.cs

    r12012 r13628  
    2525namespace HeuristicLab.MainForm.WindowsForms {
    2626  public partial class DockingMainForm : MainForm {
     27
     28    public bool AllowContexMenu { get; set; }
     29
    2730    public DockingMainForm()
    2831      : base() {
    2932      InitializeComponent();
     33      AllowContexMenu = true;
    3034    }
    3135    public DockingMainForm(Type userInterfaceItemType)
    3236      : base(userInterfaceItemType) {
    3337      InitializeComponent();
     38      AllowContexMenu = true;
    3439    }
    3540    public DockingMainForm(Type userInterfaceItemType, bool showContentInViewHost)
     
    6065
    6166    protected override Form CreateForm(IView view) {
    62       return new DockForm(view);
     67      return new DockForm(view, AllowContexMenu);
    6368    }
    6469
Note: See TracChangeset for help on using the changeset viewer.