/// <summary> /// Initializes a new instance of the <see cref="TableRow"/> class. /// </summary> /// <param name="parent">Parent control.</param> public TableRow(ControlBase parent) : base(parent) { m_Columns = new Label[MaxColumns]; m_ColumnCount = 0; KeyboardInputEnabled = true; }
/// <summary> /// Initializes a new instance of the <see cref="Text"/> class. /// </summary> /// <param name="parent">Parent control.</param> public Text(ControlBase parent) : base(parent) { m_TextBox = new TextBox(this); m_TextBox.Dock = Pos.Fill; m_TextBox.ShouldDrawBackground = false; m_TextBox.TextChanged += OnValueChanged; }
/// <summary> /// Initializes a new instance of the <see cref="Splitter"/> class. /// </summary> /// <param name="parent">Parent control.</param> public Splitter(ControlBase parent) : base(parent) { m_Panel = new ControlBase[2]; m_Scale = new bool[2]; m_Scale[0] = true; m_Scale[1] = true; }
private void ResolveMenu(ControlBase btn, XmlNodeList nodes) { //FineUI.Menu menu = new Menu(); //// 通过反射获取属性Menus //PropertyInfo info = btn.GetType().GetProperty("Menus"); //(info.GetValue(btn, null) as MenuCollection).Add(menu); PropertyInfo menuInfo = btn.GetType().GetProperty("Menu"); Menu menu = menuInfo.GetValue(btn, null) as Menu; foreach (XmlNode node in nodes) { XmlAttribute attrURL = node.Attributes["navigateurl"]; if (attrURL != null) { FineUI.MenuHyperLink lnk = new FineUI.MenuHyperLink(); lnk.Text = node.Attributes["text"].Value; lnk.NavigateUrl = attrURL.Value; lnk.Target = "_blank"; menu.Items.Add(lnk); if (node.ChildNodes.Count > 0) { ResolveMenu(lnk, node.ChildNodes); } } } }
/// <summary> /// Draws the passed control /// </summary> /// <param name="control">Control</param> /// <param name="gameTime">GameTime</param> public static void Draw(ControlBase control, GameTime gameTime) { GraphicsHandler.Begin(); //Get a list of Interfaces available and draw those that need to be drawn in the correct order var list = control.GetType().GetInterfaces(); //Drawn First if (list.Contains(typeof(IBackground))) Background.Draw(control, gameTime); //Drawn Second if (list.Contains(typeof(IBorder))) Border.Draw(control, gameTime); //Drawn Third if (list.Contains(typeof(IPicture))) Picture.Draw(control, gameTime); //Drawn Last if (list.Contains(typeof(IText))) Text.Draw(control, gameTime); GraphicsHandler.End(); }
/// <summary> /// Initializes a new instance of the <see cref="Color"/> class. /// </summary> /// <param name="parent">Parent control.</param> public Color(ControlBase parent) : base(parent) { m_Button = new ColorButton(m_TextBox); m_Button.Dock = Pos.Right; m_Button.Width = 20; m_Button.Margin = new Margin(1, 1, 1, 2); m_Button.Clicked += OnButtonPressed; }
public static void RegisterAfterRenderEventScript(ControlBase control) { string invokeAfterRenderFunc = string.Format(ClientHelper.FuncRegisterAfterRender, control.DataStoreName, control.ClientAfterRenderHanlderFuncName); string registerAfterRenderFunction = string.Format(@" {0}.on('load', function() {{ {1} }});", control.DataStoreName, invokeAfterRenderFunc); control.Page.ClientScript.RegisterStartupScript(control.Page.GetType(), control.ClientID + "JsonStore_AfterRenderFunction", registerAfterRenderFunction, true) ; }
public static void RegisterControlCombinerLoadEventHanlder(ControlBase control) { string invokeVKeCRMOnloadFunc = string.Format(ClientHelper.FuncRegisterControlsCombiner, control.DataStoreName); //Register the onload event handlers string registerOnLoadFunction = string.Format(@"{0}.on('load', function(){{ {1} }}); ", control.DataStoreName, invokeVKeCRMOnloadFunc); control.Page.ClientScript.RegisterStartupScript(control.Page.GetType(), control.ClientID + "JsonStore_OnloadFunction", registerOnLoadFunction, true); }
/// <summary> /// Initializes a new instance of the <see cref="Check"/> class. /// </summary> /// <param name="parent">Parent control.</param> public Check(ControlBase parent) : base(parent) { m_CheckBox = new Control.CheckBox(this); m_CheckBox.ShouldDrawBackground = false; m_CheckBox.CheckChanged += OnValueChanged; m_CheckBox.IsTabable = true; m_CheckBox.KeyboardInputEnabled = true; m_CheckBox.SetPosition(2, 1); Height = 18; }
/// <summary> /// Add the control which you want to combine when first load. /// </summary> /// <param name="control"></param> /// <param name="controllerType"></param> public void AddControl(ControlBase control, Type controllerType) { if ((!_controls.ContainsKey(control.ID)) && control.isAutoLoad) { control.isAutoLoad = false; if (_controls.Any(item => item.Value.Key.DataStoreID == control.DataStoreID ) == false) {// We add it only if the same datasotre doesn't exist. _controls.Add(control.ClientID, new KeyValuePair<ControlBase, string>(control, controllerType.AssemblyQualifiedName)); } } }
protected void Page_Load(object sender, EventArgs e) { Header.Controls.Add(Page.LoadControl("~/Controls/Header.ascx")); if (!string.IsNullOrEmpty(Request.Params["id"])) { control = LoadUserControl("~/Controls/Article.ascx"); } else { control = LoadUserControl("~/Controls/ArticleList.ascx"); } Main.Controls.Add(control); }
/// <summary> /// Sets the contents of a splitter panel. /// </summary> /// <param name="panelIndex">Panel index (0-1).</param> /// <param name="panel">Panel contents.</param> /// <param name="noScale">Determines whether the content is to be scaled.</param> public void SetPanel(int panelIndex, ControlBase panel, bool noScale = false) { if (panelIndex < 0 || panelIndex > 1) throw new ArgumentException("Invalid panel index", "panelIndex"); m_Panel[panelIndex] = panel; m_Scale[panelIndex] = !noScale; if (null != m_Panel[panelIndex]) { m_Panel[panelIndex].Parent = this; } }
public static void RegisterVKeCRMClientReloadControlAction(this System.Web.UI.Control control, EventType eventType, ControlBase targetControl) { //We must treate our VKeCRM control for special client id string sourceClientId = control is ControlBase ? ((ControlBase)control).GeneratedControlId : control.ClientID; if (control is ControlBase) { ((ControlBase)control).AddClientControlBinding(sourceClientId, targetControl.DataStoreID, eventType); } else { targetControl.AddClientControlBinding(sourceClientId, targetControl.DataStoreID, eventType); } }
/// <summary> /// Initializes a new instance of the <see cref="Table"/> class. /// </summary> /// <param name="parent">Parent control.</param> public Table(ControlBase parent) : base(parent) { m_ColumnCount = 1; m_DefaultRowHeight = 22; m_ColumnWidth = new int[TableRow.MaxColumns]; for (int i = 0; i < TableRow.MaxColumns; i++) { m_ColumnWidth[i] = 20; } m_SizeToContents = false; }
/// <summary> /// Constructor which builds the class using the given ControlBase control /// </summary> /// <param name="control"></param> public PreviousContainerContextInfo(ControlBase control) { if (control.ContainerContext == null) throw new LUCAControlException("Expected ContainerContext to be non-null."); if (!control.ContainerContext.Children.Contains(control)) throw new LUCAControlException("Expected parameter 'control' to be a child of it's ContainerContext."); if (control.PreviousContainerContext != default(PreviousContainerContextInfo)) control.PreviousContainerContext = null; ContainerContext = control.ContainerContext; Index = control.ContainerContext.Children.IndexOf(control); if (Index == control.ContainerContext.Children.Count - 1) WasLastItemInContainer = true; }
/// <summary> /// Color-select button press handler. /// </summary> /// <param name="control">Event source.</param> protected virtual void OnButtonPressed(ControlBase control) { Menu menu = new Menu(GetCanvas()); menu.SetSize(256, 180); menu.DeleteOnClose = true; menu.IconMarginDisabled = true; HSVColorPicker picker = new HSVColorPicker(menu); picker.Dock = Pos.Fill; picker.SetSize(256, 128); String[] split = m_TextBox.Text.Split(' '); picker.SetColor(GetColorFromText(), false, true); picker.ColorChanged += OnColorChanged; menu.Open(Pos.Right | Pos.Top); }
/// <summary> /// Initializes the passed control /// </summary> /// <param name="control">Control</param> public static void Initialize(ControlBase control) { foreach (var i in control.GetType().GetInterfaces()) { switch (i.Name) { case "IEvents": Events.Initialize(control); break; case "IText": Text.Initialize(control); break; case "IIndex": Index.Initialize(control); break; case "IChecked": Checked.Initialize(control); break; case "IBorder": Border.Initialize(control); break; case "IBackground": Background.Initialize(control); break; case "IPanel": Panel.Initialize(control); break; case "IPicture": Picture.Initialize(control); break; case "IFont": Font.Initialize(control); break; default: break; //If anything else simply break because its not needed } } }
/// <summary> /// It will get the value from the itself control, and then to set the paratmer of target control with reloading /// </summary> /// <param name="control"></param> /// <param name="eventType"></param> /// <param name="targetControl"></param> /// <param name="associatedParamterName"></param> public static void RegisterVKeCRMClientReloadWithParamterControlAction(this System.Web.UI.Control control, EventType eventType, ControlBase targetControl, string associatedParamterName) { //We must treate our VKeCRM control for special client id string sourceClientId = control is ControlBase ? ((ControlBase)control).GeneratedControlId : control.ClientID; if (control is ControlBase) { ((ControlBase)control).AddClientControlBinding(sourceClientId, targetControl.DataStoreID, associatedParamterName, eventType, true); } else { string function = string.Format(ClientHelper.FuncRegisterListener, sourceClientId, targetControl.DataStoreID, associatedParamterName, "true", eventType.ToString().ToLower(), sourceClientId); control.Page.ClientScript.RegisterStartupScript(control.GetType(), control.ClientID + targetControl.ClientID + "InitFunc", function, true); } }
public DataSet GetData(string logicName, System.Data.DataSet request) { try { //if (!CheckIP()) //{ // hzyMessage.ErrorMessage = "IP限制"; // return null; //} ControlBase cb = new ControlBase(); cb.hzyMessage = this.hzyMessage; return cb.GetData(logicName, request); } catch (Exception ex) { hzyMessage.ErrorMessage = ex.Message; //hzyMessage.exception = ex; HZY.COM.Common.Log.WirteLogWS(ex, ""); return null; } }
public bool Excute(string logicName, System.Data.DataSet request) { try { //if (!CheckIP()) //{ // hzyMessage.ErrorMessage = "IP限制"; // return false; //} ControlBase cb = new ControlBase(); cb.hzyMessage = this.hzyMessage; return cb.Excute(logicName, request); } catch (Exception ex) { hzyMessage.ErrorMessage = ex.ToString(); hzyMessage.Message = ex.Message; HZY.COM.Common.Log.WirteLogWS(ex, ""); return false; } }
public virtual void DrawMenuStrip(ControlBase control) { }
public Viewer(ControlBase parent) : base(parent, new XmlStringSource(Xml)) { m_ExceptionEventArgs = new ExceptionEventArgs(); }
private void PopulatePlayback(ControlBase parent) { var playbackzoom = GwenHelper.CreateHeaderPanel(parent, "Playback Zoom"); RadioButtonGroup pbzoom = new RadioButtonGroup(playbackzoom) { Dock = Dock.Left, ShouldDrawBackground = false, }; pbzoom.AddOption("Default Zoom"); pbzoom.AddOption("Current Zoom"); pbzoom.AddOption("Specific Zoom"); Spinner playbackspinner = new Spinner(pbzoom) { Dock = Dock.Bottom, Max = 24, Min = 1, }; pbzoom.SelectionChanged += (o, e) => { Settings.PlaybackZoomType = ((RadioButtonGroup)o).SelectedIndex; Settings.Save(); playbackspinner.IsHidden = (((RadioButtonGroup)o).SelectedLabel != "Specific Zoom"); }; playbackspinner.ValueChanged += (o, e) => { Settings.PlaybackZoomValue = (float)((Spinner)o).Value; Settings.Save(); }; pbzoom.SetSelection(Settings.PlaybackZoomType); playbackspinner.Value = Settings.PlaybackZoomValue; var playbackmode = GwenHelper.CreateHeaderPanel(parent, "Playback Color"); GwenHelper.AddCheckbox(playbackmode, "Color Playback", Settings.ColorPlayback, (o, e) => { Settings.ColorPlayback = ((Checkbox)o).IsChecked; Settings.Save(); }); var preview = GwenHelper.AddCheckbox(playbackmode, "Preview Mode", Settings.PreviewMode, (o, e) => { Settings.PreviewMode = ((Checkbox)o).IsChecked; Settings.Save(); }); var recording = GwenHelper.AddCheckbox(playbackmode, "Recording Mode", Settings.Local.RecordingMode, (o, e) => { Settings.Local.RecordingMode = ((Checkbox)o).IsChecked; }); var framerate = GwenHelper.CreateHeaderPanel(parent, "Frame Control"); var smooth = GwenHelper.AddCheckbox(framerate, "Smooth Playback", Settings.SmoothPlayback, (o, e) => { Settings.SmoothPlayback = ((Checkbox)o).IsChecked; Settings.Save(); }); ComboBox pbrate = GwenHelper.CreateLabeledCombobox(framerate, "Playback Rate:"); for (var i = 0; i < Constants.MotionArray.Length; i++) { var f = (Constants.MotionArray[i] / (float)Constants.PhysicsRate); pbrate.AddItem(f + "x", f.ToString(CultureInfo.InvariantCulture), f); } pbrate.SelectByName(Settings.DefaultPlayback.ToString(CultureInfo.InvariantCulture)); pbrate.ItemSelected += (o, e) => { Settings.DefaultPlayback = (float)e.SelectedItem.UserData; Settings.Save(); }; var cbslowmo = GwenHelper.CreateLabeledCombobox(framerate, "Slowmo FPS:"); var fpsarray = new[] { 1, 2, 5, 10, 20 }; for (var i = 0; i < fpsarray.Length; i++) { cbslowmo.AddItem(fpsarray[i].ToString(), fpsarray[i].ToString(CultureInfo.InvariantCulture), fpsarray[i]); } cbslowmo.SelectByName(Settings.SlowmoSpeed.ToString(CultureInfo.InvariantCulture)); cbslowmo.ItemSelected += (o, e) => { Settings.SlowmoSpeed = (int)e.SelectedItem.UserData; Settings.Save(); }; smooth.Tooltip = "Interpolates frames from the base\nphysics rate of 40 frames/second\nup to 60 frames/second"; }
/// <summary> /// Handler for Copy event. /// </summary> /// <param name="from">Source control.</param> protected override void OnCopy(ControlBase from, EventArgs args) { Platform.Platform.SetClipboardText(Text); }
public virtual void DrawTabButton(ControlBase control, bool active, Pos dir) { }
private void ChangeControl(ControlBase control, bool add) { Element container = GetChildElementContainerInternal(); if (add) { control.AddControlTo(container); } else { control.RemoveControlFrom(container); } }
/// <summary> /// Performs a safe remove of a given child from the collection. /// Preferable over direct remove from the Children collection itself, /// because this method can be overriden by derived controls /// </summary> /// <param name="childToRemove"></param> public virtual void RemoveChild(ControlBase childToRemove) { Children.Remove(childToRemove); }
public virtual void DrawGroupBox(ControlBase control, int textStart, int textHeight, int textWidth) { }
public virtual void DrawMenuItem(ControlBase control, bool submenuOpen, bool isChecked) { }
public virtual void DrawCheckBox(ControlBase control, bool selected, bool depressed) { }
public virtual void DrawRadioButton(ControlBase control, bool selected, bool depressed) { }
public virtual void DrawMenu(ControlBase control, bool paddingDisabled) { }
/// <summary> /// Initializes a new instance of the <see cref="HSVColorPicker"/> class. /// </summary> /// <param name="parent">Parent control.</param> public HSVColorPicker(ControlBase parent) : base(parent) { MouseInputEnabled = true; int baseSize = BaseUnit; m_LerpBox = new ColorLerpBox(this); m_LerpBox.Margin = Margin.Two; m_LerpBox.ColorChanged += ColorBoxChanged; m_LerpBox.Dock = Dock.Fill; ControlBase values = new VerticalLayout(this); values.Dock = Dock.Right; { m_After = new ColorDisplay(values); m_After.Size = new Size(baseSize * 5, baseSize * 2); m_Before = new ColorDisplay(values); m_Before.Margin = new Margin(2, 0, 2, 2); m_Before.Size = new Size(baseSize * 5, baseSize * 2); GridLayout grid = new GridLayout(values); grid.Margin = new Margin(2, 0, 2, 2); grid.SetColumnWidths(GridLayout.AutoSize, GridLayout.Fill); { { Label label = new Label(grid); label.Text = "R: "; label.Alignment = Alignment.Left | Alignment.CenterV; m_Red = new NumericUpDown(grid); m_Red.Min = 0; m_Red.Max = 255; m_Red.SelectAllOnFocus = true; m_Red.ValueChanged += NumericTyped; } { Label label = new Label(grid); label.Text = "G: "; label.Alignment = Alignment.Left | Alignment.CenterV; m_Green = new NumericUpDown(grid); m_Green.Min = 0; m_Green.Max = 255; m_Green.SelectAllOnFocus = true; m_Green.ValueChanged += NumericTyped; } { Label label = new Label(grid); label.Text = "B: "; label.Alignment = Alignment.Left | Alignment.CenterV; m_Blue = new NumericUpDown(grid); m_Blue.Min = 0; m_Blue.Max = 255; m_Blue.SelectAllOnFocus = true; m_Blue.ValueChanged += NumericTyped; } } } m_ColorSlider = new ColorSlider(this); m_ColorSlider.Margin = Margin.Two; m_ColorSlider.ColorChanged += ColorSliderChanged; m_ColorSlider.Dock = Dock.Right; EnableDefaultColor = false; SetColor(DefaultColor); }
private void OnExit(ControlBase sender, ExitEventArgs args) { m_Restart = args.Restart; Exit(); }
/// <summary> /// Initializes a new instance of the <see cref="TableRow"/> class. /// </summary> /// <param name="parent">Parent control.</param> public TableRow(ControlBase parent) : base(parent) { KeyboardInputEnabled = true; }
public virtual void DrawTabTitleBar(ControlBase control) { }
public ComboBoxTest(ControlBase parent) : base(parent) { VerticalLayout layout = new VerticalLayout(this); { ComboBox combo = new ComboBox(layout); combo.Margin = Net.Margin.Five; combo.Width = 200; combo.AddItem("Option One", "one"); combo.AddItem("Number Two", "two"); combo.AddItem("Door Three", "three"); combo.AddItem("Four Legs", "four"); combo.AddItem("Five Birds", "five"); combo.ItemSelected += OnComboSelect; } { // Empty ComboBox combo = new ComboBox(layout); combo.Margin = Net.Margin.Five; combo.Width = 200; } { // Lots of things ComboBox combo = new ComboBox(layout); combo.Margin = Net.Margin.Five; combo.Width = 200; for (int i = 0; i < 500; i++) { combo.AddItem(String.Format("Option {0}", i)); } combo.ItemSelected += OnComboSelect; } { // Editable EditableComboBox combo = new EditableComboBox(layout); combo.Margin = Net.Margin.Five; combo.Width = 200; combo.AddItem("Option One", "one"); combo.AddItem("Number Two", "two"); combo.AddItem("Door Three", "three"); combo.AddItem("Four Legs", "four"); combo.AddItem("Five Birds", "five"); combo.ItemSelected += (s, a) => UnitPrint(String.Format("ComboBox: OnComboSelect: {0}", combo.SelectedItem.Text));; combo.TextChanged += (s, a) => UnitPrint(String.Format("ComboBox: OnTextChanged: {0}", combo.Text)); combo.SubmitPressed += (s, a) => UnitPrint(String.Format("ComboBox: OnSubmitPressed: {0}", combo.Text)); } { HorizontalLayout hlayout = new HorizontalLayout(layout); { // In-Code Item Change ComboBox combo = new ComboBox(hlayout); combo.Margin = Net.Margin.Five; combo.Width = 200; MenuItem Triangle = combo.AddItem("Triangle"); combo.AddItem("Red", "color"); combo.AddItem("Apple", "fruit"); combo.AddItem("Blue", "color"); combo.AddItem("Green", "color", 12); combo.ItemSelected += OnComboSelect; //Select by Menu Item { Button TriangleButton = new Button(hlayout); TriangleButton.Text = "Triangle"; TriangleButton.Width = 100; TriangleButton.Clicked += delegate(ControlBase sender, ClickedEventArgs args) { combo.SelectedItem = Triangle; }; } //Select by Text { Button TestBtn = new Button(hlayout); TestBtn.Text = "Red"; TestBtn.Width = 100; TestBtn.Clicked += delegate(ControlBase sender, ClickedEventArgs args) { combo.SelectByText("Red"); }; } //Select by Name { Button TestBtn = new Button(hlayout); TestBtn.Text = "Apple"; TestBtn.Width = 100; TestBtn.Clicked += delegate(ControlBase sender, ClickedEventArgs args) { combo.SelectByName("fruit"); }; } //Select by UserData { Button TestBtn = new Button(hlayout); TestBtn.Text = "Green"; TestBtn.Width = 100; TestBtn.Clicked += delegate(ControlBase sender, ClickedEventArgs args) { combo.SelectByUserData(12); }; } } } }
public XState(ControlBase control) { _control = control; }
void OnComboSelect(ControlBase control, EventArgs args) { ComboBox combo = control as ComboBox; UnitPrint(String.Format("ComboBox: OnComboSelect: {0}", combo.SelectedItem.Text)); }
public void AddToMeasure(ControlBase element) { m_MeasureQueue.Add(element); }
private void PopulateKeybinds(ControlBase parent) { var hk = new HotkeyWidget(parent); }
public virtual void DrawTabControl(ControlBase control) { }
/// <summary> /// Handler for Paste event. /// </summary> /// <param name="from">Source control.</param> protected override void onPaste(ControlBase from, EventArgs args) { base.onPaste(from, args); insertText(Platform.Neutral.GetClipboardText()); }
public virtual void DrawMenuRightArrow(ControlBase control) { }
/// <summary> /// Initializes a new instance of the <see cref="Center"/> class. /// </summary> /// <param name="parent">Parent control.</param> public Center(ControlBase parent) : base(parent) { Pos = Pos.Center; }
// Returns true if any of the settings do not match: public virtual bool DidChange(ControlBase c) { if (text != c.text) { c.Text = c.text; return true; } if (textOffsetZ != c.textOffsetZ) { if (c.spriteText != null) c.spriteText.offsetZ = textOffsetZ; return true; } return false; }
public virtual void DrawTextBox(ControlBase control) { }
void Image_Clicked(ControlBase control, EventArgs args) { UnitPrint("Image: Clicked"); }
internal void RemoveChildControl(ControlBase control) { _controls.Remove(control); }
public virtual void DrawWindow(ControlBase control, int topHeight, bool inFocus) { }
/// <summary> /// Performs a framework-safe insert into the Children collection /// Preferable over direct Insert to the Children collection itself, /// because this method can be overriden by derived controls /// </summary> /// <param name="insertAtIndexOf"></param> /// <param name="childToInsert"></param> public virtual void InsertChild(int insertAtIndexOf, ControlBase childToInsert) { Children.Insert(insertAtIndexOf, childToInsert); }
public virtual void DrawWindowCloseButton(ControlBase control, bool depressed, bool hovered, bool disabled) { }
/// <summary> /// Performs a framework-safe add of a child to the collection /// Preferable over direct Add to the Children collection itself, /// because this method can be overriden by derived controls /// </summary> /// <param name="childToAdd"></param> public virtual void AddChild(ControlBase childToAdd) { Children.Add(childToAdd); }
public virtual void DrawHighlight(ControlBase control) { }
/// <summary> /// Initializes a new instance of the <see cref="Positioner"/> class. /// </summary> /// <param name="parent">Parent control.</param> public Positioner(ControlBase parent) : base(parent) { Pos = Pos.Left | Pos.Top; }
public virtual void DrawStatusBar(ControlBase control) { }
// Mirrors the specified control's settings public virtual void Mirror(ControlBase c) { text = c.text; textOffsetZ = c.textOffsetZ; }
public virtual void DrawShadow(ControlBase control) { }
public virtual void Validate(ControlBase c) { }
public virtual void DrawScrollBarBar(ControlBase control, bool depressed, bool hovered, bool horizontal) { }