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


C# Menu.AttachToWidget方法代码示例

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


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

示例1: MakeMenu

		private Gtk.Menu MakeMenu (Gtk.Widget parent) 
		{
			Gtk.Menu menu = new Gtk.Menu ();
			menu.AttachToWidget (parent, new Gtk.MenuDetachFunc (DetachWidget));
			
			Gtk.ImageMenuItem item;
						
			// Quick Search menu items
			if (recent_searches.Count == 0) {
				item = new Gtk.ImageMenuItem (Catalog.GetString ("No Recent Searches"));
				item.Sensitive = false;
				menu.Append (item);
				menu_to_query_map = null;
			} else {
				item = new Gtk.ImageMenuItem (Catalog.GetString ("Recent Searches"));
				item.Sensitive = false;
				item.Image = new Gtk.Image (Stock.Find, IconSize.Menu);
				menu.Append (item);

				menu_to_query_map = new Hashtable ();

				foreach (string s in recent_searches) {
					// Replace all occurences of '_' with "__"
					// so that underscores don't become mnemonics.
					string query = s.Replace ("_", "__");

					item = new Gtk.ImageMenuItem (query);
					item.Activated += new EventHandler (OnSearch);
					menu.Append (item);
					menu_to_query_map [item] = s;
				}
			}			

			if (recent_searches.Count > 0) {
				item = new Gtk.ImageMenuItem (Catalog.GetString ("Clear"));
				item.Image = new Gtk.Image (Gtk.Stock.Clear, Gtk.IconSize.Menu);
				item.Activated += new EventHandler (OnClear);
				menu.Append (item);
			}

			menu.Append (new Gtk.SeparatorMenuItem ());			
		
			item = new Gtk.ImageMenuItem (Catalog.GetString ("Quit"));
			item.Image = new Gtk.Image (Gtk.Stock.Quit, Gtk.IconSize.Menu);
			item.Activated += new EventHandler (OnQuit);
			menu.Append (item);
			
			menu.ShowAll ();
			return menu;
		}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:50,代码来源:TrayIcon.cs

示例2: FileMaskEntry

        //(string name, bool isFolder) : base (false, 6)
        public FileMaskEntry(List<string> mask, object parent,Gtk.Window parentWindow)
            : base(false, 6)
        {
            windowParent =parentWindow;

            text = new Entry ();
            this.parent= parent;
            browse = Button.NewWithMnemonic (MainClass.Languages.Translate("browse"));

            text.Changed += new EventHandler (OnTextChanged);
            browse.Clicked += new EventHandler (OnButtonClicked);

            PackStart (text, true, true, 0);

            PackEnd (browse, false, false, 0);

            Gdk.Pixbuf default_pixbuf = null;
            string file = System.IO.Path.Combine(MainClass.Paths.ResDir, "stock-menu.png");

            popupCondition = new Gtk.Menu();

            if (System.IO.File.Exists(file)) {
                default_pixbuf = new Gdk.Pixbuf(file);

                Gtk.Button btnClose = new Gtk.Button(new Gtk.Image(default_pixbuf));
                btnClose.TooltipText = MainClass.Languages.Translate("insert_path_mask");
                btnClose.Relief = Gtk.ReliefStyle.None;
                btnClose.CanFocus = false;
                btnClose.WidthRequest = btnClose.HeightRequest = 22;

                popupCondition.AttachToWidget(btnClose,new Gtk.MenuDetachFunc(DetachWidget));

                btnClose.Clicked += delegate {
                    popupCondition.Popup(null,null, new Gtk.MenuPositionFunc (GetPosition) ,3,Gtk.Global.CurrentEventTime);
                };
                PackEnd (btnClose, false, false, 0);
            }

            if (mask != null)
                foreach (string cd in mask) {

                    AddMenuItem(cd);
                }
            popupCondition.ShowAll();

            this.ShowAll();
        }
开发者ID:moscrif,项目名称:ide,代码行数:48,代码来源:FileMaskEntry.cs

