public PanelTab() { MinSize = new Vector2(TabMinWidth, TabHeight); MaxSize = new Vector2(TabMaxWidth, TabHeight); LayoutCell = new LayoutCell(Alignment.LeftTop); Size = MinSize; Layout = new HBoxLayout(); var caption = new SimpleText { Id = "TextPresenter", Padding = Theme.Metrics.ControlsPadding, ForceUncutText = false, FontHeight = Theme.Metrics.TextHeight, HAlignment = HAlignment.Center, VAlignment = VAlignment.Center, OverflowMode = TextOverflowMode.Ellipsis, LayoutCell = new LayoutCell(Alignment.Center), }; var presenter = new TabPresenter(caption); CompoundPresenter.Add(presenter); DefaultAnimation.AnimationEngine = new AnimationEngineDelegate { OnRunAnimation = (animation, markerId, animationTimeCorrection) => { presenter.SetState(markerId); return(true); } }; AddNode(caption); HitTestTarget = true; LateTasks.Add(Theme.MouseHoverInvalidationTask(this)); this.AddChangeWatcher(() => Active, isActive => Padding = isActive ? new Thickness { Top = -1f, Bottom = 1f } : new Thickness()); }
public void InvokeBackTest() { var tabHistory = new MockTabHistory(); var view = new MockTabView(); var presenter = new TabPresenter( view, new MockFavorites(), new MockConfig(), new MockFaviconCache(), new MockHistory(), tabHistory); var url1 = Url.FromString("www.first.com"); var url2 = Url.FromString("www.second.com"); presenter.Push(url1); presenter.Push(url2); Assert.AreEqual(url2, tabHistory.Current().Url); view.InvokeBack(); Assert.AreEqual(url1, tabHistory.Current().Url); }
public ThemedTab() { Padding = Theme.Metrics.ControlsPadding; MinSize = Theme.Metrics.MinTabSize; MaxSize = Theme.Metrics.MaxTabSize; Size = MinSize; Layout = new HBoxLayout(); var caption = new SimpleText { Id = "TextPresenter", ForceUncutText = false, FontHeight = Theme.Metrics.TextHeight, HAlignment = HAlignment.Center, VAlignment = VAlignment.Center, OverflowMode = TextOverflowMode.Ellipsis, LayoutCell = new LayoutCell(Alignment.Center) }; var presenter = new TabPresenter(caption); Presenter = presenter; DefaultAnimation.AnimationEngine = new AnimationEngineDelegate { OnRunAnimation = (animation, markerId, animationTimeCorrection) => { presenter.SetState(markerId); return(true); } }; var closeButton = new ThemedTabCloseButton { Id = "CloseButton" }; AddNode(caption); AddNode(closeButton); LateTasks.Add(Theme.MouseHoverInvalidationTask(this)); }
/// <summary> /// Does the setup. /// </summary> private void DoSetup() { var presenter = new TabPresenter(MainWindow); Setup setup = new Setup(Dispatcher, presenter); setup.Initialize(); IMvxAppStart start = Mvx.Resolve <IMvxAppStart>(); start.Start(); this.setupComplete = true; }
public void PushTest() { var tabHistory = new MockTabHistory(); var presenter = new TabPresenter( new MockTabView(), new MockFavorites(), new MockConfig(), new MockFaviconCache(), new MockHistory(), tabHistory); var url = Url.FromString("www.test.com"); presenter.Push(url); Assert.AreEqual(url, tabHistory.Current().Url); }
public void InvokeGoHomeTest() { var config = new MockConfig(); var tabHistory = new MockTabHistory(); var view = new MockTabView(); var presenter = new TabPresenter( view, new MockFavorites(), config, new MockFaviconCache(), new MockHistory(), tabHistory); view.InvokeGoHome(); Assert.AreEqual(config.Home, tabHistory.Current().Url); }
public void InvokeSubmitTest() { var tabHistory = new MockTabHistory(); var view = new MockTabView(); var presenter = new TabPresenter( view, new MockFavorites(), new MockConfig(), new MockFaviconCache(), new MockHistory(), tabHistory); var url = Url.FromString("www.test.com"); view.InvokeSubmit(url); Assert.AreEqual(url, tabHistory.Current().Url); }
public void InvokeReloadTest() { var view = new MockTabView(); var presenter = new TabPresenter( view, new MockFavorites(), new MockConfig(), new MockFaviconCache(), new MockHistory(), new MockTabHistory()); presenter.Push(Url.FromString("www.test.com")); int pageloads = view.PageLoads; view.InvokeReload(); Assert.AreEqual(++pageloads, view.PageLoads); }
public void InvokeAddFavoriteTest() { var favorites = new MockFavorites(); var view = new MockTabView(); var presenter = new TabPresenter( view, favorites, new MockConfig(), new MockFaviconCache(), new MockHistory(), new MockTabHistory()); var url = Url.FromString("www.test.com"); presenter.Push(url); view.InvokeAddFavorite(); Assert.IsNotNull(favorites.GetViewModel().Single(model => model.Url == url.ToString())); }
public TabRegionConfiguration(TabPresenter presenter, FrameworkElement view) { this.presenter = presenter; this.view = view; }