当前位置: 首页>>代码示例>>C#>>正文


C# Button.GrabDefault方法代码示例

本文整理汇总了C#中Gtk.Button.GrabDefault方法的典型用法代码示例。如果您正苦于以下问题:C# Button.GrabDefault方法的具体用法?C# Button.GrabDefault怎么用?C# Button.GrabDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gtk.Button的用法示例。


在下文中一共展示了Button.GrabDefault方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Create

		public static Gtk.Window Create ()
		{
			window = new Window ("GtkComboBox");
			window.SetDefaultSize (200, 100);

			VBox box1 = new VBox (false, 0);
			window.Add (box1);

			VBox box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, true, true, 0);

			ComboBoxText combo = ComboBoxText.NewWithEntry ();
			combo.AppendText ("Foo");
			combo.AppendText ("Bar");
			combo.Changed += new EventHandler (OnComboActivated);
			combo.Entry.Changed += new EventHandler (OnComboEntryChanged);
			box2.PackStart (combo, true, true, 0);

			HSeparator separator = new HSeparator ();

			box1.PackStart (separator, false, false, 0);

			box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, false, false, 0);

			Button button = new Button (Stock.Close);
			button.Clicked += new EventHandler (OnCloseClicked);
			button.CanDefault = true;
			
			box2.PackStart (button, true, true, 0);
			button.GrabDefault ();
			return window;
		}
开发者ID:liberostelios,项目名称:gtk-sharp,代码行数:35,代码来源:TestComboBox.cs

示例2: Create

		public static Gtk.Window Create ()
		{
			window = new Dialog ();
			window.Title = "Bi-directional flipping";
			window.SetDefaultSize (200, 100);

			label = new Label ("Label direction: <b>Left-to-right</b>");
			label.UseMarkup = true;
			label.SetPadding (3, 3);
			window.VBox.PackStart (label, true, true, 0);

			check_button = new CheckButton ("Toggle label direction");
			window.VBox.PackStart (check_button, true, true, 2);

			if (window.Direction == TextDirection.Ltr)
				check_button.Active = true;

			check_button.Toggled += new EventHandler (Toggle_Flip);
			check_button.BorderWidth = 10;

			button = new Button (Stock.Close);
			button.Clicked += new EventHandler (Close_Button);
			button.CanDefault = true;
			
			window.ActionArea.PackStart (button, true, true, 0);
			button.GrabDefault ();

			window.ShowAll ();
			return window;
		}
开发者ID:ystk,项目名称:debian-gtk-sharp2,代码行数:30,代码来源:TestFlipping.cs

示例3: Create

		public static Gtk.Window Create ()
		{
			window = new Dialog ();
			window.Response += new ResponseHandler (Print_Response);
			window.SetDefaultSize (200, 100);

			window.Title = "GtkDialog";
			Button button = new Button (Stock.Ok);
			button.Clicked += new EventHandler (Close_Button);
			button.CanDefault = true;
			window.ActionArea.PackStart (button, true, true, 0);
			button.GrabDefault ();

			ToggleButton toggle_button = new ToggleButton ("Toggle Label");
			toggle_button.Clicked += new EventHandler (Label_Toggle);
			window.ActionArea.PackStart (toggle_button, true, true, 0);

			toggle_button = new ToggleButton ("Toggle Separator");
			toggle_button.Clicked += new EventHandler (Separator_Toggle);
			window.ActionArea.PackStart (toggle_button, true, true, 0);

			window.ShowAll ();

			return window;
		}
开发者ID:ystk,项目名称:debian-gtk-sharp2,代码行数:25,代码来源:TestDialog.cs

示例4: Create

		public static Gtk.Window Create ()
		{
			window = new Window ("GtkCombo");
			window.SetDefaultSize (200, 100);

			VBox box1 = new VBox (false, 0);
			window.Add (box1);

			VBox box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, true, true, 0);

			combo = new Gtk.Combo ();
			string[] pop = {"Foo", "Bar"};
			combo.PopdownStrings = pop;
			combo.Entry.Activated += new EventHandler (OnComboActivated);
			box2.PackStart (combo, true, true, 0);

			HSeparator separator = new HSeparator ();

			box1.PackStart (separator, false, false, 0);

			box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, false, false, 0);

			Button button = new Button (Stock.Close);
			button.Clicked += new EventHandler (OnCloseClicked);
			button.CanDefault = true;
			
			box2.PackStart (button, true, true, 0);
			button.GrabDefault ();
			return window;
		}
