コード例 #1
0
        public EditRepositoryDialog(Repository editedRepository)
        {
            Build();
            this.repo = editedRepository;

            if (repo != null)
            {
                versionControlType.Sensitive = false;
                versionControlType.AppendText(repo.VersionControlSystem.Name);
                versionControlType.Active = 0;

                Gtk.Widget editor = repo.VersionControlSystem.CreateRepositoryEditor(repo);
                repoEditorContainer.Add(editor);
                editor.Show();
            }
            else
            {
                foreach (VersionControlSystem vcs in VersionControlService.GetVersionControlSystems())
                {
                    if (vcs.IsInstalled)
                    {
                        versionControlType.AppendText(vcs.Name);
                        systems.Add(vcs);
                    }
                }
                versionControlType.Active = 0;
            }
            if (repo != null)
            {
                entryName.Text    = repo.Name;
                repo.NameChanged += OnNameChanged;
            }
        }
コード例 #2
0
 void SetWidget(Gtk.Widget widget)
 {
     RemoveBoxChild();
     box.Add(widget);
     widget.Show();
     box.Show();
 }
コード例 #3
0
 internal void UseCustomWidget(Gtk.Widget widget)
 {
     customWidget = true;
     frame.Remove(frame.Child);
     frame.Add(widget);
     widget.Show();
 }
コード例 #4
0
        void UpdateEditor()
        {
            if (systems.Count == 0)
            {
                return;
            }

            if (repoEditorContainer.Child != null)
            {
                repoEditorContainer.Remove(repoEditorContainer.Child);
            }

            if (versionControlType.Active == -1)
            {
                entryName.Sensitive = false;
                return;
            }

            string oldname = repo != null ? repo.Name : "";

            VersionControlSystem vcs = (VersionControlSystem)systems [versionControlType.Active];

            repo              = vcs.CreateRepositoryInstance();
            repo.Name         = oldname;
            repo.NameChanged += OnNameChanged;
            Gtk.Widget editor = vcs.CreateRepositoryEditor(repo);
            repoEditorContainer.Add(editor);
            editor.Show();
            entryName.Sensitive = true;
        }
コード例 #5
0
 public void AddChild(Gtk.Widget child, ChildPosition position)
 {
     child.Parent = this;
     child.Show();
     children.Add(new SmartScrolledWindowContainerChild(this, child)
     {
         ChildPosition = position
     });
 }
コード例 #6
0
 internal void UseCustomWidget(Gtk.Widget widget)
 {
     toolbarProvider.Attach(null);
     ClearToolbar();
     customWidget = true;
     frame.Remove(frame.Child);
     frame.Add(widget);
     widget.Show();
 }
コード例 #7
0
        void LoadEditors()
        {
            Dictionary <object, object> oldData = new Dictionary <object, object> ();

            foreach (KeyValuePair <object, IExecutionConfigurationEditor> editor in currentEditors)
            {
                object data = editor.Value.Save();
                oldData [editor.Key] = data;
            }

            foreach (Gtk.Widget w in notebook.Children)
            {
                notebook.Remove(w);
                w.Destroy();
            }

            if (mode == null)
            {
                return;
            }

            currentEditors.Clear();

            foreach (ExecutionCommandCustomizer customizer in ExecutionModeCommandService.GetExecutionCommandCustomizers(ctx))
            {
                IExecutionConfigurationEditor e = customizer.CreateEditor();
                currentEditors.Add(customizer, e);
                object cdata;
                if (!oldData.TryGetValue(customizer, out cdata))
                {
                    cdata = data.GetCommandData(customizer.Id);
                }
                Gtk.Widget w = e.Load(ctx, cdata);
                w.Show();
                notebook.AppendPage(w, new Gtk.Label(GettextCatalog.GetString(customizer.Name)));
            }

            ParameterizedExecutionHandler handler = mode.ExecutionHandler as ParameterizedExecutionHandler;

            if (handler != null)
            {
                IExecutionConfigurationEditor e = handler.CreateEditor();
                currentEditors.Add(mode, e);
                object cdata;
                if (!oldData.TryGetValue(mode, out cdata))
                {
                    cdata = data.Data;
                }
                Gtk.Widget w = e.Load(ctx, data.Data);
                w.Show();
                notebook.AppendPage(w, new Gtk.Label(mode.Name));
            }
            notebook.ShowTabs  = notebook.ShowBorder = currentEditors.Count > 1;
            hseparator.Visible = !notebook.ShowTabs;
        }
