コード例 #1
0
        public SearchEntry()
        {
            entry.HasFrame = false;
            box.PackStart(entry, true, true, 0);
            iconFind = new HoverImageButton(IconSize.Menu, Gtk.Stock.Find);
            box.PackStart(iconFind, false, false, 0);
            iconClean = new HoverImageButton(IconSize.Menu, Gtk.Stock.Clear);
            box.PackStart(iconClean, false, false, 0);
            box.BorderWidth = 1;

            HeaderBox hbox = new HeaderBox(1, 1, 1, 1);

            hbox.Show();
            hbox.Add(box);
            Add(hbox);

            ModifyBg(StateType.Normal, entry.Style.Base(StateType.Normal));
            iconClean.ModifyBg(StateType.Normal, entry.Style.Base(StateType.Normal));
            iconFind.ModifyBg(StateType.Normal, entry.Style.Base(StateType.Normal));

            iconClean.BorderWidth = 1;
            iconClean.CanFocus    = false;
            iconFind.BorderWidth  = 1;
            iconFind.CanFocus     = false;

            iconClean.Clicked += delegate {
                entry.Text = string.Empty;
            };

            iconFind.Clicked += delegate {
                FireSearch();
            };

            entry.Activated += delegate {
                FireSearch();
            };

            ShowAll();
            UpdateIcon();

            entry.Changed += delegate {
                UpdateIcon();
                FireSearch();
            };
        }
コード例 #2
0
ファイル: SearchEntry.cs プロジェクト: wanglehui/mono-addins
		public SearchEntry ()
		{
			entry.HasFrame = false;
			box.PackStart (entry, true, true, 0);
			iconFind = new HoverImageButton (IconSize.Menu, Gtk.Stock.Find);
			box.PackStart (iconFind, false, false, 0);
			iconClean = new HoverImageButton (IconSize.Menu, Gtk.Stock.Clear);
			box.PackStart (iconClean, false, false, 0);
			box.BorderWidth = 1;
			
			HeaderBox hbox = new HeaderBox (1,1,1,1);
			hbox.Show ();
			hbox.Add (box);
			Add (hbox);
			
			ModifyBg (StateType.Normal, entry.Style.Base (StateType.Normal));
			iconClean.ModifyBg (StateType.Normal, entry.Style.Base (StateType.Normal));
			iconFind.ModifyBg (StateType.Normal, entry.Style.Base (StateType.Normal));
			
			iconClean.BorderWidth = 1;
			iconClean.CanFocus = false;
			iconFind.BorderWidth = 1;
			iconFind.CanFocus = false;
			
			iconClean.Clicked += delegate {
				entry.Text = string.Empty;
			};
			
			iconFind.Clicked += delegate {
				FireSearch ();
			};
			
			entry.Activated += delegate {
				FireSearch ();
			};
			
			ShowAll ();
			UpdateIcon ();
			
			entry.Changed += delegate {
				UpdateIcon ();
				FireSearch ();
			};
		}