class Qx::Scintilla

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/troshka/editor/qxscintilla.rb, line 6
def initialize
  super
  connect(SIGNAL "userListActivated(int, const QString)") do |id, text|
    @autocompletion_activated.(id, text) rescue nil
  end
end

Public Instance Methods

current_column_number() click to toggle source
# File lib/troshka/editor/qxscintilla.rb, line 38
def current_column_number
  #  SCI_GETCOLUMN = 2129
  SendScintilla(2129,pos,0)
end
current_line() click to toggle source
# File lib/troshka/editor/qxscintilla.rb, line 86
def current_line
  {text: current_line_text, line_number: current_line_number}
end
current_line_number() click to toggle source

Operations

# File lib/troshka/editor/qxscintilla.rb, line 33
def current_line_number
  # SCI_LINEFROMPOSITION
  SendScintilla(2166,pos,0)
end
current_line_text() click to toggle source
# File lib/troshka/editor/qxscintilla.rb, line 52
def current_line_text
  line_text current_line_number
end
current_position() click to toggle source
# File lib/troshka/editor/qxscintilla.rb, line 82
def current_position
  {line: current_line_number, column: current_column_number}
end
keyPressEvent(event) click to toggle source
Calls superclass method
# File lib/troshka/editor/qxscintilla.rb, line 13
def keyPressEvent(event)
  e = OpenStruct.new
  e.key = event.key
  e.modifiers = event.modifiers
  e.continue = true

  @key_pressed.(e) rescue nil
  super event if e.continue
end
key_pressed(&blk) click to toggle source
# File lib/troshka/editor/qxscintilla.rb, line 28
def key_pressed(&blk)
  @key_pressed = blk
end
line_length(line) click to toggle source
# File lib/troshka/editor/qxscintilla.rb, line 43
def line_length(line)
  # SCI_GETLINEENDPOSITION
  SendScintilla(2136, line, 0)
end
line_text(line_number) click to toggle source
# File lib/troshka/editor/qxscintilla.rb, line 48
def line_text(line_number)
  text line_number
end
move_cursor(position) click to toggle source
# File lib/troshka/editor/qxscintilla.rb, line 66
def move_cursor(position)
  line, column = position[:line], position[:column]
  line ||= current_line_number
  column ||= current_column_number
  
  setCursorPosition line, column
end
move_cursor_to_end() click to toggle source
# File lib/troshka/editor/qxscintilla.rb, line 78
def move_cursor_to_end
  setCursorPosition number_of_lines, line_length(number_of_lines)
end
number_of_lines() click to toggle source
# File lib/troshka/editor/qxscintilla.rb, line 74
def number_of_lines
  lines
end
replace_line(text, line_number=nil) click to toggle source
# File lib/troshka/editor/qxscintilla.rb, line 61
def replace_line(text, line_number=nil)
  select_line
  replaceSelectedText text
end
select_line(line_number=nil) click to toggle source
# File lib/troshka/editor/qxscintilla.rb, line 56
def select_line(line_number=nil)
  line ||= current_line_number
  setSelection line, 0, line, line_length(line)
end
user_list_activated(&block) click to toggle source

Events

# File lib/troshka/editor/qxscintilla.rb, line 24
def user_list_activated(&block)
  @autocompletion_activated = block
end

Private Instance Methods

pos() click to toggle source
# File lib/troshka/editor/qxscintilla.rb, line 92
def pos
  # SCI_GETCURRENTPOS
  SendScintilla(2008, 0, 0)
end