Пример #1
0
        /// <summary>
        /// Set the page ranges.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_print_settings_capi.h">cef/include/capi/cef_print_settings_capi.h</see>.
        /// </remarks>
        public void SetPageRanges(CfxRange[] ranges)
        {
            UIntPtr ranges_length;

            IntPtr[] ranges_ptrs;
            if (ranges != null)
            {
                ranges_length = (UIntPtr)ranges.Length;
                ranges_ptrs   = new IntPtr[ranges.Length];
                for (int i = 0; i < ranges.Length; ++i)
                {
                    ranges_ptrs[i] = CfxRange.Unwrap(ranges[i]);
                }
            }
            else
            {
                ranges_length = UIntPtr.Zero;
                ranges_ptrs   = null;
            }
            PinnedObject ranges_pinned = new PinnedObject(ranges_ptrs);
            int          ranges_nomem;

            CfxApi.PrintSettings.cfx_print_settings_set_page_ranges(NativePtr, ranges_length, ranges_pinned.PinnedPtr, out ranges_nomem);
            ranges_pinned.Free();
            if (ranges_nomem != 0)
            {
                throw new OutOfMemoryException();
            }
        }
Пример #2
0
        /// <summary>
        /// Completes the existing composition by optionally inserting the specified
        /// |text| into the composition node. |replacementRange| is an optional range
        /// of the existing text that will be replaced. |relativeCursorPos| is where
        /// the cursor will be positioned relative to the current cursor position. See
        /// comments on ImeSetComposition for usage. The |replacementRange| and
        /// |relativeCursorPos| values are only used on OS X. This function is only
        /// used when window rendering is disabled.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_browser_capi.h">cef/include/capi/cef_browser_capi.h</see>.
        /// </remarks>
        public void ImeCommitText(string text, CfxRange replacementRange, int relativeCursorPos)
        {
            var text_pinned = new PinnedString(text);

            CfxApi.BrowserHost.cfx_browser_host_ime_commit_text(NativePtr, text_pinned.Obj.PinnedPtr, text_pinned.Length, CfxRange.Unwrap(replacementRange), relativeCursorPos);
            text_pinned.Obj.Free();
        }
Пример #3
0
        /// <summary>
        /// Begins a new composition or updates the existing composition. Blink has a
        /// special node (a composition node) that allows the input function to change
        /// text without affecting other DOM nodes. |text| is the optional text that
        /// will be inserted into the composition node. |underlines| is an optional set
        /// of ranges that will be underlined in the resulting text.
        /// |replacementRange| is an optional range of the existing text that will be
        /// replaced. |selectionRange| is an optional range of the resulting text that
        /// will be selected after insertion or replacement. The |replacementRange|
        /// value is only used on OS X.
        ///
        /// This function may be called multiple times as the composition changes. When
        /// the client is done making changes the composition should either be canceled
        /// or completed. To cancel the composition call ImeCancelComposition. To
        /// complete the composition call either ImeCommitText or
        /// ImeFinishComposingText. Completion is usually signaled when:
        ///   A. The client receives a WM_IME_COMPOSITION message with a GCS_RESULTSTR
        ///      flag (on Windows), or;
        ///   B. The client receives a "commit" signal of GtkIMContext (on Linux), or;
        ///   C. insertText of NSTextInput is called (on Mac).
        ///
        /// This function is only used when window rendering is disabled.
        /// </summary>
        /// <remarks>
        /// See also the original CEF documentation in
        /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_browser_capi.h">cef/include/capi/cef_browser_capi.h</see>.
        /// </remarks>
        public void ImeSetComposition(string text, CfxCompositionUnderline[] underlines, CfxRange replacementRange, CfxRange selectionRange)
        {
            var     text_pinned = new PinnedString(text);
            UIntPtr underlines_length;

            IntPtr[] underlines_ptrs;
            if (underlines != null)
            {
                underlines_length = (UIntPtr)underlines.Length;
                underlines_ptrs   = new IntPtr[underlines.Length];
                for (int i = 0; i < underlines.Length; ++i)
                {
                    underlines_ptrs[i] = CfxCompositionUnderline.Unwrap(underlines[i]);
                }
            }
            else
            {
                underlines_length = UIntPtr.Zero;
                underlines_ptrs   = null;
            }
            PinnedObject underlines_pinned = new PinnedObject(underlines_ptrs);
            int          underlines_nomem;

            CfxApi.BrowserHost.cfx_browser_host_ime_set_composition(NativePtr, text_pinned.Obj.PinnedPtr, text_pinned.Length, underlines_length, underlines_pinned.PinnedPtr, out underlines_nomem, CfxRange.Unwrap(replacementRange), CfxRange.Unwrap(selectionRange));
            text_pinned.Obj.Free();
            underlines_pinned.Free();
            if (underlines_nomem != 0)
            {
                throw new OutOfMemoryException();
            }
        }