class Twiddler::Config::MouseChord

Attributes

buttons[R]
mods[R]

Public Class Methods

new() click to toggle source
Calls superclass method Twiddler::Config::Chord::new
# File lib/twiddler/config.rb, line 313
def initialize
  super
  @mods = {
    :ctrl => false,
    :alt => false,
    :shift => false,
    :double => false,
    :toggle => false
  }
  @buttons = {
    :left => false,
    :middle => false,
    :right => false
  }
end

Public Instance Methods

data=(bits) click to toggle source
# File lib/twiddler/config.rb, line 331
def data=(bits)
  if bits[0] == ?1
    @mods[:ctrl] = true
  end
  if bits[1] == ?1 
    @mods[:alt] = true
  end
  if bits[2] == ?1 
    @mods[:shift] = true
  end
  if bits[3] == ?1 
    @mods[:double] = true
  end
  if bits[4] == ?1 
    @mods[:toggle] = true
  end
  if bits[5] == ?1 
    @buttons[:middle] = true
  end
  if bits[6] == ?1 
    @buttons[:right] = true
  end
  if bits[7] == ?1 
    @buttons[:left] = true
  end
end
render_action() click to toggle source
# File lib/twiddler/config.rb, line 358
def render_action
  action = ""
  if @mods[:ctrl]
    action << "Ctl-"
  end
  if @mods[:alt]
    action << "Alt-"
  end
  if @mods[:shift]
    action << "Shf-"
  end
  if @mods[:double]
    action << "Dbl-"
  end
  if @mods[:toggle]
    action << "Tgl-"
  end
  if @buttons[:middle]
    action << "M"
  end
  if @buttons[:right]
    action << "R"
  end
  if @buttons[:left]
    action << "L"
  end
  return action
end