예제 #1
0
        public override Id InitWithFrame(NSRect aFrameRect)
        {
            this.NativePointer = this.SendMessageSuper <IntPtr>(ThisClass, "initWithFrame:", aFrameRect);

            NSRect wheelRect = new NSRect(0, 0, aFrameRect.Width, aFrameRect.Height);

            if (iViewWheel == null)
            {
                // create subviews
                iViewWheel = new ViewRotaryImage();
                iViewMute  = new NSImageView();
                iViewBar   = new ViewRotaryBar();
                iViewGrip  = new ViewRotaryGrip();

                // add views to the parent in back to front order
                this.AddSubview(iViewWheel);
                iViewWheel.AddSubview(iViewGrip);
                iViewGrip.AddSubview(iViewBar);
                iViewBar.AddSubview(iViewMute);
            }


            // initialise the views
            iViewWheel.InitWithFrame(wheelRect);
            iViewWheel.SetImages(Properties.Resources.ImageWheel, NSImageAlignment.NSImageAlignCenter,
                                 Properties.Resources.ImageWheelOver, NSImageAlignment.NSImageAlignCenter);

            iViewGrip.InitWithFrame(wheelRect);

            iViewBar.InitWithFrame(wheelRect);

            iViewMute.InitWithFrame(wheelRect);
            iViewMute.Image           = Properties.Resources.ImageWheelMute;
            iViewMute.ImageAlignment  = NSImageAlignment.NSImageAlignCenter;
            iViewMute.ImageFrameStyle = NSImageFrameStyle.NSImageFrameNone;
            iViewMute.ImageScaling    = NSImageScaling.NSImageScaleNone;


            // initialise angle for the control knob
            iKnobAngle      = 270.0f;
            iViewGrip.Angle = iKnobAngle;

            // initialise state of the widget
            iEnabled    = false;
            iMouseState = EMouse.eUp;
            iMouseOver  = false;
            iDimmed     = false;
            UpdateState();


            // create tracking area
            iTrackingArea = TrackerHelper.Create(this, wheelRect, false);

            return(this);
        }
예제 #2
0
        public override Id InitWithFrame(NSRect aFrameRect)
        {
            this.NativePointer = this.SendMessageSuper <IntPtr>(ThisClass, "initWithFrame:", aFrameRect);

            NSRect wheelRect = new NSRect(0, 0, aFrameRect.Width, aFrameRect.Height);

            if (iViewBar == null)
            {
                // create subviews
                iViewBar   = new ViewRotaryBar();
                iViewBkgd  = new NSImageView();
                iViewLeft  = new NSImageView();
                iViewRight = new NSImageView();
                iViewMute  = new NSImageView();

                // create subview hierarchy
                this.AddSubview(iViewBkgd);
                iViewBkgd.AddSubview(iViewBar);
                iViewBar.AddSubview(iViewLeft);
                iViewBar.AddSubview(iViewRight);
                iViewBar.AddSubview(iViewMute);
            }

            // initialise the views
            iViewBar.InitWithFrame(wheelRect);

            iViewBkgd.InitWithFrame(wheelRect);
            iViewBkgd.Image           = Properties.Resources.ImageRocker;
            iViewBkgd.ImageAlignment  = NSImageAlignment.NSImageAlignCenter;
            iViewBkgd.ImageFrameStyle = NSImageFrameStyle.NSImageFrameNone;
            iViewBkgd.ImageScaling    = NSImageScaling.NSImageScaleNone;

            iViewLeft.InitWithFrame(wheelRect);
            iViewLeft.Image           = Properties.Resources.ImageRockerLeftOver;
            iViewLeft.ImageAlignment  = NSImageAlignment.NSImageAlignCenter;
            iViewLeft.ImageFrameStyle = NSImageFrameStyle.NSImageFrameNone;
            iViewLeft.ImageScaling    = NSImageScaling.NSImageScaleNone;

            iViewRight.InitWithFrame(wheelRect);
            iViewRight.Image           = Properties.Resources.ImageRockerRightOver;
            iViewRight.ImageAlignment  = NSImageAlignment.NSImageAlignCenter;
            iViewRight.ImageFrameStyle = NSImageFrameStyle.NSImageFrameNone;
            iViewRight.ImageScaling    = NSImageScaling.NSImageScaleNone;

            iViewMute.InitWithFrame(wheelRect);
            iViewMute.Image           = Properties.Resources.ImageWheelMute;
            iViewMute.ImageAlignment  = NSImageAlignment.NSImageAlignCenter;
            iViewMute.ImageFrameStyle = NSImageFrameStyle.NSImageFrameNone;
            iViewMute.ImageScaling    = NSImageScaling.NSImageScaleNone;


            // initialise state of the widget
            iEnabled   = false;
            iDimmed    = false;
            iMouseDown = EMouse.eNot;
            iMouseOver = EMouse.eNot;
            UpdateState();

            // create tracking area
            iTrackingArea = TrackerHelper.Create(this, wheelRect, true);

            return(this);
        }