示例3: TemplatesTreeViewButtonPressed

		void TemplatesTreeViewButtonPressed (object o, ButtonPressEventArgs args)
		{
			SolutionTemplate template = GetSelectedTemplate ();
			if ((template == null) || (template.AvailableLanguages.Count <= 1)) {
				return;
			}

			if (templateTextRenderer.IsLanguageButtonPressed (args.Event)) {
				if (popupMenu == null) {
					popupMenu = new Menu ();
					popupMenu.AttachToWidget (this, null);
				}
				ClearPopupMenuItems ();
				AddLanguageMenuItems (popupMenu, template);
				popupMenu.ModifyBg (StateType.Normal, GtkTemplateCellRenderer.LanguageButtonBackgroundColor);
				popupMenu.ShowAll ();

				MenuPositionFunc posFunc = (Menu m, out int x, out int y, out bool pushIn) => {
					Gdk.Rectangle rect = templateTextRenderer.GetLanguageRect ();
					Gdk.Rectangle screenRect = GtkUtil.ToScreenCoordinates (templatesTreeView, templatesTreeView.GdkWindow, rect);
					x = screenRect.X;
					y = screenRect.Bottom;
					pushIn = false;
				};
				popupMenu.Popup (null, null, posFunc, 0, args.Event.Time);
			}
		}
开发者ID:gAdrev,项目名称:monodevelop,代码行数:27,代码来源:GtkNewProjectDialogBackend.cs

示例4: MakeMenu

		private Gtk.Menu MakeMenu (Gtk.Widget parent) 
		{
			Gtk.Menu menu = new Gtk.Menu ();
			menu.AttachToWidget (parent, new Gtk.MenuDetachFunc (DetachWidget));
			
			Gtk.ImageMenuItem item;
						
			// Quick Search menu items
			ArrayList list = win.RetriveSearches ();
			if (list == null || list.Count == 0 ) {
				item = new Gtk.ImageMenuItem (Catalog.GetString ("No Recent Searches"));
				item.Sensitive = false;
				menu.Append (item);
				menu_to_query_map = null;
			} else {
				item = new Gtk.ImageMenuItem (Catalog.GetString ("Recent Searches"));
				item.Sensitive = false;
				item.Image = new Gtk.Image (Images.GetPixbuf ("icon-search.png"));
				menu.Append (item);

				menu_to_query_map = new Hashtable ();

				foreach (string s in list) {
					item = new Gtk.ImageMenuItem (s);
					item.Activated += new EventHandler (QuickSearchEvent);
					menu.Append (item);
					menu_to_query_map [item] = s;
				}
			}			

			if (list != null && list.Count > 0) {
				item = new Gtk.ImageMenuItem (Catalog.GetString ("Clear"));
				item.Image = new Gtk.Image (Gtk.Stock.Clear, Gtk.IconSize.Menu);
				item.Activated += new EventHandler (ClearEvent);
				menu.Append (item);
			}

			menu.Append (new Gtk.SeparatorMenuItem ());			
		
			item = new Gtk.ImageMenuItem (Catalog.GetString ("Quit"));
			item.Image = new Gtk.Image (Gtk.Stock.Quit, Gtk.IconSize.Menu);
			item.Activated += new EventHandler (QuitEvent);
			menu.Append (item);
			
			menu.ShowAll ();
			return menu;
		}	
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:47,代码来源:BestTray.cs

示例5: ReloadPanel

        public void ReloadPanel()
        {
            popupCondition = new Gtk.Menu();
            popupCondition.AttachToWidget(btnPopUp,new Gtk.MenuDetachFunc(DetachWidget));

            AddMenuItem(MainClass.Settings.Platform.Name);
            AddMenuItem(MainClass.Settings.Resolution.Name);

            if (project.ConditoinsDefine != null){
                foreach (Condition cd in project.ConditoinsDefine) {

                    AddMenuItem(cd.Name);
                }
            }

            popupCondition.ShowAll();
        }
开发者ID:moscrif,项目名称:ide,代码行数:17,代码来源:GeneralPanel.cs

