(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / class / System.Windows.Forms / System.Windows.Forms / ContainerControl.cs
blobf7114e6e6892d775de3e2736586f21eec79f1b5a
1 //
2 // System.Windows.Forms.ContainerControl.cs
3 //
4 // Author:
5 // Miguel de Icaza (miguel@ximian.com)
6 // stubbed out by Jaak Simm (jaaksimm@firm.ee)
7 // Dennis Hayes (dennish@Raytek.com)
8 // WINELib implementation started by John Sohn (jsohn@columbus.rr.com)
9 //
10 // (C) Ximian, Inc., 2002/3
14 // Permission is hereby granted, free of charge, to any person obtaining
15 // a copy of this software and associated documentation files (the
16 // "Software"), to deal in the Software without restriction, including
17 // without limitation the rights to use, copy, modify, merge, publish,
18 // distribute, sublicense, and/or sell copies of the Software, and to
19 // permit persons to whom the Software is furnished to do so, subject to
20 // the following conditions:
21 //
22 // The above copyright notice and this permission notice shall be
23 // included in all copies or substantial portions of the Software.
24 //
25 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
29 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
30 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 using System.ComponentModel;
35 using System.Drawing;
37 namespace System.Windows.Forms {
39 /// <summary>
40 /// Provides focus management functionality for controls that can function as a container for other controls.
41 /// </summary>
43 public class ContainerControl : ScrollableControl, IContainerControl {
45 private Control activeControl;
47 public ContainerControl () : base ()
49 controlStyles_ |= ControlStyles.ContainerControl;
53 [MonoTODO]
54 public Control ActiveControl {
55 get {
56 return(activeControl);
58 set {
59 if ((value==activeControl) || (value==null)) {
60 return;
63 if (!Contains(value)) {
64 throw new ArgumentException("Not a child control");
67 // FIXME; need to let Wine know
68 activeControl=value;
72 //Compact Framework
73 [MonoTODO]
74 // not ready for BindingContext
75 public override BindingContext BindingContext {
76 get {
77 throw new NotImplementedException ();
79 set {
80 //fixme:
84 protected override CreateParams CreateParams {
85 get { return base.CreateParams; }
88 public Form ParentForm {
89 get {
90 if (Parent != null) {
91 return(Parent.FindForm());
92 } else {
93 return(FindForm());
98 /// --- Methods ---
99 /// internal .NET framework supporting methods, not stubbed out:
100 /// - protected virtual void UpdateDefaultButton()
102 protected override void AdjustFormScrollbars (
103 bool displayScrollbars)
105 //FIXME:
106 base.AdjustFormScrollbars (displayScrollbars);
109 protected override void Dispose (bool disposing)
111 //FIXME
112 base.Dispose(disposing);
115 public bool ActivateControl(Control control)
117 Control parent=Parent;
118 ContainerControl container;
119 bool result=true;
121 // We might have a container inside a container, etc...
122 // if we do, make sure that the whole chain up knows about the activation
123 if (parent!=null) {
124 container=parent.GetContainerControl() as ContainerControl;
125 if ((container!=null) && (container.ActiveControl!=this)) {
126 container.ActivateControl(this);
130 if (activeControl!=control) {
131 // FIXME - let wine know
132 activeControl=control;
134 return(result);
137 // [event methods]
138 protected override void OnControlRemoved (ControlEventArgs e)
140 if ((e.Control==activeControl) || (e.Control.Contains(activeControl))) {
141 ActiveControl=null;
143 base.OnControlRemoved(e);
146 protected override void OnCreateControl ()
148 base.OnCreateControl ();
149 OnBindingContextChanged(EventArgs.Empty);
151 // end of [event methods]
153 protected override bool ProcessDialogChar (char charCode)
155 // Only process if we own the whole thing
156 if (GetTopLevel()) {
157 if (ProcessMnemonic(charCode)) {
158 return(true);
161 return base.ProcessDialogChar(charCode);
164 [MonoTODO]
165 protected override bool ProcessDialogKey (Keys keyData)
167 if ( keyData == Keys.Tab ) {
168 return ProcessTabKey ( Control.ModifierKeys != Keys.Shift );
169 } else if ((keyData==Keys.Left) || (keyData==Keys.Right) || (keyData==Keys.Up) || (keyData==Keys.Down)) {
170 // Select the next control
172 Control select=this;
173 bool forward=true;
175 if ((keyData==Keys.Left) || (keyData==Keys.Up)) {
176 forward=false;
179 if (activeControl!=null) {
180 select=activeControl.Parent;
183 select.SelectNextControl(activeControl, forward, false, false, true);
184 return(true);
186 return base.ProcessDialogKey(keyData);
189 [MonoTODO]
190 protected override bool ProcessMnemonic (char charCode)
192 //FIXME:
193 return base.ProcessMnemonic(charCode);
196 [MonoTODO]
197 protected virtual bool ProcessTabKey ( bool forward )
199 Control newFocus = getNextFocusedControl ( this, forward );
200 if ( newFocus != null )
201 return newFocus.Focus ( );
202 return false;
205 // Not an overridden function?
206 protected override void Select(bool directed,bool forward)
208 base.Select(directed, forward);
211 protected virtual void UpdateDefaultButton() {
215 [MonoTODO]
216 public bool Validate ()
218 throw new NotImplementedException ();
221 protected override void WndProc(ref Message m)
223 base.WndProc(ref m);