Class: Cursor

Inherits:
Object show all
Defined in:
lib/xiki/cursor.rb

Constant Summary collapse

@@remember =
{}

Class Method Summary collapse

Class Method Details

.barObject



33
34
35
36
# File 'lib/xiki/cursor.rb', line 33

def self.bar
  $el.el4r_lisp_eval "(customize-set-variable 'cursor-type '(bar . 2))"
  nil
end

.blackObject



71
72
73
74
# File 'lib/xiki/cursor.rb', line 71

def self.black
  $el.set_face_background :cursor, "#000000"
  nil
end

.black_boxObject



92
93
94
95
# File 'lib/xiki/cursor.rb', line 92

def self.black_box
  self.black
  self.box
end

.blueObject



55
56
57
58
# File 'lib/xiki/cursor.rb', line 55

def self.blue
  $el.set_face_background :cursor, "#0099ff"
  nil
end

.blue_hollowObject



80
81
82
83
# File 'lib/xiki/cursor.rb', line 80

def self.blue_hollow
  self.blue
  self.hollow
end

.blue_underscoreObject



88
89
90
91
# File 'lib/xiki/cursor.rb', line 88

def self.blue_underscore
  self.blue
  self.underscore
end

.boxObject



37
38
39
40
# File 'lib/xiki/cursor.rb', line 37

def self.box
  $el.customize_set_variable :cursor_type, :box
  nil
end

.color(color) ⇒ Object



50
51
52
53
# File 'lib/xiki/cursor.rb', line 50

def self.color color
  $el.set_face_background :cursor, color
  nil
end

.greenObject



63
64
65
66
# File 'lib/xiki/cursor.rb', line 63

def self.green
  $el.set_face_background :cursor, "#33bb00"
  nil
end

.green_underscoreObject



84
85
86
87
# File 'lib/xiki/cursor.rb', line 84

def self.green_underscore
  self.green
  self.underscore
end

.hollowObject



45
46
47
48
# File 'lib/xiki/cursor.rb', line 45

def self.hollow
  $el.customize_set_variable :cursor_type, :hollow
  nil
end


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/xiki/cursor.rb', line 5

def self.menu
  %`
  > Summary
  | Api for changing the cursor
  |
  - colors/
    @Cursor.white
    @Cursor.red
    @Cursor.green
    @Cursor.blue
    @Cursor.color "#80f"
  - shapes/
    @Cursor.bar
    @Cursor.underscore
    @Cursor.hollow
    @Cursor.box
  - colors and shapes/
    @Cursor.red_bar
    @Cursor.green_underscore
    @Cursor.blue_hollow
    @Cursor.black_box
  - remembering and restoring cursor/
    @Cursor.remember :a
    @Cursor.restore :a
  `

end

.redObject



59
60
61
62
# File 'lib/xiki/cursor.rb', line 59

def self.red
  $el.set_face_background :cursor, "#ff3300"
  nil
end

.red_barObject



76
77
78
79
# File 'lib/xiki/cursor.rb', line 76

def self.red_bar
  self.red
  self.bar
end

.remember(symbol = :default) ⇒ Object



97
98
99
100
# File 'lib/xiki/cursor.rb', line 97

def self.remember symbol=:default
  # Save is hash for later restoring (only if not there yet)
  @@remember[symbol] = [$el.elvar.cursor_type, $el.face_background(:cursor)]
end

.restore(symbol = :default) ⇒ Object



102
103
104
105
106
107
# File 'lib/xiki/cursor.rb', line 102

def self.restore symbol=:default
  before = @@remember[symbol]
  return Cursor.black_box unless before  # Black if not found
  type, color = before
  $el.customize_set_variable :cursor_type, type
end

.underscoreObject



41
42
43
44
# File 'lib/xiki/cursor.rb', line 41

def self.underscore
  $el.el4r_lisp_eval "(customize-set-variable 'cursor-type '(hbar . 3))"
  nil
end

.whiteObject



67
68
69
70
# File 'lib/xiki/cursor.rb', line 67

def self.white
  $el.set_face_background :cursor, "#ffffff"
  nil
end