示例6: ShowContextMenu

        /// <summary>Shows a context menu.</summary>
        /// <param name='menu'>The menu.</param>
        /// <param name='parent'>The parent widget.</param>
        /// <param name='evt'>The mouse event. May be null if triggered by keyboard.</param>
        /// <param name='caret'>The caret/selection position within the parent, if the EventButton is null.</param>
        public static void ShowContextMenu(Menu menu, Widget parent, Gdk.EventButton evt, Gdk.Rectangle caret)
        {
            MenuPositionFunc posFunc = null;

            if (parent != null) {
                menu.AttachToWidget (parent, null);
                menu.Hidden += (sender, e) => {
                    if (menu.AttachWidget != null)
                        menu.Detach ();
                };
                posFunc = delegate (Menu m, out int x, out int y, out bool pushIn) {
                    Gdk.Window window = evt != null? evt.Window : parent.GdkWindow;
                    window.GetOrigin (out x, out y);
                    var alloc = parent.Allocation;
                    if (evt != null) {
                        x += (int) evt.X;
                        y += (int) evt.Y;
                    } else if (caret.X >= alloc.X && caret.Y >= alloc.Y) {
                        x += caret.X;
                        y += caret.Y + caret.Height;
                    } else {
                        x += alloc.X;
                        y += alloc.Y;
                    }
                    Requisition request = m.SizeRequest ();
                    var screen = parent.Screen;
                    Gdk.Rectangle geometry = screen.GetMonitorGeometry(screen.GetMonitorAtPoint (x, y));

                    //whether to push or flip menus that would extend offscreen
                    //FIXME: this is the correct behaviour for mac, check other platforms
                    bool flip_left = true;
                    bool flip_up   = false;

                    if (x + request.Width > geometry.X + geometry.Width) {
                        if (flip_left) {
                            x -= request.Width;
                        } else {
                            x = geometry.X + geometry.Width - request.Width;
                        }

                        if (x < geometry.Left)
                            x = geometry.Left;
                    }

                    if (y + request.Height > geometry.Y + geometry.Height) {
                        if (flip_up) {
                            y -= request.Height;
                        } else {
                            y = geometry.Y + geometry.Height - request.Height;
                        }

                        if (y < geometry.Top)
                            y = geometry.Top;
                    }

                    pushIn = false;
                };
            }

            uint time;
            uint button;

            if (evt == null) {
                time = Global.CurrentEventTime;
                button = 0;
            } else {
                time = evt.Time;
                button = evt.Button;
            }

            //HACK: work around GTK menu issues on mac when passing button to menu.Popup
            //some menus appear and immediately hide, and submenus don't activate
            //            if (Platform.IsMac) {
            //                button = 0;
            //            }

            menu.Popup (null, null, posFunc, button, time);
        }
开发者ID:28427328,项目名称:SQCharts,代码行数:83,代码来源:GtkWorkarounds.cs

示例7: BuildMenu

        private void BuildMenu()
        {
            list.Clear ();
            if (optionMenu.Menu != null)
            optionMenu.Menu.Destroy ();
            currentMenu = new Menu ();
            currentMenu.AttachToWidget (trayIcon, null);

            Menu menu = new Menu ();
            string[] files = Directory.GetFiles (didiwikidir);
            for (int i = 0; i < files.Length ; i++)
            {
            string file = files[i];
            if (!file.EndsWith (".css"))
            {
            string fname = System.IO.Path.GetFileName (file);
            MenuItem item = new MenuItem (fname);
            item.Data["File"] = fname;
            item.Data["Position"] = i;

            ImageMenuItem trayMenuItem = new ImageMenuItem (fname);
            Image img = new Image ();
            img.Pixbuf = new Gdk.Pixbuf (null, "page.png");
            img.IconSize = (int)IconSize.Menu;
            trayMenuItem.Image = img;

            trayMenuItem.Activated += ItemActivated;
            trayMenuItem.Data ["File"] = fname;
            trayMenuItem.Data ["Position"] = i;

            menu.Append (item);
            currentMenu.Append (trayMenuItem);
            list.Add (fname);
            }
            }

            currentMenu.Append (new SeparatorMenuItem ());
            ImageMenuItem closeItem = new ImageMenuItem ("_Quit");
            closeItem.Image = new Image (Gtk.Stock.Quit, Gtk.IconSize.Menu);
            closeItem.Activated += Quit;
            currentMenu.Append (closeItem);
            optionMenu.Menu = menu;
            menu.ShowAll ();
        }
开发者ID:BackupTheBerlios,项目名称:mspace-svn,代码行数:44,代码来源:WebViewer.cs

