private Form owner;
private Form.ControlCollection owned_forms;
private MdiClient mdi_container;
+ private MdiChildContext mdi_child_context;
private Form mdi_parent;
private bool key_preview;
private MainMenu menu;
private SizeGripStyle size_grip_style;
private Rectangle maximized_bounds;
private Rectangle default_maximized_bounds;
+ Color transparency_key;\r
+
#endregion // Local Variables
#region Private & Internal Methods
maximized_bounds = Rectangle.Empty;
default_maximized_bounds = Rectangle.Empty;
owned_forms = new Form.ControlCollection(this);
+ transparency_key = Color.Empty;
}
#endregion // Public Constructor & Destructor
if (icon != value) {
icon = value;
- XplatUI.SetIcon(window.Handle, icon);
+ XplatUI.SetIcon(Handle, icon);
}
}
}
}
}
- [DefaultValue(typeof(Size), "{Width=0, Height=0}")]
+ [DefaultValue("{Width=0, Height=0}")]
[Localizable(true)]
[RefreshProperties(RefreshProperties.Repaint)]
public Size MaximumSize {
}
set {
+ SuspendLayout ();
+
+ // TopLevel = true;
+
+ if (!value.IsMdiContainer)
+ throw new ArgumentException ();
+
if (mdi_parent != null) {
- mdi_parent.Controls.Remove(this);
+ mdi_parent.MdiContainer.Controls.Remove (this);
}
mdi_parent = value;
if (mdi_parent != null) {
- mdi_parent.Controls.Add(this);
+ mdi_child_context = new MdiChildContext (this);
+ mdi_parent.MdiContainer.Controls.Add (this);
}
+
+ ResumeLayout ();
}
}
+ internal MdiClient MdiContainer {
+ get { return mdi_container; }
+ }
+
[DefaultValue(null)]
public MainMenu Menu {
get {
menu.SetForm (this);
MenuAPI.SetMenuBarWindow (menu.Handle, this);
-
- XplatUI.SetMenu(window.Handle, menu.Handle);
+
+ if (IsHandleCreated && menu != null) {
+ XplatUI.SetMenu(window.Handle, menu.Handle);
+ }
// FIXME - Do we still need this?
this.SetBoundsCore(0, 0, 0, 0, BoundsSpecified.None);
}
}
- [DefaultValue(typeof(Size), "{Width=0, Height=0}")]
+ [DefaultValue("{Width=0, Height=0}")]
[Localizable(true)]
[RefreshProperties(RefreshProperties.Repaint)]
public Size MinimumSize {
[Localizable(false)]
public Size Size {
get {
- return Size;
+ return base.Size;
}
set {
}
set {
+ if (!value && IsMdiContainer)
+ throw new ArgumentException ("MDI Container forms must be top level.");
SetTopLevel(value);
}
}
}
}
+ public Color TransparencyKey {\r
+ get {\r
+ return transparency_key;\r
+ }\r
+\r
+ set {\r
+ AllowTransparency = true;\r
+ transparency_key = value;\r
+ // TODO: change window attributes; a new driver call\r
+ }\r
+ }\r
+
[DefaultValue(FormWindowState.Normal)]
public FormWindowState WindowState {
get {
protected override void OnCreateControl() {
base.OnCreateControl ();
if (this.ActiveControl == null) {
+ bool visible;
+
+ // This visible hack is to work around CanSelect always being false if one of the parents
+ // is not visible; and we by default create Form invisible...
+ visible = this.is_visible;
+ this.is_visible = true;
+
if (SelectNextControl(this, true, true, true, true) == false) {
Select(this);
}
+
+ this.is_visible = visible;
+ }
+
+ if (menu != null) {
+ XplatUI.SetMenu(window.Handle, menu.Handle);
}
+
OnLoad(EventArgs.Empty);
// Send initial location
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected override void WndProc(ref Message m) {
+
+ if (IsMdiChild && mdi_child_context.HandleMessage (ref m)) {
+ return;
+ }
+
switch((Msg)m.Msg) {
case Msg.WM_CLOSE: {
CancelEventArgs args = new CancelEventArgs();
}
case Msg.WM_KILLFOCUS: {
+ base.WndProc(ref m);
return;
}
case Msg.WM_SETFOCUS: {
+#if not
if (this.ActiveControl != null) {
ActiveControl.Focus();
}
+#endif
+ base.WndProc(ref m);
return;
}