Class: CDK::FSLIDER
Instance Attribute Summary
Attributes inherited from CDKOBJS
#BXAttr, #HZChar, #LLChar, #LRChar, #ULChar, #URChar, #VTChar, #accepts_focus, #binding_list, #border_size, #box, #exit_type, #has_focus, #is_visible, #screen, #screen_index
Instance Method Summary
collapse
-
#drawField ⇒ Object
-
#formattedSize(value) ⇒ Object
-
#getDigits ⇒ Object
-
#initialize(cdkscreen, xplace, yplace, title, label, filler, field_width, start, low, high, inc, fast_inc, digits, box, shadow) ⇒ FSLIDER
constructor
A new instance of FSLIDER.
-
#object_type ⇒ Object
-
#SCAN_FMT ⇒ Object
-
#setDigits(digits) ⇒ Object
Methods inherited from SLIDER
Decrement, Increment, #activate, #destroy, #draw, #erase, #focus, #getHighValue, #getLowValue, #getValue, #inject, #limitCurrentValue, #move, #moveToEditPosition, #performEdit, #position, removeChar, #set, #setBKattr, #setEditPosition, #setLowHigh, #setValue, #unfocus, #validEditPosition
Methods inherited from CDKOBJS
#SCREEN_XPOS, #SCREEN_YPOS, #bind, #bindableObject, #checkBind, #cleanBindings, #cleanTitle, #destroy, #draw, #drawTitle, #erase, #focus, #getBox, #getc, #getch, #inject, #isBind, #move, #move_specific, #position, #refreshData, #saveData, #setBXattr, #setBackgroundColor, #setBox, #setExitType, #setHZchar, #setLLchar, #setLRchar, #setPostProcess, #setPreProcess, #setTitle, #setULchar, #setURchar, #setVTchar, #unbind, #unfocus, #validCDKObject, #validObjType
Constructor Details
#initialize(cdkscreen, xplace, yplace, title, label, filler, field_width, start, low, high, inc, fast_inc, digits, box, shadow) ⇒ FSLIDER
5
6
7
8
9
10
|
# File 'lib/cdk/fslider.rb', line 5
def initialize(cdkscreen, xplace, yplace, title, label, filler,
field_width, start, low, high, inc, fast_inc, digits, box, shadow)
@digits = digits
super(cdkscreen, xplace, yplace, title, label, filler, field_width,
start, low, high, inc, fast_inc, box, shadow)
end
|
Instance Method Details
#drawField ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/cdk/fslider.rb', line 13
def drawField
step = 1.0 * @field_width / (@high - @low)
filler_characters = (@current - @low) * step
@field_win.werase
(0...filler_characters).each do |x|
@field_win.mvwaddch(0, x, @filler)
end
digits = [@digits, 30].min
format = '%%.%if' % [digits]
temp = format % [@current]
Draw.writeCharAttrib(@field_win, @field_width, 0, temp,
Ncurses::A_NORMAL, CDK::HORIZONTAL, 0, temp.size)
self.moveToEditPosition(@field_edit)
@field_win.wrefresh
end
|
38
39
40
41
42
43
|
# File 'lib/cdk/fslider.rb', line 38
def formattedSize(value)
digits = [@digits, 30].min
format = '%%.%if' % [digits]
temp = format % [value]
return temp.size
end
|
#getDigits ⇒ Object
49
50
51
|
# File 'lib/cdk/fslider.rb', line 49
def getDigits
return @digits
end
|
#object_type ⇒ Object
57
58
59
|
# File 'lib/cdk/fslider.rb', line 57
def object_type
:FSLIDER
end
|
#SCAN_FMT ⇒ Object
53
54
55
|
# File 'lib/cdk/fslider.rb', line 53
def SCAN_FMT
'%g%c'
end
|
#setDigits(digits) ⇒ Object
45
46
47
|
# File 'lib/cdk/fslider.rb', line 45
def setDigits(digits)
@digits = [0, digits].max
end
|