Ejemplo n.º 1
0
 private PersistentPaneController(Paned pane, string @namespace, string key, int fallback)
 {
     this.@namespace = @namespace;
     this.key        = key;
     this.fallback   = fallback;
     Paned           = pane;
 }
Ejemplo n.º 2
0
 public GtkShellDocumentViewContainerSplit(DocumentViewContainerMode mode)
 {
     this.mode = mode;
     paned     = CreatePaned();
     paned.Show();
     paned.SizeAllocated += Paned_SizeAllocated;
 }
Ejemplo n.º 3
0
        private void RecreateGridSplitter()
        {
            if (_paned != null)
            {
                this.RemoveFromContainer(_paned);
            }

            var orientation = Element.Orientation;

            switch (orientation)
            {
            case GridSplitterOrientation.Horizontal:
                _paned          = new HPaned();
                _paned.CanFocus = true;
                break;

            case GridSplitterOrientation.Vertical:
                _paned          = new VPaned();
                _paned.CanFocus = true;
                break;
            }

            Add(_paned);
            _paned.ShowAll();
        }
Ejemplo n.º 4
0
        public override bool OnChildPlacement(DockObject child, ref DockPlacement placement)
        {
            DockPlacement pos = DockPlacement.None;

            if (this.Child != null)
            {
                Paned paned = this.Child as Paned;
                if (child == paned.Child1)
                {
                    pos = this.Orientation == Orientation.Horizontal ? DockPlacement.Left : DockPlacement.Top;
                }
                else if (child == paned.Child2)
                {
                    pos = this.Orientation == Orientation.Horizontal ? DockPlacement.Right : DockPlacement.Bottom;
                }
            }

            if (pos != DockPlacement.None)
            {
                placement = pos;
                return(true);
            }

            return(base.OnChildPlacement(child, ref pos));
        }
Ejemplo n.º 5
0
        protected override void OnAdded(Widget widget)
        {
            if (Child == null)
            {
                return;
            }

            Paned paned = Child as Paned;

            if (paned.Child1 != null && paned.Child2 != null)
            {
                return;
            }

            DockItem      item = widget as DockItem;
            DockPlacement pos  = DockPlacement.None;

            if (paned.Child1 == null)
            {
                pos = (Orientation == Orientation.Horizontal ?
                       DockPlacement.Left : DockPlacement.Top);
            }
            else
            {
                pos = (Orientation == Orientation.Horizontal ?
                       DockPlacement.Right : DockPlacement.Bottom);
            }

            if (pos != DockPlacement.None)
            {
                Dock(item, pos, null);
            }
        }
Ejemplo n.º 6
0
        private void ToggleResize(object obj, EventArgs args)
        {
            ToggleButton toggle = obj as ToggleButton;
            Widget       child  = children[obj] as Widget;
            Paned        paned  = child.Parent as Paned;

            Paned.PanedChild pc = paned[child] as Paned.PanedChild;
            pc.Resize = toggle.Active;
        }
Ejemplo n.º 7
0
        private void ToggleShrink(object obj, EventArgs args)
        {
            ToggleButton toggle = obj as ToggleButton;
            Widget       child  = children[toggle];
            Paned        paned  = child.Parent as Paned;

            Paned.PanedChild pc = paned[child] as Paned.PanedChild;
            pc.Shrink = toggle.Active;
        }
