コード例 #1
0
        private void BuildWidget()
        {
            box           = new HBox();
            entry         = new FramelessEntry(this);
            filter_button = new HoverImageButton(IconSize.Menu, new string[] { Stock.Find });
            clear_button  = new HoverImageButton(IconSize.Menu, new string[] { Stock.Clear });

            box.PackStart(filter_button, false, false, 0);
            box.PackStart(entry, true, true, 0);
            box.PackStart(clear_button, false, false, 0);
            Add(box);
            box.ShowAll();

            entry.StyleSet      += OnInnerEntryStyleSet;
            entry.StateChanged  += OnInnerEntryStateChanged;
            entry.FocusInEvent  += OnInnerEntryFocusEvent;
            entry.FocusOutEvent += OnInnerEntryFocusEvent;
            entry.Changed       += OnInnerEntryChanged;

            filter_button.Image.Xpad = 2;
            clear_button.Image.Xpad  = 2;
            filter_button.CanFocus   = false;
            clear_button.CanFocus    = false;

            filter_button.ButtonReleaseEvent += OnButtonReleaseEvent;
            clear_button.ButtonReleaseEvent  += OnButtonReleaseEvent;
            clear_button.Clicked             += OnClearButtonClicked;

            filter_button.Visible = false;
            clear_button.Visible  = false;
        }
コード例 #2
0
ファイル: SearchEntry.cs プロジェクト: wzq0621/monodevelop
        private void BuildWidget()
        {
            alignment = new Alignment(0.5f, 0.5f, 1f, 0f);
            alignment.Accessible.SetShouldIgnore(true);
            alignment.SetPadding(1, 1, 3, 3);
            VisibleWindow = false;

            box = new HBox();
            box.Accessible.SetShouldIgnore(true);
            entry = new FramelessEntry(this);
            entry.UseNativeContextMenus();
            entry.Accessible.SetSubRole("AXSearchField");
            entry.Accessible.SetLabel(GettextCatalog.GetString("Search"));

            filter_button = new HoverImageButton(IconSize.Menu, "md-searchbox-search");
            filter_button.Accessible.SetRole(AtkCocoa.Roles.AXMenuButton);
            filter_button.Accessible.SetLabel(GettextCatalog.GetString("Search filter menu"));
            filter_button.Accessible.Description = GettextCatalog.GetString("Change the search filters");

            // This will be set to false if an event handler is attached to RequestMenu
            filter_button.Accessible.SetShouldIgnore(true);

            clear_button = new HoverImageButton(IconSize.Menu, "md-searchbox-clear");
            clear_button.Accessible.SetLabel(GettextCatalog.GetString("Clear"));
            clear_button.Accessible.Description = GettextCatalog.GetString("Clear the search entry");

            entryAlignment = new Gtk.Alignment(0.5f, 0.5f, 1f, 1f);
            entryAlignment.Accessible.SetShouldIgnore(true);
            alignment.SetPadding(0, 0, 3, 3);
            entryAlignment.Add(entry);
            box.PackStart(filter_button, false, false, 0);
            box.PackStart(entryAlignment, true, true, 0);
            box.PackStart(clear_button, false, false, 0);
            alignment.Add(box);
            Add(alignment);
            alignment.ShowAll();

            entry.StyleSet      += OnInnerEntryStyleSet;
            entry.StateChanged  += OnInnerEntryStateChanged;
            entry.FocusInEvent  += OnInnerEntryFocusEvent;
            entry.FocusOutEvent += OnInnerEntryFocusEvent;
            entry.Changed       += OnInnerEntryChanged;
            entry.Activated     += delegate {
                NotifyActivated();
            };

            filter_button.CanFocus = false;
            clear_button.CanFocus  = false;

            filter_button.ButtonReleaseEvent += OnButtonReleaseEvent;
            clear_button.ButtonReleaseEvent  += OnButtonReleaseEvent;
            clear_button.Clicked             += OnClearButtonClicked;

            ShowHideButtons();
        }
コード例 #3
0
        private void BuildWidget()
        {
            var yscale = 0f;

            if (Platform.IsWindows)
            {
                yscale = (float)GtkWorkarounds.GetScaleFactor(this);
            }

            alignment = new Alignment(0.5f, 0.5f, 1f, yscale);
            alignment.SetPadding(1, 1, 3, 3);
            VisibleWindow = false;

            box   = new HBox();
            entry = new FramelessEntry(this);
            entry.UseNativeContextMenus();

            filter_button = new HoverImageButton(IconSize.Menu, "md-searchbox-search");
            clear_button  = new HoverImageButton(IconSize.Menu, "md-searchbox-clear");

            entryAlignment = new Gtk.Alignment(0.5f, 0.5f, 1f, 1f);
            alignment.SetPadding(0, 0, 3, 3);
            entryAlignment.Add(entry);
            box.PackStart(filter_button, false, false, 0);
            box.PackStart(entryAlignment, true, true, 0);
            box.PackStart(clear_button, false, false, 0);
            alignment.Add(box);
            Add(alignment);
            alignment.ShowAll();

            entry.StyleSet      += OnInnerEntryStyleSet;
            entry.StateChanged  += OnInnerEntryStateChanged;
            entry.FocusInEvent  += OnInnerEntryFocusEvent;
            entry.FocusOutEvent += OnInnerEntryFocusEvent;
            entry.Changed       += OnInnerEntryChanged;
            entry.Activated     += delegate {
                NotifyActivated();
            };

            filter_button.CanFocus = false;
            clear_button.CanFocus  = false;

            filter_button.ButtonReleaseEvent += OnButtonReleaseEvent;
            clear_button.ButtonReleaseEvent  += OnButtonReleaseEvent;
            clear_button.Clicked             += OnClearButtonClicked;

            ShowHideButtons();
        }
