예제 #1
0
        protected void ComposeWindow(Xwt.Window xwtWindow)
        {
            var windowBackend = xwtWindow.GetBackend() as Xwt.GtkBackend.WindowBackend;

            // set minimum size:
            var minSize = Registry.Pooled <Limaki.Drawing.IDrawingUtils> ().GetTextDimension("File Edit Style", null);

            windowBackend.Window.SizeRequested += (s, e) => {
                var req  = e.Requisition;
                var size = new Xwt.Size(e.Requisition.Width, e.Requisition.Height);
                Trace.WriteLine($"{nameof (windowBackend)}.{nameof (windowBackend.Window.SizeRequested)}:\t{size}");
                req.Width     = (int)minSize.Width;
                e.Requisition = req;
            };
        }
예제 #2
0
        private void AddToolbars(Xwt.Window xwtWindow, ConceptUsecase useCase)
        {
            var backend = xwtWindow.GetBackend() as Xwt.WPFBackend.WindowBackend;
            var window  = backend.Window;
            var grid    = backend.Window.Content as Grid;

            var toolBarTray = new ToolBarTray();

            toolBarTray.Orientation = System.Windows.Controls.Orientation.Horizontal;
            Grid.SetColumn(toolBarTray, 0);
            Grid.SetRow(toolBarTray, 1);
            grid.Children.Add(toolBarTray);
            var toolRow = new RowDefinition()
            {
                Height = GridLength.Auto
            };                                                              // Only take the toolRow requested space.

            grid.RowDefinitions.Insert(1, toolRow);

            var dockpanel = grid.Children.OfType <DockPanel>().FirstOrDefault();

            if (dockpanel != null)
            {
                Grid.SetColumn(dockpanel, 0);
                Grid.SetRow(dockpanel, 2);
            }

            if (useCase.Toolbar == null)
            {
                return;
            }

            var toolStrips = useCase.Toolbar.Items
                             .Cast <Limaki.View.IVidget> ()
                             .Select(t => t.Backend.ToWpf() as ToolBar);

            foreach (var strip in toolStrips)
            {
                toolBarTray.ToolBars.Add(strip);
            }
        }