Ejemplo n.º 8
0
        private void BuildLibrary()
        {
            var box = new HeaderBox()
            {
                Title = Catalog.GetString("Library")
            };

            // Build the Library Header
            var header = new HBox()
            {
                Spacing     = 5,
                BorderWidth = 5
            };

            var app_button = new Button(new Image()
            {
                IconSize = (int)IconSize.LargeToolbar,
                IconName = "media-player-banshee"
            })
            {
                TooltipText = Catalog.GetString("Launch the Banshee Media Player")
            };

            app_button.Clicked += (o, e) => {
                ServiceManager.SourceManager.SetActiveSource(ServiceManager.SourceManager.MusicLibrary);
                ServiceManager.Get <MediaPanelService> ().PresentPrimaryInterface();
            };

            header.PackStart(source_combo_box = new SourceComboBox(), false, false, 0);
            header.PackStart(app_button, false, false, 0);
            header.PackStart(search_entry = new SearchEntry(), true, true, 0);
            box.PackStartHighlighted(header, false, false, 0, HeaderBox.HighlightFlags.Background);

            // Build the Library Views
            var pane = new Paned(Orientation.Horizontal);

            pane.Pack1(SetupView(artist_view = new ArtistListView()
            {
                Name                 = "media-panel-artists",
                WidthRequest         = 150,
                DoNotRenderNullModel = true
            }), false, false);
            pane.Pack2(SetupView(album_view = new AlbumListView()
            {
                Name = "media-panel-albums",
                DoNotRenderNullModel = true
            }), true, true);
            box.PackStart(pane, true, true, 0);
            box.Hexpand = box.Vexpand = true;
            box.Halign  = box.Valign = Align.Fill;

            Attach(box, 0, 0, 1, 1);
        }
