Пример #1
0
 internal TextInputConnection(TextInputClient client)
 {
     D.assert(client != null);
     this._window = Window.instance;
     this._client = client;
     this._id     = _nextId++;
 }
Пример #2
0
        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();
        }
Пример #3
0
        public static TextInputConnection attach(TextInputClient client, TextInputConfiguration configuration)
        {
            D.assert(client != null);
            var connection = new TextInputConnection(client);

            _currentConnection = connection;
            if (keyboardDelegate != null)
            {
                keyboardDelegate.Dispose();
            }

            if (Application.isEditor)
            {
                keyboardDelegate = new DefaultKeyboardDelegate();
            }
            else
            {
#if UNITY_IOS || UNITY_ANDROID
                if (configuration.unityTouchKeyboard)
                {
                    keyboardDelegate = new UnityTouchScreenKeyboardDelegate();
                }
                else
                {
                    keyboardDelegate = new UIWidgetsTouchScreenKeyboardDelegate();
                }
#elif UNITY_WEBGL
                keyboardDelegate = new UIWidgetsWebGLKeyboardDelegate();
#else
                keyboardDelegate = new DefaultKeyboardDelegate();
#endif
            }
            keyboardDelegate.setClient(connection._id, configuration);
            return(connection);
        }
Пример #4
0
 internal TextInputConnection(TextInputClient client, TextInput textInput)
 {
     D.assert(client != null);
     D.assert(textInput != null);
     this._client    = client;
     this._textInput = textInput;
     this._id        = _nextId++;
 }
Пример #5
0
        public TextInputConnection attach(TextInputClient client, TextInputConfiguration configuration)
        {
            D.assert(client != null);
            var connection = new TextInputConnection(client, this);

            this.keyboardManager.setClient(connection._id, configuration);
            this._currentConnection = connection;
            return(connection);
        }