开发者ID:ystk,项目名称:debian-gtk-sharp2,代码行数:34,代码来源:TestCombo.cs

示例5: Create

		public static Gtk.Window Create ()
		{
			window = new Window ("GtkRadioButton");
			window.SetDefaultSize (200, 100);

			VBox box1 = new VBox (false, 0);
			window.Add (box1);

			VBox box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, true, true, 0);

			radio_button = new RadioButton ("Button 1");
			box2.PackStart (radio_button, true, true, 0);

			radio_button = new RadioButton (radio_button, "Button 2");
			radio_button.Active = true;
			box2.PackStart (radio_button, true, true, 0);

			radio_button = new RadioButton (radio_button, "Button 3");
			box2.PackStart (radio_button, true, true, 0);

			radio_button = new RadioButton (radio_button, "Inconsistent");
			radio_button.Inconsistent = true;
			box2.PackStart (radio_button, true, true, 0);

			box1.PackStart (new HSeparator (), false, true, 0);

			box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, true, true, 0);
			
			radio_button = new RadioButton ("Button 4");
			radio_button.Mode = false;
			box2.PackStart (radio_button, true, true, 0);

			radio_button = new RadioButton (radio_button, "Button 5");
			radio_button.Active = true;
			radio_button.Mode = false;
			box2.PackStart (radio_button, true, true, 0);

			radio_button = new RadioButton (radio_button, "Button 6");
			radio_button.Mode = false;
			box2.PackStart (radio_button, true, true, 0);

			box1.PackStart (new HSeparator (), false, true, 0);

			box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, false, true, 0);

			Button button = new Button (Stock.Close);
			button.Clicked += new EventHandler (Close_Button);
			box2.PackStart (button, true, true, 0);
			button.CanDefault = true;
			button.GrabDefault ();

			return window;
		}
开发者ID:liberostelios,项目名称:gtk-sharp,代码行数:59,代码来源:TestRadioButton.cs

示例6: CreateGui

		public void CreateGui() 
		{
			dialog = new Dialog ();
			dialog.Title = "Login";
			dialog.BorderWidth = 3;
			dialog.VBox.BorderWidth = 5;
			dialog.HasSeparator = false;

			Frame frame = new Frame ("Connection");
			string image = Stock.DialogInfo;
			
			HBox hbox = new HBox (false, 2);
			hbox.BorderWidth = 5;
			hbox.PackStart (new Gtk.Image (image, IconSize.Dialog), true, true, 0);
		
			Table table = new Table (2, 3, false);
			hbox.PackStart (table);
			table.ColumnSpacing = 4;
			table.RowSpacing = 4;
			Label label = null;

			label = Label.NewWithMnemonic ("_Provider");
			table.Attach (label, 0, 1, 0, 1);
			providerOptionMenu = CreateProviderOptionMenu();
			table.Attach (providerOptionMenu, 1, 2, 0, 1);
			
			label = Label.NewWithMnemonic ("_Connection String");
			table.Attach (label, 0, 1, 1, 2);
			connection_entry = new Entry ();
			table.Attach (connection_entry, 1, 2, 1, 2);

			frame.Add (hbox);

			dialog.VBox.PackStart (frame, true, true, 0);

			Button button = null;
			button = new Button(Stock.Ok);
			button.Clicked += new EventHandler (Connect_Action);
			button.CanDefault = true;
			dialog.ActionArea.PackStart (button, true, true, 0);
			button.GrabDefault ();

			button = new Button(Stock.Cancel);
			button.Clicked += new EventHandler (Dialog_Cancel);
			dialog.ActionArea.PackStart (button, true, true, 0);
			dialog.Modal = true;

			dialog.ShowAll ();
		}
开发者ID:Zman0169,项目名称:mono,代码行数:49,代码来源:LoginDialog.cs

