Last change
on this file since 2253 was
2253,
checked in by mkommend, 15 years ago
|
added support for multiple document mainform without docking (ticket #716)
|
File size:
1.5 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.ComponentModel;
|
---|
4 | using System.Data;
|
---|
5 | using System.Drawing;
|
---|
6 | using System.Linq;
|
---|
7 | using System.Text;
|
---|
8 | using System.Windows.Forms;
|
---|
9 |
|
---|
10 | namespace HeuristicLab.MainForm {
|
---|
11 | public partial class MultipleDocumentMainForm : MainFormBase {
|
---|
12 | public MultipleDocumentMainForm(Type userInterfaceType)
|
---|
13 | : base(userInterfaceType) {
|
---|
14 | InitializeComponent();
|
---|
15 | this.IsMdiContainer = true;
|
---|
16 | }
|
---|
17 |
|
---|
18 | public override void ShowView(IView view) {
|
---|
19 | if (InvokeRequired) Invoke((Action<IView>)ShowView, view);
|
---|
20 | else {
|
---|
21 | base.ShowView(view);
|
---|
22 | MultipleDocumentForm form = new MultipleDocumentForm(view);
|
---|
23 | form.Activated += new EventHandler(MultipleDocumentFormActivated);
|
---|
24 | form.FormClosing += new FormClosingEventHandler(MultipleDocumentFormClosing);
|
---|
25 | form.MdiParent = this;
|
---|
26 | form.Show();
|
---|
27 | }
|
---|
28 | }
|
---|
29 |
|
---|
30 | private void MultipleDocumentFormActivated(object sender, EventArgs e) {
|
---|
31 | base.activeView = ((MultipleDocumentForm)sender).View;
|
---|
32 | base.StatusStripText = ((MultipleDocumentForm)sender).View.Caption;
|
---|
33 | }
|
---|
34 |
|
---|
35 | private void MultipleDocumentFormClosing(object sender, FormClosingEventArgs e) {
|
---|
36 | MultipleDocumentForm form = (MultipleDocumentForm)sender;
|
---|
37 | openViews.Remove(form.View);
|
---|
38 | if (openViews.Count == 0)
|
---|
39 | activeView = null;
|
---|
40 | form.Activated -= new EventHandler(MultipleDocumentFormActivated);
|
---|
41 | form.FormClosing -= new FormClosingEventHandler(MultipleDocumentFormClosing);
|
---|
42 | }
|
---|
43 | }
|
---|
44 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.