Module: WR::ModKeyAccel
- Defined in:
- lib/wrb/toplevelcommon.rb
Constant Summary collapse
- FVIRTKEY =
0x01- FNOINVERT =
0x02- FSHIFT =
0x04- FCONTROL =
0x08- FALT =
0x10- FVirt =
{"Shift"=>FSHIFT, "Ctrl"=>FCONTROL, "Alt" =>FALT}
- VFuncKey =
{ "F1"=>0x70, "F2"=>0x71, "F3"=>0x72, "F4"=>0x73,"F5"=>0x74, "F6"=>0x75, "F7"=>0x76, "F8"=>0x77, "F9"=>0x78, "F10"=>0x79, "F11"=>0x7a, "F12"=>0x7b, "Insert"=>0x2d, "Delete"=>0x2e, "PageUp"=>0x21, "PageDown"=>0x22, "End"=>0x23, "Home"=>0x24 }
Class Method Summary collapse
Class Method Details
.parse_keyaccel(txt, cmd = nil) ⇒ Object
324 325 326 327 328 329 330 331 332 333 334 335 |
# File 'lib/wrb/toplevelcommon.rb', line 324 def parse_keyaccel(txt, cmd=nil) fvirt = FVIRTKEY ar = txt.strip.split(/\+/) if (str=ar.pop).length > 1 vk = VFuncKey[str] raise "Illegal key `#{str}'" unless vk else vk = str.upcase.unpack('c')[0] end ar.each{|i| fvirt += FVirt[i.strip] || raise("Illegal virtual key `#{i}'")} [fvirt, vk, cmd] end |