コード例 #8
0
        protected override void OnAdded(Gtk.Widget widget)
        {
            if (widget.Equals(this.vboxWindow))
            {
                base.OnAdded(widget);
                return;
            }

            this.vboxClient.PackStart(widget, true, true, 0);
            widget.Show();
        }
コード例 #9
0
		protected virtual void OnComboVisualizersChanged (object sender, System.EventArgs e)
		{
			if (currentWidget != null)
				mainBox.Remove (currentWidget);
			if (comboVisualizers.Active == -1) {
				buttonOk.Sensitive = false;
				return;
			}
			buttonOk.Sensitive = true;
			currentVisualizer = visualizers [comboVisualizers.Active];
			currentWidget = currentVisualizer.GetVisualizerWidget (value);
			mainBox.PackStart (currentWidget, true, true, 0);
			currentWidget.Show ();
		}
コード例 #10
0
 protected virtual void OnComboVisualizersChanged(object sender, System.EventArgs e)
 {
     if (currentWidget != null)
     {
         mainBox.Remove(currentWidget);
     }
     if (comboVisualizers.Active == -1)
     {
         buttonOk.Sensitive = false;
         return;
     }
     buttonOk.Sensitive = true;
     currentVisualizer  = visualizers [comboVisualizers.Active];
     currentWidget      = currentVisualizer.GetVisualizerWidget(value);
     mainBox.PackStart(currentWidget, true, true, 0);
     currentWidget.Show();
 }
コード例 #11
0
 protected override void OnRealized()
 {
     base.OnRealized();
     if (!initialized)
     {
         initialized = true;
         if (app is IsolatedApplication)
         {
             ConnectPlug();
         }
         else
         {
             Gtk.Widget w = OnCreateWidget();
             w.Show();
             book.AppendPage(w, null);
         }
     }
 }
コード例 #12
0
        private void AddRow(Gtk.Table table, Gtk.Widget widget, string labelText, uint row)
        {
            Gtk.Label l = new Gtk.Label(labelText);
            l.UseUnderline = true;
            l.Xalign       = 0.0f;
            l.Show();
            table.Attach(l, 0, 1, row, row + 1,
                         Gtk.AttachOptions.Fill,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         0, 0);

            widget.Show();
            table.Attach(widget, 1, 2, row, row + 1,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         0, 0);

            l.MnemonicWidget = widget;

            // TODO: Tooltips
        }
コード例 #13
0
 /// <summary>
 /// Packs widget on the left side of the box. Every next packed widget
 /// gets packed after previous
 /// </summary>
 /// <param name="aWidget">
 /// Widget to insert inside <see cref="Gtk.Widget"/>
 /// </param>
 public void PackStart(Gtk.Widget aWidget)
 {
     if (aWidget == null)
     {
         return;
     }
     if (BeforeAlignment.LeftPadding == 0)
     {
         BeforeAlignment.LeftPadding = 3;
     }
     BeforeBox.PackEnd(aWidget, false, false, 0);
     if (aWidget is Gtk.Entry)
     {
         (aWidget as Gtk.Widget).FocusInEvent  += OnEntryFocusIn;
         (aWidget as Gtk.Widget).FocusOutEvent += OnEntryFocusOut;
     }
     else
     {
         aWidget.CanFocus = false;
     }
     aWidget.Show();
 }
コード例 #14
0
 /// <summary>
 /// Packs widget on the right side of the box. Every next packed widget
 /// gets packed before previous
 /// </summary>
 /// <param name="aWidget">
 /// Widget to insert inside <see cref="Gtk.Widget"/>
 /// </param>
 public void PackEnd(Gtk.Widget aWidget)
 {
     if (aWidget == null)
     {
         return;
     }
     if (AfterAlignment.RightPadding == 0)
     {
         AfterAlignment.RightPadding = 3;
     }
     AfterBox.PackEnd(aWidget, false, false, 0);
     if (aWidget is Gtk.Entry)
     {
         (aWidget as Gtk.Widget).FocusInEvent  += OnEntryFocusIn;
         (aWidget as Gtk.Widget).FocusOutEvent += OnEntryFocusOut;
     }
     else
     {
         aWidget.CanFocus = false;
     }
     aWidget.Show();
 }
