Welcome to mirror list, hosted at ThFree Co, Russian Federation.

TabPage.cs « System.Windows.Forms « Managed.Windows.Forms « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ded9913a1018e6bf229e947a3e880179862141b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2004-2005 Novell, Inc.
//
// Authors:
//	Jackson Harper (jackson@ximian.com)


using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;

namespace System.Windows.Forms {
	[DefaultEvent("Click")]
	[DesignTimeVisible(false)]
	[DefaultProperty("Text")]
	[Designer("System.Windows.Forms.Design.TabPageDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
	[ToolboxItem(false)]
	public class TabPage : Panel {
		#region Fields
		private int image_index = -1;
		private string tooltip_text = String.Empty;
		private Rectangle tab_bounds;
		private int row;
		#endregion	// Fields
		
		#region Public Constructors
		public TabPage ()
		{
			Visible = true;

			SetStyle (ControlStyles.CacheText, true);
		}

		public TabPage (string text) : base ()
		{
			base.Text = text;
		}

		#endregion	// Public Constructors

		#region Public Instance Properties
		[Browsable(false)]
		[EditorBrowsable(EditorBrowsableState.Never)]
		public override AnchorStyles Anchor {
			get { return base.Anchor; }
			set { base.Anchor = value; }
		}

		[Browsable(false)]
		[EditorBrowsable(EditorBrowsableState.Never)]
		public override DockStyle Dock {
			get { return base.Dock; }
			set { base.Dock = value; }
		}

		[Browsable(false)]
		[EditorBrowsable(EditorBrowsableState.Never)]
		public new bool Enabled {
			get { return base.Enabled; }
			set { base.Enabled = value; }
		}

		[DefaultValue(-1)]
		[Editor("System.Windows.Forms.Design.ImageIndexEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
		[Localizable(true)]
		[TypeConverter(typeof(ImageIndexConverter))]
		public int ImageIndex {
			get { return image_index; }
			set {
				if (image_index == value)
					return;
				image_index = value;
				UpdateOwner ();
			}
		}

		[Browsable(false)]
		[EditorBrowsable(EditorBrowsableState.Never)]
		public new int TabIndex {
			get { return base.TabIndex; }
			set { base.TabIndex = value; }
		}

		[Browsable(false)]
		[EditorBrowsable(EditorBrowsableState.Never)]
		public new bool TabStop {
			get { return base.TabStop; }
			set { base.TabStop = value; }
		}

		[Browsable(true)]
		[Localizable(true)]
		public override string Text {
			get { return base.Text; }
			set {
				if (value == base.Text)
					return;
				base.Text = value;
				UpdateOwner ();
			}
		}

		[Localizable(true)]
		[DefaultValue("")]
		public string ToolTipText {
			get { return tooltip_text; }
			set {
				if (value == null)
					value = String.Empty;
				tooltip_text = value;
			}
		}

		[Browsable(false)]
		[EditorBrowsable(EditorBrowsableState.Never)]
		public new bool Visible {
			get { return base.Visible; }
			set { base.Visible = value; }
		}

		#endregion	// Public Instance Properties

		#region Public Static Methods
		public static TabPage GetTabPageOfComponent (object comp)
		{
			Control control = comp as Control;
			if (control == null)
				return null;
			control = control.Parent;
			while (control != null) {
				if (control is TabPage)
					break;
				control = control.Parent;
			}
			return control as TabPage;
		}

		#endregion	// Public Static Methods

		#region Public Instance Methods
		public override string ToString ()
		{
			return "TabPage: {" + Text + "}";
		}

		#endregion	// Public Instance Methods

		#region	Internal & Private Methods and Properties
		internal Rectangle TabBounds {
			get { return tab_bounds; }
			set { tab_bounds = value; }
		}

		internal int Row {
			get { return row; }
			set { row = value; }
		}

		private void UpdateOwner ()
		{
			if (Owner != null) {
				Owner.Redraw ();
			}
		}

		private TabControl Owner {
			get { return base.Parent as TabControl; }
		}

		#endregion	// Internal & Private Methods and Properties

		#region Protected Instance Methods
		protected override ControlCollection CreateControlsInstance ()
		{
			return new TabPageControlCollection (this);
		}

		protected override void SetBoundsCore (int x, int y, int width, int height, BoundsSpecified specified) 
		{
			if (Owner != null && Owner.IsHandleCreated) {
				Rectangle display = Owner.DisplayRectangle;

				base.SetBoundsCore (display.X, display.Y,
							display.Width, display.Height,
							BoundsSpecified.All);
			} else {
				base.SetBoundsCore (x, y, width, height, specified);
			}
		}

		#endregion	// Protected Instance Methods

		#region Events
		[Browsable(false)]
		[EditorBrowsable(EditorBrowsableState.Never)]
		public new event EventHandler DockChanged {
			add { base.DockChanged += value; }
			remove { base.DockChanged -= value; }
		}

		[Browsable(false)]
		[EditorBrowsable(EditorBrowsableState.Never)]
		public new event EventHandler EnabledChanged {
			add { base.EnabledChanged += value; }
			remove { base.EnabledChanged -= value; }
		}

		[Browsable(false)]
		[EditorBrowsable(EditorBrowsableState.Never)]
		public new event EventHandler TabIndexChanged {
			add { base.TabIndexChanged += value; }
			remove { base.TabIndexChanged -= value; }
		}

		[Browsable(false)]
		[EditorBrowsable(EditorBrowsableState.Never)]
		public new event EventHandler TabStopChanged {
			add { base.TabStopChanged += value; }
			remove { base.TabStopChanged -= value; }
		}

		[Browsable(false)]
		[EditorBrowsable(EditorBrowsableState.Never)]
		public new event EventHandler VisibleChanged {
			add { base.VisibleChanged += value; }
			remove { base.VisibleChanged -= value; }
		}

		#endregion	// Events

		#region Class TabPageControlCollection
		public class TabPageControlCollection : ControlCollection {

			private TabPage owner;

			public TabPageControlCollection (TabPage owner) : base (owner)
			{
				this.owner = owner;
			}

			public override void Add (Control value)
			{
				base.Add (value);
			}
		}
		#endregion	// Class TabPageControlCollection
	}

	
}