override protected void CreateChildren() { base.CreateChildren(); //Scroller scroller = new Scroller // { // SkinClass = typeof(ScrollerSkin2), // Left = 0, // Right = 0, // Top = 0, // Bottom = 0 // }; ////scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.Off); ////scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.Off); //AddChild(scroller); //Group viewport = new Group // { // Layout = new VerticalLayout // { // HorizontalAlign = HorizontalAlign.Left, // PaddingLeft = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10, // Gap = 10 // } // }; //scroller.Viewport = viewport; #region Controls HGroup hbox = new HGroup { VerticalAlign = VerticalAlign.Middle, PaddingLeft = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10, Gap = 10 }; hbox.SetStyle("showBackground", true); hbox.SetStyle("backgroundColor", ColorMixer.FromHex(0x004CFF).ToColor()); /*viewport.*/ AddChild(hbox); Button button = new Button { Text = "Increase width", SkinClass = typeof(ImageButtonSkin), Icon = ImageLoader.Instance.Load("Icons/shape_square_add") }; button.Click += delegate { button.Width += 10; _dataProvider.AddItem("miki " + button.Width); }; hbox.AddChild(button); Button btnWindow = new Button { Text = "New window", FocusEnabled = false, SkinClass = typeof(ImageButtonSkin), Icon = ImageLoader.Instance.Load("Icons/comment") }; btnWindow.Click += delegate { //_container.RemoveAllChildren(); //for (int i = _container.NumberOfChildren - 1; i >= 0; i--) //{ // _container.RemoveContentChildAt(i); //} //_container.RemoveAllContentChildren(); //_count = 0; _count++; var window = new MyWindow { Title = "The Window " + _count, Id = "window_" + _count, SkinClass = typeof(WindowSkin2), Icon = ImageLoader.Instance.Load("Icons/balloon_32"), Width = 400, Height = 600 }; //System.Random rnd = new System.Random(); //if (rnd.Next(2) > 0) window.Plugins.Add(new Resizable { ShowOverlay = false }); window.AddEventListener(CloseEvent.CLOSE, delegate { PopupManager.Instance.RemovePopup(window); }); #region Cannot use plugin! // NOTE: We cannot use the plugin having a DragHandle because the placehoder group is being switched live // we just have to use the MoveArea skin part and do the dragging thing from inside the Dialog //var draggable = new Draggable // { // DragHandle = b.HeaderGroup // }; //b.Plugins.Add(draggable); #endregion PopupManager.Instance.AddPopup(window, false); PopupManager.Instance.CenterPopUp(window); }; hbox.AddChild(btnWindow); #endregion hbox = new HGroup { PaddingLeft = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10, Gap = 10 }; //hbox.SetStyle("showBackground", true); //hbox.SetStyle("backgroundColor", RgbColor.FromHex(0x004CFF).ToColor()); /*viewport.*/ AddChild(hbox); #region Data controls List <object> source = new List <object> { "Failure", "Teaches", "Success", "One", "Two", "Three", "Four", "Five", "Six" }; _dataProvider = new ArrayList(source); var factory = new ItemRendererFactory <DefaultItemRenderer>(); //DataGroup dataGroup = new DataGroup // { // Layout = new VerticalLayout(), // DataProvider = _dataProvider, // //ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(), // ItemRendererFunction = delegate(object item) // { // return factory; // } // }; //hbox.AddChild(dataGroup); //dataGroup = new DataGroup // { // Layout = new TileLayout { RequestedColumnCount = 4 }, // //Width = 200, Height = 200, // DataProvider = _dataProvider, // //ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(), // ItemRendererFunction = delegate // { // return factory; // }, // //ClipAndEnableScrolling = true // }; //hbox.AddChild(dataGroup); List list = new List { //Layout = new TileLayout { RequestedColumnCount = 4 }, Width = 200, Height = 200, Left = 100, Top = 50, DataProvider = _dataProvider, //ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(), ItemRendererFunction = delegate { return(factory); } }; /*viewport.*/ AddChild(list); #endregion }
override protected void CreateChildren() { base.CreateChildren(); #region Controls Toolbar toolbar = new Toolbar(); AddChild(toolbar); Button btnAlert = new Button { Text = "Alert", FocusEnabled = false, SkinClass = typeof(ImageButtonSkin), Icon = ImageLoader.Instance.Load("Icons/comment") }; btnAlert.Click += delegate { Alert.DefaultSkin = null; Alert.Show( "Title", "Message", AlertButtonFlag.Ok, new AlertOption(AlertOptionType.Icon, Resources.Load <Texture>("edriven_gui")), new AlertOption(AlertOptionType.HeaderIcon, Resources.Load <Texture>("Icons/accept")) ); }; toolbar.AddContentChild(btnAlert); btnAlert = new Button { Text = "Alert (skin 2)", FocusEnabled = false, SkinClass = typeof(ImageButtonSkin), Icon = ImageLoader.Instance.Load("Icons/comment") }; btnAlert.Click += delegate { Alert.DefaultSkin = typeof(AlertSkin2); Alert.Show( "Title", "Message", AlertButtonFlag.Ok, new AlertOption(AlertOptionType.Icon, Resources.Load <Texture>("Icons/star_big")), new AlertOption(AlertOptionType.HeaderIcon, Resources.Load <Texture>("Icons/accept")) ); }; toolbar.AddContentChild(btnAlert); btnAlert = new Button { Text = "Alert (skin 3)", FocusEnabled = false, SkinClass = typeof(ImageButtonSkin), Icon = ImageLoader.Instance.Load("Icons/comment") }; btnAlert.Click += delegate { Alert.DefaultSkin = typeof(AlertSkin3); Alert.Show( "Title", "Message", AlertButtonFlag.Ok, new AlertOption(AlertOptionType.Icon, Resources.Load <Texture>("Icons/star_big")), new AlertOption(AlertOptionType.HeaderIcon, Resources.Load <Texture>("Icons/accept")) ); }; toolbar.AddContentChild(btnAlert); Button btnWindow = new Button { Text = "New window", FocusEnabled = false, SkinClass = typeof(ImageButtonSkin), Icon = ImageLoader.Instance.Load("Icons/comment") }; btnWindow.Click += delegate { _count++; var window = new MyWindow { Title = "The Window " + _count, Id = "window_" + _count, SkinClass = typeof(WindowSkin2), Icon = ImageLoader.Instance.Load("Icons/balloon_32"), Width = 500, Height = 600 }; window.SetStyle("addedEffect", _windowShow); window.Plugins.Add(new Resizable { ShowOverlay = false }); window.AddEventListener(CloseEvent.CLOSE, delegate { PopupManager.Instance.RemovePopup(window); }); PopupManager.Instance.AddPopup(window, false); PopupManager.Instance.CenterPopUp(window); }; toolbar.AddContentChild(btnWindow); #endregion Scroller scroller = new Scroller { SkinClass = typeof(ScrollerSkin2), PercentWidth = 100, PercentHeight = 100 }; AddChild(scroller); Group viewport = new Group { Layout = new VerticalLayout { HorizontalAlign = HorizontalAlign.Left, PaddingLeft = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10, Gap = 10 } }; scroller.Viewport = viewport; }
override protected void CreateChildren() { base.CreateChildren(); #region Controls Toolbar toolbar = new Toolbar(); AddChild(toolbar); Button btnAlert = new Button { Text = "Alert", FocusEnabled = false, SkinClass = typeof(ImageButtonSkin), Icon = ImageLoader.Instance.Load("Icons/comment") }; btnAlert.Click += delegate { Alert.DefaultSkin = null; Alert.Show( "Title", "Message", AlertButtonFlag.Ok, new AlertOption(AlertOptionType.Icon, Resources.Load<Texture>("edriven_gui")), new AlertOption(AlertOptionType.HeaderIcon, Resources.Load<Texture>("Icons/accept")) ); }; toolbar.AddContentChild(btnAlert); btnAlert = new Button { Text = "Alert (skin 2)", FocusEnabled = false, SkinClass = typeof(ImageButtonSkin), Icon = ImageLoader.Instance.Load("Icons/comment") }; btnAlert.Click += delegate { Alert.DefaultSkin = typeof(AlertSkin2); Alert.Show( "Title", "Message", AlertButtonFlag.Ok, new AlertOption(AlertOptionType.Icon, Resources.Load<Texture>("Icons/star_big")), new AlertOption(AlertOptionType.HeaderIcon, Resources.Load<Texture>("Icons/accept")) ); }; toolbar.AddContentChild(btnAlert); btnAlert = new Button { Text = "Alert (skin 3)", FocusEnabled = false, SkinClass = typeof(ImageButtonSkin), Icon = ImageLoader.Instance.Load("Icons/comment") }; btnAlert.Click += delegate { Alert.DefaultSkin = typeof(AlertSkin3); Alert.Show( "Title", "Message", AlertButtonFlag.Ok, new AlertOption(AlertOptionType.Icon, Resources.Load<Texture>("Icons/star_big")), new AlertOption(AlertOptionType.HeaderIcon, Resources.Load<Texture>("Icons/accept")) ); }; toolbar.AddContentChild(btnAlert); Button btnWindow = new Button { Text = "New window", FocusEnabled = false, SkinClass = typeof(ImageButtonSkin), Icon = ImageLoader.Instance.Load("Icons/comment") }; btnWindow.Click += delegate { _count++; var window = new MyWindow { Title = "The Window " + _count, Id = "window_" + _count, SkinClass = typeof(WindowSkin2), Icon = ImageLoader.Instance.Load("Icons/balloon_32"), Width = 500, Height = 600 }; window.SetStyle("addedEffect", _windowShow); window.Plugins.Add(new Resizable { ShowOverlay = false }); window.AddEventListener(CloseEvent.CLOSE, delegate { PopupManager.Instance.RemovePopup(window); }); PopupManager.Instance.AddPopup(window, false); PopupManager.Instance.CenterPopUp(window); }; toolbar.AddContentChild(btnWindow); #endregion Scroller scroller = new Scroller { SkinClass = typeof(ScrollerSkin2), PercentWidth = 100, PercentHeight = 100 }; AddChild(scroller); Group viewport = new Group { Layout = new VerticalLayout { HorizontalAlign = HorizontalAlign.Left, PaddingLeft = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10, Gap = 10 } }; scroller.Viewport = viewport; }
override protected void CreateChildren() { base.CreateChildren(); #region Controls Toolbar toolbar = new Toolbar(); AddChild(toolbar); #region Alert Button btnAlert = new Button { Text = "Alert", FocusEnabled = false, SkinClass = typeof(ImageButtonSkin), Icon = ImageLoader.Instance.Load("Icons/comment") }; btnAlert.Click += delegate { Alert.Show("Info", "This is the example alert.", AlertButtonFlag.Ok, new AlertOption(AlertOptionType.HeaderIcon, Resources.Load <Texture>("Icons/information")), new AlertOption(AlertOptionType.Icon, Resources.Load <Texture>("Icons/star_big"))); }; toolbar.AddContentChild(btnAlert); #endregion #region Window Button btnWindow = new Button { Text = "New window", FocusEnabled = false, SkinClass = typeof(ImageButtonSkin), Icon = ImageLoader.Instance.Load("Icons/comment") }; btnWindow.Click += delegate { _count++; var window = new MyWindow { Title = "The Window " + _count, Id = "window_" + _count, SkinClass = typeof(WindowSkin2), Icon = ImageLoader.Instance.Load("Icons/balloon_32"), Width = 400, Height = 600 }; window.SetStyle("addedEffect", _windowShow); window.Plugins.Add(new Resizable { ShowOverlay = false }); window.AddEventListener(CloseEvent.CLOSE, delegate { PopupManager.Instance.RemovePopup(window); }); PopupManager.Instance.AddPopup(window, false); PopupManager.Instance.CenterPopUp(window); }; toolbar.AddContentChild(btnWindow); #endregion #endregion #region Scroller Scroller scroller = new Scroller { SkinClass = typeof(ScrollerSkin2), PercentWidth = 100, PercentHeight = 100 }; //scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.On); //scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.On); AddChild(scroller); Group viewport = new Group { Layout = new VerticalLayout { HorizontalAlign = HorizontalAlign.Left, PaddingLeft = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10, Gap = 10 } }; scroller.Viewport = viewport; #endregion #region Horizontal Scrollbars viewport.AddChild(new HScrollBar { SkinClass = typeof(HScrollBarSkin3), PercentWidth = 100, MinWidth = 300, Maximum = 300, PageSize = 100 }); viewport.AddChild(new HScrollBar { SkinClass = typeof(HScrollBarSkin3), PercentWidth = 50, Maximum = 500, Value = 200, PageSize = 100 }); viewport.AddChild(new HScrollBar { SkinClass = typeof(HScrollBarSkin2), MinWidth = 600, Maximum = 1000, PageSize = 100 }); viewport.AddChild(new HScrollBar { SkinClass = typeof(HScrollBarSkin3), MinWidth = 700, Maximum = 300, PageSize = 100 }); viewport.AddChild(new HScrollBar { PercentWidth = 100, MinWidth = 600, SkinClass = typeof(HScrollBarSkin3), Maximum = 1000, PageSize = 100 }); #endregion #region HGroup HGroup hGroup = new HGroup { /*PercentWidth = 100, */ Gap = 10 }; viewport.AddChild(hGroup); #endregion #region Vertical scrollbars VScrollBar vScrollBar = new VScrollBar { PercentHeight = 100, Maximum = 300 }; vScrollBar.Change += delegate(Event e) { Debug.Log("Change: " + e); }; hGroup.AddChild(vScrollBar); hGroup.AddChild(new VScrollBar { PercentHeight = 100, Maximum = 400, PageSize = 100 }); hGroup.AddChild(new VScrollBar { SkinClass = typeof(VScrollBarSkin2), PercentHeight = 100, Maximum = 1000, PageSize = 100 }); hGroup.AddChild(new VScrollBar { SkinClass = typeof(VScrollBarSkin2), Height = 400, Maximum = 400, PageSize = 100 }); hGroup.AddChild(new VScrollBar { SkinClass = typeof(VScrollBarSkin3), PercentHeight = 100, Maximum = 200, PageSize = 100 }); hGroup.AddChild(new VScrollBar { SkinClass = typeof(VScrollBarSkin3), Height = 400, Maximum = 300, PageSize = 100 }); #endregion #region Panels //hGroup.AddChild(new Spacer { PercentWidth = 50 }); Panel panel = new MyPanel { Width = 360, Height = 600, Icon = ImageLoader.Instance.Load("Icons/shape_square_add"), Title = "First panel", StyleName = "default" }; hGroup.AddChild(panel); panel = new MyPanel2 { MaxWidth = 500, Height = 600, SkinClass = typeof(PanelSkin2), Icon = ImageLoader.Instance.Load("Icons/page_white_text"), Title = "Second panel" }; panel.SetStyle("titleColor", 0xffff00); hGroup.AddChild(panel); //hGroup.AddChild(new Spacer { PercentWidth = 50 }); #endregion #region Vertical sliders hGroup.AddChild(new VSlider { PercentHeight = 100 }); hGroup.AddChild(new VSlider { Width = 30, Height = 400, SkinClass = typeof(VSliderSkin2) }); hGroup.AddChild(new VSlider { Width = 30, Height = 400, SkinClass = typeof(VSliderSkin2), Enabled = false }); hGroup.AddChild(new VSlider { Width = 50, Height = 400, SkinClass = typeof(VSliderSkin2) }); hGroup.AddChild(new VSlider { Width = 80, Height = 400, SkinClass = typeof(VSliderSkin3) }); hGroup.AddChild(new VSlider { Width = 80, PercentHeight = 100, Maximum = 1000, SkinClass = typeof(VSliderSkin3) }); #endregion #region Horizontal sliders viewport.AddChild(new HSlider { Maximum = 400, PercentWidth = 100 }); viewport.AddChild(new HSlider { Width = 400, Maximum = 400, Height = 30, SkinClass = typeof(HSliderSkin2) }); viewport.AddChild(new HSlider { Width = 400, Maximum = 400, Height = 50, SkinClass = typeof(HSliderSkin2) }); viewport.AddChild(new HSlider { PercentWidth = 50, Height = 80, SkinClass = typeof(HSliderSkin3) }); viewport.AddChild(new HSlider { PercentWidth = 100, Maximum = 1000, Height = 80, SkinClass = typeof(HSliderSkin3) }); #endregion }
override protected void CreateChildren() { base.CreateChildren(); #region Controls Toolbar toolbar = new Toolbar(); AddChild(toolbar); #region Alert Button btnAlert = new Button { Text = "Alert", FocusEnabled = false, SkinClass = typeof(ImageButtonSkin), Icon = ImageLoader.Instance.Load("Icons/comment") }; btnAlert.Click += delegate { Alert.Show("Info", "This is the example alert.", AlertButtonFlag.Ok, new AlertOption(AlertOptionType.HeaderIcon, Resources.Load<Texture>("Icons/information")), new AlertOption(AlertOptionType.Icon, Resources.Load<Texture>("Icons/star_big"))); }; toolbar.AddContentChild(btnAlert); #endregion #region Window Button btnWindow = new Button { Text = "New window", FocusEnabled = false, SkinClass = typeof(ImageButtonSkin), Icon = ImageLoader.Instance.Load("Icons/comment") }; btnWindow.Click += delegate { _count++; var window = new MyWindow { Title = "The Window " + _count, Id = "window_" + _count, SkinClass = typeof(WindowSkin2), Icon = ImageLoader.Instance.Load("Icons/balloon_32"), Width = 400, Height = 600 }; window.SetStyle("addedEffect", _windowShow); window.Plugins.Add(new Resizable { ShowOverlay = false }); window.AddEventListener(CloseEvent.CLOSE, delegate { PopupManager.Instance.RemovePopup(window); }); PopupManager.Instance.AddPopup(window, false); PopupManager.Instance.CenterPopUp(window); }; toolbar.AddContentChild(btnWindow); #endregion #endregion #region Scroller Scroller scroller = new Scroller { SkinClass = typeof (ScrollerSkin2), PercentWidth = 100, PercentHeight = 100 }; //scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.On); //scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.On); AddChild(scroller); Group viewport = new Group { Layout = new VerticalLayout { HorizontalAlign = HorizontalAlign.Left, PaddingLeft = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10, Gap = 10 } }; scroller.Viewport = viewport; #endregion #region Horizontal Scrollbars viewport.AddChild(new HScrollBar { SkinClass = typeof(HScrollBarSkin3), PercentWidth = 100, MinWidth = 300, Maximum = 300, PageSize = 100 }); viewport.AddChild(new HScrollBar { SkinClass = typeof(HScrollBarSkin3), PercentWidth = 50, Maximum = 500, Value = 200, PageSize = 100 }); viewport.AddChild(new HScrollBar { SkinClass = typeof(HScrollBarSkin2), MinWidth = 600, Maximum = 1000, PageSize = 100 }); viewport.AddChild(new HScrollBar { SkinClass = typeof(HScrollBarSkin3), MinWidth = 700, Maximum = 300, PageSize = 100 }); viewport.AddChild(new HScrollBar { PercentWidth = 100, MinWidth = 600, SkinClass = typeof(HScrollBarSkin3), Maximum = 1000, PageSize = 100 }); #endregion #region HGroup HGroup hGroup = new HGroup { /*PercentWidth = 100, */Gap = 10 }; viewport.AddChild(hGroup); #endregion #region Vertical scrollbars VScrollBar vScrollBar = new VScrollBar { PercentHeight = 100, Maximum = 300 }; vScrollBar.Change += delegate(Event e) { Debug.Log("Change: " + e); }; hGroup.AddChild(vScrollBar); hGroup.AddChild(new VScrollBar { PercentHeight = 100, Maximum = 400, PageSize = 100 }); hGroup.AddChild(new VScrollBar { SkinClass = typeof(VScrollBarSkin2), PercentHeight = 100, Maximum = 1000, PageSize = 100 }); hGroup.AddChild(new VScrollBar { SkinClass = typeof(VScrollBarSkin2), Height = 400, Maximum = 400, PageSize = 100 }); hGroup.AddChild(new VScrollBar { SkinClass = typeof(VScrollBarSkin3), PercentHeight = 100, Maximum = 200, PageSize = 100 }); hGroup.AddChild(new VScrollBar { SkinClass = typeof(VScrollBarSkin3), Height = 400, Maximum = 300, PageSize = 100 }); #endregion #region Panels //hGroup.AddChild(new Spacer { PercentWidth = 50 }); Panel panel = new MyPanel { Width = 360, Height = 600, Icon = ImageLoader.Instance.Load("Icons/shape_square_add"), Title = "First panel", StyleName = "default" }; hGroup.AddChild(panel); panel = new MyPanel2 { MaxWidth = 500, Height = 600, SkinClass = typeof (PanelSkin2), Icon = ImageLoader.Instance.Load("Icons/page_white_text"), Title = "Second panel" }; panel.SetStyle("titleColor", 0xffff00); hGroup.AddChild(panel); //hGroup.AddChild(new Spacer { PercentWidth = 50 }); #endregion #region Vertical sliders hGroup.AddChild(new VSlider { PercentHeight = 100 }); hGroup.AddChild(new VSlider { Width = 30, Height = 400, SkinClass = typeof(VSliderSkin2) }); hGroup.AddChild(new VSlider { Width = 30, Height = 400, SkinClass = typeof(VSliderSkin2), Enabled = false }); hGroup.AddChild(new VSlider { Width = 50, Height = 400, SkinClass = typeof(VSliderSkin2) }); hGroup.AddChild(new VSlider { Width = 80, Height = 400, SkinClass = typeof(VSliderSkin3) }); hGroup.AddChild(new VSlider { Width = 80, PercentHeight = 100, Maximum = 1000, SkinClass = typeof(VSliderSkin3) }); #endregion #region Horizontal sliders viewport.AddChild(new HSlider { Maximum = 400, PercentWidth = 100 }); viewport.AddChild(new HSlider { Width = 400, Maximum = 400, Height = 30, SkinClass = typeof(HSliderSkin2) }); viewport.AddChild(new HSlider { Width = 400, Maximum = 400, Height = 50, SkinClass = typeof(HSliderSkin2) }); viewport.AddChild(new HSlider { PercentWidth = 50, Height = 80, SkinClass = typeof(HSliderSkin3) }); viewport.AddChild(new HSlider { PercentWidth = 100, Maximum = 1000, Height = 80, SkinClass = typeof(HSliderSkin3) }); #endregion }