public static Panel createPanel(this SdkTrayManager trayMgr, TrayLocation trayLoc, string name, float width, float height, float left, float top) { Panel panel = new Panel(name, width, height, left, top); trayMgr.moveWidgetToTray(panel, trayLoc); return(panel); }
public DecorWidget CreateDecorWidget(TrayLocation trayLoc, string name, string templateName) { DecorWidget dw = new DecorWidget(name, templateName); MoveWidgetToTray(dw, trayLoc); return(dw); }
void MoveWidgetToTray(Widget widget, TrayLocation trayLoc, int place = -1) { Contract.ArgumentNotNull(widget, "widget"); // remove widget from old tray var wList = _widgets[(int)widget.TrayLocation]; if (wList.Contains(widget)) { wList.Remove(widget); _trays[(int)widget.TrayLocation].RemoveChild(widget.Name); } // insert widget into new tray at given position, or at the end if unspecified or invalid if (place == -1 || place > (int)_widgets[(int)trayLoc].Count) { place = (int)_widgets[(int)trayLoc].Count; } _widgets[(int)trayLoc].Insert(place, widget); _trays[(int)trayLoc].AddChild(widget.OverlayElement); widget.OverlayElement.HorizontalAlignment = _trayWidgetAlign[(int)trayLoc]; // adjust trays if necessary if (widget.TrayLocation != TrayLocation.None || trayLoc != TrayLocation.None) { AdjustTrays(); } widget.TrayLocation = trayLoc; }
public static Panel createPanel(this SdkTrayManager trayMgr, TrayLocation trayLoc, string name) { Panel panel = new Panel(name); trayMgr.moveWidgetToTray(panel, trayLoc); return(panel); }
public Label CreateLabel(TrayLocation trayLoc, string name, string caption, float width = 0.0f) { Label l = new Label(name, caption, width); MoveWidgetToTray(l, trayLoc); //l->_assignListener(mListener); return(l); }
public ParamsPanel CreateParamsPanel(TrayLocation trayLoc, string name, float width, StringVector paramNames) { ParamsPanel pp = new ParamsPanel(name, width, paramNames.Count); pp.SetAllParamNames(paramNames); MoveWidgetToTray(pp, trayLoc); return(pp); }
public void ShowLogo(TrayLocation trayLoc, int place = -1) { if (!IsLogoVisible()) { _logo = CreateDecorWidget(TrayLocation.None, Name + "/Logo", "SdkTrays/Logo"); } MoveWidgetToTray(_logo, trayLoc, place); }
private void _addTextureShadowDebugOverlay(TrayLocation loc, int num) { for (var i = 0; i < num; ++i) { //TODO //Texture shadowTex = this.SceneManager.GetShadowTexture( i ); //_addTextureDebugOverlay( loc, shadowTex, i ); } }
public static InputBox createInputBox(this SdkTrayManager trayMgr, TrayLocation trayLoc, string name, string caption, float width, float boxWidth, string text = null, bool onlyAcceptNum = false) { InputBox ib = new InputBox(name, caption, width, boxWidth, text, onlyAcceptNum); trayMgr.moveWidgetToTray(ib, trayLoc); ib.Text = text; //ib._assignListener(mListener); return(ib); }
public void ShowFrameStats(TrayLocation trayLoc, int place = -1) { if (!AreFrameStatsVisible()) { StringVector stats = new StringVector(); stats.Add("Average FPS"); stats.Add("Best FPS"); stats.Add("Worst FPS"); stats.Add("Triangles"); stats.Add("Batches"); _fpsLabel = CreateLabel(TrayLocation.None, Name + "/FpsLabel", "FPS:", 180); //_fpsLabel._AssignListener(this); _statsPanel = CreateParamsPanel(TrayLocation.None, Name + "/StatsPanel", 180, stats); } }
private void _addTextureDebugOverlay(TrayLocation loc, string texname, int i) { // Create material var matName = "Axiom/DebugTexture" + i; var debugMat = (Material)MaterialManager.Instance.GetByName(matName); if (debugMat == null) { debugMat = (Material)MaterialManager.Instance.Create(matName, ResourceGroupManager.DefaultResourceGroupName); } var p = debugMat.GetTechnique(0).GetPass(0); p.RemoveAllTextureUnitStates(); p.LightingEnabled = false; var t = p.CreateTextureUnitState(texname); t.SetTextureAddressingMode(TextureAddressing.Clamp); // create template if (OverlayManager.Instance.Elements.GetElement("Axiom/DebugTexOverlay", true) == null) { var e = OverlayManager.Instance.Elements.CreateElement("Panel", "Axiom/DebugTexOverlay", true); e.MetricsMode = MetricsMode.Pixels; e.Width = 128; e.Height = 128; } // add widget var widgetName = "DebugTex" + i; var w = TrayManager.GetWidget(widgetName); if (w == null) { w = TrayManager.CreateDecorWidget(loc, widgetName, "", "Axiom/DebugTexOverlay"); } w.OverlayElement.MaterialName = matName; }
/// <summary> /// /// </summary> /// <param name="trayLoc"></param> /// <param name="name"></param> /// <param name="caption"></param> /// <param name="width"></param> /// <param name="maxItemsShown"></param> /// <returns></returns> public SelectMenu CreateThickSelectMenu( TrayLocation trayLoc, String name, DisplayString caption, Real width, int maxItemsShown ) { return CreateThickSelectMenu( trayLoc, name, caption, width, maxItemsShown, new List<String>() ); }
/// <summary> /// /// </summary> /// <param name="trayLoc"></param> /// <param name="name"></param> /// <param name="caption"></param> /// <param name="width"></param> /// <param name="height"></param> /// <returns></returns> public TextBox CreateTextBox( TrayLocation trayLoc, String name, DisplayString caption, Real width, Real height ) { var tb = new TextBox( name, caption, width, height ); MoveWidgetToTray( tb, trayLoc ); tb.AssignedTrayListener = this.listener; return tb; }
/// <summary> /// /// </summary> /// <param name="trayLoc"></param> /// <param name="name"></param> /// <param name="caption"></param> /// <param name="width"></param> /// <returns></returns> public Button CreateButton( TrayLocation trayLoc, String name, String caption, Real width ) { var b = new Button( name, caption, width ); MoveWidgetToTray( b, trayLoc ); b.AssignedTrayListener = this.listener; return b; }
/// <summary> /// Destroys all widgets in a tray. /// </summary> /// <param name="trayLoc"></param> public void DestroyAllWidgetsInTray( TrayLocation trayLoc ) { while ( !( this.mWidgets[ (int)trayLoc ].Count == 0 ) ) { DestroyWidget( this.mWidgets[ (int)trayLoc ][ 0 ] ); } }
/// <summary> /// Shows logo in the specified location. /// </summary> /// <param name="trayLoc"></param> public void ShowLogo( TrayLocation trayLoc ) { ShowLogo( trayLoc, -1 ); }
/// <summary> /// Destroys a widget. /// </summary> /// <param name="trayLoc"></param> /// <param name="place"></param> public void DestroyWidget( TrayLocation trayLoc, int place ) { DestroyWidget( GetWidget( trayLoc, place ) ); }
private void _addTextureDebugOverlay(TrayLocation loc, Texture tex, int i) { _addTextureDebugOverlay(loc, tex.Name, i); }
/// <summary> /// Gets a widget from a tray by name. /// </summary> /// <param name="trayLoc"></param> /// <param name="name"></param> /// <returns></returns> public Widget GetWidget( TrayLocation trayLoc, String name ) { for ( int i = 0; i < this.mWidgets[ (int)trayLoc ].Count; i++ ) { if ( this.mWidgets[ (int)trayLoc ][ i ].Name == name ) { return this.mWidgets[ (int)trayLoc ][ i ]; } } return null; }
/// <summary> /// Adds a widget to a specified tray. /// </summary> /// <param name="currentTrayLoc"></param> /// <param name="currentPlace"></param> /// <param name="targetTrayLoc"></param> /// <param name="targetPlace"></param> public void MoveWidgetToTray( TrayLocation currentTrayLoc, int currentPlace, TrayLocation targetTrayLoc, int targetPlace ) { MoveWidgetToTray( GetWidget( currentTrayLoc, currentPlace ), targetTrayLoc, targetPlace ); }
/// <summary> /// Adds a widget to a specified tray. /// </summary> /// <param name="currentTrayLoc"></param> /// <param name="name"></param> /// <param name="targetTrayLoc"></param> /// <param name="place"></param> public void MoveWidgetToTray( TrayLocation currentTrayLoc, String name, TrayLocation targetTrayLoc, int place ) { MoveWidgetToTray( GetWidget( currentTrayLoc, name ), targetTrayLoc, place ); }
/// <summary> /// Adds a widget to a specified tray. /// </summary> /// <param name="name"></param> /// <param name="trayLoc"></param> /// <param name="place"></param> public void MoveWidgetToTray( String name, TrayLocation trayLoc, int place ) { MoveWidgetToTray( GetWidget( name ), trayLoc, place ); }
/// <summary> /// Adds a widget to a specified tray. /// </summary> /// <param name="name"></param> /// <param name="trayLoc"></param> public void MoveWidgetToTray( String name, TrayLocation trayLoc ) { MoveWidgetToTray( GetWidget( name ), trayLoc, -1 ); }
/// <summary> /// Adds a widget to a specified tray. /// </summary> /// <param name="widget"></param> /// <param name="trayLoc"></param> /// <param name="place"></param> public void MoveWidgetToTray( Widget widget, TrayLocation trayLoc, int place ) { if ( widget == null ) { throw new ArgumentNullException( "widget", "Widget deos not exist." ); } // remove widget from old tray WidgetList wList = this.mWidgets[ (int)widget.TrayLocation ]; if ( wList == null ) { wList = new WidgetList(); this.mWidgets[ (int)widget.TrayLocation ] = wList; } if ( wList.Contains( widget ) ) { wList.Remove( widget ); this.mTrays[ (int)widget.TrayLocation ].RemoveChild( widget.Name ); } // insert widget into new tray at given position, or at the end if unspecified or invalid if ( place == -1 || place > this.mWidgets[ (int)trayLoc ].Count ) { place = this.mWidgets[ (int)trayLoc ].Count; } this.mWidgets[ (int)trayLoc ].Insert( place, widget ); // mWidgets[ (int)trayLoc ].Add( widget ); this.mTrays[ (int)trayLoc ].AddChild( widget.OverlayElement ); widget.OverlayElement.HorizontalAlignment = this.trayWidgetAlign[ (int)trayLoc ]; // adjust trays if necessary if ( widget.TrayLocation != TrayLocation.None || trayLoc != TrayLocation.None ) { AdjustTrays(); } widget.AssigendTray = trayLoc; //widget.Show(); //mTraysLayer.AddElement( (OverlayElementContainer)widget.OverlayElement); }
/// <summary> /// Adds a widget to a specified tray. /// </summary> /// <param name="widget"></param> /// <param name="trayLoc"></param> public void MoveWidgetToTray( Widget widget, TrayLocation trayLoc ) { MoveWidgetToTray( widget, trayLoc, -1 ); }
/// <summary> /// /// </summary> /// <param name="trayLoc"></param> /// <param name="name"></param> /// <param name="caption"></param> /// <param name="width"></param> /// <param name="maxItemsShown"></param> /// <param name="items"></param> /// <returns></returns> public SelectMenu CreateThickSelectMenu( TrayLocation trayLoc, String name, DisplayString caption, Real width, int maxItemsShown, IList<String> items ) { var sm = new SelectMenu( name, caption, width, 0, maxItemsShown ); MoveWidgetToTray( sm, trayLoc ); sm.AssignedTrayListener = this.listener; if ( !( items.Count == 0 ) ) { sm.Items = items; } return sm; }
/// <summary> /// /// </summary> /// <param name="trayLoc"></param> /// <param name="name"></param> /// <param name="caption"></param> /// <param name="boxWidth"></param> /// <param name="maxItemsShown"></param> /// <returns></returns> public SelectMenu createLongSelectMenu( TrayLocation trayLoc, String name, DisplayString caption, Real boxWidth, int maxItemsShown ) { return CreateLongSelectMenu( trayLoc, name, caption, 0, boxWidth, maxItemsShown, new List<string>() ); }
private void _addTextureDebugOverlay( TrayLocation loc, string texname, int i ) { // Create material var matName = "Axiom/DebugTexture" + i; var debugMat = (Material)MaterialManager.Instance.GetByName( matName ); if ( debugMat == null ) { debugMat = (Material)MaterialManager.Instance.Create( matName, ResourceGroupManager.DefaultResourceGroupName ); } var p = debugMat.GetTechnique( 0 ).GetPass( 0 ); p.RemoveAllTextureUnitStates(); p.LightingEnabled = false; var t = p.CreateTextureUnitState( texname ); t.SetTextureAddressingMode( TextureAddressing.Clamp ); // create template if ( OverlayManager.Instance.Elements.GetElement( "Axiom/DebugTexOverlay", true ) == null ) { var e = OverlayManager.Instance.Elements.CreateElement( "Panel", "Axiom/DebugTexOverlay", true ); e.MetricsMode = MetricsMode.Pixels; e.Width = 128; e.Height = 128; } // add widget var widgetName = "DebugTex" + i; var w = TrayManager.GetWidget( widgetName ); if ( w == null ) { w = TrayManager.CreateDecorWidget( loc, widgetName, "", "Axiom/DebugTexOverlay" ); } w.OverlayElement.MaterialName = matName; }
/// <summary> /// Shows frame statistics widget set in the specified location. /// </summary> /// <param name="trayLoc"></param> /// <param name="place"></param> public void ShowFrameStats( TrayLocation trayLoc, int place ) { if ( !IsFrameStatsVisible ) { var stats = new List<string>(); stats.Add( "Average FPS" ); stats.Add( "Best FPS" ); stats.Add( "Worst FPS" ); stats.Add( "Triangles" ); stats.Add( "Batches" ); this.mFpsLabel = CreateLabel( TrayLocation.None, this.mName + "/FpsLabel", "FPS:", 180 ); this.mFpsLabel.AssignedTrayListener = this; this.StatsPanel = CreateParamsPanel( TrayLocation.None, this.mName + "/StatsPanel", 180, stats ); } MoveWidgetToTray( this.mFpsLabel, trayLoc, place ); MoveWidgetToTray( this.StatsPanel, trayLoc, LocateWidgetInTray( this.mFpsLabel ) + 1 ); }
/// <summary> /// Gets all the widgets of a specific tray. /// </summary> /// <param name="trayLoc"></param> /// <returns></returns> public IEnumerator<Widget> GetWidgetEnumerator( TrayLocation trayLoc ) { return this.mWidgets[ (int)trayLoc ].GetEnumerator(); }
/// <summary> /// Shows logo in the specified location. /// </summary> /// <param name="trayLoc"></param> /// <param name="place"></param> public void ShowLogo( TrayLocation trayLoc, int place ) { if ( !IsLogoVisible ) { this.Logo = CreateDecorWidget( trayLoc, this.mName + "/Logo", "Panel", "SdkTrays/Logo" ); } MoveWidgetToTray( this.Logo, trayLoc, place ); }
/// <summary> /// Shows frame statistics widget set in the specified location. /// </summary> /// <param name="trayLoc"></param> public void ShowFrameStats( TrayLocation trayLoc ) { ShowFrameStats( trayLoc, -1 ); }
/// <summary> /// Gets a widget from a tray by place. /// </summary> /// <param name="trayLoc"></param> /// <param name="place"></param> /// <returns></returns> public Widget GetWidget( TrayLocation trayLoc, int place ) { if ( place >= 0 && place < this.mWidgets[ (int)trayLoc ].Count ) { return this.mWidgets[ (int)trayLoc ][ place ]; } return null; }
/// <summary> /// Destroys a widget. /// </summary> /// <param name="trayLoc"></param> /// <param name="name"></param> public void DestroyWidget( TrayLocation trayLoc, String name ) { DestroyWidget( GetWidget( trayLoc, name ) ); }
/// <summary> /// Removes a widget from its tray. Same as moving it to the null tray. /// </summary> /// <param name="trayLoc"></param> /// <param name="name"></param> public void RemoveWidgetFromTray( TrayLocation trayLoc, String name ) { RemoveWidgetFromTray( GetWidget( trayLoc, name ) ); }
/// <summary> /// Gets the number of widgets in a tray. /// </summary> /// <param name="trayLoc"></param> /// <returns></returns> public int GetWidgetCount( TrayLocation trayLoc ) { return this.mWidgets[ (int)trayLoc ].Count; }
private void _addTextureDebugOverlay( TrayLocation loc, Texture tex, int i ) { _addTextureDebugOverlay( loc, tex.Name, i ); }
/// <summary> /// Removes a widget from its tray. Same as moving it to the null tray. /// </summary> /// <param name="trayLoc"></param> /// <param name="place"></param> public void RemoveWidgetFromTray( TrayLocation trayLoc, int place ) { RemoveWidgetFromTray( GetWidget( trayLoc, place ) ); }
private void _addTextureShadowDebugOverlay( TrayLocation loc, int num ) { for ( var i = 0; i < num; ++i ) { //TODO //Texture shadowTex = this.SceneManager.GetShadowTexture( i ); //_addTextureDebugOverlay( loc, shadowTex, i ); } }
/// <summary> /// Removes all widgets from a widget tray. /// </summary> /// <param name="trayLoc"></param> public void ClearTray( TrayLocation trayLoc ) { if ( trayLoc == TrayLocation.None ) { return; // can't clear the null tray } while ( !( this.mWidgets[ (int)trayLoc ].Count == 0 ) ) // remove every widget from given tray { RemoveWidgetFromTray( this.mWidgets[ (int)trayLoc ][ 0 ] ); } }
/// <summary> /// Sets horizontal alignment of a tray's contents. /// </summary> /// <param name="trayLoc"></param> /// <param name="gha"></param> public void SetTrayWidgetAlignment( TrayLocation trayLoc, HorizontalAlignment gha ) { this.trayWidgetAlign[ (int)trayLoc ] = gha; for ( int i = 0; i < this.mWidgets[ (int)trayLoc ].Count; i++ ) { this.mWidgets[ (int)trayLoc ][ i ].OverlayElement.HorizontalAlignment = gha; } }
/// <summary> /// /// </summary> /// <param name="trayLoc"></param> /// <param name="name"></param> /// <param name="caption"></param> /// <returns></returns> public Button CreateButton( TrayLocation trayLoc, String name, String caption ) { return CreateButton( trayLoc, name, caption, 0 ); }
protected Widget() { TrayLocation = TrayLocation.None; }
/// <summary> /// /// </summary> public Widget() { this.trayLoc = TrayLocation.None; this.element = null; this.listener = null; }