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


C# NSTableView.AddColumn方法代码示例

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


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

示例1: ShowPage


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

                if (TableView == null || TableView.RowCount != Controller.Plugins.Count) {
                    TableView = new NSTableView () {
                        Frame            = new RectangleF (0, 0, 0, 0),
                        RowHeight        = 34,
                        IntercellSpacing = new SizeF (8, 12),
                        HeaderView       = null,
                        Delegate         = new SparkleTableViewDelegate ()
                    };

                    ScrollView = new NSScrollView () {
                        Frame               = new RectangleF (190, Frame.Height - 280, 408, 185),
                        DocumentView        = TableView,
                        HasVerticalScroller = true,
                        BorderType          = NSBorderType.BezelBorder
                    };

                    IconColumn = new NSTableColumn () {
                        Width         = 36,
                        HeaderToolTip = "Icon",
                        DataCell      = new NSImageCell () { ImageAlignment = NSImageAlignment.Right }
                    };

                    DescriptionColumn = new NSTableColumn () {
                        Width         = 350,
                        HeaderToolTip = "Description",
                        Editable      = false
                    };

                    DescriptionColumn.DataCell.Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande",
                        NSFontTraitMask.Condensed, 0, 11);

                    TableView.AddColumn (IconColumn);
                    TableView.AddColumn (DescriptionColumn);

                    // Hi-res display support was added after Snow Leopard
                    if (Environment.OSVersion.Version.Major < 11)
                        DataSource = new SparkleDataSource (1, Controller.Plugins);
                    else
                        DataSource = new SparkleDataSource (BackingScaleFactor, Controller.Plugins);

                    TableView.DataSource = DataSource;
                    TableView.ReloadData ();
                    
                    (TableView.Delegate as SparkleTableViewDelegate).SelectionChanged += delegate {
                        Controller.SelectedPluginChanged (TableView.SelectedRow);
                        Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow);
                    };
                }
                
                TableView.SelectRow (Controller.SelectedPluginIndex, false);
                TableView.ScrollRowToVisible (Controller.SelectedPluginIndex);

                HistoryCheckButton = new NSButton () {
                    Frame = new RectangleF (190, Frame.Height - 400, 300, 18),
                    Title = "Fetch prior revisions"
                };

                if (Controller.FetchPriorHistory)
                    HistoryCheckButton.State = NSCellStateValue.On;

                HistoryCheckButton.SetButtonType (NSButtonType.Switch);

                AddButton = new NSButton () {
                    Title = "Add",
开发者ID:ramabhadrarao,项目名称:niiarshare,代码行数:67,代码来源:SparkleSetup.cs

示例2: ShowPage


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

                TableView = new NSTableView () {
                    Frame            = new RectangleF (0, 0, 0, 0),
                    RowHeight        = 34,
                    IntercellSpacing = new SizeF (8, 12),
                    HeaderView       = null,
                    Delegate         = new SparkleTableViewDelegate ()
                };

                ScrollView = new NSScrollView () {
                    Frame               = new RectangleF (190, Frame.Height - 280, 408, 185),
                    DocumentView        = TableView,
                    HasVerticalScroller = true,
                    BorderType          = NSBorderType.BezelBorder
                };

                IconColumn = new NSTableColumn (new NSImage ()) {
                    Width = 36,
                    HeaderToolTip = "Icon",
                    DataCell = new NSImageCell () {
                        ImageAlignment = NSImageAlignment.Right
                    }
                };

                DescriptionColumn = new NSTableColumn () {
                    Width         = 350,
                    HeaderToolTip = "Description",
                    Editable      = false
                };

                DescriptionColumn.DataCell.Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande",
                    NSFontTraitMask.Condensed, 0, 11);

                TableView.AddColumn (IconColumn);
                TableView.AddColumn (DescriptionColumn);

                DataSource = new SparkleDataSource (Controller.Plugins);

                TableView.DataSource = DataSource;
                TableView.ReloadData ();

                HistoryCheckButton = new NSButton () {
                    Frame = new RectangleF (190, Frame.Height - 400, 300, 18),
                    Title = "Fetch prior revisions"
                };

                if (Controller.FetchPriorHistory)
                    HistoryCheckButton.State = NSCellStateValue.On;

                HistoryCheckButton.SetButtonType (NSButtonType.Switch);

                AddButton = new NSButton () {
                    Title = "Add",
                    Enabled = false
                };

                CancelButton = new NSButton () {
                    Title = "Cancel"
                };

                Controller.ChangeAddressFieldEvent += delegate (string text,
                    string example_text, FieldState state) {

                    InvokeOnMainThread (delegate {
                        AddressTextField.StringValue = text;
                        AddressTextField.Enabled     = (state == FieldState.Enabled);
开发者ID:mvaello,项目名称:SparkleShare,代码行数:67,代码来源:SparkleSetup.cs

示例3: SparkleSetup


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

                        TableView = new NSTableView () {
                            Frame            = new RectangleF (0, 0, 0, 0),
                            RowHeight        = 30,
                            IntercellSpacing = new SizeF (0, 12),
                            HeaderView       = null,
                            Delegate         = new SparkleTableViewDelegate ()
                        };

                        ScrollView = new NSScrollView () {
                            Frame               = new RectangleF (190, Frame.Height - 280, 408, 175),
                            DocumentView        = TableView,
                            HasVerticalScroller = true,
                            BorderType          = NSBorderType.BezelBorder
                        };

                        IconColumn = new NSTableColumn (new NSImage ()) {
                            Width = 42,
                            HeaderToolTip = "Icon",
                            DataCell = new NSImageCell ()
                        };

                        DescriptionColumn = new NSTableColumn () {
                            Width         = 350,
                            HeaderToolTip = "Description",
                            Editable      = false
                        };

                        DescriptionColumn.DataCell.Font =
                            NSFontManager.SharedFontManager.FontWithFamily (
                                "Lucida Grande", NSFontTraitMask.Condensed, 0, 11);

                        TableView.AddColumn (IconColumn);
                        TableView.AddColumn (DescriptionColumn);

                        DataSource = new SparkleDataSource ();

                        foreach (SparklePlugin plugin in Controller.Plugins)
                            DataSource.Items.Add (plugin);

                        TableView.DataSource = DataSource;
                        TableView.ReloadData ();

                        Controller.ChangeAddressFieldEvent += delegate (string text,
                            string example_text, FieldState state) {

                            InvokeOnMainThread (delegate {
                                AddressTextField.StringValue = text;
                                AddressTextField.Enabled     = (state == FieldState.Enabled);
                            });
                        };

                        Controller.ChangePathFieldEvent += delegate (string text,
                            string example_text, FieldState state) {

                            InvokeOnMainThread (delegate {
                                PathTextField.StringValue = text;
                                PathTextField.Enabled     = (state == FieldState.Enabled);

                                if (!string.IsNullOrEmpty (example_text))
                                    PathHelpLabel.StringValue = "e.g. " + example_text;
                            });
                        };

                        TableView.SelectRow (Controller.SelectedPluginIndex, false);
开发者ID:monreal,项目名称:SparkleShare,代码行数:67,代码来源:SparkleSetup.cs

示例4: SparkleSetup


//.........这里部分代码省略.........
                            TableView = new NSTableView () {
                                Frame            = new RectangleF (0, 0, 0, 0),
                                RowHeight        = 34,
                                IntercellSpacing = new SizeF (8, 12),
                                HeaderView       = null,
                                Delegate         = new SparkleTableViewDelegate ()
                            };

                            ScrollView = new NSScrollView () {
                                Frame               = new RectangleF (190, Frame.Height - 280, 408, 175),
                                DocumentView        = TableView,
                                HasVerticalScroller = true,
                                BorderType          = NSBorderType.BezelBorder
                            };

                            IconColumn = new NSTableColumn (new NSImage ()) {
                                Width = 36,
                                HeaderToolTip = "Icon",
                                DataCell = new NSImageCell () {
                                    ImageAlignment = NSImageAlignment.Right
                                }
                            };

                            DescriptionColumn = new NSTableColumn () {
                                Width         = 350,
                                HeaderToolTip = "Description",
                                Editable      = false
                            };

                            DescriptionColumn.DataCell.Font =
                                NSFontManager.SharedFontManager.FontWithFamily (
                                    "Lucida Grande", NSFontTraitMask.Condensed, 0, 11);

                            TableView.AddColumn (IconColumn);
                            TableView.AddColumn (DescriptionColumn);

                            DataSource = new SparkleDataSource (Controller.Plugins);

                            TableView.DataSource = DataSource;
                            TableView.ReloadData ();

                            HistoryCheckButton = new NSButton () {
                                Frame = new RectangleF (190, Frame.Height - 400, 300, 18),
                                Title = "Fetch prior revisions"
                            };

                            if (Controller.FetchPriorHistory)
                                HistoryCheckButton.State = NSCellStateValue.On;

                            HistoryCheckButton.SetButtonType (NSButtonType.Switch);

                            HistoryCheckButton.Activated += delegate {
                                Controller.HistoryItemChanged (HistoryCheckButton.State == NSCellStateValue.On);
                            };

                            ContentView.AddSubview (HistoryCheckButton);

                            Controller.ChangeAddressFieldEvent += delegate (string text,
                                string example_text, FieldState state) {

                                InvokeOnMainThread (delegate {
                                    AddressTextField.StringValue = text;
                                    AddressTextField.Enabled     = (state == FieldState.Enabled);
                                    AddressHelpLabel.StringValue = example_text;
                                });
                            };
开发者ID:hanssey,项目名称:SparkleShare,代码行数:67,代码来源:SparkleSetup.cs

示例5: Initialize

		// Shared initialization code
		void Initialize ()
		{
			//window = new NSWindow(new RectangleF(0,0, 470, 250), NSWindowStyle.Titled | NSWindowStyle.Closable, NSBackingStore.Buffered, false);
			window = new NSWindow(new RectangleF(0,0, 470, 250), NSWindowStyle.Titled, NSBackingStore.Buffered, false);
			window.HasShadow = true;
			NSView content = window.ContentView;
			window.WindowController = this;
			window.Title = "Sign In";
			NSTextField signInLabel = new NSTextField(new RectangleF(17, 190, 109, 17));
			signInLabel.StringValue = "Sign In:";
			signInLabel.Editable = false;
			signInLabel.Bordered = false;
			signInLabel.BackgroundColor = NSColor.Control;
			
			content.AddSubview(signInLabel);
			
			// Create our select button
			selectButton = new NSButton(new RectangleF(358,12,96,32));
			selectButton.Title = "Select";
			selectButton.SetButtonType(NSButtonType.MomentaryPushIn);
			selectButton.BezelStyle = NSBezelStyle.Rounded;
			
			selectButton.Activated += delegate {
				
				profileSelected();
			};
			
			selectButton.Enabled = false;
			
			content.AddSubview(selectButton);
			
			// Setup our table view
			NSScrollView tableContainer = new NSScrollView(new RectangleF(20,60,428, 123));
			tableContainer.BorderType = NSBorderType.BezelBorder;
			tableContainer.AutohidesScrollers = true;
			tableContainer.HasVerticalScroller = true;
			
			tableView = new NSTableView(new RectangleF(0,0,420, 123));
			tableView.UsesAlternatingRowBackgroundColors = true;
			
			NSTableColumn colGamerTag = new NSTableColumn("Gamer");
			tableView.AddColumn(colGamerTag);
			
			colGamerTag.Width = 420;
			colGamerTag.HeaderCell.Title = "Gamer Profile";
			tableContainer.DocumentView = tableView;
			
			content.AddSubview(tableContainer);
			
			// Create our add button
			NSButton addButton = new NSButton(new RectangleF(20,27,25,25));
			//Console.WriteLine(NSImage.AddTemplate);
			addButton.Image = NSImage.ImageNamed("NSAddTemplate");
			addButton.SetButtonType(NSButtonType.MomentaryPushIn);
			addButton.BezelStyle = NSBezelStyle.SmallSquare;
			
			addButton.Activated += delegate {
				addLocalPlayer();
			};
			content.AddSubview(addButton);
			
			// Create our remove button
			NSButton removeButton = new NSButton(new RectangleF(44,27,25,25));
			removeButton.Image = NSImage.ImageNamed("NSRemoveTemplate");
			removeButton.SetButtonType(NSButtonType.MomentaryPushIn);
			removeButton.BezelStyle = NSBezelStyle.SmallSquare;
			
			removeButton.Activated += delegate {
				removeLocalPlayer();
			};
			content.AddSubview(removeButton);			
			
			gamerList = MonoGameGamerServicesHelper.DeserializeProfiles();
			
//			for (int x= 1; x< 25; x++) {
//				gamerList.Add("Player " + x);
//			}
			tableView.DataSource = new GamersDataSource(this);
			tableView.Delegate = new GamersTableDelegate(this);
		}
开发者ID:Boerlam001,项目名称:MonoGame,代码行数:81,代码来源:SigninController.cs

示例6: SelectEncodingPanel


//.........这里部分代码省略.........
			var labelSize = label.Frame.Size;
			float labelBottom = size.Height - 12 - labelSize.Height;
			label.Frame = new RectangleF (12, labelBottom, labelSize.Width, labelSize.Height);
			view.AddSubview (label);
			
			var moveButtonWidth = 32;
			var tableHeight = labelBottom - buttonAreaTop - padding;
			var tableWidth = size.Width / 2 - padding * 3 - moveButtonWidth + padding / 2;
			
			allTable = new NSTableView (new RectangleF (padding, buttonAreaTop, tableWidth, tableHeight));
			allTable.HeaderView = null;
			var allScroll = new NSScrollView (allTable.Frame) {
				BorderType = NSBorderType.BezelBorder,
				AutohidesScrollers = true,
				HasVerticalScroller = true,
				DocumentView = allTable,
			};
			view.AddSubview (allScroll);
			
			float center = (size.Width + padding) / 2;
			
			var selectedLabel = CreateLabel (GettextCatalog.GetString ("Encodings shown in menu:"));
			var selectedLabelSize = selectedLabel.Frame.Size;
			selectedLabel.Frame = new RectangleF (center, labelBottom, selectedLabelSize.Width, selectedLabelSize.Height);
			view.AddSubview (selectedLabel);
			
			selectedTable = new NSTableView (new RectangleF (center, buttonAreaTop, tableWidth, tableHeight));
			selectedTable.HeaderView = null;
			var selectedScroll = new NSScrollView (selectedTable.Frame) {
				BorderType = NSBorderType.BezelBorder,
				AutohidesScrollers = true,
				HasVerticalScroller = true,
				DocumentView = selectedTable,
			};
			view.AddSubview (selectedScroll);
			
			float buttonLevel = tableHeight / 2 + buttonAreaTop;
			
			var goRightImage = NSImage.ImageNamed ("NSGoRightTemplate");
			
			addButton = new NSButton (
				new RectangleF (tableWidth + padding * 2, buttonLevel + padding / 2,
					moveButtonWidth, moveButtonWidth)) {
				//Title = "\u2192",
				BezelStyle = NSBezelStyle.SmallSquare,
				Image = goRightImage
			};
			addButton.Activated += Add;
			view.AddSubview (addButton);
			
			removeButton = new NSButton (
				new RectangleF (tableWidth + padding * 2, buttonLevel - padding / 2 - moveButtonWidth,
					moveButtonWidth, moveButtonWidth)) {
				//Title = "\u2190",
				BezelStyle = NSBezelStyle.SmallSquare,
				Image = NSImage.ImageNamed ("NSGoLeftTemplate"),
			};
			removeButton.Activated += Remove;
			view.AddSubview (removeButton);
			
			upButton = new NSButton (
				new RectangleF (center + tableWidth + padding, buttonLevel + padding / 2,
					moveButtonWidth, moveButtonWidth)) {
				//Title = "\u2191",
				BezelStyle = NSBezelStyle.SmallSquare,
				Image = MakeRotatedCopy (goRightImage, 90),
			};
			upButton.Activated += MoveUp;
			view.AddSubview (upButton);
			
			downButton = new NSButton (
				new RectangleF (center + tableWidth + padding, buttonLevel - padding / 2 - moveButtonWidth,
					moveButtonWidth, moveButtonWidth)) {
				//Title = "\u2193",
				BezelStyle = NSBezelStyle.SmallSquare,
				Image = MakeRotatedCopy (goRightImage, -90),
			};
			downButton.Activated += MoveDown;
			view.AddSubview (downButton);
			
			var allColumn = new NSTableColumn () {
				DataCell = new NSTextFieldCell () { Wraps = true },
				Width = tableWidth
			};
			allTable.AddColumn (allColumn);
			allTable.DataSource = allSource = new EncodingSource (TextEncoding.SupportedEncodings);
			allTable.Delegate = new EncodingAllDelegate (this);
			
			var selectedColumn = new NSTableColumn () {
				DataCell = new NSTextFieldCell () { Wraps = true },
				Width = tableWidth
			};
			selectedTable.AddColumn (selectedColumn);
			selectedTable.DataSource = selectedSource = new EncodingSource (TextEncoding.ConversionEncodings);
			selectedTable.Delegate = new EncodingSelectedDelegate (this);
			
			UpdateButtons ();
			
			this.ContentView = view;
		}
开发者ID:Tak,项目名称:monodevelop-novell,代码行数:101,代码来源:SelectEncodingPanel.cs

示例7: ShowPage


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

                if (TableView == null || TableView.RowCount != Controller.Presets.Count) {
                    TableView = new NSTableView () {
                        Frame            = new RectangleF (0, 0, 0, 0),
                        RowHeight        = 38,
                        IntercellSpacing = new SizeF (8, 12),
                        HeaderView       = null,
                        Delegate         = new SparkleTableViewDelegate ()
                    };

                    ScrollView = new NSScrollView () {
                        Frame               = new RectangleF (190, Frame.Height - 280, 408, 185),
                        DocumentView        = TableView,
                        HasVerticalScroller = true,
                        BorderType          = NSBorderType.BezelBorder
                    };

                    IconColumn = new NSTableColumn () {
                        Width         = 36,
                        HeaderToolTip = "Icon",
                        DataCell      = new NSImageCell () { ImageAlignment = NSImageAlignment.Right }
                    };

                    DescriptionColumn = new NSTableColumn () {
                        Width         = 350,
                        HeaderToolTip = "Description",
                        Editable      = false
                    };

                    DescriptionColumn.DataCell.Font = NSFontManager.SharedFontManager.FontWithFamily (
                        UserInterface.FontName, NSFontTraitMask.Condensed, 0, 11);

                    TableView.AddColumn (IconColumn);
                    TableView.AddColumn (DescriptionColumn);

                    // Hi-res display support was added after Snow Leopard
                    if (Environment.OSVersion.Version.Major < 11)
                        DataSource = new SparkleDataSource (1, Controller.Presets);
                    else
                        DataSource = new SparkleDataSource (BackingScaleFactor, Controller.Presets);

                    TableView.DataSource = DataSource;
                    TableView.ReloadData ();
                    
                    (TableView.Delegate as SparkleTableViewDelegate).SelectionChanged += delegate {
                        Controller.SelectedPresetChanged (TableView.SelectedRow);
                        Controller.CheckAddPage (AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow);
                    };
                }
                
                TableView.SelectRow (Controller.SelectedPresetIndex, false);
                TableView.ScrollRowToVisible (Controller.SelectedPresetIndex);
                MakeFirstResponder ((NSResponder) TableView);

                HistoryCheckButton = new NSButton () {
                    Frame = new RectangleF (190, Frame.Height - 400, 300, 18),
                    Title = "Fetch prior revisions"
                };

                if (Controller.FetchPriorHistory)
                    HistoryCheckButton.State = NSCellStateValue.On;

                HistoryCheckButton.SetButtonType (NSButtonType.Switch);

                AddButton = new NSButton () {
开发者ID:Rud5G,项目名称:SparkleShare,代码行数:67,代码来源:Setup.cs

示例8: ViewDidLoad

		public override void ViewDidLoad()
		{
			base.ViewDidLoad();

			var tableView = new NSTableView(new RectangleF(10, 400, 300, 300).Upside());
			Add(tableView);

			var column = new MvxTableColumn ();
			column.Identifier = "First";
			column.BindingText = "Text .";
			column.HeaderCell = new NSCell ("Example");
			tableView.AddColumn (column);

			var source = new MvxTableViewSource (tableView);
			tableView.Source = source;

			var add = new NSButton();
			add.Title = "+";
			add.Frame = new RectangleF(10, 100, 140, 30).Upside();
			Add(add);

			var remove = new NSButton();
			remove.Title = "-";
			remove.Frame = new RectangleF(170, 100, 140, 30).Upside();
			Add(remove);

			var set = this.CreateBindingSet<ListView, ListViewModel>();
			set.Bind(source).For(v => v.ItemsSource).To(vm => vm.Items);
			set.Bind(add).To(vm => vm.AddCommand);
			set.Bind(remove).To(vm => vm.RemoveCommand);
			set.Apply();
		}
开发者ID:Dexyon,项目名称:MvvmCross-Samples,代码行数:32,代码来源:Views.cs

示例9: SetTableColumns

        private void SetTableColumns(NSTableView tableView)
        {
            // Always keep at least one column
            int numColumns = (int) (tableView.EnclosingScrollView.Frame.Width / maxColumnWidth);
            if (numColumns < 1)
            {
                numColumns = 1;
            }

            int existingColumnCount = tableView.TableColumns().Count();
            if (numColumns > existingColumnCount)
            {
                logger.Info("Add columns; {0} to {1}", existingColumnCount, numColumns);
                while (tableView.TableColumns().Count() < numColumns)
                {
                    var copy =  new NSTableColumn();
                    copy.Width = copy.MaxWidth = maxColumnWidth;

                    NSTableColumn column = tableView.TableColumns().First();
                    copy.DataCell = (NSCell) column.DataCell.Copy();
                    tableView.AddColumn(copy);
                }
                tableView.ReloadData();
            }
            else
            if (numColumns < existingColumnCount)
            {
                logger.Info("Remove columns; {0} to {1}", existingColumnCount, numColumns);
                while (tableView.TableColumns().Count() > numColumns)
                {
                    tableView.RemoveColumn(tableView.TableColumns().Last());
                }
                tableView.ReloadData();
            }
        }
开发者ID:kevintavog,项目名称:MapThis,代码行数:35,代码来源:TableDelegate.cs


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