public UITreeView(string name) : base(name) { // 创建缺省的根节点 this.rootNode = new UIComp_TreeNodeRoot(this); this.rootNode.EndUpdated += new EventHandler <TreeNodeEventArg>(rootNode_LayoutChanged); this.backgroundRenderComp = new UIComp_DrawTextureAtlas(this); this.backgroundRenderComp.ResourceAtlasLocation = new NexusEngine.NResourceLoc(@"engine_data:/ui/Atlas/engine_data1.txa"); this.backgroundRenderComp.AtlasItemName = "0"; this.stickRenderComp = new UIComp_DrawTextureAtlas(this); this.stickRenderComp.ResourceAtlasLocation = new NexusEngine.NResourceLoc(@"engine_data:/ui/Atlas/engine_data1.txa"); this.stickRenderComp.AtlasItemName = @"N_sys-gb-a"; this.resourceImages = new DrawTextureAtlasCollection(); this.resourceImages.Add(new UIComp_DrawTextureAtlas(this)); this.resourceImages.Add(new UIComp_DrawTextureAtlas(this)); this.resourceImages[(int)ResourceImageType.CollapseIcon].ResourceAtlasLocation = new NexusEngine.NResourceLoc(@"engine_data:/ui/Atlas/engine_data1.txa"); this.resourceImages[(int)ResourceImageType.CollapseIcon].AtlasItemName = @"N_help-button-d"; this.resourceImages[(int)ResourceImageType.ExpandIcon].ResourceAtlasLocation = new NexusEngine.NResourceLoc(@"engine_data:/ui/Atlas/engine_data1.txa"); this.resourceImages[(int)ResourceImageType.ExpandIcon].AtlasItemName = @"N_help-button-c"; this.resourceImages[(int)ResourceImageType.CollapseIcon].Width = new UIDim(0, 9); this.resourceImages[(int)ResourceImageType.CollapseIcon].Height = new UIDim(0, 9); this.resourceImages[(int)ResourceImageType.ExpandIcon].Width = new UIDim(0, 9); this.resourceImages[(int)ResourceImageType.ExpandIcon].Height = new UIDim(0, 9); // 创建子控件 this.verticalScrollBar = CreateVerticalScrollBar(); this.horizontalScrollBar = CreateHorizontalScrollBar(); InitEventHandler(); }
protected virtual UIHorizontalScrollBar CreateHorizontalScrollBar() { UIHorizontalScrollBar hsb = WindowManager.Instance.CreateWindow("Nexus.GUI.Widgets.UIHorizontalScrollBar", name + "_HSB", this) as UIHorizontalScrollBar; hsb.Height = new UIDim(0, 28); hsb.Width = new UIDim(1.0f, 0); hsb.Y = new UIDim(1, 0); return(hsb); }