Beispiel #1
0
        /// <summary>
        /// ctor.
        /// </summary>
        public Window(CGRect contentRect, NSWindowStyle aStyle, NSBackingStore bufferingType, bool deferCreation)
            : base(contentRect, aStyle, bufferingType, deferCreation)
        {
            Delegate          = new WindowDelegate(this);
            _inputPane        = InputPane.GetForCurrentView();
            _inputPane.Window = this;

            // Register the types that can be dragging into the window (effectively 'AllowDrop').
            // This must be done before dragging enters the window or dragging methods won't be invoked.
            // We register for all possible types and then confirm whether they
            // are actually supported within the draggingEntered and draggingUpdated methods.
            // This has a minor side effect in the standard UI (zoom effect) but is considered acceptable.
            RegisterForDraggedTypes(new string[]
            {
                NSPasteboard.NSPasteboardTypeUrl,
                NSPasteboard.NSPasteboardTypeTIFF,
                NSPasteboard.NSPasteboardTypePNG,
                NSPasteboard.NSPasteboardTypeHTML,
                NSPasteboard.NSPasteboardTypeRTF,
                NSPasteboard.NSPasteboardTypeRTFD,
                NSPasteboard.NSPasteboardTypeFileUrl,
                NSPasteboard.NSPasteboardTypeString

                /* For future use
                 * UTType.URL,
                 * UTType.Image,
                 * UTType.HTML,
                 * UTType.RTF,
                 * UTType.FileURL,
                 * UTType.PlainText,
                 */
            });
        }
        public AppKitDisplay()
        {
            NSApplication.Init();

            CGRect     screenFrame = NSScreen.MainScreen.Frame;
            RectangleF frame       = new RectangleF((float)screenFrame.X, (float)screenFrame.Y,
                                                    (float)screenFrame.Width * 0.74f, (float)screenFrame.Height * 0.74f);
            NSWindowStyle style = NSWindowStyle.Titled | NSWindowStyle.Closable |
                                  NSWindowStyle.Miniaturizable | NSWindowStyle.Resizable;

            _window = new WindowClass(frame, style, NSBackingStore.Buffered, false);
            _window.AppKitDisplay           = this;
            _window.ReleasedWhenClosed      = false;
            _window.BackgroundColor         = NSColor.Black;
            _window.IsOpaque                = true;
            _window.AcceptsMouseMovedEvents = true;
            string[] draggedTypes = { NSPasteboard.NSFilenamesType.ToString() };
            _window.RegisterForDraggedTypes(draggedTypes);
            _delegate        = new WindowDelegate(this, _window);
            _window.Delegate = _delegate;

            _textinputClient = new TextInputClient(this);
            _window.ContentView.AddSubview(_textinputClient);

            FillKeyTable();
        }
        public void OnInitialize()
        {
            MainScrollView   = CreateScrollView();
            NativeScrollView = (NSScrollView)MainScrollView.NativeObject;

            View.AddSubview(NativeScrollView);


            var windowDelegate = new WindowDelegate();

            windowDelegate.GotFocus += async(s, e) => {
                await windowController.UpdateVersionMenu(DocumentID);
            };
            windowDelegate.LostFocus += (s, e) => {
                windowController.ClearVersionMenu();
            };

            View.Window.WeakDelegate = windowDelegate;


            windowController = (DocumentWindowController)View.Window.WindowController;
            windowController.VersionSelected  += WindowController_VersionSelected;
            windowController.RefreshRequested += WindowController_RefreshRequested;
            windowController.PageChanged      += WindowController_PageChanged;
        }
Beispiel #4
0
        private void createGameButton(object sender, RoutedEventArgs e)
        {
            WindowDelegate func      = new WindowDelegate(createGame);
            CreateGame     createWin = new CreateGame(func);

            createWin.ShowDialog();
        }
    void BuildEditorContent()
    {
        Rect  tempRect    = new Rect();
        float windowWidth = Screen.width / 2;

        style.normal.textColor = Color.white;
        /*--------------"First Column"-------------*/
        tempRect       = new Rect(0, 0, Screen.width * 1 / 6, Screen.height);
        windowDelegate = DrawFirstColumn;
        BuildWindow(windowDelegate, windowWidth, "", tempRect, Vector2.zero);

        /*-------------"Second Column"-------------*/
        tempRect       = new Rect(Screen.width * 1 / 6, 0, Screen.width * 1 / 6, Screen.height);
        windowDelegate = DrawSecondColumn;
        BuildWindow(windowDelegate, windowWidth, "", tempRect, Vector2.zero);

        /*-------------"Third Column"-------------*/
        tempRect       = new Rect(Screen.width * 2 / 6, 0, Screen.width * 3 / 6, Screen.height);
        windowDelegate = DrawThirdColumn;
        BuildWindow(windowDelegate, windowWidth, "", tempRect, Vector2.zero);

        /*--------------"Last Column"-------------*/
        tempRect       = new Rect(Screen.width * 5 / 6, 0, Screen.width * 1 / 6, Screen.height);
        windowDelegate = DrawLastColumn;
        BuildWindow(windowDelegate, windowWidth, "", tempRect, Vector2.zero);
    }