示例7: CreateGui

		public void CreateGui() 
		{
			dialog = new Dialog ();
			
			dialog.AllowGrow = true;
			dialog.Title = "About";
			dialog.BorderWidth = 3;
			dialog.VBox.BorderWidth = 5;
			dialog.HasSeparator = false;
		
			Table table = new Table (4, 1, false);
			table.ColumnSpacing = 4;
			table.RowSpacing = 4;
			Label label = null;
			
			label = new Label ("About Mono SQL# For GTK#");
			table.Attach (label, 0, 1, 0, 1);

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

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

			label = new Label ("(C) Copyright 2002-2006 Daniel Morgan");
			table.Attach (label, 0, 1, 3, 4);

			table.Show();

			dialog.VBox.PackStart (table, false, false, 10);

			Button button = null;
			button = new Button (Stock.Ok);
			button.Clicked += new EventHandler (Ok_Action);
			button.CanDefault = true;
			dialog.ActionArea.PackStart (button, true, true, 0);
			button.GrabDefault ();

			dialog.Modal = true;

			dialog.ShowAll ();
		}
开发者ID:emtees,项目名称:old-code,代码行数:42,代码来源:AboutDialog.cs

示例8: Create

		public static Gtk.Window Create ()
		{
			window = new Window ("GtkCheckButton");
			window.SetDefaultSize (200, 100);

			VBox box1 = new VBox (false, 0);
			window.Add (box1);

			VBox box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, true, true, 0);

			checked_button = new CheckButton ("_button1");
			box2.PackStart (checked_button, true, true, 0);

 			checked_button = new CheckButton ("button2");
 			box2.PackStart (checked_button, true, true, 0);

			checked_button = new CheckButton ("button3");
			box2.PackStart (checked_button, true, true, 0);

			checked_button = new CheckButton ("Inconsistent");
			checked_button.Inconsistent = true;
			box2.PackStart (checked_button, true, true, 0);

			HSeparator separator = new HSeparator ();

			box1.PackStart (separator, false, false, 0);

			box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, false, false, 0);

			Button button = new Button (Stock.Close);
			button.Clicked += new EventHandler (OnCloseClicked);
			button.CanDefault = true;
			
			box2.PackStart (button, true, true, 0);
			button.GrabDefault ();
			return window;
		}
开发者ID:liberostelios,项目名称:gtk-sharp,代码行数:41,代码来源:TestCheckButton.cs

示例9: Create

		public static Gtk.Window Create ()
		{
			window = new Window ("Statusbar");
			window.SetDefaultSize (150, 100);

			VBox box1 = new VBox (false, 0);
			window.Add (box1);

			VBox box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, true, true, 0);

			statusbar = new Statusbar ();
			box1.PackEnd (statusbar, true, true, 0);
			statusbar.TextPopped += new TextPoppedHandler (statusbar_popped);

			Button button = new Button ("push");
			box2.PackStart (button, false, false, 0);
			button.Clicked += new EventHandler (statusbar_pushed);

			button = new Button ("pop");
			box2.PackStart (button, false, false, 0);
			button.Clicked += new EventHandler (pop_clicked);

			box1.PackStart (new HSeparator (), false, true, 0);

			box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, false, true, 0);

			Button close_button = new Button (Stock.Close);
			close_button.Clicked += new EventHandler (Close_Button);
			box2.PackStart (close_button, true, true, 0);
			button.CanDefault = true;
			button.GrabDefault ();
			
			window.ShowAll ();
			return window;
		}
开发者ID:liberostelios,项目名称:gtk-sharp,代码行数:39,代码来源:TestStatusbar.cs

示例10: DemoMenus

		public DemoMenus () : base ("Menus")
		{
			AccelGroup accel_group = new AccelGroup ();
			AddAccelGroup (accel_group);

			VBox box1 = new VBox (false, 0);
			Add (box1);

			MenuBar menubar = new MenuBar ();
			box1.PackStart (menubar, false, true, 0);

			MenuItem menuitem = new MenuItem ("test\nline2");
			menuitem.Submenu = CreateMenu (2, true);
			menubar.Append (menuitem);

 			MenuItem menuitem1 = new MenuItem ("foo");
 			menuitem1.Submenu = CreateMenu (3, true);
 			menubar.Append (menuitem1);

			menuitem = new MenuItem ("bar");
			menuitem.Submenu = CreateMenu (4, true);
			menuitem.RightJustified = true;
			menubar.Append (menuitem);

			VBox box2 = new VBox (false, 10);
			box2.BorderWidth = 10;
			box1.PackStart (box2, false, true, 0);

			Button close = new Button ("close");
			close.Clicked += new EventHandler (CloseClicked);
			box2.PackStart (close, true, true, 0);

			close.CanDefault = true;
			close.GrabDefault ();

			ShowAll ();
		}
