Ejemplo n.º 1
0
        public override void SetLayout(Layout inner)
        {
            foreach (Gtk.Widget child in hbox.Children)
            {
                hbox.Remove(child);
            }
            IGtkLayout gtklayout = (IGtkLayout)inner.Handler;

            hbox.PackStart(gtklayout.ContainerObject, false, true, 0);
            //vp.Add ((Gtk.Widget)gtklayout.ContainerObject);
        }
Ejemplo n.º 2
0
Archivo: Main.cs Proyecto: ktvoelker/di
 public Main(Controller.Main c)
     : base(Gtk.WindowType.Toplevel)
 {
     ctl = c;
     Name = "di";
     Title = "di";
     DefaultWidth = 800;
     DefaultHeight = 600;
     DeleteEvent += OnDeleteEvent;
     topLevelBox = new Gtk.HBox();
     topLevelBox.Homogeneous = false;
     topLevelBox.Spacing = 20;
     Add(topLevelBox);
     windowsBox = new Gtk.HBox();
     windowsBox.Homogeneous = true;
     windowsBox.Spacing = 10;
     foreach (var window in ctl.Windows)
     {
         var view = new WindowView(this, window);
         windowsBox.Add(view);
     }
     topLevelBox.PackStart(windowsBox, true, true, 0);
     ctl.Windows.Added.Add((index, window) =>
     {
         var view = new WindowView(this, window);
         windowsBox.Add(view);
         windowsBox.ShowAll();
     });
     ctl.Windows.Removed.Add((index, window) =>
     {
         var view = windowsBox.Children[index];
         bool hadFocus = view.ContainsFocus();
         windowsBox.Remove(view);
         if (hadFocus && windowsBox.Children.Length > 0)
         {
             windowsBox.Children[0].GiveFocus();
         }
     });
     ctl.Windows.Cleared.Add(() =>
     {
         foreach (var view in windowsBox.Children)
         {
             windowsBox.Remove(view);
         }
     });
     ctl.Windows.CurrentChanged.Add((idx, win) => ApplyControllerFocus(win));
     ctl.BeginTask.Add(task =>
     {
         var sidebar = Sidebar.Create(task);
         topLevelBox.PackEnd(sidebar, false, false, 20);
         task.End.Add(() =>
         {
             bool hadFocus = sidebar.ContainsFocus();
             topLevelBox.Remove(sidebar);
             if (hadFocus)
             {
                 ApplyControllerFocus(ctl.Windows.Current);
             }
         });
         sidebar.ShowAll();
     });
 }