示例8: DockPopupMenu

        public void DockPopupMenu(uint button, uint time)
        {
            if (menu == null) {
                // Create popup menu and attach it to the dock item
                menu = new Menu ();
                menu.AttachToWidget (this, new MenuDetachFunc (DetachMenu));

                // Hide menuitem
                MenuItem mitem = new MenuItem ("Hide");
                mitem.Activated += new EventHandler (ItemHideCb);
                menu.Append (mitem);

                // Lock menuitem
                CheckMenuItem citem = new CheckMenuItem ("Lock");
                citem.Active = this.Locked;
                citem.Toggled += new EventHandler (ItemLockCb);
                menu.Append (citem);
            }

            menu.ShowAll ();
            menu.Popup (null, null, null, button, time);
        }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:22,代码来源:DockItem.cs

示例9: SplashScreenForm

        public SplashScreenForm(bool showSetting)
            : base(Gtk.WindowType.Toplevel)
        {
            Console.WriteLine("splash.bild.start-{0}",DateTime.Now);
            waitingSplash =showSetting;

            AppPaintable = true;
            this.Decorated = false;
            this.WindowPosition = WindowPosition.Center;
            this.TypeHint = Gdk.WindowTypeHint.Splashscreen;
            try {
                bitmap = new Gdk.Pixbuf(System.IO.Path.Combine( MainClass.Paths.ResDir, "moscrif.png"));
            } catch (Exception ex) {
                Tool.Logger.Error(ex.Message);
                Tool.Logger.Error("Can't load splash screen pixbuf 'moscrif.png'.");
            }
            progress = new ProgressBar();
            progress.Fraction = 0.00;
            progress.HeightRequest = 6;

            vbox = new VBox();
            vbox.BorderWidth = 12;
            label = new Gtk.Label();
            label.UseMarkup = true;
            label.Xalign = 0;
            //vbox.PackEnd(progress, false, true, 0);

            if(showSetting){

                Table table= new Table(3,3,false);

                Label lbl1 = new Label("Color Scheme :");
                Label lbl2 = new Label("Keybinding :");

                table.Attach(lbl1,0,1,0,1,AttachOptions.Shrink,AttachOptions.Shrink,0,0);
                table.Attach(lbl2,0,1,1,2,AttachOptions.Shrink,AttachOptions.Shrink,0,0);

                cbBackground = new ColorButton();
                table.Attach(cbBackground,1,2,0,1,AttachOptions.Fill,AttachOptions.Shrink,0,0);

                cbKeyBinding = Gtk.ComboBox.NewText ();//new ComboBox();
                cbKeyBinding.Name="cbKeyBinding";

                if(MainClass.Settings.BackgroundColor==null){
                    MainClass.Settings.BackgroundColor = new Moscrif.IDE.Option.Settings.BackgroundColors(218,218,218);
                    /*if(MainClass.Platform.IsMac)
                        MainClass.Settings.BackgroundColor = new Moscrif.IDE.Settings.Settings.BackgroundColors(218,218,218);
                    else
                        MainClass.Settings.BackgroundColor = new Moscrif.IDE.Settings.Settings.BackgroundColors(224,41,47);
                        */
                }

                cbKeyBinding.AppendText(WIN);
                cbKeyBinding.AppendText(MACOSX);
                cbKeyBinding.AppendText(JAVA);
                cbKeyBinding.AppendText(VisualC);

                if(MainClass.Platform.IsMac){
                    cbKeyBinding.Active = 1;
                } else {
                    cbKeyBinding.Active = 0;
                }

                Gdk.Pixbuf default_pixbuf = null;
                string file = System.IO.Path.Combine(MainClass.Paths.ResDir, "stock-menu.png");
                //if (System.IO.File.Exists(file)) {

                    try {
                        default_pixbuf = new Gdk.Pixbuf(file);
                    } catch (Exception ex) {
                        Tool.Logger.Error(ex.Message);
                    }

                    popupColor = new Gtk.Menu();
                    CreateMenu();

                    Gtk.Button btnClose = new Gtk.Button(new Gtk.Image(default_pixbuf));
                    btnClose.TooltipText = MainClass.Languages.Translate("select_color");
                    btnClose.Relief = Gtk.ReliefStyle.None;
                    btnClose.CanFocus = false;
                    btnClose.WidthRequest = btnClose.HeightRequest = 22;

                    popupColor.AttachToWidget(btnClose,new Gtk.MenuDetachFunc(DetachWidget));
                    btnClose.Clicked += delegate {
                        popupColor.Popup(null,null, new Gtk.MenuPositionFunc (GetPosition) ,3,Gtk.Global.CurrentEventTime);
                    };
                    table.Attach(btnClose,2,3,0,1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
                    popupColor.ShowAll();
                //}

                cbBackground.Color = new Gdk.Color(MainClass.Settings.BackgroundColor.Red,
                            MainClass.Settings.BackgroundColor.Green,MainClass.Settings.BackgroundColor.Blue);

                table.Attach(cbKeyBinding,1,2,1,2,AttachOptions.Fill,AttachOptions.Shrink,0,0);

                btnOk = new Gtk.Button();
                btnOk.Label = "_Ok";
                btnOk.UseUnderline = true;
                btnOk.Clicked+=  OnButtonOkClicked;

//.........这里部分代码省略.........
开发者ID:moscrif,项目名称:ide,代码行数:101,代码来源:SplashScreen.cs

示例10: GlobalOptionsWidget


//.........这里部分代码省略.........
            crt.Toggled += delegate(object o, ToggledArgs args) {
                TreeIter iter;
                if (storeIFo.GetIter (out iter, new TreePath(args.Path))) {
                    bool old = (bool) storeIFo.GetValue(iter,1);
                    IgnoreFolder iFol = (IgnoreFolder) storeIFo.GetValue(iter,3);
                    iFol.IsForIde =!old;

                    storeIFo.SetValue(iter,1,!old);
                }
            };

            tvIgnoreFolder.AppendColumn(MainClass.Languages.Translate("ignore_for_ide"), crt , "active", 1);

            CellRendererToggle crt2 = new CellRendererToggle();
            crt2.Activatable = true;
            crt2.Toggled += delegate(object o, ToggledArgs args) {
                    TreeIter iter;
                if (storeIFo.GetIter (out iter, new TreePath(args.Path))) {
                    bool old = (bool) storeIFo.GetValue(iter,2);
                    IgnoreFolder iFol = (IgnoreFolder) storeIFo.GetValue(iter,3);
                        //CombinePublish cp =(CombinePublish) fontListStore.GetValue(iter,2);
                        //cp.IsSelected = !old;
                        iFol.IsForPublish =!old;

                    storeIFo.SetValue(iter,2,!old);
                }
            };

            tvIgnoreFolder.AppendColumn(MainClass.Languages.Translate("ignore_for_Pub"), crt2 , "active", 2);
            tvIgnoreFolder.Model = storeIFo;

            foreach (IgnoreFolder ignoref in MainClass.Settings.IgnoresFolders){

                storeIFo.AppendValues(ignoref.Folder,ignoref.IsForIde,ignoref.IsForPublish,ignoref);
            }

            /* Ignore Files */
            ignoreFile = new List<IgnoreFolder>( MainClass.Settings.IgnoresFiles.ToArray());

            tvIgnoreFiles.AppendColumn(MainClass.Languages.Translate("name"), new Gtk.CellRendererText(), "text", 0);

            CellRendererToggle crtFi = new CellRendererToggle();
            crtFi.Activatable = true;
            crtFi.Toggled += delegate(object o, ToggledArgs args) {
                TreeIter iter;
                if (storeIFi.GetIter (out iter, new TreePath(args.Path))) {
                    bool old = (bool) storeIFi.GetValue(iter,1);
                    IgnoreFolder iFol = (IgnoreFolder) storeIFi.GetValue(iter,3);
                    iFol.IsForIde =!old;

                    storeIFi.SetValue(iter,1,!old);
                }
            };

            tvIgnoreFiles.AppendColumn(MainClass.Languages.Translate("ignore_for_ide"), crtFi , "active", 1);

            CellRendererToggle crtFi2 = new CellRendererToggle();
            crtFi2.Activatable = true;
            crtFi2.Toggled += delegate(object o, ToggledArgs args) {
                TreeIter iter;
                if (storeIFi.GetIter (out iter, new TreePath(args.Path))) {
                    bool old = (bool) storeIFi.GetValue(iter,2);
                    IgnoreFolder iFol = (IgnoreFolder) storeIFi.GetValue(iter,3);
                    iFol.IsForPublish =!old;
                    storeIFi.SetValue(iter,2,!old);
                }
            };

            tvIgnoreFiles.AppendColumn(MainClass.Languages.Translate("ignore_for_Pub"), crtFi2 , "active", 2);
            tvIgnoreFiles.Model = storeIFi;

            foreach (IgnoreFolder ignoref in MainClass.Settings.IgnoresFiles){

                storeIFi.AppendValues(ignoref.Folder,ignoref.IsForIde,ignoref.IsForPublish,ignoref);
            }
            /**/

            Gdk.Pixbuf default_pixbuf = null;
            string file = System.IO.Path.Combine(MainClass.Paths.ResDir, "stock-menu.png");
            if (System.IO.File.Exists(file)) {
                default_pixbuf = new Gdk.Pixbuf(file);

                popupColor = new Gtk.Menu();
                CreateMenu();

                Gtk.Button btnClose = new Gtk.Button(new Gtk.Image(default_pixbuf));
                btnClose.TooltipText = MainClass.Languages.Translate("select_color");
                btnClose.Relief = Gtk.ReliefStyle.None;
                btnClose.CanFocus = false;
                btnClose.WidthRequest = btnClose.HeightRequest = 22;

                popupColor.AttachToWidget(btnClose,new Gtk.MenuDetachFunc(DetachWidget));
                btnClose.Clicked += delegate {
                    popupColor.Popup(null,null, new Gtk.MenuPositionFunc (GetPosition) ,3,Gtk.Global.CurrentEventTime);
                };
                table1.Attach(btnClose,2,3,3,4, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);

                popupColor.ShowAll();
            }
        }
开发者ID:moscrif,项目名称:ide,代码行数:101,代码来源:GlobalOptionsPanel.cs

示例11: SettingPlatformDialog

        public SettingPlatformDialog(bool isRequired)
        {
            this.Build();
            //this.isRequired = isRequired;
            if(isRequired){
                button34.Visible=false;
            }

            if(MainClass.Settings.BackgroundColor==null){
                MainClass.Settings.BackgroundColor = new Option.Settings.BackgroundColors(218,218,218);
                /*if(MainClass.Platform.IsMac)
                    MainClass.Settings.BackgroundColor = new Moscrif.IDE.Settings.Settings.BackgroundColors(218,218,218);
                else
                    MainClass.Settings.BackgroundColor = new Moscrif.IDE.Settings.Settings.BackgroundColors(224,41,47);
                    */
            }

            if(!isRequired){
                cbKeyBinding.AppendText(NOTHING);
                cbKeyBinding.Active = 0;
            }

            cbKeyBinding.AppendText(WIN);
            cbKeyBinding.AppendText(MACOSX);
            cbKeyBinding.AppendText(JAVA);
            cbKeyBinding.AppendText(VisualC);

            if(isRequired){
                if(MainClass.Platform.IsMac){
                    cbKeyBinding.Active = 1;
                } else {
                    cbKeyBinding.Active = 0;
                }
            }

            Gdk.Pixbuf default_pixbuf = null;
            string file = System.IO.Path.Combine(MainClass.Paths.ResDir, "stock-menu.png");
            if (System.IO.File.Exists(file)) {
                default_pixbuf = new Gdk.Pixbuf(file);

                popupColor = new Gtk.Menu();
                CreateMenu();

                Gtk.Button btnClose = new Gtk.Button(new Gtk.Image(default_pixbuf));
                btnClose.TooltipText = MainClass.Languages.Translate("select_color");
                btnClose.Relief = Gtk.ReliefStyle.None;
                btnClose.CanFocus = false;
                btnClose.WidthRequest = btnClose.HeightRequest = 22;

                popupColor.AttachToWidget(btnClose,new Gtk.MenuDetachFunc(DetachWidget));
                btnClose.Clicked += delegate {
                    popupColor.Popup(null,null, new Gtk.MenuPositionFunc (GetPosition) ,3,Gtk.Global.CurrentEventTime);
                };
                table1.Attach(btnClose,2,3,0,1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
                table1.ShowAll();
                popupColor.ShowAll();
            }

            cbBackground.Color = new Gdk.Color(MainClass.Settings.BackgroundColor.Red,
                        MainClass.Settings.BackgroundColor.Green,MainClass.Settings.BackgroundColor.Blue);
        }
开发者ID:moscrif,项目名称:ide,代码行数:61,代码来源:SettingPlatformDialog.cs


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