Exemplo n.º 1
0
        protected virtual void Compose()
        {
            var size = new Xwt.Size(36, 36);

            GraphStreamViewCommand = new CommandView {
                Action      = s => ViewMode = SplitView.ViewMode = SplitViewMode.GraphContent,
                Image       = Iconery.GraphContentView,
                Size        = size,
                ToolTipText = "show contents"
            };
            GraphGraphViewCommand = new CommandView {
                Action      = s => ViewMode = SplitView.ViewMode = SplitViewMode.GraphGraph,
                Image       = Iconery.GraphGraphView,
                Size        = size,
                ToolTipText = "show tiled graph"
            };

            ToggleViewCommand = new CommandView {
                Action      = s => SplitView.ToggleView(),
                Image       = Iconery.ToggleView,
                Size        = size,
                ToolTipText = "toogle view"
            };

            OpenNewWindowCommand = new CommandView {
                Action      = s => SplitView.ShowInNewWindow(),
                Image       = Iconery.NewViewVisualNote,
                Size        = size,
                ToolTipText = "open new window"
            };

            Action <bool> goBackOrForward = backOrForward => {
                if (SplitView.CanGoBackOrForward(backOrForward))
                {
                    SplitView.GoBackOrForward(backOrForward);
                    CheckBackForward(SplitView);
                }
            };

            GoBackCommand = new CommandView {
                Action      = s => goBackOrForward(false),
                Image       = Iconery.GoPrevious,
                Size        = size,
                ToolTipText = "navigate back"
            };

            GoForwardCommand = new CommandView {
                Action      = s => goBackOrForward(true),
                Image       = Iconery.GoNext,
                Size        = size,
                ToolTipText = "navigate forward"
            };

            GoHomeCommand = new CommandView {
                Action      = s => SplitView.GoHome(),
                Image       = Iconery.GoHome,
                Size        = size,
                ToolTipText = "go to favorites"
            };

            NewSheetCommand = new CommandView {
                Action      = s => SplitView.NewSheet(),
                Image       = Iconery.NewSheet,
                Size        = size,
                ToolTipText = "new sheet"
            };

            NewNoteCommand = new CommandView {
                Action      = s => SplitView.NewNote(),
                Image       = Iconery.NewNote,
                Size        = size,
                ToolTipText = "new note"
            };

            SaveSheetCommand = new CommandView {
                Action      = s => SplitView.SaveDocument(),
                Image       = Iconery.SaveContent,
                Size        = size,
                ToolTipText = "save content"
            };

            GraphStreamViewButton = new ToolbarButton(GraphStreamViewCommand)
            {
                IsCheckable = true
            };
            GraphGraphViewButton = new ToolbarButton(GraphGraphViewCommand)
            {
                IsCheckable = true
            };
            var toggleViewButton = new ToolbarButton(ToggleViewCommand);
            var newWindowButton  = new ToolbarButton(OpenNewWindowCommand);

            GoBackButton    = new ToolbarButton(GoBackCommand);
            GoForwardButton = new ToolbarButton(GoForwardCommand);
            var goHomeButton    = new ToolbarButton(GoHomeCommand);
            var newSheetButton  = new ToolbarButton(NewSheetCommand);
            var newNoteButton   = new ToolbarButton(NewNoteCommand);
            var saveSheetButton = new ToolbarButton(SaveSheetCommand);

            SheetCombo = new ComboBox {
                Width = 100
            };

            var sheetComboHost = new ToolbarItemHost()
            {
                Child = SheetCombo
            };

            this.AddItems(
                sheetComboHost,
                saveSheetButton,

                new ToolbarSeparator(),
                GraphStreamViewButton,
                GraphGraphViewButton,
                toggleViewButton,

                new ToolbarSeparator(),
                GoBackButton,
                GoForwardButton,
                goHomeButton,
                new ToolbarSeparator(),
                newSheetButton,
                newNoteButton,
                newWindowButton,
                new ToolbarSeparator()
                );
        }