Refactored the Kernel registration fluent interface to be more readable, better suppo...
[castle.git] / Experiments / Attic / Generator / Castle.ActiveRecord.Generator / MainForm.cs
blob8a838a6494de6927444acbf4fb99c532339c9d18
1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.ActiveRecord.Generator
17 using System;
18 using System.Drawing;
19 using System.Collections;
20 using System.ComponentModel;
21 using System.Windows.Forms;
22 using System.Data;
23 using WeifenLuo.WinFormsUI;
25 using Castle.ActiveRecord.Generator.Components;
28 public class MainForm : Form, IWorkspace
30 private DockPanel dockManager;
31 private System.Windows.Forms.MainMenu mainMenu1;
32 private System.Windows.Forms.StatusBar statusBar1;
33 private System.Windows.Forms.ToolBar toolBar1;
34 private System.Windows.Forms.ImageList imageList2;
35 private System.ComponentModel.IContainer components;
37 public MainForm()
39 InitializeComponent();
42 public MainForm(Model model) : this()
44 model.OnProjectChanged += new ProjectDelegate(OnChanged);
45 model.OnProjectReplaced += new ProjectReplaceDelegate(OnProjectReplaced);
48 #region IWorkspace Members
50 public MainMenu MainMenu
52 get { return mainMenu1; }
55 public ToolBar MainToolBar
57 get { return toolBar1; }
60 public StatusBar MainStatusBar
62 get { return statusBar1; }
65 public DockPanel MainDockManager
67 get { return dockManager; }
70 public IWin32Window ActiveWindow
72 get { return this; }
75 #endregion
77 /// <summary>
78 /// Clean up any resources being used.
79 /// </summary>
80 protected override void Dispose( bool disposing )
82 if( disposing )
84 if (components != null)
86 components.Dispose();
89 base.Dispose( disposing );
92 #region Windows Form Designer generated code
93 /// <summary>
94 /// Required method for Designer support - do not modify
95 /// the contents of this method with the code editor.
96 /// </summary>
97 private void InitializeComponent()
99 this.components = new System.ComponentModel.Container();
100 System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MainForm));
101 this.dockManager = new WeifenLuo.WinFormsUI.DockPanel();
102 this.mainMenu1 = new System.Windows.Forms.MainMenu();
103 this.statusBar1 = new System.Windows.Forms.StatusBar();
104 this.toolBar1 = new System.Windows.Forms.ToolBar();
105 this.imageList2 = new System.Windows.Forms.ImageList(this.components);
106 this.SuspendLayout();
108 // dockManager
110 this.dockManager.ActiveAutoHideContent = null;
111 this.dockManager.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
112 this.dockManager.Dock = System.Windows.Forms.DockStyle.Fill;
113 this.dockManager.Font = new System.Drawing.Font("Tahoma", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.World, ((System.Byte)(0)));
114 this.dockManager.Location = new System.Drawing.Point(0, 42);
115 this.dockManager.MdiIntegration = false;
116 this.dockManager.Name = "dockManager";
117 this.dockManager.Size = new System.Drawing.Size(855, 609);
118 this.dockManager.TabIndex = 0;
120 // statusBar1
122 this.statusBar1.Location = new System.Drawing.Point(0, 651);
123 this.statusBar1.Name = "statusBar1";
124 this.statusBar1.Size = new System.Drawing.Size(855, 21);
125 this.statusBar1.TabIndex = 0;
126 this.statusBar1.Text = "Ready.";
128 // toolBar1
130 this.toolBar1.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;
131 this.toolBar1.BackColor = System.Drawing.SystemColors.Control;
132 this.toolBar1.DropDownArrows = true;
133 this.toolBar1.ImageList = this.imageList2;
134 this.toolBar1.Location = new System.Drawing.Point(0, 0);
135 this.toolBar1.Name = "toolBar1";
136 this.toolBar1.ShowToolTips = true;
137 this.toolBar1.Size = new System.Drawing.Size(855, 42);
138 this.toolBar1.TabIndex = 1;
140 // imageList2
142 this.imageList2.ImageSize = new System.Drawing.Size(16, 16);
143 this.imageList2.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList2.ImageStream")));
144 this.imageList2.TransparentColor = System.Drawing.Color.Transparent;
146 // MainForm
148 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
149 this.ClientSize = new System.Drawing.Size(855, 672);
150 this.Controls.Add(this.dockManager);
151 this.Controls.Add(this.toolBar1);
152 this.Controls.Add(this.statusBar1);
153 this.IsMdiContainer = true;
154 this.Menu = this.mainMenu1;
155 this.Name = "MainForm";
156 this.Text = "MainForm";
157 this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
158 this.ResumeLayout(false);
161 #endregion
163 private void OnProjectReplaced(object sender, Project oldProject, Project newProject)
165 OnChanged(sender, newProject);
168 private void OnChanged(object sender, Project project)
170 this.Text = String.Format("ActiveRecord Generator - [{0}]", project.Name);