public void ThemeThis() { tlog.Debug(tag, $"ThemeThis START"); ViewStyle style = new ViewStyle() { Color = Color.Cyan, }; theme.AddStyle("style", style); tlog.Debug(tag, "Count : " + theme.Count); tlog.Debug(tag, "theme[\"style\"] : " + theme["style"]); ViewStyle newStyle = new ViewStyle() { Size = new Size(100, 50), Color = Color.Red }; theme["Style"] = newStyle; tlog.Debug(tag, "theme[\"style\"] : " + theme["style"]); tlog.Debug(tag, $"ThemeThis END (OK)"); }
public void ThemeAddStyle() { tlog.Debug(tag, $"ThemeAddStyle START"); Theme a1 = new Theme(); ViewStyle v1 = new ViewStyle(); a1.AddStyle("red", v1); a1.AddStyle(null, v1); tlog.Debug(tag, $"ThemeAddStyle END (OK)"); Assert.Pass("ThemeAddStyle"); }
public void ThemeMerge() { tlog.Debug(tag, $"ThemeMerge START"); var testingTarget = new Theme(); Assert.IsNotNull(testingTarget, "should be not null"); Assert.IsInstanceOf <Theme>(testingTarget, "should be an instance of testing target class!"); ViewStyle style = new ViewStyle() { Size = new Size2D(100, 30), Focusable = true }; testingTarget.Version = "0.1"; testingTarget.AddStyle("myStyle", style); try { theme.Merge(testingTarget); // merge with Theme theme.Merge(path); // merge with xaml file } catch (Exception e) { tlog.Debug(tag, e.Message.ToString()); Assert.Fail("Caught Exception: Failed!"); } tlog.Debug(tag, $"ThemeMerge END (OK)"); }
public override void OnCreate(View root) { var theme1 = new Theme(); theme1.AddStyle("Button", new ButtonStyle { BackgroundColor = Color.Blue, Position = new Position(100, 100) }); var theme2 = new Theme(); theme2.AddStyle("Button", new ButtonStyle { BackgroundColor = Color.Red, Size = new Size(100, 100), }); theme1.Merge(theme2); root.Add(new Button(theme1.GetStyle("Button") as ButtonStyle) { Text = "Button1", }); theme2.GetStyle("Button").SolidNull = true; theme1.Merge(theme2); root.Add(new Button(theme1.GetStyle("Button") as ButtonStyle) { Text = "Button2", }); }
public void ThemeManagerGetStyle() { tlog.Debug(tag, $"ThemeManagerGetStyle START"); var testingTarget = new Theme(path); Assert.IsNotNull(testingTarget, "should be not null"); Assert.IsInstanceOf <Theme>(testingTarget, "should be an instance of testing target class!"); ViewStyle style = new ViewStyle() { Color = Color.Cyan, }; testingTarget.AddStyle("style", style); ThemeManager.CurrentTheme = testingTarget; tlog.Debug(tag, "GetStyle : " + ThemeManager.GetStyle("style")); tlog.Debug(tag, "GetStyle : " + ThemeManager.GetStyle(typeof(View))); tlog.Debug(tag, "GetUpdateStyleWithoutClone : " + ThemeManager.GetUpdateStyleWithoutClone("style")); tlog.Debug(tag, "GetUpdateStyleWithoutClone : " + ThemeManager.GetUpdateStyleWithoutClone(typeof(ViewStyle))); tlog.Debug(tag, $"ThemeManagerGetStyle END (OK)"); }
public void ThemeManagerApplyExternalPlatformTheme() { tlog.Debug(tag, $"ThemeManagerApplyExternalPlatformTheme START"); var theme = new Theme(path); ViewStyle style = new ViewStyle() { Color = Color.Cyan, }; theme.AddStyle("style", style); try { ThemeManager.ApplyExternalPlatformTheme(theme.Id, theme.Version); } catch (Exception e) { tlog.Debug(tag, e.Message.ToString()); Assert.Fail("Caught Exception : Failed!"); } tlog.Debug(tag, $"ThemeManagerApplyExternalPlatformTheme END (OK)"); }
public void ThemeMerge() { tlog.Debug(tag, $"ThemeMerge START"); ViewStyle style = new ViewStyle() { Size = new Size2D(100, 30), Focusable = true }; Theme a1 = new Theme(); a1.Version = "0.1"; a1.AddStyle("myStyle", style); ViewStyle style1 = new ViewStyle() { Margin = new Extents(4, 2, 3, 7) }; Theme t1 = new Theme(); t1.Id = "t1"; t1.Version = "1.0"; t1.AddStyle("myStyle", style1); try { a1.Merge(t1); } catch (Exception e) { tlog.Debug(tag, e.Message.ToString()); Assert.Fail("Caught Exception: Failed!"); } tlog.Debug(tag, $"ThemeMerge END (OK)"); }
public void Activate() { Window window = NUIApplication.GetDefaultWindow(); // If this is set to true, all views are created with GrabTouchAfterLeave set to true. View.SetDefaultGrabTouchAfterLeave(true); root = new View { Layout = new AbsoluteLayout(), WidthResizePolicy = ResizePolicyType.FillToParent, HeightResizePolicy = ResizePolicyType.FillToParent, }; var textLabel = new TextLabel { Size = new Size(300, 300), MultiLine = true, BackgroundColor = Color.Grey, WidthSpecification = LayoutParamPolicies.MatchParent, }; // greenView is created with the size 250x250 and GrabTouchAfterLeave=true var greenView = new View() { Size = new Size(300, 300), Position = new Position(50, 320), BackgroundColor = Color.Green, }; textLabel.Text = "greenView GrabTouchAfterLeave : " + greenView.GrabTouchAfterLeave; greenView.TouchEvent += (s, e) => { Tizen.Log.Error("NUI", $"greenView {e.Touch.GetState(0)}\n"); return(true); }; // If userTheme is applied, Theme userTheme = new Theme(); userTheme.AddStyle("Tizen.NUI.BaseComponents.TextLabel", new TextLabelStyle() { Size = new Size(500, 500), }); ThemeManager.ApplyTheme(userTheme); // BlueView is created with size 500x500 defined in userTheme and GrabTouchAfterLeave=true var blueView = new TextLabel (new TextLabelStyle { Size = new Size(300, 300), Text = "BlueView", }) { Position = new Position(10, 100), BackgroundColor = Color.Blue, }; textLabel.Text += "\nblueView GrabTouchAfterLeave : " + blueView.GrabTouchAfterLeave; blueView.TouchEvent += (s, e) => { Tizen.Log.Error("NUI", $"blueView {e.Touch.GetState(0)}\n"); return(true); }; // BlueView is created with size 100x100 defined in userStyle and GrabTouchAfterLeave=true var redView = new TextLabel (new TextLabelStyle { PixelSize = 24, Size = new Size(100, 100), }) { Text = "RedView", Position = new Position(50, 120), BackgroundColor = Color.Red, }; textLabel.Text += "\redView GrabTouchAfterLeave : " + redView.GrabTouchAfterLeave; redView.TouchEvent += (s, e) => { Tizen.Log.Error("NUI", $"redView {e.Touch.GetState(0)}\n"); return(true); }; greenView.Add(blueView); blueView.Add(redView); root.Add(textLabel); root.Add(greenView); window.Add(root); }
public override void OnCreate(View root) { var popupStyle1 = new PopupStyle() { Size = new Size(500, 200), BackgroundColor = Color.White, BoxShadow = new Shadow(6.0f, Color.Blue, extents: new Vector2(5, 5)), Title = new TextLabelStyle { TextColor = Color.Black, PixelSize = 16, Text = "PopupStyle1" }, Buttons = new ButtonStyle { SizeHeight = 50, BackgroundColor = new Selector <Color> { Pressed = Color.Black, Other = Color.Cyan, }, Text = new TextLabelStyle { TextColor = new Selector <Color> { Pressed = Color.White, Other = Color.Black, }, PixelSize = 12, }, ParentOrigin = ParentOrigin.BottomLeft, PivotPoint = PivotPoint.BottomLeft, PositionUsesPivotPoint = true }, ThemeChangeSensitive = true, }; var popupStyle2 = popupStyle1.Clone() as PopupStyle; popupStyle2.BackgroundColor = Color.Black; popupStyle2.Title.Text = "PopupStyle2"; popupStyle2.Title.TextColor = Color.Cyan; popupStyle2.Buttons.SizeHeight = 80; popupStyle2.Buttons.BackgroundColor = new Selector <Color> { Pressed = Color.Cyan, Other = Color.Black, }; popupStyle2.Buttons.Text.TextColor = new Selector <Color> { Pressed = Color.Black, Other = Color.White, }; theme1 = new Theme(); theme1.AddStyle("Popup1", popupStyle1); theme1.AddStyle("Popup2", popupStyle2); theme2 = new Theme(); theme2.AddStyle("Popup1", popupStyle2); theme2.AddStyle("Popup2", popupStyle1); ThemeManager.ApplyTheme(theme1); popup0 = new Popup("Popup1"); popup0.AddButton("ChangeTheme"); popup0.AddButton("Close"); popup0.PopupButtonClickEvent += PopupButtonClickedEvent; popup0.Post(NUIApplication.GetDefaultWindow()); popup1 = new Popup("Popup2"); popup1.Position = new Position(0, 210); popup1.AddButton("ChangeTheme"); popup1.AddButton("Close"); popup1.PopupButtonClickEvent += PopupButtonClickedEvent; popup1.Post(NUIApplication.GetDefaultWindow()); }
public override void OnCreate(View root) { var buttonStyle1 = new ButtonStyle() { Size = new Size(160, 100), BackgroundColor = Color.Blue, Text = new TextLabelStyle { TextColor = Color.Black, PixelSize = 16, }, Icon = new ImageViewStyle { ResourceUrl = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "image.jpg", Size = new Size(30, 30) }, ThemeChangeSensitive = true, }; var buttonStyle2 = new ButtonStyle() { Size = new Size(120, 120), BackgroundColor = Color.Red, Text = new TextLabelStyle { TextColor = Color.White, PixelSize = 18, }, Icon = new ImageViewStyle { ResourceUrl = "", Size = new Size(0, 0) }, ThemeChangeSensitive = true, }; theme1 = new Theme(); theme1.AddStyle("Button1", buttonStyle1); theme1.AddStyle("Button2", buttonStyle2); theme2 = new Theme(); theme2.AddStyle("Button1", buttonStyle2); theme2.AddStyle("Button2", buttonStyle1); theme3 = new Theme(); buttonStyle2.BackgroundColor = Color.Yellow; buttonStyle2.Text.TextColor = Color.Black; theme3.AddStyle("Button1", buttonStyle2); ThemeManager.ApplyTheme(theme1); var button = new Button("Button1") { Text = "A" }; root.Add(button); var button1 = new Button("Button2") { Position = new Position(170, 0), Text = "B" }; root.Add(button1); var button2 = new Button("Button1") { Position = new Position(0, 130), Text = "C" }; root.Add(button2); var button3 = new Button("Button2") { Position = new Position(170, 130), Text = "D" }; root.Add(button3); var button4 = new Button("Button1") { Position = new Position(0, 260), ThemeChangeSensitive = false, Text = "E" }; root.Add(button4); button.Clicked += OnClicked; }