module Gdk::TextSelector

Constants

CHARACTER_PATTERN
CHARACTER_PATTERN_EXACT
CHUNK_PATTERN
END_TAG_PATTERN
END_TAG_PATTERN_EXACT
ENTITY_ENCODED_PATTERN
ENTITY_ENCODED_PATTERN_EXACT
NON_TAG_PATTERN_EXACT
START_TAG_PATTERN
START_TAG_PATTERN_EXACT

Public Class Methods

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

Public Instance Methods

textselector_attr_list(attr_list=Pango::AttrList.new) click to toggle source
# File core/mui/cairo_textselector.rb, line 56
def textselector_attr_list(attr_list=Pango::AttrList.new)
  if textselector_range
    bg = ::Pango::AttrBackground.new(*Gdk::MiraclePainter::BLACK)
    fg = ::Pango::AttrForeground.new(*Gdk::MiraclePainter::WHITE)
    bg.start_index = fg.start_index = plain_description[0...textselector_range.first].bytesize
    bg.end_index = fg.end_index = plain_description[0...textselector_range.last].bytesize
    attr_list.insert(bg)
    attr_list.insert(fg)
  end
  attr_list
end
textselector_press(index, trail=0) click to toggle source
# File core/mui/cairo_textselector.rb, line 31
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 26
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 38
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 49
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 43
def textselector_unselect
  @textselect_end = @textselect_start = nil
  @textselector_pressing = false
  on_modify
  self end