private static void DisposingSlot(object[] parameters) { if (null != _vbox) { _vbox.Dispose(); _vbox = null; } }
protected VGroup WrapVBox(Component parent, params DisplayListMember[] children) { VGroup wrapper = new VGroup { HorizontalAlign = HorizontalAlign.Center, Gap = 10 }; parent.AddChild(wrapper); foreach (DisplayListMember child in children) { wrapper.AddChild(child); } return wrapper; }
protected override void CreateChildren() { //Debug.Log("Button skin creating children"); base.CreateChildren(); #region Background _background = new RectShape { Left = 0, Right = 0, Top = 0, Bottom = 0, BackgroundColor = (Color) GetStyle("backgroundUpColor") }; _background.SetStyle("backgroundStyle", ButtonSingleStateStyle.Instance); AddChild(_background); #endregion #region Shine _shine = new RectShape { Left = 1, Right = 1, Top = 1, Height = GetCurrentShineHeight("up"), MouseEnabled = false }; _shine.SetStyle("backgroundStyle", GetShineStyle()); _shine.BackgroundColor = (Color) GetStyle("shineColor"); AddChild(_shine); #endregion VGroup vGroup = new VGroup { Gap = 10, HorizontalAlign = HorizontalAlign.Center, VerticalAlign = VerticalAlign.Middle, HorizontalCenter = 0, VerticalCenter = 0, Right = 10, Left = 10, Top = 10, Bottom = 10, }; AddChild(vGroup); #region Label LabelDisplay = new Label { MouseEnabled = false, Multiline = true, Color = (Color) GetStyle("labelUpColor") }; vGroup.AddChild(LabelDisplay); #endregion #region Icon IconDisplay = new Image {MouseEnabled = false}; vGroup.AddChild(IconDisplay); #endregion }
/// <summary> /// Note: Since Load could happen, if both scene containing OptionsToolbar, we wouldn't like to instantiate twice /// Thus we made 2 checks in for toolbar existance in this class /// </summary> protected override void CreateChildren() { if (HideInEditor && Application.isEditor) return; base.CreateChildren(); if (null != _vbox) return; // meaning toolbar created in the previous scene _vbox = new VGroup { Right = 10, MinWidth = 160, Gap = 0 }; OptionsToolbarStage.Instance.AddChild(_vbox); // add to InspectorOverlayStage _options = new Options(); _options.SetStyle("showBackground", true); _vbox.AddChild(_options); Button handle = new Button { StyleName = "handle_horiz", FocusEnabled = false, PercentWidth = 100, ResizeWithStyleBackground = true, Text = "Options" }; _vbox.AddChild(handle); handle.AddEventListener(MouseEvent.ROLL_OVER, delegate(Event e) { if (handle == e.Target) { Show(); } e.CancelAndStopPropagation(); }, EventPhase.Capture | EventPhase.Target ); _vbox.AddEventListener(MouseEvent.ROLL_OVER, // deffering hide delegate { if (null != _timer) { _timer.Reset(); _timer.Stop(); } }, EventPhase.Capture | EventPhase.Target ); _vbox.AddEventListener(MouseEvent.ROLL_OUT, delegate(Event e) { if (_vbox == e.Target) { if (null == _timer) _timer = new Timer(1, 1); _timer.Complete += delegate { Hide(); _timer.Dispose(); _timer = null; }; _timer.Start(); } e.CancelAndStopPropagation(); }, EventPhase.Capture | EventPhase.Target ); _vbox.ValidateNow(); // invoke measure float h = _options.Height; _vbox.Y = -h; _hide.YTo = -h; }
protected override void CreateChildren() { //Debug.Log("Button skin creating children"); base.CreateChildren(); #region Background image /* just in case that no image is visible */ /*_background = new RectShape { Left = 0, Right = 0, Top = 0, Bottom = 0 }; _background.SetStyle("backgroundStyle", ButtonSingleStateStyle.Instance); AddChild(_background);*/ /* Tiled image */ _backgroundImage = new Image { Left = 0, Right = 0, Top = 0, Bottom = 0, Mode = ImageMode.Tiled, Visible = true }; AddChild(_backgroundImage); #endregion #region Icon + label group VGroup vGroup = new VGroup { Gap = 10, HorizontalAlign = HorizontalAlign.Center, VerticalAlign = VerticalAlign.Middle, HorizontalCenter = 0, VerticalCenter = 0, Right = 10, Left = 10, Top = 10, Bottom = 10, }; AddChild(vGroup); #endregion #region Label LabelDisplay = new Label { MouseEnabled = false, Multiline = true, Color = (Color) GetStyle("labelUpColor") }; vGroup.AddChild(LabelDisplay); #endregion #region Icon IconDisplay = new Image {MouseEnabled = false}; vGroup.AddChild(IconDisplay); #endregion }
override protected void CreateChildren() { base.CreateChildren(); #region Controls Toolbar toolbar = new Toolbar(); AddChild(toolbar); Button button = new Button { Text = "Add data", SkinClass = typeof(ImageButtonSkin), Icon = ImageLoader.Instance.Load("Icons/add"), AutoRepeat = true }; button.ButtonDown += delegate { _dataProvider.AddItem("data " + _random.Next(1, 100)); }; toolbar.AddContentChild(button); #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 { MouseEnabled = true, Layout = new VerticalLayout { HorizontalAlign = HorizontalAlign.Left, PaddingLeft = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10, Gap = 10 } }; scroller.Viewport = viewport; //AddChild(viewport); #endregion #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>(); /* LISTS */ #region HGroup HGroup hGroup1 = new HGroup { PaddingLeft = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10, Gap = 20 }; //hbox.SetStyle("showBackground", true); //hbox.SetStyle("backgroundColor", RgbColor.FromHex(0x004CFF).ToColor()); viewport.AddChild(hGroup1); #endregion HGroup hGroup = new HGroup(); viewport.AddChild(hGroup); /* DATA GROUPS */ #region Data group 1 hGroup1 = new HGroup { PaddingLeft = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10, Gap = 50 }; hGroup.AddChild(hGroup1); DataGroup dataGroup = new DataGroup { Layout = new VerticalLayout(), DataProvider = _dataProvider, //ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(), ItemRendererFunction = delegate(object item) { return factory; } }; hGroup1.AddChild(dataGroup); #endregion #region Data group 2 hGroup1 = new HGroup { PaddingLeft = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10, Gap = 50 }; hGroup.AddChild(hGroup1); dataGroup = new DataGroup { Layout = new TileLayout {RequestedColumnCount = 2}, //Width = 200, Height = 200, DataProvider = _dataProvider, //ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(), ItemRendererFunction = delegate { return factory; } //ClipAndEnableScrolling = true }; hGroup1.AddChild(dataGroup); #endregion #region Data group 3 hGroup1 = new HGroup { PaddingLeft = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10, Gap = 50 }; hGroup.AddChild(hGroup1); dataGroup = new DataGroup { Layout = new TileLayout { RequestedColumnCount = 4 }, //Width = 200, Height = 200, DataProvider = _dataProvider, //ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(), ItemRendererFunction = delegate { return factory; } //ClipAndEnableScrolling = true }; hGroup1.AddChild(dataGroup); #endregion #endregion #region VGroup VGroup vgroup = new VGroup(); hGroup.AddChild(vgroup); #endregion #region List 1 List list = new List { //Layout = new TileLayout { RequestedColumnCount = 4 }, Width = 200, Height = 200, DataProvider = _dataProvider, //ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(), ItemRendererFunction = delegate { return factory; } }; vgroup.AddChild(list); #endregion #region List 2 list = new List { //Layout = new TileLayout { RequestedColumnCount = 3 }, Width = 200, Height = 245, DataProvider = _dataProvider, //ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(), ItemRendererFunction = delegate { return factory; } }; vgroup.AddChild(list); #endregion #region List 3 list = new List { Id = "list3", Width = 400, Height = 600, DataProvider = _dataProvider, SkinClass = typeof(ListSkin2), ItemRenderer = new ItemRendererFactory<BigItemRenderer>() }; hGroup.AddChild(list); #endregion #region Process renderer click AddEventListener(BigItemRenderer.ADD_BUTTON_CLICKED, delegate(Event e) { BigItemRenderer itemRenderer = (BigItemRenderer)e.Target; Alert.Show("Info", itemRenderer.Data.ToString(), AlertButtonFlag.Ok, new AlertOption(AlertOptionType.HeaderIcon, ImageLoader.Instance.Load("Icons/information"))); }); #endregion }
override protected void CreateChildren() { base.CreateChildren(); #region Controls Toolbar toolbar = new Toolbar(); AddChild(toolbar); Button button = new Button { Text = "Add data", SkinClass = typeof(ImageButtonSkin), Icon = ImageLoader.Instance.Load("Icons/star"), AutoRepeat = true }; button.ButtonDown += delegate { _dataProvider.AddItem("data " + _random.Next(1, 100)); }; toolbar.AddContentChild(button); #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 { MouseEnabled = true, Layout = new VerticalLayout { HorizontalAlign = HorizontalAlign.Left, PaddingLeft = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10, Gap = 10 } }; scroller.Viewport = viewport; #endregion List<object> source = new List<object> { "Failure", "Teaches", "Success", "One", "Two", "Three", "Four", "Five", "Six" }; _dataProvider = new ArrayList(source); HGroup hGroup = new HGroup { PercentHeight = 100 }; viewport.AddChild(hGroup); var factory = new ItemRendererFactory<DefaultItemRenderer>(); VGroup vGroup2 = new VGroup { PercentHeight = 100 }; hGroup.AddChild(vGroup2); HGroup hGroup2 = new HGroup { PercentWidth = 100 }; vGroup2.AddChild(hGroup2); /* LISTS */ #region List 1 List list = new List { Id = "list1", //Layout = new TileLayout { RequestedColumnCount = 4 }, Width = 200, Height = 200, DataProvider = _dataProvider, //ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(), ItemRendererFunction = delegate { return factory; } }; hGroup2.AddChild(list); #endregion #region List 2 list = new List { Id = "list2", //Layout = new TileLayout { RequestedColumnCount = 3 }, Width = 200, Height = 245, DataProvider = _dataProvider, //ItemRenderer = new ItemRendererFactory <DefaultItemRenderer>(), ItemRendererFunction = delegate { return factory; } }; hGroup2.AddChild(list); #endregion #region List 3 list = new List { Id = "list3", Width = 400, Height = 600, DataProvider = _dataProvider, SkinClass = typeof(ListSkin2), ItemRenderer = new ItemRendererFactory<BigItemRenderer>() }; hGroup2.AddChild(list); #endregion #region List 4 list = new List { Id = "list4", PercentHeight = 100, MinWidth = 400, Layout = new TileLayout { HorizontalGap = 0, VerticalGap = 0, RequestedColumnCount = 3 }, DataProvider = _dataProvider, SkinClass = typeof(ListSkin2), ItemRenderer = new ItemRendererFactory<BigItemRenderer>() }; hGroup.AddChild(list); #endregion #region List 5 (horizontal) vGroup2.AddChild(new Spacer { PercentHeight = 100 }); list = new List { Id = "list5", PercentWidth = 100, Height = 100, Layout = new HorizontalLayout { Gap = 0, RequestedColumnCount = 3 }, DataProvider = _dataProvider, SkinClass = typeof(ListSkin2), ItemRenderer = new ItemRendererFactory<BigItemRenderer>() }; vGroup2.AddChild(list); #endregion #region Process renderer click AddEventListener(BigItemRenderer.ADD_BUTTON_CLICKED, delegate(Event e) { BigItemRenderer itemRenderer = (BigItemRenderer) e.Target; Alert.Show("Info", itemRenderer.Data.ToString(), AlertButtonFlag.Ok, new AlertOption(AlertOptionType.HeaderIcon, ImageLoader.Instance.Load("Icons/information"))); }); #endregion }
override protected void CreateChildren() { base.CreateChildren(); TitleLabel titleLabel = new TitleLabel { StyleName = "title", HorizontalCenter = 0, Top = 20 }; AddChild(titleLabel); new TextRotator { Delay = 5, // 5 seconds delay Lines = new[] { "Cursor Demo", "Created with eDriven.Gui", //"Author: Danko Kozar", "Cursor packages are loaded dynamically", "You can set the priority to each cursor operation" }, Callback = delegate(string line) { titleLabel.Text = line; } } .Start(); var buttonStyles = new Hashtable { {"cursor", "pointer"} }; #region VBox var vbox = new VGroup { HorizontalCenter = 0, VerticalCenter = 0, Gap = 10 }; AddChild(vbox); #endregion vbox.AddChild(new Label { Text = "Load cursor package:" }); #region HBox var hbox = new HGroup(); /*hbox.Click += delegate(Event e) { var me = (MouseEvent)e; if (me.Target is Button) AudioPlayerMapper.GetDefault().PlaySound("button_click"); };*/ vbox.AddChild(hbox); #endregion #region Cursor package 1 var btnCursor1 = new Button { Text = "Load cursor package 1", Icon = (Texture)Resources.Load("Icons/drive_disk"), FocusEnabled = false, SkinClass = typeof(ImageButtonSkin), Styles = buttonStyles, MinWidth = 200, MinHeight = 120, ToggleMode = true, Selected = true }; hbox.AddChild(btnCursor1); #endregion #region Cursor package 2 var btnCursor2 = new Button { Text = "Load cursor package 2", Icon = (Texture)Resources.Load("Icons/drive_disk"), FocusEnabled = false, SkinClass = typeof(ImageButtonSkin), Styles = buttonStyles, MinWidth = 200, MinHeight = 120, ToggleMode = true, Selected = false }; hbox.AddChild(btnCursor2); // button 1 press btnCursor1.Click += delegate { if (_selectedButton != 0) AudioPlayerMapper.GetDefault().PlaySound("button_click"); _selectedButton = 0; DeferManager.Instance.Defer(delegate { btnCursor1.Selected = _selectedButton == 0; btnCursor2.Selected = _selectedButton == 1; CursorManager.Instance.LoadPackage("Cursors/antialiased-classic/package"); }, 1); }; // button 2 press btnCursor2.Click += delegate { if (_selectedButton != 1) AudioPlayerMapper.GetDefault().PlaySound("button_click"); _selectedButton = 1; DeferManager.Instance.Defer(delegate { btnCursor1.Selected = _selectedButton == 0; btnCursor2.Selected = _selectedButton == 1; CursorManager.Instance.LoadPackage("Cursors/blueglass-vista/package"); }, 1); }; #endregion #region Spacer vbox.AddChild(new Spacer {Height = 30}); #endregion vbox.AddChild(new Label { Text = "Hover cursor over buttons:" }); TileGroup tileGroup = new TileGroup { PercentWidth = 100, RequestedRowCount = 2 }; vbox.AddChild(tileGroup); #region Crosshair var btnCrosshair = new Button { Text = "Crosshair", Icon = (Texture)Resources.Load("Icons/star"), SkinClass = typeof(ImageButtonSkin), FocusEnabled = false, Styles = new Hashtable { { "cursor", "crosshair" } }, MinWidth = 200, MinHeight = 120 }; tileGroup.AddChild(btnCrosshair); #endregion #region Move var btnMove = new Button { Text = "Move", Icon = (Texture)Resources.Load("Icons/star"), SkinClass = typeof(ImageButtonSkin), FocusEnabled = false, Styles = new Hashtable { { "cursor", "move" } }, MinWidth = 200, MinHeight = 120 }; tileGroup.AddChild(btnMove); #endregion #region Help var btnHelp = new Button { Text = "Help", Icon = (Texture)Resources.Load("Icons/star"), SkinClass = typeof(ImageButtonSkin), FocusEnabled = false, Styles = new Hashtable { { "cursor", "help" } }, MinWidth = 200, MinHeight = 120 }; tileGroup.AddChild(btnHelp); #endregion #region E-Resize var btnEResize = new Button { Text = "E-Resize", Icon = (Texture)Resources.Load("Icons/star"), SkinClass = typeof(ImageButtonSkin), FocusEnabled = false, Styles = new Hashtable { { "cursor", "e-resize" } }, MinWidth = 200, MinHeight = 120 }; tileGroup.AddChild(btnEResize); #endregion #region Spacer vbox.AddChild(new Spacer { Height = 30 }); #endregion vbox.AddChild(new Label { Text = "Click the button for a high-priority cursor:" }); #region Cursor progress var btnProgress = new Button { Text = "Show progress cursor (5 sec)", Icon = (Texture)Resources.Load("Icons/star"), SkinClass = typeof(ImageButtonSkin), FocusEnabled = false, Styles = buttonStyles, MinWidth = 200, MinHeight = 120, PercentWidth = 100 }; btnProgress.Press += new eDriven.Core.Events.EventHandler(delegate { int id = CursorManager.Instance.SetCursor("wait", 1); var t = new Timer(5, 1); t.Complete += delegate { t.Dispose(); CursorManager.Instance.RemoveCursor(id); }; t.Start(); }); vbox.AddChild(btnProgress); #endregion }
override protected void CreateChildren() { base.CreateChildren(); /** * Note: this demo HAS the overall scroller, but the stage itself SEEMS not to scroll * That's because we pushed the scrolled 150 px from both right and bottom * so we could place additional scrollbars there. * */ #region Scroller + viewport Scroller scroller = new Scroller { SkinClass = typeof (ScrollerSkin2), Left = 10, Right = 150, Top = 10, Bottom = 150 }; //scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.On); //scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.On); AddChild(scroller); Group viewport = new Group(); scroller.Viewport = viewport; #endregion #region Horizontal scrollers HGroup hGroup = new HGroup { Gap = 10 }; viewport.AddChild(hGroup); VGroup hScrollers = new VGroup { PercentWidth = 100, Gap = 10, Left = 10, Right = 150, Bottom = 10 }; AddChild(hScrollers); HScrollBar hScroll = new HScrollBar { SkinClass = typeof(HScrollBarSkin3), PercentWidth = 100, Maximum = 600, Viewport = viewport, MouseWheelScrollsHorizontally = true }; hScrollers.AddChild(hScroll); hScroll = new HScrollBar { SkinClass = typeof(HScrollBarSkin2), PercentWidth = 100, Maximum = 600, Viewport = viewport, }; hScrollers.AddChild(hScroll); hScroll = new HScrollBar { PercentWidth = 100, Maximum = 600, Viewport = viewport, }; hScrollers.AddChild(hScroll); #endregion #region Vertical scrollers HGroup vScrollers = new HGroup { PercentHeight = 100, Gap = 10, Right = 10, Top = 10, Bottom = 150 }; AddChild(vScrollers); VScrollBar vScroll = new VScrollBar { SkinClass = typeof(VScrollBarSkin3), PercentHeight = 100, Maximum = 600, Viewport = viewport }; vScrollers.AddChild(vScroll); vScroll = new VScrollBar { SkinClass = typeof(VScrollBarSkin2), PercentHeight = 100, Maximum = 600, Viewport = viewport }; vScrollers.AddChild(vScroll); vScroll = new VScrollBar { PercentHeight = 100, Maximum = 600, Viewport = viewport }; vScrollers.AddChild(vScroll); #endregion #region Content VGroup vGroup = new VGroup { Id = "vGroup", VerticalAlign = VerticalAlign.Middle, HorizontalCenter = 0, VerticalCenter = 0, PaddingLeft = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10, Gap = 10 }; vGroup.SetStyle("showBackground", true); vGroup.SetStyle("backgroundColor", Color.white); hGroup.AddChild(vGroup); HGroup hgroup = new HGroup(); vGroup.AddChild(hgroup); _btn = new Button { Text = "Default button", FocusEnabled = false, Icon = ImageLoader.Instance.Load("Icons/page_white_text"), MinWidth = 200, MinHeight = 150 }; /* Let's just add a panel to the bottom row on double-clicking this button */ _btn.DoubleClick += delegate { AddPanel(); }; hgroup.AddChild(_btn); _btn = new Button { Text = "Default toggle", FocusEnabled = false, ToggleMode = true, Selected = true, Icon = ImageLoader.Instance.Load("Icons/page_white_text") }; hgroup.AddChild(_btn); _btn = new Button { Text = "Styled button", SkinClass = typeof (ButtonSkin2), FocusEnabled = false, Icon = ImageLoader.Instance.Load("Icons/page_white_text"), MinWidth = 200, MinHeight = 150 }; hgroup.AddChild(_btn); _btn = new Button { Text = "Styled toggle", SkinClass = typeof (ButtonSkin2), FocusEnabled = false, ToggleMode = true, Selected = true, Icon = ImageLoader.Instance.Load("Icons/page_white_text") }; hgroup.AddChild(_btn); // nice buttons 1st row hgroup = new HGroup(); vGroup.AddChild(hgroup); _btn = new Button { Text = "Option 1", SkinClass = typeof (ButtonSkin4), FocusEnabled = false, Icon = ImageLoader.Instance.Load("IconsBig/arkshany-bookmarks"), MinWidth = 200, MinHeight = 200 }; hgroup.AddChild(_btn); _btn = new Button { Text = "Option 2", SkinClass = typeof (ButtonSkin4), FocusEnabled = false, Icon = ImageLoader.Instance.Load("IconsBig/arkshany-bookmarks"), MinWidth = 200, MinHeight = 200 }; hgroup.AddChild(_btn); _btn = new Button { Text = "Option 3", SkinClass = typeof (ButtonSkin4), FocusEnabled = false, Icon = ImageLoader.Instance.Load("IconsBig/arkshany-bookmarks"), MinWidth = 200, MinHeight = 200, ToggleMode = true, Selected = true }; hgroup.AddChild(_btn); // nice buttons 2nd row hgroup = new HGroup(); vGroup.AddChild(hgroup); _btn = new MyButton { Text = "Option 1", SkinClass = typeof (ButtonSkin5), FocusEnabled = false, Icon = ImageLoader.Instance.Load("IconsBig/applications-games"), MinWidth = 200, MinHeight = 200 }; hgroup.AddChild(_btn); _btn = new MyButton2 { Text = "Option 2", SkinClass = typeof (ButtonSkin5), FocusEnabled = false, Icon = ImageLoader.Instance.Load("IconsBig/gconfeditor"), MinWidth = 200, MinHeight = 200 }; hgroup.AddChild(_btn); _btn = new Button { Text = "Option 3 (disabled)", SkinClass = typeof (ButtonSkin5), FocusEnabled = false, Icon = ImageLoader.Instance.Load("IconsBig/gtk-floppy"), MinWidth = 200, MinHeight = 200, Enabled = false }; hgroup.AddChild(_btn); // new row hgroup = new HGroup(); vGroup.AddChild(hgroup); // image var image = new Image { Texture = (Texture) Resources.Load("eDriven/Editor/Logo/logo2") }; hgroup.AddChild(image); // panel 1 _panel = new Panel { Title = "Panel 1", MinWidth = 200, MinHeight = 300 }; hgroup.AddChild(_panel); // panel 2 _panel = new Panel { SkinClass = typeof (PanelSkin3), Title = "Panel 2", MinWidth = 200, MinHeight = 300 }; hgroup.AddChild(_panel); // panel 3 _panel = new Panel { SkinClass = typeof (PanelSkin4), Title = "Panel 3", MinWidth = 200, MinHeight = 300 }; hgroup.AddChild(_panel); #endregion // new row (placeholder) _hgroup = new HGroup(); vGroup.AddChild(_hgroup); }
protected override void CreateChildren() { //Debug.Log("Button skin creating children"); base.CreateChildren(); #region Background _background = new RectShape { Left = 0, Right = 0, Top = 0, Bottom = 0, BackgroundColor = (Color)GetStyle("backgroundColor") }; _background.SetStyle("backgroundStyle", ButtonSingleStateStyle.Instance); AddChild(_background); /*_backgroundImage = new Image { Left = 0, Right = 0, Top = 0, Bottom = 0, //Visible = false, ScaleMode = ImageScaleMode.ScaleToFill }; AddChild(_backgroundImage);*/ #endregion VGroup vGroup = new VGroup { Gap = 10, HorizontalAlign = HorizontalAlign.Center, VerticalAlign = VerticalAlign.Middle, HorizontalCenter = 0, VerticalCenter = 0, Right = 10, Left = 10, Top = 10, Bottom = 10, }; AddChild(vGroup); #region Icon IconDisplay = new Image { MouseEnabled = false, //Visible = false, //IncludeInLayout = false }; vGroup.AddChild(IconDisplay); #endregion #region Label LabelDisplay = new Label { MouseEnabled = false, //Visible = false, //IncludeInLayout = false }; vGroup.AddChild(LabelDisplay); #endregion }
override protected void CreateChildren() { base.CreateChildren(); #region Top label Label label = new TitleLabel { HorizontalCenter = 0, Top = 20, StyleName = "title" }; AddChild(label); new TextRotator { Delay = 5, // 5 seconds delay Lines = new[] { "Loading Mask Demo", "Created with eDriven.Gui" //"Author: Danko Kozar" }, Callback = delegate(string line) { label.Text = line; } } .Start(); #endregion #region VBox VGroup vbox = new VGroup { HorizontalCenter = 0, VerticalCenter = 0, HorizontalAlign = HorizontalAlign.Center, Gap = 20 }; AddChild(vbox); #endregion HGroup hbox = new HGroup { Gap = 20, VerticalAlign = VerticalAlign.Middle }; vbox.AddChild(hbox); // 3 example mask, just for fun hbox.AddChild(new LoadingMaskAnimator { Width = 250, Height = 100, Message = "Loading something..." }); hbox.AddChild(new LoadingMaskAnimator { Width = 250, Height = 150, Message = "Loading something else..." }); hbox.AddChild(new LoadingMaskAnimator { Width = 250, Height = 200, Message = "And yet something else..." }); //vbox.AddChild(new Spacer {Height = 40}); hbox = new HGroup { Gap = 20, VerticalAlign = VerticalAlign.Middle }; vbox.AddChild(hbox); // create 3 buttons CreateButton(hbox); CreateButton(hbox); CreateButton(hbox); Button btn = new Button { Text = @"Click to show a global mask for 3 seconds", Icon = Resources.Load<Texture>("IconsBig/oxyblue-address-book-new"), SkinClass = typeof(ButtonSkin5), Left = 100, Top = 100, Width = 250, Height = 250, FocusEnabled = false }; btn.Click += new EventHandler(delegate { int count = 0; GlobalLoadingMask.Show(""); Timer t = new Timer(1, 3) { TickOnStart = true }; t.Tick += delegate { GlobalLoadingMask.SetMessage(string.Format("Masking... {0} seconds", count)); count++; }; t.Complete += delegate { GlobalLoadingMask.Hide(); }; t.Start(); }); vbox.AddChild(btn); }
override protected void CreateChildren() { base.CreateChildren(); #region Title Label label = new TitleLabel {HorizontalCenter = 0, Top = 20, StyleName = "title", Text = "Panel demo"}; AddChild(label); #endregion #region Scroller Scroller scroller = new Scroller { SkinClass = typeof (ScrollerSkin2), Left = 0, Right = 0, Top = 0, Bottom = 0, }; //scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.On); //scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.On); AddChild(scroller); Group viewport = new Group(); scroller.Viewport = viewport; #endregion #region HGroup HGroup hGroup = new HGroup {Gap = 10, HorizontalCenter = 0, VerticalCenter = 0}; viewport.AddChild(hGroup); #endregion #region Panel 1 Panel panel = new MyPanel { Width = 360, Height = 600, Icon = ImageLoader.Instance.Load("Icons/shape_square_add"), Title = "First panel", StyleName = "default" }; hGroup.AddChild(panel); #endregion #region Panel 2 panel = new MyPanel { //Width = 360, Height = 600, SkinClass = typeof(PanelSkin2), Icon = ImageLoader.Instance.Load("Icons/page_white_text"), Title = "Second panel" }; hGroup.AddChild(panel); //// NOTE: propagation of styles to skin still not implemented //// So, this won't work: panel.SetStyle("headerLabelColor", 0xffff00); //// This is a temporary solution: //panel.CreationCompleteHandler += delegate //{ //Debug.Log("panel.Skin: " + panel.Skin); //panel.Skin.SetStyle("headerLabelColor", Color.yellow); //}; #endregion #region Panel 2 skin switch VGroup vGroup = new VGroup(); vGroup.Plugins.Add(new TabManager { ArrowsEnabled = true, UpDownArrowsEnabled = true }); hGroup.AddChild(vGroup); Button button = new Button { Text = "Skin 1", Icon = Resources.Load<Texture>("Icons/skin"), SkinClass = typeof(ImageButtonSkin), PercentWidth = 100 }; button.Press += delegate { panel.SkinClass = typeof (PanelSkin); //((MyPanel)panel).CreateButtons(); }; vGroup.AddChild(button); button = new Button { Text = "Skin 2", Icon = Resources.Load<Texture>("Icons/skin"), SkinClass = typeof(ImageButtonSkin), PercentWidth = 100 }; button.Press += delegate { panel.SkinClass = typeof (PanelSkin2); }; vGroup.AddChild(button); button = new Button { Text = "Skin 3", Icon = Resources.Load<Texture>("Icons/skin"), SkinClass = typeof(ImageButtonSkin), PercentWidth = 100 }; button.Press += delegate { panel.SkinClass = typeof (PanelSkin3); }; vGroup.AddChild(button); button = new Button { Text = "Skin 4", Icon = Resources.Load<Texture>("Icons/skin"), SkinClass = typeof(ImageButtonSkin), PercentWidth = 100 }; button.Press += delegate { panel.SkinClass = typeof (PanelSkin4); }; vGroup.AddChild(button); button = new Button { Text = "Add button", AutoRepeat = true, Icon = Resources.Load<Texture>("Icons/add"), SkinClass = typeof(ImageButtonSkin), PercentWidth = 100 }; /*button.Press += delegate { ((MyPanel)panel).AddButton("Button"); };*/ button.ButtonDown += delegate { ((MyPanel)panel).AddButton("Button"); }; vGroup.AddChild(button); #endregion }
override protected void CreateChildren() { base.CreateChildren(); VGroup vbox = new VGroup { Gap = 10, HorizontalCenter = 0, VerticalCenter = 0 }; AddChild(vbox); Button btn = new Button { Text = "Button 1", Icon = (Texture)Resources.Load("Icons/star"), SkinClass = typeof(ImageButtonSkin) }; vbox.AddChild(btn); btn = new Button { Text = "Button 2", Icon = (Texture)Resources.Load("Icons/star"), StyleName = "button2", SkinClass = typeof(ImageButtonSkin) }; vbox.AddChild(btn); btn = new Button { Text = "Button 3", Icon = (Texture)Resources.Load("Icons/star"), StyleName = "button3", SkinClass = typeof(ImageButtonSkin) }; vbox.AddChild(btn); vbox.Click += delegate { Alert.Show( "Checking", "Are you sure you want to greet the world?", AlertButtonFlag.Yes | AlertButtonFlag.No, delegate (string action) { switch (action) { case "yes": Alert.Show( "Hello", "Hello world!", AlertButtonFlag.Ok, new AlertOption(AlertOptionType.HeaderIcon, Resources.Load<Texture>("Icons/accept")) ); break; case "no": Alert.Show( "Going to sleep", "Good night.", AlertButtonFlag.Ok, new AlertOption(AlertOptionType.HeaderIcon, Resources.Load<Texture>("Icons/cancel")) ); break; } }, new AlertOption(AlertOptionType.HeaderIcon, Resources.Load<Texture>("Icons/information")) ); }; }
protected override void CreateChildren() { base.CreateChildren(); _rect = new RectShape(); //{ Left = 0, Right = 0, Top = 0, Bottom = 0 //}; AddChild(_rect); _hGroup = new HGroup { PaddingLeft = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10, Gap = 10 }; AddChild(_hGroup); // left group VGroup vGroup = new VGroup { VerticalAlign = VerticalAlign.Middle, Gap = 10, PercentWidth = 100, PercentHeight = 100 }; _hGroup.AddChild(vGroup); _image = new Image { Styles = ButtonStyles }; _image.MouseDown += delegate { DispatchEvent(new Event("showImage", true)); // bubbling event }; vGroup.AddChild(_image); LabelDisplay = new Label { Width = 150 }; //vGroup.AddChild(LabelDisplay); if (_text != string.Empty) LabelDisplay.Text = _text; // right group vGroup = new VGroup { VerticalAlign = VerticalAlign.Middle, Gap = 10, PercentWidth = 100, PercentHeight = 100 }; _hGroup.AddChild(vGroup); if (null == _buttonShow) { _buttonShow = new Button { Text = "Show", PercentWidth = 100, FocusEnabled = false, SkinClass = typeof(ImageButtonSkin), Styles = ButtonStyles, Icon = ImageLoader.Instance.Load("Icons/accept") }; _buttonShow.ButtonDown += delegate { DispatchEvent(new Event("showImage", true)); // bubbling! }; vGroup.AddChild(_buttonShow); } if (null == _buttonRemove) { _buttonRemove = new Button { Text = "Remove", PercentWidth = 100, FocusEnabled = false, SkinClass = typeof(ImageButtonSkin), Styles = ButtonStyles, Icon = ImageLoader.Instance.Load("Icons/cancel") }; _buttonRemove.ButtonDown += delegate { var parentList = Owner as List; if (null != parentList) { //Debug.Log("Removing at " + parentList.DataProvider.GetItemIndex(Data)); parentList.DataProvider.RemoveItemAt(parentList.DataProvider.GetItemIndex(Data)); } else Debug.LogError("Owner of item renderer is not a list"); }; vGroup.AddChild(_buttonRemove); } }
override protected void CreateChildren() { base.CreateChildren(); #region Scroller and viewport Scroller scroller = new Scroller { SkinClass = typeof(ScrollerSkin2), Left = 0, Right = 0, Top = 0, Bottom = 0, }; AddChild(scroller); Group viewport = new Group { Id = "viewport", Layout = new AbsoluteLayout() }; scroller.Viewport = viewport; Group g = new Group(); viewport.AddChild(g); var image = new Image { Mode = ImageMode.Tiled, TilingAnchor = Anchor.BottomRight, Texture = (Texture)Resources.Load("stripes3"), Left = 10, Right = 10, Top = 10, Bottom = 10, Tooltip = "Original size" }; g.AddChild(image); #endregion #region VGroup VGroup vGroup = new VGroup { Id = "vGroup", PaddingLeft = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10, Left = 10, Right = 10, Top = 10, Bottom = 10, Gap = 10 }; g.AddChild(vGroup); #endregion #region Images var hgroup = new HGroup(); vGroup.AddChild(hgroup); image = new Image { Texture = (Texture) Resources.Load("eDriven/Editor/Logo/logo"), ScaleMode = ImageScaleMode.OriginalSize }; hgroup.AddChild(image); image = new Image { Width = 600, Height = 400, Texture = (Texture)Resources.Load("eDriven/Editor/Logo/logo"), ScaleMode = ImageScaleMode.OriginalSize }; hgroup.AddChild(image); image = new Image { Width = 300, Height = 150, Texture = (Texture)Resources.Load("eDriven/Editor/Logo/logo"), ScaleMode = ImageScaleMode.OriginalSize }; hgroup.AddChild(image); image = new Image { Width = 150, Height = 300, Texture = (Texture)Resources.Load("eDriven/Editor/Logo/logo"), ScaleMode = ImageScaleMode.OriginalSize }; hgroup.AddChild(image); hgroup = new HGroup(); vGroup.AddChild(hgroup); image = new Image { Width = 350, Height = 200, ScaleMode = ImageScaleMode.ScaleToWidth, Texture = (Texture)Resources.Load("eDriven/Editor/Logo/logo") }; hgroup.AddChild(image); image = new Image { Width = 350, Height = 200, ScaleMode = ImageScaleMode.ScaleToHeight, Texture = (Texture)Resources.Load("eDriven/Editor/Logo/logo") }; hgroup.AddChild(image); image = new Image { Width = 350, Height = 200, ScaleMode = ImageScaleMode.ScaleToFit, Texture = (Texture)Resources.Load("eDriven/Editor/Logo/logo") }; hgroup.AddChild(image); image = new Image { Width = 350, Height = 200, ScaleMode = ImageScaleMode.ScaleToFill, Texture = (Texture)Resources.Load("eDriven/Editor/Logo/logo") }; hgroup.AddChild(image); image = new Image { Width = 350, Height = 200, ScaleMode = ImageScaleMode.StretchToFit, Texture = (Texture)Resources.Load("eDriven/Editor/Logo/logo") }; hgroup.AddChild(image); hgroup = new HGroup(); vGroup.AddChild(hgroup); image = new Image { Width = 200, Height = 350, ScaleMode = ImageScaleMode.ScaleToWidth, Texture = (Texture)Resources.Load("eDriven/Editor/Logo/logo") }; hgroup.AddChild(image); image = new Image { Width = 200, Height = 350, ScaleMode = ImageScaleMode.ScaleToHeight, Texture = (Texture)Resources.Load("eDriven/Editor/Logo/logo") }; hgroup.AddChild(image); image = new Image { Width = 200, Height = 350, ScaleMode = ImageScaleMode.ScaleToFit, Texture = (Texture)Resources.Load("eDriven/Editor/Logo/logo") }; hgroup.AddChild(image); image = new Image { Width = 200, Height = 350, ScaleMode = ImageScaleMode.ScaleToFill, Texture = (Texture)Resources.Load("eDriven/Editor/Logo/logo") }; hgroup.AddChild(image); image = new Image { Width = 200, Height = 350, ScaleMode = ImageScaleMode.StretchToFit, Texture = (Texture)Resources.Load("eDriven/Editor/Logo/logo") }; hgroup.AddChild(image); hgroup = new HGroup(); vGroup.AddChild(hgroup); #endregion #region Panels _panel = new Panel { Title = "Panel 1", MinWidth = 200, MinHeight = 350 }; hgroup.AddChild(_panel); _panel = new Panel { SkinClass = typeof(PanelSkin3), Title = "Panel 2", MinWidth = 200, MinHeight = 350 }; hgroup.AddChild(_panel); _panel = new Panel { SkinClass = typeof(PanelSkin4), Title = "Panel 3", MinWidth = 200, MinHeight = 350 }; hgroup.AddChild(_panel); #endregion }
override protected void CreateChildren() { base.CreateChildren(); #region Controls Toolbar toolbar = new Toolbar(); AddChild(toolbar); Button button = new Button { Text = "Add data", SkinClass = typeof(ImageButtonSkin), Icon = ImageLoader.Instance.Load("Icons/star"), AutoRepeat = true }; button.ButtonDown += delegate { _dataProvider.AddItem( new ExampleItem { FirstName = "First" + _random.Next(1, 100), LastName = "Last" + _random.Next(1, 100), Age = _random.Next(1, 80), DrivingLicense = _random.Next(0, 2) == 1 } ); }; toolbar.AddContentChild(button); #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 { MouseEnabled = true, Layout = new VerticalLayout { HorizontalAlign = HorizontalAlign.Left, PaddingLeft = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 10, Gap = 10 } }; scroller.Viewport = viewport; #endregion #region Fill the data provider List<string> names = new List<string> { "Failure", "Teaches", "Success", "One", "Two", "Three", "Four", "Five", "Six" }; List<object> source = new List<object>(); foreach (var theName in names) { source.Add( new ExampleItem { FirstName = theName, LastName = theName, Age = _random.Next(1, 10), DrivingLicense = _random.Next(0, 2) == 1 } ); } _dataProvider = new ArrayList(source); #endregion HGroup hGroup = new HGroup { PercentWidth = 100, PercentHeight = 100 }; viewport.AddChild(hGroup); #region Grid (header + list + footer) VGroup vGroup = new VGroup { PercentWidth = 100, PercentHeight = 100, Gap = 0 }; hGroup.AddChild(vGroup); #region Header /* Implement your own header logic here */ /*HGroup header = new HGroup {PercentWidth = 100, Gap = 0}; vGroup.AddChild(header); for (int i = 0; i < 5; i++) { Button btnCol = new Button // example header { Text = "Column " + (i + 1), ToggleMode = true, PercentWidth = 100 }; btnCol.Click += delegate(Event e) { // sort, filder and refresh (do list.DataProvider = list.DataProvider) }; header.AddChild(btnCol); }*/ #endregion #region List List list = new List { Id = "list1", PercentWidth = 100, PercentHeight = 100, DataProvider = _dataProvider, LabelField = "FirstName", // this must be set due to list logic legacy (the field must exist in DTO) SkinClass = typeof (ListSkin2), ItemRenderer = new ItemRendererFactory<MyGridItemRenderer>() }; vGroup.AddChild(list); #endregion #region Footer HGroup footer = new HGroup { PercentWidth = 100, Gap = 30, PaddingLeft = 10, PaddingRight = 10, PaddingTop = 10, PaddingBottom = 0 }; vGroup.AddChild(footer); _lblSum = new Label {Text = "Age sum: ", StyleName = "footer" }; footer.AddChild(_lblSum); _lblNumberOfSelectedItems = new Label { Text = "Driving licenses: ", StyleName = "footer" }; footer.AddChild(_lblNumberOfSelectedItems); UpdateFooter(); #endregion #endregion #region Process renderer click AddEventListener(MyGridItemRenderer.ADD_BUTTON_CLICKED, delegate(Event e) { IItemRenderer itemRenderer = (IItemRenderer)e.Target; Alert.Show("Info", itemRenderer.Data.ToString(), AlertButtonFlag.Ok, new AlertOption(AlertOptionType.HeaderIcon, (object) ImageLoader.Instance.Load("Icons/information"))); }); AddEventListener(MyGridItemRenderer.EDIT_BUTTON_CLICKED, delegate(Event e) { var editor = new ExamplePopupEditor { Title = "Edit", Icon = ImageLoader.Instance.Load("Icons/edit"), Data = ((MyGridItemRenderer) e.Target).Data, CloseOnEsc = true }; editor.AddEventListener(CloseEvent.CLOSE, delegate { PopupManager.Instance.RemovePopup(editor); }); PopupManager.Instance.AddPopup(editor, true); }); #endregion #region Process property change _dataProvider.AddEventListener(PropertyChangeEvent.PROPERTY_CHANGE, delegate(Event e) { //PropertyChangeEvent pce = (PropertyChangeEvent) e; //Debug.Log(pce.NewValue); UpdateFooter(); }); #endregion }