/// <summary> /// /// </summary> public Widget() { this.trayLoc = TrayLocation.None; this.element = null; this.listener = null; }
/// <summary> /// Creates backdrop, cursor, and trays. /// </summary> /// <param name="name"></param> /// <param name="window"></param> /// <param name="mouse"></param> /// <param name="listener"></param> public SdkTrayManager( String name, RenderWindow window, SIS.Mouse mouse, ISdkTrayListener listener ) { this.mName = name; this.mWindow = window; this.Mouse = mouse; Listener = listener; this.mWidgetPadding = 8; this.mWidgetSpacing = 2; OverlayManager om = OverlayManager.Instance; String nameBase = this.mName + "/"; nameBase.Replace( ' ', '_' ); // create overlay layers for everything BackdropLayer = om.Create( nameBase + "BackdropLayer" ); this.mTraysLayer = om.Create( nameBase + "WidgetsLayer" ); this.mPriorityLayer = om.Create( nameBase + "PriorityLayer" ); this.cursorLayer = om.Create( nameBase + "CursorLayer" ); BackdropLayer.ZOrder = 100; this.mTraysLayer.ZOrder = 200; this.mPriorityLayer.ZOrder = 300; this.cursorLayer.ZOrder = 400; // make backdrop and cursor overlay containers this.cursor = (OverlayElementContainer)om.Elements.CreateElementFromTemplate( "SdkTrays/Cursor", "Panel", nameBase + "Cursor" ); this.cursorLayer.AddElement( this.cursor ); this.backdrop = (OverlayElementContainer)om.Elements.CreateElement( "Panel", nameBase + "Backdrop" ); BackdropLayer.AddElement( this.backdrop ); this.mDialogShade = (OverlayElementContainer)om.Elements.CreateElement( "Panel", nameBase + "DialogShade" ); this.mDialogShade.MaterialName = "SdkTrays/Shade"; this.mDialogShade.Hide(); this.mPriorityLayer.AddElement( this.mDialogShade ); String[] trayNames = { "TopLeft", "Top", "TopRight", "Left", "Center", "Right", "BottomLeft", "Bottom", "BottomRight" }; for ( int i = 0; i < 9; i++ ) // make the real trays { this.mTrays[ i ] = (OverlayElementContainer) om.Elements.CreateElementFromTemplate( "SdkTrays/Tray", "BorderPanel", nameBase + trayNames[ i ] + "Tray" ); this.mTraysLayer.AddElement( this.mTrays[ i ] ); this.trayWidgetAlign[ i ] = HorizontalAlignment.Center; // align trays based on location if ( i == (int)TrayLocation.Top || i == (int)TrayLocation.Center || i == (int)TrayLocation.Bottom ) { this.mTrays[ i ].HorizontalAlignment = HorizontalAlignment.Center; } if ( i == (int)TrayLocation.Left || i == (int)TrayLocation.Center || i == (int)TrayLocation.Right ) { this.mTrays[ i ].VerticalAlignment = VerticalAlignment.Center; } if ( i == (int)TrayLocation.TopRight || i == (int)TrayLocation.Right || i == (int)TrayLocation.BottomRight ) { this.mTrays[ i ].HorizontalAlignment = HorizontalAlignment.Right; } if ( i == (int)TrayLocation.BottomLeft || i == (int)TrayLocation.Bottom || i == (int)TrayLocation.BottomRight ) { this.mTrays[ i ].VerticalAlignment = VerticalAlignment.Bottom; } } // create the null tray for free-floating widgets this.mTrays[ 9 ] = (OverlayElementContainer)om.Elements.CreateElement( "Panel", nameBase + "NullTray" ); this.trayWidgetAlign[ 9 ] = HorizontalAlignment.Left; this.mTraysLayer.AddElement( this.mTrays[ 9 ] ); for ( int i = 0; i < this.mWidgets.Length; i++ ) { this.mWidgets[ i ] = new WidgetList(); } AdjustTrays(); ShowTrays(); ShowCursor(); }