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


C# Gtk.Attach方法代码示例

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


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

示例1: GenerateContent

        private void GenerateContent(ref Gtk.Table tableSystem, string label, int xPos, Condition cd,bool isResolution)
        {
            ListStore lstorePlatform = new ListStore(typeof(int),typeof(int),typeof(string));

            int selectRule = 0;
            if (conditionRules_Old.Count > 0) {
                ConditionRule cr = conditionRules_Old.Find(x => x.ConditionId == cd.Id);
                if (cr != null)
                    selectRule = cr.RuleId;
            }

            Label lblPlatform = new Label(label);
            lblPlatform.Name = "lbl_" + label;
            lblPlatform.Xalign = 1;
            lblPlatform.Yalign = 0.5F;

            ComboBox cboxPlatform = new ComboBox();
            cboxPlatform.Name = "cd_" + label;

            CellRendererText textRenderer = new CellRendererText();
            cboxPlatform.PackStart(textRenderer, true);
            cboxPlatform.AddAttribute(textRenderer, "text", 2);

            cboxPlatform.WidthRequest = 200;
            cboxPlatform.Model = lstorePlatform;
            cboxPlatform.Changed += delegate(object sender, EventArgs e) {

                    if (sender == null)
                        return;

                    ComboBox combo = sender as ComboBox;

                    TreeIter iter;
                    if (combo.GetActiveIter(out iter)) {
                        int ruleId = (int)combo.Model.GetValue(iter, 0);
                        int condId = (int)combo.Model.GetValue(iter, 1);
                            if (ruleId != 0){
                            ConditionRule cr = conditionRules.Find(x => x.ConditionId == condId);//cd.Id);
                            if (cr != null)
                                cr.RuleId = ruleId;
                            else
                                conditionRules.Add(new ConditionRule(condId,ruleId));
                        }
                        else {
                            ConditionRule cr = conditionRules.Find(x => x.ConditionId == condId);//cd.Id);
                            if (cr != null){
                                conditionRules.Remove(cr);
                            }
                        }
                    }

                };

            tableSystem.Attach(lblPlatform, 0, 1, (uint)(xPos - 1), (uint)xPos, AttachOptions.Shrink, AttachOptions.Shrink, 2, 2);
            tableSystem.Attach(cboxPlatform, 1, 2, (uint)(xPos - 1), (uint)xPos, AttachOptions.Shrink, AttachOptions.Shrink, 2, 2);

            TreeIter selectIter = lstorePlatform.AppendValues(0, cd.Id, "Unset");

            foreach (Rule rl in cd.Rules){

                if(!isResolution){

                    if (rl.Id == selectRule)
                        selectIter = lstorePlatform.AppendValues(rl.Id, cd.Id, rl.Name);
                    else
                        lstorePlatform.AppendValues(rl.Id, cd.Id, rl.Name);
                } else {
                    string name  = String.Format("{0} ({1}x{2})",rl.Name,rl.Width,rl.Height);
                    if (rl.Id == selectRule)
                        selectIter = lstorePlatform.AppendValues(rl.Id, cd.Id, name);
                    else
                        lstorePlatform.AppendValues(rl.Id, cd.Id, name);
                }
            }

            cboxPlatform.SetActiveIter(selectIter);
        }
开发者ID:moscrif,项目名称:ide,代码行数:77,代码来源:FileConditionsPanel.cs

示例2: AddRow

		// TODO: Centralize duplicated code
		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
		}
开发者ID:MichaelAquilina,项目名称:tomboy,代码行数:22,代码来源:WebDavSyncServiceAddin.cs

