private void BuildWidget()
        {
            alignment = new Gtk.Alignment(0.5f, 0.5f, 1f, 0f);
            alignment.SetPadding(1, 1, 3, 3);
            VisibleWindow = false;

            box           = new Gtk.HBox();
            entry         = new FramelessEntry(this);
            filter_button = new HoverImageButton(searchImage);
            clear_button  = new HoverImageButton(clearImage);

            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();
        }
Пример #2
0
        private void BuildWidget()
        {
            alignment = new Gtk.Alignment (0.5f, 0.5f, 1f, 0f);
            alignment.SetPadding (1, 1, 3, 3);
            VisibleWindow = false;

            box = new Gtk.HBox ();
            entry = new FramelessEntry (this);
            filter_button = new HoverImageButton (searchImage);
            clear_button = new HoverImageButton (clearImage);

            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 ();
        }