예제 #1
0
        private void on_ime_composition_range_changed(cef_render_handler_t *self, cef_browser_t *browser, cef_range_t *selected_range, UIntPtr character_boundsCount, cef_rect_t *character_bounds)
        {
            CheckSelf(self);

            // TODO: reuse array/special list for rectange - this method called only from one thread and can be reused

            var m_browser       = CefBrowser.FromNative(browser);
            var m_selectedRange = new CefRange(selected_range->from, selected_range->to);

            CefRectangle[] m_characterBounds;
            if (character_boundsCount == UIntPtr.Zero)
            {
                m_characterBounds = s_emptyRectangleArray;
            }
            else
            {
                var m_characterBoundsCount = checked ((int)character_boundsCount);
                m_characterBounds = new CefRectangle[m_characterBoundsCount];
                for (var i = 0; i < m_characterBoundsCount; i++)
                {
                    m_characterBounds[i] = new CefRectangle(
                        character_bounds[i].x,
                        character_bounds[i].y,
                        character_bounds[i].width,
                        character_bounds[i].height
                        );
                }
            }

            OnImeCompositionRangeChanged(m_browser, m_selectedRange, m_characterBounds);
        }
        /// <summary>
        /// Retrieve the page ranges.
        /// </summary>
        public CefRange[] GetPageRanges()
        {
            var count = GetPageRangesCount();

            if (count == 0)
            {
                return(new CefRange[0]);
            }

            var     n_ranges = new cef_range_t[count];
            UIntPtr n_count  = (UIntPtr)count;

            fixed(cef_range_t *n_ranges_ptr = n_ranges)
            {
                cef_print_settings_t.get_page_ranges(_self, &n_count, n_ranges_ptr);
            }

            count = (int)n_count;
            if (count == 0)
            {
                return(new CefRange[0]);
            }

            var ranges = new CefRange[count];

            for (var i = 0; i < count; i++)
            {
                ranges[i].From = n_ranges[i].from;
                ranges[i].To   = n_ranges[i].to;
            }

            return(ranges);
        }
예제 #3
0
        private void on_text_selection_changed(cef_render_handler_t *self, cef_browser_t *browser, cef_string_t *selected_text, cef_range_t *selected_range)
        {
            CheckSelf(self);

            var m_browser        = CefBrowser.FromNative(browser);
            var m_selected_text  = cef_string_t.ToString(selected_text);
            var m_selected_range = new CefRange(selected_range->from, selected_range->to);

            OnTextSelectionChanged(m_browser, m_selected_text, m_selected_range);
        }
예제 #4
0
 /// <summary>
 /// Called when text selection has changed for the specified |browser|.
 /// |selected_text| is the currently selected text and |selected_range| is
 /// the character range.
 /// </summary>
 protected virtual void OnTextSelectionChanged(CefBrowser browser, string selectedText, CefRange selectedRange)
 {
 }
예제 #5
0
 /// <summary>
 /// Called when the IME composition range has changed. |selected_range| is the
 /// range of characters that have been selected. |character_bounds| is the
 /// bounds of each character in view coordinates.
 /// </summary>
 protected abstract void OnImeCompositionRangeChanged(CefBrowser browser, CefRange selectedRange, CefRectangle[] characterBounds);