1 // Permission is hereby granted, free of charge, to any person obtaining
2 // a copy of this software and associated documentation files (the
3 // "Software"), to deal in the Software without restriction, including
4 // without limitation the rights to use, copy, modify, merge, publish,
5 // distribute, sublicense, and/or sell copies of the Software, and to
6 // permit persons to whom the Software is furnished to do so, subject to
7 // the following conditions:
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 // Miguel de Icaza (miguel@gnome.org)
24 // (C) 2004 Novell, Inc.
28 using System.ComponentModel;
29 using System.Collections;
30 using System.Windows.Forms.Layout;
32 namespace System.Windows.Forms {
34 public class TableLayoutSettings : LayoutSettings {
35 TableLayoutPanel panel;
36 ColumnStyleCollection column_style;
37 TableLayoutPanelGrowStyle grow_style;
42 static LayoutEngine layout_engine = new TableLayout ();
44 internal TableLayoutSettings (TableLayoutPanel panel)
49 grow_style = TableLayoutPanelGrowStyle.AddRows;
50 column_style = new ColumnStyleCollection (panel);
53 public int ColumnCount {
73 public TableLayoutPanelGrowStyle GrowStyle {
79 public override LayoutEngine LayoutEngine {
85 public TableLayoutSettings.ColumnStyleCollection ColumnStyle {
91 public abstract class StyleCollection {
92 ArrayList al = new ArrayList ();
93 TableLayoutPanel table;
95 internal StyleCollection (TableLayoutPanel table)
100 public int Add (TableLayoutSettings.Style style)
102 return al.Add (style);
105 // FIXME; later this should be an override.
110 // FIXME: Need to investigate what happens when the style is gone.
114 #region IList methods
116 // The IList methods will later be implemeneted, this is to get us started
118 internal bool Contains (Style style)
120 return al.Contains (style);
123 internal int IndexOf (Style style)
125 return al.IndexOf (style);
128 internal void Insert (int index, Style style)
130 al.Insert (index, style);
133 internal void Remove (Style style)
139 public Style this [int idx] {
141 return (Style) al [idx];
150 public class ColumnStyleCollection : StyleCollection {
152 internal ColumnStyleCollection (TableLayoutPanel panel) : base (panel)
156 public void Add (ColumnStyle style)
161 public bool Contains (ColumnStyle style)
163 return base.Contains (style);
166 public int IndexOf (ColumnStyle style)
168 return base.IndexOf (style);
171 public void Insert (int index, ColumnStyle style)
173 base.Insert (index, style);
176 public void Remove (ColumnStyle style)
181 public new ColumnStyle this [int index] {
183 return (ColumnStyle) base [index];
187 base [index] = value;
193 internal SizeType size_type;
195 public SizeType SizeType {