Exemple #1
0
        public virtual void SetButtonStyle(ButtonStyle style)
        {
            currentStyle = style;
            if (currentType == ButtonType.Normal)
            {
                switch (style)
                {
                case ButtonStyle.Normal:
                    if (Widget.Image != null ||
                        Frontend.MinHeight > 0 ||
                        Frontend.HeightRequest > 0 ||
                        Widget.Title.Contains(Environment.NewLine))
                    {
                        Widget.BezelStyle = NSBezelStyle.RegularSquare;
                    }
                    else
                    {
                        Widget.BezelStyle = NSBezelStyle.Rounded;
                    }
                    Messaging.void_objc_msgSend_bool(Widget.Handle, selSetShowsBorderOnlyWhileMouseInside.Handle, false);
                    break;

                case ButtonStyle.Borderless:
                case ButtonStyle.Flat:
                    Widget.BezelStyle = NSBezelStyle.ShadowlessSquare;
                    Messaging.void_objc_msgSend_bool(Widget.Handle, selSetShowsBorderOnlyWhileMouseInside.Handle, true);
                    break;
                }
            }
        }
Exemple #2
0
        public void SetButtonStyle(ButtonStyle style)
        {
            switch (style)
            {
            case ButtonStyle.Normal:
                Widget.BezelStyle = NSBezelStyle.Rounded;
                Widget.SetButtonType(NSButtonType.MomentaryPushIn);
                Messaging.void_objc_msgSend_bool(Widget.Handle, selSetShowsBorderOnlyWhileMouseInside.Handle, false);
                break;

            case ButtonStyle.Flat:
                Widget.BezelStyle = NSBezelStyle.Rounded;
                Messaging.void_objc_msgSend_bool(Widget.Handle, selSetShowsBorderOnlyWhileMouseInside.Handle, true);
                break;
            }
        }
        public override void SetButtonStyle(ButtonStyle style)
        {
            switch (style)
            {
            case ButtonStyle.Normal:
                Widget.BezelStyle = NSBezelStyle.Rounded;
                Messaging.void_objc_msgSend_bool(Widget.Handle, selSetShowsBorderOnlyWhileMouseInside.Handle, false);
                break;

            case ButtonStyle.Borderless:
            case ButtonStyle.Flat:
                Widget.BezelStyle = NSBezelStyle.ShadowlessSquare;
                Messaging.void_objc_msgSend_bool(Widget.Handle, selSetShowsBorderOnlyWhileMouseInside.Handle, true);
                break;
            }
        }
 internal void NotifyToggle()
 {
     if (lastState != Widget.State)
     {
         switch (((Button)Frontend).Style)
         {
         case ButtonStyle.Borderless:
         case ButtonStyle.Flat:
             Messaging.void_objc_msgSend_bool(Widget.Handle, selSetShowsBorderOnlyWhileMouseInside.Handle, !Active);
             break;
         }
         lastState = Widget.State;
         ApplicationContext.InvokeUserCode(delegate {
             EventSink.OnToggled();
         });
     }
 }