Beispiel #6
0
        protected override void OnShown()
        {
            var lol = new WindowDelegate();

            Window.Delegate = lol;

            lol.ResizeRequested += (s, e) => {
                ResizeRequested?.Invoke(this, EventArgs.Empty);
            };

            lol.MovedRequested += (s, e) => {
                MovedRequested?.Invoke(this, EventArgs.Empty);
            };

            lol.LostFocus += (s, e) => {
                LostFocus?.Invoke(this, EventArgs.Empty);
            };

            lol.BecomeMainWindow += (s, e) => {
                OnBecomeMainWindow(this, EventArgs.Empty);
            };

            lol.BecomeKeyWindow += (sender, e) => {
                GotFocus?.Invoke(this, EventArgs.Empty);
            };

            base.OnShown();
        }
Beispiel #7
0
 public MaterialGui(ImGuiWrapper gui, Material material, WindowDelegate onMaterialChanged) : base(gui, "Edit " + material.Name)
 {
     Material          = material;
     OnMaterialChanged = onMaterialChanged;
     ItemWidth         = 100.0f;
     AddProperties();
 }
Beispiel #8
0
 // Shared initialization code
 void Initialize()
 {
     Delegate = new WindowDelegate(this);
     InitializeIconRegistry();
     FormHandlers.Register();
     NbtClipboardController.Initialize(new NbtClipboardControllerMac());
 }
Beispiel #9
0
 /// <summary>
 /// ctor.
 /// </summary>
 public Window(CGRect contentRect, NSWindowStyle aStyle, NSBackingStore bufferingType, bool deferCreation)
     : base(contentRect, aStyle, bufferingType, deferCreation)
 {
     Delegate          = new WindowDelegate();
     _inputPane        = InputPane.GetForCurrentView();
     _inputPane.Window = this;
 }
Beispiel #10
0
		// Shared initialization code
		void Initialize ()
		{
			Delegate = new WindowDelegate(this);
			InitializeIconRegistry();
			FormHandlers.Register();
			NbtClipboardController.Initialize(new NbtClipboardControllerMac());
		}
 Vector2 BuildWindow(WindowDelegate tempDelegate, float windowWidth, string name, Rect rect, Vector2 scrollPos)
 {
     //GUILayout.BeginArea(rect, ("  " + name), style);
     GUILayout.BeginArea(rect);
     {
         EditorGUILayout.BeginVertical();
         {
             scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
             {
                 tempDelegate();
             }
             EditorGUILayout.EndScrollView();
         }
         EditorGUILayout.EndVertical();
     }
     GUILayout.EndArea();
     return(scrollPos);
 }
Beispiel #12
0
        public ModalWindowController(string startUri, string endUriRoot) : base("ModalWindow")
        {
            StartUri   = startUri;
            EndUriRoot = endUriRoot;
            Result     = null;

            ModalDelegate = new WindowDelegate(() =>
            {
                App.AbortModal();
            });

            NavigationDelegate = new NavDelegate(d =>
            {
                if (d.StartsWith(EndUriRoot, StringComparison.InvariantCultureIgnoreCase))
                {
                    Result = d;
                    Window.Close();
                }
            });
        }
Beispiel #13
0
        public static IWave GetFilterWave(IFilter filterType, decimal sampleRate, WindowDelegate windowFunction)
        {
            WaveWindow window = new WaveWindow(windowFunction, filterType.Length);
            double     k      = filterType.GetKCoefficient(sampleRate, filterType.CutoffFrequency);

            double[] values = new double[filterType.Length];

            int    halfFilterLength = (filterType.Length - 1) / 2;
            double twoPi            = 2 * Math.PI;

            for (int i = 0; i < filterType.Length; i++)
            {
                if (i == halfFilterLength)
                {
                    values[i] = 2.0 / k;
                }
                else
                {
                    values[i] = Math.Sin(twoPi * (i - halfFilterLength) / k) / (Math.PI * (i - halfFilterLength));
                }
                values[i] *= filterType.GetValue(i - halfFilterLength) * window[i];
            }
            return(new Wave(values, 1 / sampleRate));
        }
Beispiel #14
0
 public static double[] GetWindowValues(WindowDelegate window, int windowSize)
 {
     return(Enumerable.Range(0, windowSize).Select(i => window(i, windowSize)).ToArray());
 }
Beispiel #15
0
 public CreateGame(WindowDelegate func)
 {
     InitializeComponent();
     this.func = func;
 }
 public ButtonGuiElement(string label, WindowDelegate callback)
 {
     Label    = label;
     Callback = callback;
 }
Beispiel #17
0
 public WaveWindow(WindowDelegate windowFunction, int windowLength)
 {
     Function = windowFunction;
     Length   = windowLength;
     _values  = Enumerable.Range(0, windowLength).Select(i => windowFunction(i, windowLength)).ToArray();
 }