开发者ID:liberostelios,项目名称:gtk-sharp,代码行数:37,代码来源:DemoMenus.cs

示例11: CreateEdit

        /// <summary>
        /// Create the UI
        /// </summary>
        private void CreateEdit()
        {
            this.Header = CmisSync.Properties_Resources.EditTitle;

            VBox layout_vertical   = new VBox(false, 12);

            Button cancel_button = new Button(CmisSync.Properties_Resources.Cancel);
            cancel_button.Clicked += delegate {
                this.Close();
            };

            Button finish_button = new Button(CmisSync.Properties_Resources.SaveChanges);
            finish_button.Sensitive = false;
            finish_button.Clicked += delegate {
                this.Controller.SaveFolder();
                this.Close();
            };

            layout_vertical.PackStart(new Label(string.Empty), false, false, 0);
            Notebook tab_view = new Notebook();
            //tab_view.AppendPage(layout_vertical, new Label("Edit Folders"));
            var credentialsWidget = new CredentialsWidget();
            credentialsWidget.Password = this.Credentials.Password.ToString();
            credentialsWidget.Address = this.Credentials.Address.ToString();
            credentialsWidget.UserName = this.Credentials.UserName;
            credentialsWidget.Changed += (object sender, EventArgs e) => finish_button.Sensitive = true;
            tab_view.AppendPage(credentialsWidget, new Label(Properties_Resources.Credentials));
            this.Add(tab_view);
            this.AddButton(cancel_button);
            this.AddButton(finish_button);

            finish_button.GrabDefault();

            this.ShowAll();
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:38,代码来源:Edit.cs

示例12: CreateGui

		public void CreateGui() 
		{
			dialog = new Dialog ();
			
			dialog.AllowGrow = true;
			dialog.Title = "Login";
			dialog.BorderWidth = 2;
			dialog.VBox.BorderWidth = 2;
			dialog.HasSeparator = false;

			Frame frame = new Frame ("Connection");
			frame.BorderWidth = 2;
		
			Table table = new Table (7, 2, false);
			table.ColumnSpacing = 2;
			table.RowSpacing = 2;
			Label label = null;

			label = new Label ("_Provider");
			label.Xalign = 1.0f;
			label.Ypad = 8;
			table.Attach (label, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 1, 1);
			LoadProviderCombo();
			if (providerCombo.Model.IterNChildren() > 0)
				providerCombo.Active = 0;
			providerSelected = providerCombo.Active;
			table.Attach (providerCombo, 1, 8, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 10, 1);
						
			label = new Label ("_Connection String");
			label.Xpad = 2;
			label.Ypad = 8;
			label.Xalign = 1.0f;
			table.Attach (label, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 1, 1);
			connection_entry = new Entry ();
			connection_entry.Changed += new EventHandler (OnConnectionEntryChanged);
			table.Attach (connection_entry, 1, 8, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 10, 1);
			
			label = new Label ("_Server");
			label.Xalign = 1.0f;
			label.Ypad = 8;
			table.Attach (label, 0, 1, 2, 3, AttachOptions.Fill, AttachOptions.Fill, 1, 1);
			server_entry = new Entry ();
			server_entry.Changed += new EventHandler (OnParameterChanged);
			table.Attach (server_entry, 1, 8, 2, 3, AttachOptions.Fill, AttachOptions.Fill, 10, 1);

			label = new Label ("_Database");
			label.Xalign = 1.0f;
			label.Ypad = 8;
			table.Attach (label, 0, 1, 3, 4, AttachOptions.Fill, AttachOptions.Fill, 1, 1);
			database_entry = new Entry ();
			database_entry.Changed += new EventHandler (OnParameterChanged);
			table.Attach (database_entry, 1, 8, 3, 4, AttachOptions.Fill, AttachOptions.Fill, 10, 1);

			label = new Label ("_User ID");
			label.Xalign = 1.0f;
			label.Ypad = 8;
			table.Attach (label, 0, 1, 4, 5, AttachOptions.Fill, AttachOptions.Fill, 1, 1);
			userid_entry = new Entry ();
			userid_entry.Changed += new EventHandler (OnParameterChanged);
			table.Attach (userid_entry, 1, 8, 4, 5, AttachOptions.Fill, AttachOptions.Fill, 10, 1);

			label = new Label ("_Password");
			label.Xalign = 1.0f;
			label.Ypad = 8;
			table.Attach (label, 0, 1, 5, 6, AttachOptions.Fill, AttachOptions.Fill, 1, 1);
			password_entry = new Entry ();
			password_entry.Visibility = false;
			password_entry.Changed += new EventHandler (OnParameterChanged);
			table.Attach (password_entry, 1, 8, 5, 6, AttachOptions.Fill, AttachOptions.Fill, 10, 1);

			label = new Label ("_Other");
			label.Xalign = 1.0f;
			label.Ypad = 8;
			table.Attach (label, 0, 1, 6, 7, AttachOptions.Fill, AttachOptions.Fill, 1, 1);
			other_entry = new Entry ();
			other_entry.Changed += new EventHandler (OnParameterChanged);
			table.Attach (other_entry, 1, 8, 6, 7, AttachOptions.Fill, AttachOptions.Fill, 10, 1);

			table.Show();
			frame.Add (table);

			dialog.VBox.PackStart (frame, false, false, 5);
			
			Frame appSettingFrame = new Frame ("App Settings");
			appSettingFrame.Add (grid);
			dialog.VBox.PackStart (appSettingFrame, true, true, 10);

			Button button = null;
			button = new Button (Stock.Ok);
			button.Clicked += new EventHandler (Connect_Action);
			button.CanDefault = true;
			dialog.ActionArea.PackStart (button, true, true, 0);
			button.GrabDefault ();

			button = new Button (Stock.Cancel);
			button.Clicked += new EventHandler (Dialog_Cancel);
			dialog.ActionArea.PackStart (button, true, true, 0);
			dialog.Modal = true;
			dialog.SetDefaultSize (500, 500);

//.........这里部分代码省略.........
开发者ID:emtees,项目名称:old-code,代码行数:101,代码来源:LoginDialog.cs

示例13: ShowAdd1Page


//.........这里部分代码省略.........
            Add (layout_vertical);

            // Cancel button
            Button cancel_button = new Button (cancelText);

            cancel_button.Clicked += delegate {
                Controller.PageCancelled ();
            };

            // Continue button
            Button continue_button = new Button (continueText) {
                Sensitive = String.IsNullOrEmpty( Controller.CheckAddPage (address_entry.Text))
            };

            continue_button.Clicked += delegate {
                // Show wait cursor
                this.GdkWindow.Cursor = wait_cursor;

                // Try to find the CMIS server (asynchronous using a delegate)
                GetRepositoriesFuzzyDelegate dlgt =
                    new GetRepositoriesFuzzyDelegate(CmisUtils.GetRepositoriesFuzzy);
                ServerCredentials credentials = new ServerCredentials() {
                    UserName = user_entry.Text,
                    Password = password_entry.Text,
                    Address = new Uri(address_entry.Text)
                };
                IAsyncResult ar = dlgt.BeginInvoke(credentials, null, null);
                while (!ar.AsyncWaitHandle.WaitOne(100)) {
                    while (Application.EventsPending()) {
                        Application.RunIteration();
                    }
                }
                Tuple<CmisServer, Exception> result = dlgt.EndInvoke(ar);
                CmisServer cmisServer = result.Item1;
                if(cmisServer != null)
                {
                    Controller.repositories = cmisServer.Repositories;
                    address_entry.Text = cmisServer.Url.ToString();
                }
                else
                {
                    Controller.repositories = null;
                }
                // Hide wait cursor
                this.GdkWindow.Cursor = default_cursor;

                if (Controller.repositories == null)
                {
                    // Show warning
                    string warning = "";
                    string message = result.Item2.Message;
                    Exception e = result.Item2;
                    if (e is CmisPermissionDeniedException)
                    {
                        warning = Properties_Resources.LoginFailedForbidden;
                    }
//                    else if (e is CmisServerNotFoundException)
//                    {
//                        warning = Properties_Resources.ConnectFailure;
//                    }
                    else if (e.Message == "SendFailure" && cmisServer.Url.Scheme.StartsWith("https"))
                    {
                        warning = Properties_Resources.SendFailureHttps;
                    }
                    else if (e.Message == "TrustFailure")
                    {
                        warning = Properties_Resources.TrustFailure;
                    }
                    else
                    {
                        warning = message + Environment.NewLine + Properties_Resources.Sorry;
                    }
                    address_error_label.Markup = "<span foreground=\"red\">" + warning + "</span>";
                    address_error_label.Show();
                }
                else
                {
                    // Continue to folder selection
                    Controller.Add1PageCompleted(
                            new Uri(address_entry.Text), user_entry.Text, password_entry.Text);
                }
            };

            Controller.UpdateAddProjectButtonEvent += delegate (bool button_enabled) {
                Application.Invoke (delegate {
                    continue_button.Sensitive = button_enabled;
                    if(button_enabled) {
                        continue_button.SetFlag(Gtk.WidgetFlags.CanFocus);
                        continue_button.SetFlag(Gtk.WidgetFlags.CanDefault);
                        continue_button.GrabDefault();
                    }
                });
            };

            AddButton (cancel_button);
            AddButton (continue_button);

            Controller.CheckAddPage (address_entry.Text);
            address_entry.GrabFocus ();
        }
开发者ID:emrul,项目名称:CmisSync,代码行数:101,代码来源:Setup.cs

示例14: ShowAdd2Page


//.........这里部分代码省略.........

            Gtk.TreeIter iter;
            treeView.HeadersVisible = false;
            treeView.Selection.Mode = SelectionMode.Single;

            TreeViewColumn column = new TreeViewColumn ();
            column.Title = "Name";
            CellRendererToggle renderToggle = new CellRendererToggle ();
            column.PackStart (renderToggle, false);
            renderToggle.Activatable = true;
            column.AddAttribute (renderToggle, "active", (int)CmisTreeStore.Column.ColumnSelected);
            column.AddAttribute (renderToggle, "inconsistent", (int)CmisTreeStore.Column.ColumnSelectedThreeState);
            column.AddAttribute (renderToggle, "radio", (int)CmisTreeStore.Column.ColumnRoot);
            renderToggle.Toggled += delegate (object render, ToggledArgs args) {
                TreeIter iterToggled;
                if (! cmisStore.CmisStore.GetIterFromString (out iterToggled, args.Path))
                {
                    Console.WriteLine("Toggled GetIter Error " + args.Path);
                    return;
                }

                Node node = cmisStore.CmisStore.GetValue(iterToggled,(int)CmisTreeStore.Column.ColumnNode) as Node;
                if (node == null)
                {
                    Console.WriteLine("Toggled GetValue Error " + args.Path);
                    return;
                }

                RootFolder selectedRoot = repositories.Find (x => (x.Selected != false));
                Node parent = node;
                while (parent.Parent != null)
                {
                    parent = parent.Parent;
                }
                RootFolder root = parent as RootFolder;
                if (root != selectedRoot)
                {
                    selectedRoot.Selected = false;
                    cmisStore.UpdateCmisTree(selectedRoot);
                }

                if (node.Parent == null)
                {
                    node.Selected = true;
                }
                else
                {
                    if (node.Selected == false)
                    {
                        node.Selected = true;
                    }
                    else
                    {
                        node.Selected = false;
                    }
                }
                cmisStore.UpdateCmisTree(root);
            };
            CellRendererText renderText = new CellRendererText ();
            column.PackStart (renderText, false);
            column.SetAttributes (renderText, "text", (int)CmisTreeStore.Column.ColumnName);
            column.Expand = true;
            treeView.AppendColumn (column);

            treeView.AppendColumn ("Status", new StatusCellRenderer (), "text", (int)CmisTreeStore.Column.ColumnStatus);

            treeView.RowExpanded += delegate (object o, RowExpandedArgs args) {
                Node node = cmisStore.CmisStore.GetValue(args.Iter, (int)CmisTreeStore.Column.ColumnNode) as Node;
                Node parent = node;
                while (parent.Parent != null)
                {
                    parent = parent.Parent;
                }
                RootFolder root = parent as RootFolder;
                loader[root.Id].Load(node);
            };

            ScrolledWindow sw = new ScrolledWindow() {
                ShadowType = Gtk.ShadowType.In
            };
            sw.Add(treeView);

            layout_vertical.PackStart (new Label(""), false, false, 0);
            layout_vertical.PackStart (sw, true, true, 0);
            Add(layout_vertical);
            AddButton(back_button);
            AddButton(cancel_button);
            AddButton(continue_button);

            if (repositories.Count > 0)
            {
                continue_button.GrabDefault ();
                continue_button.GrabFocus ();
            }
            else
            {
                back_button.GrabDefault ();
                back_button.GrabFocus ();
            }
        }