コード例 #15
0
        public HitRendererControl(string _name, string icon, HitRenderer r)
            : base(false, 3)
        {
            name     = _name;
            renderer = r;

            renderer.RefreshEvent += new HitRenderer.RefreshHandler(OnRefresh);

            if (icon != null)
            {
                Gtk.Widget iconW = DataBarn.GetImageWidget(icon);
                if (iconW != null)
                {
                    this.PackStart(iconW, false, false, 3);
                    iconW.Show();
                }
            }

            nameLabel = new Gtk.Label("");
            this.PackStart(nameLabel, false, false, 3);
            nameLabel.Show();


            nextButton          = new Gtk.Button("Next");
            nextButton.Clicked += new EventHandler(OnNextClicked);
            this.PackEnd(nextButton, false, false, 3);

            displayedLabel = new Gtk.Label("");
            this.PackEnd(displayedLabel, false, false, 3);
            displayedLabel.Show();

            prevButton          = new Gtk.Button("Prev");
            prevButton.Clicked += new EventHandler(OnPrevClicked);
            this.PackEnd(prevButton, false, false, 3);

            // Initialize things
            OnRefresh(null);
        }
コード例 #16
0
        protected void UpdateWidget()
        {
            if (!initialized)
            {
                return;
            }

            if (app is LocalApplication)
            {
                Gtk.Widget w = OnCreateWidget();
                if (w.Parent != book)
                {
                    book.AppendPage(w, null);
                    w.Show();
                }
                book.Page = book.NPages - 1;
                if (book.NPages > 1)
                {
                    Gtk.Widget cw = book.GetNthPage(0);
                    book.Remove(cw);
                    OnDestroyWidget(cw);
                }
            }
        }
コード例 #17
0
 private void AddWidget(Gtk.Widget widget)
 {
     widget.Show();
     ContentArea.Add(widget);
 }
コード例 #18
0
 private void AddWidget(Gtk.Widget widget)
 {
     widget.Show();
     this.VBox.Add(widget);
 }
コード例 #19
0
ファイル: TopLevelImpl.cs プロジェクト: weitzhandler/Avalonia
 public void Show() => _widget.Show();
コード例 #20
0
        void SetImagePosition()
        {
            if (Control.Child != null)
            {
                Control.Remove(Control.Child);
            }
            (label.Parent as Gtk.Container)?.Remove(label);
            (gtkimage?.Parent as Gtk.Container)?.Remove(gtkimage);

            Gtk.Widget child     = null;
            var        showImage = Image != null;
            var        showLabel = !string.IsNullOrEmpty(label.Text);

            if (showImage && showLabel)
            {
                Gtk.VBox vbox;
                Gtk.HBox hbox;
                switch (ImagePosition)
                {
                case ButtonImagePosition.Above:
                    child = vbox = new Gtk.VBox(false, 2);
                    vbox.PackStart(gtkimage, true, true, 0);
                    vbox.PackEnd(label, false, true, 0);
                    break;

                case ButtonImagePosition.Below:
                    child = vbox = new Gtk.VBox(false, 2);
                    vbox.PackStart(label, false, true, 0);
                    vbox.PackEnd(gtkimage, true, true, 0);
                    break;

                case ButtonImagePosition.Left:
                    child = hbox = new Gtk.HBox(false, 2);
                    hbox.PackStart(gtkimage, false, true, 0);
                    hbox.PackStart(label, true, true, 0);
                    break;

                case ButtonImagePosition.Right:
                    child = hbox = new Gtk.HBox(false, 2);
                    hbox.PackStart(label, true, true, 0);
                    hbox.PackEnd(gtkimage, false, true, 0);
                    break;

                case ButtonImagePosition.Overlay:
#if GTK2
                    var table = new Gtk.Table(1, 1, false);
                    child = table;
                    table.Attach(label, 0, 0, 1, 1, Gtk.AttachOptions.Expand, Gtk.AttachOptions.Expand, 0, 0);
                    table.Attach(gtkimage, 0, 0, 1, 1, Gtk.AttachOptions.Expand, Gtk.AttachOptions.Expand, 0, 0);
#else
                    var grid = new Gtk.Grid();
                    child            = grid;
                    label.Hexpand    = label.Vexpand = true;
                    gtkimage.Hexpand = gtkimage.Vexpand = true;
                    grid.Attach(label, 0, 0, 1, 1);
                    grid.Attach(gtkimage, 0, 0, 1, 1);
#endif
                    break;

                default:
                    throw new NotSupportedException();
                }
            }
            else if (showLabel)
            {
                child = label;
            }
            else if (showImage)
            {
                child = gtkimage;
            }

            if (child != null)
            {
                child.Show();
                Control.Child = child;
            }

            Control.QueueResize();
        }
