module Gdk::TextSelector

Public Class Methods

new(*args) click to toggle source
# File core/mui/cairo_textselector.rb, line 7
def initialize(*args)
  @textselector_pressing = @textselect_start = @textselect_end = nil
  super end

Public Instance Methods

textselector_markup(styled_text) click to toggle source
# File core/mui/cairo_textselector.rb, line 41
def textselector_markup(styled_text)
  type_strict styled_text => String
  if textselector_range
    markup(styled_text, textselector_range, '<span background="#000000" foreground="#ffffff">', '</span>')
  else
    styled_text end end
textselector_press(index, trail=0) click to toggle source
# File core/mui/cairo_textselector.rb, line 16
def textselector_press(index, trail=0)
  @textselector_pressing = true
  before = textselector_range
  @textselect_end = @textselect_start = index + trail
  on_modify if before == textselector_range
  self end
textselector_range() click to toggle source
# File core/mui/cairo_textselector.rb, line 11
def textselector_range
  if(@textselect_start and @textselect_end and @textselect_start != @textselect_end)
    first, last = [@textselect_start, @textselect_end].sort
    Range.new(first, last, true) end end
textselector_release(index = nil, trail=0) click to toggle source
# File core/mui/cairo_textselector.rb, line 23
def textselector_release(index = nil, trail=0)
  textselector_select(index, trail) if index
  @textselector_pressing = false
  self end
textselector_select(index, trail=0) click to toggle source
# File core/mui/cairo_textselector.rb, line 34
def textselector_select(index, trail=0)
  if(@textselector_pressing)
    before = textselector_range
    @textselect_end = index + trail
    on_modify if before == textselector_range end
  self end
textselector_unselect() click to toggle source
# File core/mui/cairo_textselector.rb, line 28
def textselector_unselect
  @textselect_end = @textselect_start = nil
  @textselector_pressing = false
  on_modify
  self end