Ejemplo n.º 9
0
        private static void Control(Paned pane, string @namespace, string key, int defaultValue)
        {
            string dict_key = String.Format("{0}.{1}", @namespace, key);

            if (controllers.ContainsKey(dict_key))
            {
                controllers[dict_key].Paned = pane;
            }
            else
            {
                controllers.Add(dict_key, new PersistentPaneController(pane, @namespace, key, defaultValue));
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Creates a LinearAfterThresholdView instance.
        /// </summary>
        /// <param name="owner">Owner view.</param>
        public LinearAfterThresholdView(ViewBase owner) : base(owner)
        {
            properties = new PropertyView(this);
            graph      = new GraphView(this);

            panel = new Paned(Orientation.Vertical);

            panel.Pack1(properties.MainWidget, false, false);
            panel.Pack2(graph.MainWidget, true, false);
            panel.Destroyed += OnDestroyed;
            mainWidget       = panel;
            mainWidget.ShowAll();
        }
Ejemplo n.º 11
0
        public override void OnDocked(DockObject requestor, DockPlacement position, object data)
        {
            if (Child == null)
            {
                return;
            }

            Paned paned = (Paned)Child;
            bool  done  = false;

            /* see if we can dock the item in our paned */
            switch (Orientation)
            {
            case Orientation.Horizontal:
                if (paned.Child1 == null && position == DockPlacement.Left)
                {
                    paned.Pack1(requestor, false, false);
                    done = true;
                }
                else if (paned.Child2 == null && position == DockPlacement.Right)
                {
                    paned.Pack2(requestor, true, true);
                    done = true;
                }
                break;

            case Orientation.Vertical:
                if (paned.Child1 == null && position == DockPlacement.Top)
                {
                    paned.Pack1(requestor, true, true);
                    done = true;
                }
                else if (paned.Child2 == null && position == DockPlacement.Bottom)
                {
                    paned.Pack2(requestor, false, false);
                    done = true;
                }
                break;
            }

            if (!done)
            {
                /* this will create another paned and reparent us there */
                base.OnDocked(requestor, position, data);
            }
            else
            {
                ((DockItem)requestor).ShowGrip();
                requestor.DockObjectFlags |= DockObjectFlags.Attached;
            }
        }
Ejemplo n.º 12
0
        private void Layout(bool top)
        {
            //Hyena.Log.Information ("ListBrowser LayoutLeft");
            Reset();

            SchemaEntry <int> current_entry = top ? pane_top_position : pane_left_position;

            container = GetPane(!top);
            Paned filter_box = GetPane(top);

            filter_box.PositionSet = true;
            Paned current_pane = filter_box;

            for (int i = 0; i < filter_scrolled_windows.Count; i++)
            {
                ScrolledWindow window           = filter_scrolled_windows[i];
                bool           last_even_filter = (i == filter_scrolled_windows.Count - 1 && filter_scrolled_windows.Count % 2 == 0);
                if (i > 0 && !last_even_filter)
                {
                    Paned new_pane = GetPane(top);
                    current_pane.Pack2(new_pane, true, false);
                    current_pane.Position = top ? 180 : 350;
                    PersistentPaneController.Control(current_pane, ControllerName(top, i));
                    current_pane = new_pane;
                }

                if (last_even_filter)
                {
                    current_pane.Pack2(window, true, false);
                    current_pane.Position = top ? 180 : 350;
                    PersistentPaneController.Control(current_pane, ControllerName(top, i));
                }
                else
                {
                    current_pane.Pack1(window, false, false);
                }
            }

            container.Pack1(filter_box, false, false);
            container.Pack2(main_scrolled_window, true, false);
            browser_container = filter_box;

            if (current_entry.Equals(SchemaEntry <int> .Zero))
            {
                throw new InvalidOperationException(String.Format("No SchemaEntry found for {0} position of {1}",
                                                                  top ? "top" : "left", this.GetType().FullName));
            }
            container.Position = current_entry.DefaultValue;
            PersistentPaneController.Control(container, current_entry);
            ShowPack();
        }
Ejemplo n.º 13
0
        private void Layout()
        {
            //Hyena.Log.Information ("ListBrowser LayoutLeft");
            Reset();

            container = new HPaned();
            Paned filter_box = new HPaned();

            filter_box.PositionSet = true;
            Paned current_pane = filter_box;

            for (int i = 0; i < filter_scrolled_windows.Count; i++)
            {
                ScrolledWindow window           = filter_scrolled_windows[i];
                bool           last_even_filter = (i == filter_scrolled_windows.Count - 1 && filter_scrolled_windows.Count % 2 == 0);
                if (i > 0 && !last_even_filter)
                {
                    Paned new_pane = new HPaned();
                    current_pane.Pack2(new_pane, true, false);
                    current_pane.Position = 350;
                    PersistentPaneController.Control(current_pane, ControllerName(i));
                    current_pane = new_pane;
                }

                if (last_even_filter)
                {
                    current_pane.Pack2(window, true, false);
                    current_pane.Position = 350;
                    PersistentPaneController.Control(current_pane, ControllerName(i));
                }
                else
                {
                    /*if (i == 0)
                     *  current_pane.Pack1 (window, false, false);
                     * else*/
                    current_pane.Pack1(window, true, false);
                }
            }

            container.Pack1(filter_box, true, false);
            container.Pack2(main_scrolled_window, true, false);
            browser_container = filter_box;

            container.Position = 275;
            PersistentPaneController.Control(container, ControllerName(-1));
            ShowPack();
        }
Ejemplo n.º 14
0
            public DockPanelItem(DockItem item)
            {
                Item         = item;
                Pane         = new Paned(Orientation.Vertical);
                ReopenButton = new Button(new Label(item.Label)
                {
                    Angle = 270
                });

                popover          = new Popover(ReopenButton);
                popover.Position = PositionType.Left;

                ReopenButton.Clicked += (o, args) => {
                    popover.ShowAll();
                    popover.Popup();
                };
            }
        /// <summary>
        /// Create the contents of the source contents in the desired layout.
        /// </summary>
        /// <param name="top">
        /// A <see cref="System.Boolean"/> -- whether to create a LayoutTop (true) or a LayoutLeft (false)
        /// </param>
        private void Layout(bool top)
        {
            Reset();

            container                  = GetPane(!top);
            filter_box                 = new LiveRadioFilterView();
            filter_box.Sensitive       = false;
            filter_box.GenreSelected  += OnViewGenreSelected;
            filter_box.GenreActivated += OnViewGenreSelected;
            filter_box.QuerySent      += OnViewQuerySent;

            container.Pack1(filter_box, false, false);
            container.Pack2(main_scrolled_window, true, false);
            browser_container = filter_box;

            container.Position = top ? 175 : 275;
            ShowPack();
        }
Ejemplo n.º 16
0
        Frame CreatePaneOptions(Paned paned, string frameLabel,
                                string label1, string label2)
        {
            Frame frame = new Frame(frameLabel);

            frame.BorderWidth = 4;

            Table table = new Table(3, 2, true);

            frame.Add(table);

            Label label = new Label(label1);

            table.Attach(label, 0, 1, 0, 1);

            CheckButton check = new CheckButton("_Resize");

            table.Attach(check, 0, 1, 1, 2);
            check.Toggled  += new EventHandler(ToggleResize);
            children[check] = paned.Child1;

            check = new CheckButton("_Shrink");
            table.Attach(check, 0, 1, 2, 3);
            check.Active    = true;
            check.Toggled  += new EventHandler(ToggleShrink);
            children[check] = paned.Child1;

            label = new Label(label2);
            table.Attach(label, 1, 2, 0, 1);

            check = new CheckButton("_Resize");
            table.Attach(check, 1, 2, 1, 2);
            check.Active    = true;
            check.Toggled  += new EventHandler(ToggleResize);
            children[check] = paned.Child2;

            check = new CheckButton("_Shrink");
            table.Attach(check, 1, 2, 2, 3);
            check.Active    = true;
            check.Toggled  += new EventHandler(ToggleShrink);
            children[check] = paned.Child2;

            return(frame);
        }
Ejemplo n.º 17
0
        protected override void OnElementChanged(ElementChangedEventArgs <GridSplitter> e)
        {
            if (Control == null)
            {
                _paned = new HPaned();
                Add(_paned);
                _paned.ShowAll();

                SetNativeControl(this);
            }

            if (e.NewElement != null)
            {
                RecreateGridSplitter();
                UpdateContent1();
                UpdateContent2();
            }

            base.OnElementChanged(e);
        }
Ejemplo n.º 18
0
        private MainFrame() : base(WindowType.Toplevel)
        {
            Title = "Tabellarius";
            SetDefaultSize(900, 600);             // Valid default size
            SetPosition(WindowPosition.Center);
            DeleteEvent += new DeleteEventHandler(OnDelete);

            AccelGroup agr = new AccelGroup();

            var mainBox = new VBox(false, 2);
            // Titlebar - mainBox top
            var titleBar = TitleBar.GetInstance();
            // MainToolBar - mainBox middle
            var mainToolBar = MainToolBar.GetInstance();

            // ListFrame - Table left
            var listFrameAdapter = ListFrameAdapter.GetInstance();
            // Toolbar - Table middle
            var middleToolBar = MiddleToolBar.GetInstance();
            // EditFrame - Table right
            var editFrameAdapter = EditFrameAdapter.GetInstance();

            var paneBox = new HBox();

            paneBox.PackStart(listFrameAdapter, true, true, 0);
            paneBox.PackStart(new VSeparator(), false, true, 0);
            paneBox.PackStart(middleToolBar, false, true, 0);
            paneBox.PackStart(new VSeparator(), false, true, 0);
            var paned = new Paned(Orientation.Horizontal);

            paned.Add1(paneBox);
            paned.Add2(editFrameAdapter);
            paned.Position = 500;

            // Pack stuff
            mainBox.PackStart(titleBar, false, true, 0);
            mainBox.PackStart(mainToolBar, false, true, 0);
            mainBox.PackStart(new HSeparator(), false, true, 0);
            mainBox.PackStart(paned, true, true, 0);
            Add(mainBox);
        }
Ejemplo n.º 19
0
        private void Layout()
        {
            Reset();

            container = new VPaned();

            frame = new Hyena.Widgets.RoundedFrame();
            frame.SetFillColor(new Cairo.Color(0, 0, 0));
            frame.DrawBorder = false;
            frame.Add(filter_view);
            filter_view.Show();
            frame.Show();

            container.Pack1(frame, false, false);
            main_expander.Activated     += OnExpander;
            main_expander.SizeRequested += HandleSizeRequested;
            container.Pack2(main_expander, true, false);

            container.Position = 175;
            PersistentPaneController.Control(container, ControllerName(-1));

            ShowPack();
        }
Ejemplo n.º 20
0
        private void Reset()
        {
            // Unparent the views' scrolled window parents so they can be re-packed in
            // a new layout. The main container gets destroyed since it will be recreated.

            foreach (ScrolledWindow window in filter_scrolled_windows)
            {
                Paned filter_container = window.Parent as Paned;
                if (filter_container != null)
                {
                    filter_container.Remove(window);
                }
            }

            if (container != null && main_scrolled_window != null)
            {
                container.Remove(main_scrolled_window);
            }

            if (container != null)
            {
                Remove(container);
            }
        }
Ejemplo n.º 21
0
        public CPaned(Paned p)
        {
            if (!(p is VPaned) || !(p.Child2 is Expander))
            {
                Console.WriteLine("CPaned: this ain't gonna fly");
                return;
            }

            paned    = p;
            expander = p.Child2 as Expander;

            paned.SizeAllocated +=
                new SizeAllocatedHandler(OnPanedSizeAllocated);
            paned.AcceptPosition +=
                new AcceptPositionHandler(OnPanedAcceptPosition);
            paned.ButtonPressEvent +=
                new ButtonPressEventHandler(OnPanedButtonPressEvent);
            paned.ButtonReleaseEvent +=
                new ButtonReleaseEventHandler(OnPanedButtonReleaseEvent);
            paned.AddNotification(
                "position", new NotifyHandler(OnPanedPositionChanged));

            expander.AddNotification("expanded", new GLib.NotifyHandler(OnExpandedChanged));
        }
Ejemplo n.º 22
0
        public BubbleChartView(ViewBase owner = null) : base(owner)
        {
            vpaned1               = new VPaned();
            mainWidget            = vpaned1;
            mainWidget.Destroyed += OnDestroyed;

            graphView = new DirectedGraphView(this);
            vpaned1.Pack1(graphView.MainWidget, true, true);

            VBox vbox1 = new VBox(false, 0);

            ctxBox = new VBox(false, 0);

            // Arc selection: rules & actions
            VBox arcSelBox = new VBox();

            Label l1 = new Label("Rules");

            l1.Xalign = 0;
            arcSelBox.PackStart(l1, true, true, 0);
            RuleList = new EditorView(owner);
            RuleList.TextHasChangedByUser += OnRuleChanged;
            //RuleList.ScriptMode = false;

            ScrolledWindow rules = new ScrolledWindow();

            rules.ShadowType = ShadowType.EtchedIn;
            rules.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);

            rules.Add((RuleList as ViewBase).MainWidget);

            (RuleList as ViewBase).MainWidget.ShowAll();
            arcSelBox.PackStart(rules, true, true, 0);
            rules.Show();

            Label l2 = new Label("Actions");

            l2.Xalign = 0;
            arcSelBox.PackStart(l2, true, true, 0);
            ActionList = new EditorView(owner);
            ActionList.TextHasChangedByUser += OnActionChanged;
            //ActionList.ScriptMode = false;

            ScrolledWindow actions = new ScrolledWindow();

            actions.ShadowType = ShadowType.EtchedIn;
            actions.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);

            actions.Add((ActionList as ViewBase).MainWidget);

            (ActionList as ViewBase).MainWidget.ShowAll();
            arcSelBox.PackStart(actions, true, true, 0); actions.Show();
            arcSelWdgt = arcSelBox as Widget;
            arcSelWdgt.Hide();
            ctxBox.PackStart(arcSelWdgt, true, true, 0);

            // Node selection:

            Grid t1 = new Grid();

            Label l3 = new Label("Name");

            l3.Xalign = 0;
            t1.Attach(l3, 0, 0, 1, 1);

            Label l4 = new Label("Description");

            l4.Xalign = 0;
            t1.Attach(l4, 0, 1, 1, 1);

            Label l5 = new Label("Colour");

            l5.Xalign = 0;
            t1.Attach(l5, 0, 2, 1, 1);

            nameEntry          = new Entry();
            nameEntry.Changed += OnNameChanged;
            nameEntry.Xalign   = 0;

            // Setting the WidthRequest to 350 will effectively
            // set the minimum size, beyond which it cannot be further
            // shrunk by dragging the HPaned's splitter.
            nameEntry.WidthRequest = 350;
            t1.Attach(nameEntry, 1, 0, 1, 1);

            descEntry              = new Entry();
            descEntry.Xalign       = 0;
            descEntry.Changed     += OnDescriptionChanged;
            descEntry.WidthRequest = 350;
            t1.Attach(descEntry, 1, 1, 1, 1);
            colourChooser              = new ColorButton();
            colourChooser.Xalign       = 0;
            colourChooser.ColorSet    += OnColourChanged;
            colourChooser.WidthRequest = 350;
            t1.Attach(colourChooser, 1, 2, 1, 1);
            nodeSelWdgt = t1;
            ctxBox.PackStart(t1, true, true, 0);

            // Info
            Label l6 = new Label();

            l6.LineWrap = true;
            l6.Text     = "<left-click>: select a node or arc.\n" +
                          "<right-click>: shows a context-sensitive menu.\n\n" +
                          "Once a node/arc is selected, it can be dragged to a new position.\n\n" +
                          "Nodes are created by right-clicking on a blank area.\n\n" +
                          "Transition arcs are created by firstly selecting a source node,\n" +
                          "then right-clicking over a target node.";
            infoWdgt = l6 as Widget;
            infoWdgt.ShowAll();
            l6.Xalign = 0;
            l6.Yalign = 0;
            l6.Wrap   = false;
            Alignment infoWdgtWrapper = new Alignment(0, 0, 1, 0);

            infoWdgtWrapper.Add(infoWdgt);
            //ctxBox.PackStart(infoWdgt, true, true, 0);
            //vbox1.PackStart(ctxBox, false, false, 0);

            PropertiesView = new PropertyView(this);
            ((ScrolledWindow)((ViewBase)PropertiesView).MainWidget).HscrollbarPolicy = PolicyType.Never;
            // settingsBox = new Table(2, 2, false);
            // settingsBox.Attach(new Label("Initial State"), 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            // combobox1 = new ComboBox();
            // combobox1.PackStart(comboRender, false);
            // combobox1.AddAttribute(comboRender, "text", 0);
            // combobox1.Model = comboModel;
            // settingsBox.Attach(combobox1, 1, 2, 0, 1, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            // chkVerbose = new CheckButton();
            // chkVerbose.Toggled += OnToggleVerboseMode;
            // settingsBox.Attach(new Label("Verbose Mode"), 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            // settingsBox.Attach(chkVerbose, 1, 2, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Fill, 0, 0);

            hpaned1 = new HPaned();
            hpaned2 = new HPaned();
            Frame frame1 = new Frame("Rotation Settings");

            frame1.Add(((ViewBase)PropertiesView).MainWidget);
            frame1.ShadowType = ShadowType.In;
            Frame frame2 = new Frame();

            frame2.Add(hpaned2);
            frame2.ShadowType = ShadowType.In;
            ctxFrame          = new Frame();
            ctxFrame.Add(ctxBox);
            ctxFrame.ShadowType = ShadowType.In;
            Frame frame4 = new Frame("Instructions");

            frame4.Add(infoWdgtWrapper);
            frame4.ShadowType = ShadowType.In;
            hpaned1.Pack1(frame1, false, false);
            hpaned1.Pack2(frame2, true, false);
            hpaned2.Pack1(ctxFrame, true, false);
            hpaned2.Pack2(frame4, true, false);
            hpaned1.ShowAll();
            Alignment halign = new Alignment(0, 0, 1, 1);

            halign.Add(hpaned1);

            vpaned1.Pack2(halign, false, false);
            vpaned1.Show();

            graphView.OnGraphObjectSelected += OnGraphObjectSelected;
            graphView.OnGraphObjectMoved    += OnGraphObjectMoved;
            //combobox1.Changed += OnComboBox1SelectedValueChanged;

            contextMenuHelper              = new ContextMenuHelper(graphView.MainWidget);
            contextMenuHelper.ContextMenu += OnPopup;

            ContextMenu.SelectionDone += OnContextMenuDeactivated;
            ContextMenu.Mapped        += OnContextMenuRendered;

            // Ensure the menu is populated
            Select(null);
        }
Ejemplo n.º 23
0
 public CPaned(Paned p, double initial_pos) : this(p)
 {
     stored_pos = initial_pos;
 }
Ejemplo n.º 24
0
 public static void Control(Paned pane, string name)
 {
     Control(pane, String.Format("interface.panes.{0}", name), "position", pane.Position);
 }
Ejemplo n.º 25
0
 public static void Control(Paned pane, SchemaEntry <int> entry)
 {
     Control(pane, entry.Namespace, entry.Key, entry.DefaultValue);
 }
Ejemplo n.º 26
0
 public static void Control(Paned pane, string name)
 {
     Control(pane, String.Format("{0}.{1}", NamespacePrefix, name), "position", pane.Position);
 }