コード例 #21
0
 public void Show() => _window.Show();
コード例 #22
0
ファイル: Styles.Linux.cs プロジェクト: alamboley/MonoGame
        public static void Load()
        {
            Style.Add <ApplicationHandler>("PipelineTool", h =>
            {
                Global.ApplicationHandle = h.Control.Handle;

                if (Gtk.Global.MajorVersion >= 3 && Gtk.Global.MinorVersion >= 16)
                {
                    Global.UseHeaderBar = Gtk3Wrapper.gtk_application_prefers_app_menu(h.Control.Handle);
                }

                if (Global.UseHeaderBar)
                {
                    Gtk3Wrapper.gtk_application_set_app_menu(h.Control.Handle, (new Gtk.Builder("MainWindow.AppMenu.glade")).GetObject("appmenu").Handle);
                }
            });

            Style.Add <FormHandler>("MainWindow", h =>
            {
                if (!Global.UseHeaderBar)
                {
                    return;
                }

                var builder   = new Gtk.Builder("MainWindow.glade");
                var headerBar = new Gtk.Widget(builder.GetObject("headerbar").Handle);

                h.Menu    = null;
                h.ToolBar = null;

                Connect("new", MainWindow.Instance.cmdNew);
                Connect("open", MainWindow.Instance.cmdOpen);
                Connect("save", MainWindow.Instance.cmdSave);
                Connect("saveas", MainWindow.Instance.cmdSaveAs);
                Connect("import", MainWindow.Instance.cmdImport);
                Connect("close", MainWindow.Instance.cmdClose);
                Connect("help", MainWindow.Instance.cmdHelp);
                Connect("about", MainWindow.Instance.cmdAbout);
                Connect("quit", MainWindow.Instance.cmdExit);
                Connect("undo", MainWindow.Instance.cmdUndo);
                Connect("redo", MainWindow.Instance.cmdRedo);
                Connect("build", MainWindow.Instance.cmdBuild);
                Connect("rebuild", MainWindow.Instance.cmdRebuild);
                Connect("clean", MainWindow.Instance.cmdClean);
                Connect("cancel", MainWindow.Instance.cmdCancelBuild);

                _actionGroup = Gtk3Wrapper.gtk_accel_group_new();

                Connect(MainWindow.Instance.cmdNew, Gdk.Key.N, Gdk.ModifierType.ControlMask);
                Connect(MainWindow.Instance.cmdOpen, Gdk.Key.O, Gdk.ModifierType.ControlMask);
                Connect(MainWindow.Instance.cmdSave, Gdk.Key.S, Gdk.ModifierType.ControlMask);
                Connect(MainWindow.Instance.cmdExit, Gdk.Key.Q, Gdk.ModifierType.ControlMask);
                Connect(MainWindow.Instance.cmdUndo, Gdk.Key.Z, Gdk.ModifierType.ControlMask);
                Connect(MainWindow.Instance.cmdRedo, Gdk.Key.Y, Gdk.ModifierType.ControlMask);
                Connect(MainWindow.Instance.cmdBuild, Gdk.Key.F6);
                Connect(MainWindow.Instance.cmdHelp, Gdk.Key.F1);

                Gtk3Wrapper.gtk_window_add_accel_group(h.Control.Handle, _actionGroup);

                _popovermenu1 = new Gtk.Widget(builder.GetObject("popovermenu1").Handle);
                _popovermenu2 = new Gtk.Widget(builder.GetObject("popovermenu2").Handle);

                Gtk3Wrapper.gtk_window_set_titlebar(h.Control.Handle, headerBar.Handle);
                Gtk3Wrapper.gtk_header_bar_set_show_close_button(headerBar.Handle, true);

                _mainbutton = new Gtk.RadioButton("");
                RejectActive(builder.GetObject("build_button").Handle);
                RejectActive(builder.GetObject("rebuild_button").Handle);
                RejectActive(builder.GetObject("clean_button").Handle);

                _buttonbox = new Gtk.Widget(builder.GetObject("build_buttonbox").Handle);
                _cancelbox = new Gtk.Widget(builder.GetObject("cancel_button").Handle);
                _separator = new Gtk.Widget(builder.GetObject("separator1").Handle);
                MainWindow.Instance.cmdBuild.EnabledChanged       += (sender, e) => ReloadBuildbox();
                MainWindow.Instance.cmdCancelBuild.EnabledChanged += (sender, e) => ReloadBuildbox();

                MainWindow.Instance.TitleChanged += delegate
                {
                    var title    = MainWindow.TitleBase;
                    var subtitle = "";

                    if (PipelineController.Instance.ProjectOpen)
                    {
                        title    = (PipelineController.Instance.ProjectDirty) ? "*" : "";
                        title   += Path.GetFileName(PipelineController.Instance.ProjectItem.OriginalPath);
                        subtitle = Path.GetDirectoryName(PipelineController.Instance.ProjectItem.OriginalPath);
                    }

                    h.Control.Title = title;
                    Gtk3Wrapper.gtk_header_bar_set_subtitle(headerBar.Handle, subtitle);
                };

                var treeview1    = new Gtk.TreeView(builder.GetObject("treeview1").Handle);
                var store        = new Gtk.TreeStore(typeof(string), typeof(string));
                var column       = new Gtk.TreeViewColumn();
                var textCell     = new Gtk.CellRendererText();
                var dataCell     = new Gtk.CellRendererText();
                dataCell.Visible = false;
                column.PackStart(textCell, false);
                column.PackStart(dataCell, false);
                treeview1.AppendColumn(column);
                column.AddAttribute(textCell, "markup", 0);
                column.AddAttribute(dataCell, "text", 1);
                treeview1.Model = store;

                MainWindow.Instance.RecentChanged += (sender, e) =>
                {
                    store.Clear();
                    var recentList = sender as List <string>;

                    foreach (var project in recentList)
                    {
                        store.InsertWithValues(0, "<b>" + Path.GetFileName(project) + "</b>\n" +
                                               Path.GetDirectoryName(project), project);
                    }
                };

                treeview1.RowActivated += (o, args) =>
                {
                    _popovermenu2.Hide();

                    Gtk.TreeIter iter;
                    if (!store.GetIter(out iter, args.Path))
                    {
                        return;
                    }

                    var project = store.GetValue(iter, 1).ToString();
                    PipelineController.Instance.OpenProject(project);
                };

                headerBar.Show();
            });

            Style.Add <ButtonHandler>("Destuctive", h => h.Control.StyleContext.AddClass("destructive-action"));

            Style.Add <LabelHandler>("Wrap", h => h.Control.MaxWidthChars = 55);

            Style.Add <ToolBarHandler>("ToolBar", h =>
            {
                h.Control.ToolbarStyle = Gtk.ToolbarStyle.Icons;
                h.Control.IconSize     = Gtk.IconSize.SmallToolbar;
            });

            Style.Add <DrawableHandler>("Stretch", h =>
            {
                var parent = h.Control.Parent.Parent.Parent.Parent.Parent.Parent;

                parent.SizeAllocated += delegate
                {
                    var al   = h.Control.Allocation;
                    al.Width = parent.AllocatedWidth - 2;
                    h.Control.SetAllocation(al);
                };
            });

            Style.Add <PixelLayoutHandler>("Stretch", h =>
            {
                var parent = h.Control.Parent.Parent.Parent.Parent.Parent;

                parent.SizeAllocated += delegate
                {
                    var al   = h.Control.Allocation;
                    al.Width = parent.AllocatedWidth;
                    h.Control.SetAllocation(al);
                };
            });
        }