Ejemplo n.º 1
0
        protected override void OnClicked()
        {
            base.OnClicked();

            if (creator != null)
            {
                Menu menu = creator(this);

                if (menu != null)
                {
                    isOpen = true;

                    //make sure the button looks depressed
                    ReliefStyle oldRelief = this.Relief;
                    this.Relief = ReliefStyle.Normal;

                    //clean up after the menu's done
                    menu.Hidden += delegate {
                        this.Relief = oldRelief;
                        isOpen      = false;
                        this.State  = StateType.Normal;

                        //FIXME: for some reason the menu's children don't get activated if we destroy
                        //directly here, so use a timeout to delay it
                        GLib.Timeout.Add(100, delegate {
                            menu.Destroy();
                            return(false);
                        });
                    };
                    menu.Popup(null, null, PositionFunc, 0, Gtk.Global.CurrentEventTime);
                }
            }
        }
Ejemplo n.º 2
0
        protected virtual void OnButtonClicked(object sender, System.EventArgs e)
        {
            Menu menu = CreateMenu(true);

            if (menu != null)
            {
                isOpen = true;

                //make sure the button looks depressed
                ReliefStyle oldRelief = button.Relief;
                button.Relief = ReliefStyle.Normal;

                //clean up after the menu's done
                menu.Hidden += delegate {
                    button.Relief = oldRelief;
                    isOpen        = false;
                    button.State  = StateType.Normal;

                    //FIXME: for some reason the menu's children don't get activated if we destroy
                    //directly here, so use a timeout to delay it
                    GLib.Timeout.Add(100, delegate {
                        menu.Destroy();
                        return(false);
                    });
                };
                menu.Popup(null, null, PositionFunc, 0, Gtk.Global.CurrentEventTime);
            }
        }
        ReliefStyle MenuOpened()
        {
            isOpen = true;
            //make sure the button looks depressed
            ReliefStyle oldRelief = this.Relief;

            this.Relief = ReliefStyle.Normal;
            return(oldRelief);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Recursively sets the ReliefStyle of every button in the specified container
 /// </summary>
 /// <param name="c">
 /// The parent container
 /// A <see cref="Container"/>
 /// </param>
 /// <param name="style">
 /// The relief style to use
 /// A <see cref="Gtk.ReliefStyle"/>
 /// </param>
 public static void SetButtonRelief(Container c, ReliefStyle style)
 {
     foreach(Widget w in c.AllChildren)
     {
         if((w as Button) != null)
             ((Button)w).Relief = style;
         if((w as Container) != null)
             SetButtonRelief((Container)w, style);
     }
 }
 void MenuClosed(ReliefStyle oldRelief)
 {
     this.Relief = oldRelief;
     isOpen      = false;
     this.State  = StateType.Normal;
 }
Ejemplo n.º 6
0
		void MenuClosed (ReliefStyle oldRelief)
		{
			this.Relief = oldRelief;
			isOpen = false;
			this.State = StateType.Normal;
		}