예제 #1
0
            public PopUpButtons(PopUpButtonsType buttons)
            {
                ButtonsType = buttons;
                switch (buttons)
                {
                case PopUpButtonsType.CancelOK:
                    btn1 = new PopUpButton("", false, false);
                    btn2 = new PopUpButton(WIN32.MB_GetString(WIN32.SystemLocStrings.Cancel), true, false);
                    btn3 = new PopUpButton(WIN32.MB_GetString(WIN32.SystemLocStrings.OK), true, true);
                    break;

                case PopUpButtonsType.CancelNoYes:
                    btn1 = new PopUpButton(WIN32.MB_GetString(WIN32.SystemLocStrings.Cancel), true, false);
                    btn2 = new PopUpButton(WIN32.MB_GetString(WIN32.SystemLocStrings.No), true, false);
                    btn3 = new PopUpButton(WIN32.MB_GetString(WIN32.SystemLocStrings.Yes), true, true);
                    break;

                case PopUpButtonsType.NoYes:
                    btn1 = new PopUpButton("", false, false);
                    btn2 = new PopUpButton(WIN32.MB_GetString(WIN32.SystemLocStrings.No), true, false);
                    btn3 = new PopUpButton(WIN32.MB_GetString(WIN32.SystemLocStrings.Yes), true, true);
                    break;

                case PopUpButtonsType.OK:
                default:
                    btn1 = new PopUpButton("", false, false);
                    btn2 = new PopUpButton("", false, false);
                    btn3 = new PopUpButton(WIN32.MB_GetString(WIN32.SystemLocStrings.OK), true, true);
                    break;
                }
            }
예제 #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // set up resource paths
            string fontName = "content-font.ttf";

            SkiaSharp.Demos.CustomFontPath = NSBundle.MainBundle.PathForResource(Path.GetFileNameWithoutExtension(fontName), Path.GetExtension(fontName));
            var dir = Path.Combine(Path.GetTempPath(), "SkiaSharp.Demos", Path.GetRandomFileName());

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            SkiaSharp.Demos.WorkingDirectory = dir;
            SkiaSharp.Demos.OpenFileDelegate = path =>
            {
                if (!NSWorkspace.SharedWorkspace.OpenFile(Path.Combine(dir, path)))
                {
                    NSAlert.WithMessage("SkiaSharp", "OK", null, null, "Unable to open file.").RunSheetModal(View.Window);
                }
            };

            PopUpButton.AddItems(SkiaSharp.Demos.SamplesForPlatform(SkiaSharp.Demos.Platform.OSX | SkiaSharp.Demos.Platform.OpenGL));
            PopUpButton.SelectItem(0);
            SkiaView.Sample = SkiaSharp.Demos.GetSample(PopUpButton.SelectedItem.Title);
        }
예제 #3
0
        public PopUpWindow(string[] options, Vector3 position)
        {
            cam = GameObject.FindObjectOfType <Camera>();
            //position = cam.WorldToScreenPoint(position);

            this.x = position.x;
            this.y = Screen.height - position.y;

            if (y + (height * options.Length) > Screen.height)
            {
                y = Screen.height - (height * options.Length);
            }

            if (x + width > Screen.width)
            {
                x = Screen.width - width;
            }

            float y2 = y;

            int index = 0;

            foreach (string opt in options)
            {
                PopUpButton button = new PopUpButton();
                button.rect = new Rect(x, y2, width, height);
                button.text = opt;

                button.index = index++;
                y2          += height;

                buttons.Add(button);
            }
        }
예제 #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // set up resource paths
            string fontName = "content-font.ttf";

            SkiaSharp.Demos.CustomFontPath = NSBundle.MainBundle.PathForResource(Path.GetFileNameWithoutExtension(fontName), Path.GetExtension(fontName));

            PopUpButton.AddItems(SkiaSharp.Demos.SamplesForPlatform(SkiaSharp.Demos.Platform.OSX));
            PopUpButton.SelectItem(0);
            SkiaView.OnDrawCallback = SkiaSharp.Demos.MethodForSample(PopUpButton.SelectedItem.Title);
        }
예제 #5
0
        void ReleaseDesignerOutlets()
        {
            if (PopUpButton != null)
            {
                PopUpButton.Dispose();
                PopUpButton = null;
            }

            if (SkiaView != null)
            {
                SkiaView.Dispose();
                SkiaView = null;
            }
        }