コード例 #4
0
        private void BuildWidget()
        {
            alignment = new Alignment(0.5f, 0.5f, 1f, 0f);
            alignment.SetPadding(1, 1, 3, 3);
            VisibleWindow = false;

            box           = new HBox();
            entry         = new FramelessEntry(this);
            filter_button = new HoverImageButton(IconSize.Menu, "md-searchbox-search");
            clear_button  = new HoverImageButton(IconSize.Menu, "md-searchbox-clear");

            entryAlignment = new Gtk.Alignment(0.5f, 0.5f, 1f, 1f);
            alignment.SetPadding(0, 0, 3, 3);
            entryAlignment.Add(entry);
            box.PackStart(filter_button, false, false, 0);
            box.PackStart(entryAlignment, true, true, 0);
            box.PackStart(clear_button, false, false, 0);
            alignment.Add(box);
            Add(alignment);
            alignment.ShowAll();

            entry.StyleSet      += OnInnerEntryStyleSet;
            entry.StateChanged  += OnInnerEntryStateChanged;
            entry.FocusInEvent  += OnInnerEntryFocusEvent;
            entry.FocusOutEvent += OnInnerEntryFocusEvent;
            entry.Changed       += OnInnerEntryChanged;
            entry.Activated     += delegate {
                NotifyActivated();
            };

            filter_button.Image.Xpad = 0;
            clear_button.Image.Xpad  = 0;
            filter_button.CanFocus   = false;
            clear_button.CanFocus    = false;

            filter_button.ButtonReleaseEvent += OnButtonReleaseEvent;
            clear_button.ButtonReleaseEvent  += OnButtonReleaseEvent;
            clear_button.Clicked             += OnClearButtonClicked;

            ShowHideButtons();
        }
コード例 #5
0
		private void BuildWidget ()
		{
			alignment = new Alignment (0.5f, 0.5f, 1f, 0f);
			alignment.SetPadding (1, 1, 3, 3);
			VisibleWindow = false;

			box = new HBox ();
			entry = new FramelessEntry (this);
			filter_button = new HoverImageButton (IconSize.Menu, "md-searchbox-search");
			clear_button = new HoverImageButton (IconSize.Menu, "md-searchbox-clear");

			entryAlignment = new Gtk.Alignment (0.5f, 0.5f, 1f, 1f);
			alignment.SetPadding (0, 0, 3, 3);
			entryAlignment.Add (entry);
			box.PackStart (filter_button, false, false, 0);
			box.PackStart (entryAlignment, true, true, 0);
			box.PackStart (clear_button, false, false, 0);
			alignment.Add (box);
			Add (alignment);
			alignment.ShowAll ();
			
			entry.StyleSet += OnInnerEntryStyleSet;
			entry.StateChanged += OnInnerEntryStateChanged;
			entry.FocusInEvent += OnInnerEntryFocusEvent;
			entry.FocusOutEvent += OnInnerEntryFocusEvent;
			entry.Changed += OnInnerEntryChanged;
			entry.Activated += delegate {
				NotifyActivated ();
			};

			filter_button.Image.Xpad = 0;
			clear_button.Image.Xpad = 0;
			filter_button.CanFocus = false;
			clear_button.CanFocus = false;
			
			filter_button.ButtonReleaseEvent += OnButtonReleaseEvent;
			clear_button.ButtonReleaseEvent += OnButtonReleaseEvent;
			clear_button.Clicked += OnClearButtonClicked;

			ShowHideButtons ();
		}
コード例 #6
0
		private void BuildWidget ()
		{
			box = new HBox ();
			entry = new FramelessEntry (this);
			filter_button = new HoverImageButton (IconSize.Menu, new string[] { Stock.Find });
			clear_button = new HoverImageButton (IconSize.Menu, new string[] { Stock.Clear });
			
			box.PackStart (filter_button, false, false, 0);
			box.PackStart (entry, true, true, 0);
			box.PackStart (clear_button, false, false, 0);
			Add (box);
			box.ShowAll ();
			
			entry.StyleSet += OnInnerEntryStyleSet;
			entry.StateChanged += OnInnerEntryStateChanged;
			entry.FocusInEvent += OnInnerEntryFocusEvent;
			entry.FocusOutEvent += OnInnerEntryFocusEvent;
			entry.Changed += OnInnerEntryChanged;
			
			filter_button.Image.Xpad = 2;
			clear_button.Image.Xpad = 2;
			filter_button.CanFocus = false;
			clear_button.CanFocus = false;
			
			filter_button.ButtonReleaseEvent += OnButtonReleaseEvent;
			clear_button.ButtonReleaseEvent += OnButtonReleaseEvent;
			clear_button.Clicked += OnClearButtonClicked;
			
			filter_button.Visible = false;
			clear_button.Visible = false;
			
		}