/* public int Add(object text) * { * TabPage tp = new TabPage(); * tp.Text = (string)text; * Add(tp); * * return getIndex(tp); * }*/ public void Add(TabPage value) { this.Items.Add(value); __TabControl tc = (__TabControl)(Owner); __TabPage tp = (__TabPage)value; var bg = this.Owner.GetHTMLTargetContainer(); if (bg.firstChild == null) { bg.appendChild(value.GetHTMLTarget()); } else { bg.insertBefore(value.GetHTMLTarget(), bg.firstChild); } var c = (__TabPage)value; c.InternalAssignParent(this.Owner); ((__TabControl)this.Owner).OnControlAdded(new ControlEventArgs(value)); if (!firstSelected) { firstSelected = true; Owner.SelectTab(value); } }
protected void OnFontChanged(object o, EventArgs e) { foreach (var c in Controls) { if (c is TabPage) { __TabPage p = (__TabPage)c; p.setFont(Font); } } }
void onBackColorChanged(object o, EventArgs e) { __Control c = (__Control)o; int argb = 0; try // use 'try' in case typecast below fails { __TabPage _tp = (__TabPage)c; } catch { } }
void onSizeChanged(object o, EventArgs e) { __Control c = (__Control)o; try // use 'try' in case typecast below fails { __TabPage _tp = (__TabPage)c; int w = _tp.Size.Width; this.__childWidth = w; } catch { } setTabsSize(); }
void onLocationChanged(object o, EventArgs e) { __Control c = (__Control)o; try // use 'try' in case typecast below fails { __TabPage _tp = (__TabPage)c; int x = _tp.Location.X; this.__childX = x; this.__tabs.GetHTMLTarget().style.SetLocation(x, 0); } catch { } }
public void AddToUL(TabPage tp) { __TabPage _tp = (__TabPage)tp; _tp.__assignClickEvent(delegate { SelectTab(tp); } ); __ul.appendChild(_tp.Li); setTabsSize(); Shared.Drawing.Rectangle r = _tp.getBounds(); // TODO: // Calculates filler space between last tab and the end of the panel // this same calculation can be used to add an arrow tab to allow tabs to overflow right or left. // Tab overflow is not currently supported. /* * int calc = this.__ul.offsetWidth - _tp.Li.offsetLeft - _tp.Li.offsetWidth; * this.__tabFiller.style.width = ""+calc+"px"; * this.__tabFiller.style.overflow = DOM.IStyle.OverflowEnum.auto; * __ul.appendChild(this.__tabFiller); * * int intervalId = -1; * * Action a = delegate * { * Console.WriteLine("Calculate filler width=> this.__ul.offsetWidth=" + this.__ul.offsetWidth + " this.__ul.offsetLeft=" + this.__ul.offsetLeft + " _tp.Li. offsetLeft=" + _tp.Li.offsetLeft + " offsetWidth=" + _tp.Li.offsetWidth); * * calc = this.__ul.offsetLeft - this.__ul.offsetWidth - _tp.Li.offsetLeft - _tp.Li.offsetWidth; * * Console.WriteLine("Using width: " + calc); * * this.__tabFiller.style.width = "" + calc + "px"; * Native.Window.clearInterval(intervalId); * }; * * intervalId = Native.Window.setInterval(a, 1500); */ }