开发者ID:emrul,项目名称:CmisSync,代码行数:101,代码来源:Setup.cs

示例15: CreateEdit


//.........这里部分代码省略.........
            AsyncNodeLoader asyncLoader = new AsyncNodeLoader (root, credentials, PredefinedNodeLoader.LoadSubFolderDelegate, PredefinedNodeLoader.CheckSubFolderDelegate);
            asyncLoader.UpdateNodeEvent += delegate {
                cmisStore.UpdateCmisTree(root);
            };
            cmisStore.UpdateCmisTree (root);
            asyncLoader.Load (root);

            Header = CmisSync.Properties_Resources.EditTitle;

            VBox layout_vertical   = new VBox (false, 12);

            Controller.CloseWindowEvent += delegate
            {
                asyncLoader.Cancel();
            };

            Button cancel_button = new Button (CmisSync.Properties_Resources.Cancel);
            cancel_button.Clicked += delegate {
                Close();
            };

            Button finish_button = new Button (CmisSync.Properties_Resources.SaveChanges);
            finish_button.Clicked += delegate {
                Ignores = NodeModelUtils.GetIgnoredFolder(root);
                Controller.SaveFolder();
                Close();
            };

            Gtk.TreeIter iter;
            treeView.HeadersVisible = false;
            treeView.Selection.Mode = SelectionMode.Single;

            TreeViewColumn column = new TreeViewColumn ();
            column.Title = "Name";
            CellRendererToggle renderToggle = new CellRendererToggle ();
            column.PackStart (renderToggle, false);
            renderToggle.Activatable = true;
            column.AddAttribute (renderToggle, "active", (int)CmisTreeStore.Column.ColumnSelected);
            column.AddAttribute (renderToggle, "inconsistent", (int)CmisTreeStore.Column.ColumnSelectedThreeState);
            column.AddAttribute (renderToggle, "radio", (int)CmisTreeStore.Column.ColumnRoot);
            renderToggle.Toggled += delegate (object render, ToggledArgs args) {
                TreeIter iterToggled;
                if (! cmisStore.CmisStore.GetIterFromString (out iterToggled, args.Path))
                {
                    Console.WriteLine("Toggled GetIter Error " + args.Path);
                    return;
                }

                Node node = cmisStore.CmisStore.GetValue(iterToggled,(int)CmisTreeStore.Column.ColumnNode) as Node;
                if (node == null)
                {
                    Console.WriteLine("Toggled GetValue Error " + args.Path);
                    return;
                }

                if (node.Parent == null)
                {
                    node.Selected = true;
                }
                else
                {
                    if (node.Selected == false)
                    {
                        node.Selected = true;
                    }
                    else
                    {
                        node.Selected = false;
                    }
                }
                cmisStore.UpdateCmisTree(root);
            };
            CellRendererText renderText = new CellRendererText ();
            column.PackStart (renderText, false);
            column.SetAttributes (renderText, "text", (int)CmisTreeStore.Column.ColumnName);
            column.Expand = true;
            treeView.AppendColumn (column);

            treeView.AppendColumn ("Status", new StatusCellRenderer (), "text", (int)CmisTreeStore.Column.ColumnStatus);

            treeView.RowExpanded += delegate (object o, RowExpandedArgs args) {
                Node node = cmisStore.CmisStore.GetValue(args.Iter, (int)CmisTreeStore.Column.ColumnNode) as Node;
                asyncLoader.Load(node);
            };

            ScrolledWindow sw = new ScrolledWindow() {
                ShadowType = Gtk.ShadowType.In
            };
            sw.Add(treeView);

            layout_vertical.PackStart (new Label(""), false, false, 0);
            layout_vertical.PackStart (sw, true, true, 0);
            Add(layout_vertical);
            AddButton(cancel_button);
            AddButton(finish_button);

            finish_button.GrabDefault ();

            this.ShowAll();
        }
开发者ID:j2m2,项目名称:CmisSync,代码行数:101,代码来源:Edit.cs


注:本文中的Gtk.Button.GrabDefault方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。