Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/19/10 19:43:05 (14 years ago)
Author:
mkommend
Message:

Adjusted the SetEnabledStateOfControls method in all views, added the Enabled property into the IView interface and adapted the ViewHost, View and ContentView class (ticket #1155).

File:
1 edited

Legend:

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

    r4418 r4435  
    6161            View view = activeView as View;
    6262            if (view != null) {
     63              view.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;
     64              view.Size = new System.Drawing.Size(this.Width - this.viewsLabel.Width - this.viewsLabel.Margin.Left - this.viewsLabel.Margin.Right, this.Height);
    6365              view.OnShown(new ViewShownEventArgs(view, false));
    6466              Controls.Add(view);
    6567            }
    6668          } else viewType = null;
    67           OnActiveViewChanged();
    6869        }
    6970      }
     
    8485          OnViewTypeChanged();
    8586        }
    86       }
    87     }
    88 
    89     public new bool Enabled {
    90       get { return base.Enabled; }
    91       set {
    92         base.Enabled = value;
    93         this.viewsLabel.Enabled = value;
    9487      }
    9588    }
     
    136129        IContentView view;
    137130        view = MainFormManager.CreateView(viewType);
     131        view.Locked = this.Locked;
    138132        view.ReadOnly = this.ReadOnly;
    139         view.Locked = this.Locked;
    140133        ActiveView = view; //necessary to allow the views to change the status of the viewhost
    141134        view.Content = Content;
     
    145138    }
    146139
    147     private void OnActiveViewChanged() {
    148       this.SuspendRepaint();
    149       if (activeView != null) {
    150         this.ActiveView.ReadOnly = this.ReadOnly;
    151         this.ActiveView.Locked = this.Locked;
    152         this.ActiveViewControl.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;
    153         this.ActiveViewControl.Size = new System.Drawing.Size(this.Width - this.viewsLabel.Width - this.viewsLabel.Margin.Left - this.viewsLabel.Margin.Right, this.Height);
    154       }
    155       this.ResumeRepaint(true);
    156     }
    157 
    158140    private void RegisterActiveViewEvents() {
    159       activeView.Changed += new EventHandler(activeView_Changed);
    160141      activeView.CaptionChanged += new EventHandler(activeView_CaptionChanged);
     142      activeView.LockedChanged += new EventHandler(activeView_LockedChanged);
    161143    }
    162144    private void DeregisterActiveViewEvents() {
    163       activeView.Changed -= new EventHandler(activeView_Changed);
    164       activeView.CaptionChanged -= new EventHandler(activeView_CaptionChanged);
     145      activeView.CaptionChanged += new EventHandler(activeView_CaptionChanged);
     146      activeView.LockedChanged += new EventHandler(activeView_LockedChanged);
    165147    }
    166148    private void activeView_CaptionChanged(object sender, EventArgs e) {
    167       this.ActiveViewChanged();
    168     }
    169     private void activeView_Changed(object sender, EventArgs e) {
    170       this.ActiveViewChanged();
    171     }
    172     private void ActiveViewChanged() {
    173       if (ActiveView != null) {
    174         this.Caption = this.ActiveView.Caption;
    175         this.ReadOnly = this.ActiveView.ReadOnly;
    176         this.Locked = this.ActiveView.Locked;
    177       }
     149      this.Caption = activeView.Caption;
     150    }
     151    private void activeView_LockedChanged(object sender, EventArgs e) {
     152      this.Locked = activeView.Locked;
    178153    }
    179154
Note: See TracChangeset for help on using the changeset viewer.