示例3: AttachChildren

		void AttachChildren (Gtk.Table table, uint row, uint col)
		{
			if (icon != null) {
				table.Attach (icon, col, col + 1, row, row + 1);
				Gtk.Table.TableChild tc = (Gtk.Table.TableChild) table [icon];
				if (!editing)
					tc.YPadding = itemSpacing;
			}
			if (label != null) {
				table.Attach (label, col + 1, col + 2, row, row + 1);
				Gtk.Table.TableChild tc = (Gtk.Table.TableChild) table [label];
				if (!editing)
					tc.YPadding = itemSpacing;
				label.GrabFocus ();
			}
			if (accel != null)
				table.Attach (accel, col + 2, col + 3, row, row + 1);

			if (minWidth > 0 && label != null) {
				if (label.SizeRequest().Width < minWidth)
					label.WidthRequest = minWidth;
			}
			
			bool sens = editing || node.Action == null || node.Action.GtkAction.Sensitive;
			if (icon != null)
				icon.Sensitive = sens;
			if (label != null)
				label.Sensitive = sens;
			if (accel != null)
				accel.Sensitive = sens;
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:31,代码来源:ActionMenuItem.cs

示例4: Attach

		public void Attach (Gtk.Table table, uint row, uint col)
		{
			table.Attach (this, col, col + 3, row, row + 1);
			Show ();
			AttachChildren (table, row, col);
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:6,代码来源:ActionMenuItem.cs

示例5: Rebuild

		private void Rebuild(Gtk.Table table, uint[][][] positions, GedcomIndividualRecord activePerson, GedcomFamilyLink[] lst)
		{
			foreach (Gtk.Widget child in table.Children)
			{
				child.Destroy();
			}
			table.Resize(1,1);
			
			uint xmax = 0;
			uint ymax = 0;
			
			for (int i = 0; i < positions.Length; i ++)
			{
				uint x = positions[i][0][0] + 1;
				uint y = positions[i][0][1] + 1;
				uint w = positions[i][0][2];
				uint h = positions[i][0][3];
				
				GedcomFamilyLink famLink = (GedcomFamilyLink)lst[i];
				if (famLink == null)
				{	
					PedigreeBox pw = new PedigreeBox(null, 0, null);
					
					if (i > 0 && lst[((i+1)/2)-1] != null)
					{
						GedcomFamilyLink missingFamLink = (GedcomFamilyLink)lst[((i+1)/2)-1];
						
						// missing parent button
						pw.ForceMouseOver = true;
					}
					// FIXME: both conditions do the same thing, double checking
					// the gramps code it doesn't appear to be a mistake in porting
					if (positions[i][0][2] > 1)
					{
						table.Attach(pw,x, x+w, y, y+h, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0);
					}
					else
					{
						table.Attach(pw,x, x+w, y, y+h, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0);
					}
					
					xmax = (uint)Math.Max(xmax, x + w);
					ymax = (uint)Math.Max(ymax, y + h);
				}
				else
				{
					GedcomIndividualRecord indi = (GedcomIndividualRecord)_database[famLink.Indi];
					
					if (_showImages && i < ((positions.Length - 1) / 2) && positions[i][0][3] > 1)
					{
						
					}
					
					PedigreeBox pw = new PedigreeBox(indi, positions[i][0][3], null);
					pw.SelectIndividual += PedigreeBox_SelectIndividual;
					
					if (positions[i][0][3] < 7)
					{
						pw.TooltipMarkup = pw.FormatPerson(11, true);
					}
					
					if (positions[i][0][2] > 1)
					{
						table.Attach(pw, x, x+w, y, y+h, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, 0);
					}
					else
					{
						table.Attach(pw, x, x+w, y, y+h, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0);
					}
					
					xmax = (uint)Math.Max(xmax, x + w);
					ymax = (uint)Math.Max(ymax, y + h);
				}
				
				// connection lines
				if (positions[i].Length > 1)
				{
					// separate boxes for father and mother
					x = positions[i][1][0] + 1;
					y = positions[i][1][1] + 1;
					w = 1;
					h = positions[i][1][2];
					
					Gtk.DrawingArea line = new Gtk.DrawingArea();
					line.ExposeEvent += Line_Expose;
					bool rela = false;
					if (famLink != null && (famLink.Pedigree == PedegreeLinkageType.Birth || famLink.Pedigree == PedegreeLinkageType.Unknown))
					{
						line.AddEvents((int)Gdk.EventMask.ButtonPressMask);
						rela = true;
					}
					Utility.Pair<int, bool> lineData = new Pair<int,bool>();
					lineData.First = i * 2 + 1;
					lineData.Second = rela;
					_lines[line] = lineData;
					
					table.Attach(line, x, x + w, y, y + h, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0);
					
					xmax = (uint)Math.Max(xmax, x + w);
					ymax = (uint)Math.Max(ymax, y + h);
//.........这里部分代码省略.........
开发者ID:Bert6623,项目名称:Gedcom.Net,代码行数:101,代码来源:PedigreeView.cs

示例6: populatePlayers

        private void populatePlayers(Gtk.Table table)
        {
            //combo.Clear();
            Gtk.RadioButton btn = null;
            Gtk.RadioButton firstbtn = null;
            Gtk.CheckButton aitoggle = null;

            uint row = 0;
            ArrayList players = Game.GetInstance().Players;
            foreach (Player player in players)
            {
            if (firstbtn == null)
            {
                firstbtn = new Gtk.RadioButton(null, player.Name);
                firstbtn.Active = false;
                btn = firstbtn;
            } else {
                btn = new Gtk.RadioButton(firstbtn, player.Name);
            }

            aitoggle = new Gtk.CheckButton("AI");
            Game.putObjectDataIn(aitoggle, player.Name);

            table.Attach(btn, 0, 1, row, row+1);
            table.Attach(aitoggle, 1, 2, row, row+1);

            ++row;
            btn.Toggled += on_Player_toggled;
            aitoggle.Toggled += on_AI_toggled;

            }
        }
开发者ID:jcjones,项目名称:Gpremacy,代码行数:32,代码来源:GameSetupView.cs


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