Module: Iup::ScrollBarAttributes

Extended by:
AttributeBuilders
Included in:
Canvas, ScrollBox
Defined in:
lib/wrapped/scrollbar-attributes.rb

Overview

Attributes for widgets that permit a scrollbar.

For all these attributes, the optional argument is used to set the value, else the current value is returned.

Attributes

xautohide

If set, hides horizontal scrollbar if not required. Values ‘yes’ / ‘no’.

yautohide

If set, hides vertical scrollbar if not required. Values ‘yes’ / ‘no’.

Instance Method Summary collapse

Methods included from AttributeBuilders

define_attribute, define_id_attribute, define_id_readonly, define_id_writeonly, define_property_attribute, define_property_writeonly, define_readonly, define_writeonly

Instance Method Details

#dx(val = nil) ⇒ Object

Defines the size of the horizontal thumbnail. Size defaults to 0.1, and must be in range 0 < value < (xmax-xmin).



20
21
22
23
24
25
26
27
# File 'lib/wrapped/scrollbar-attributes.rb', line 20

def dx val=nil
  if val.nil?
    result = IupLib.IupGetAttribute(@handle, 'DX').first
    result.to_f
  else
    IupLib.IupSetAttribute @handle, 'DX', val.to_s
  end
end

#dy(val = nil) ⇒ Object

Defines the size of the vertical thumbnail. Size defaults to 0.1, and must be in range 0 < value < (ymax-ymin).



31
32
33
34
35
36
37
38
# File 'lib/wrapped/scrollbar-attributes.rb', line 31

def dy val=nil
  if val.nil?
    result = IupLib.IupGetAttribute(@handle, 'DY').first
    result.to_f
  else
    IupLib.IupSetAttribute @handle, 'DY', val.to_s
  end
end

#linex(val = nil) ⇒ Object

Amount thumb moves in horizontal direction. Default is dx/10.



103
104
105
106
107
108
109
110
# File 'lib/wrapped/scrollbar-attributes.rb', line 103

def linex val=nil
  if val.nil?
    result = IupLib.IupGetAttribute(@handle, 'LINEX').first
    result.to_f
  else
    IupLib.IupSetAttribute @handle, 'LINEX', val.to_s
  end
end

#liney(val = nil) ⇒ Object

Amount thumb moves in vertical direction. Default is dy/10.



113
114
115
116
117
118
119
120
# File 'lib/wrapped/scrollbar-attributes.rb', line 113

def liney val=nil
  if val.nil?
    result = IupLib.IupGetAttribute(@handle, 'LINEY').first
    result.to_f
  else
    IupLib.IupSetAttribute @handle, 'LINEY', val.to_s
  end
end

#posx(val = nil) ⇒ Object

Position of horizontal thumbnail. Size starts at 0.0, and must be in range xmin < value < (xmax-dx).



42
43
44
45
46
47
48
49
# File 'lib/wrapped/scrollbar-attributes.rb', line 42

def posx val=nil
  if val.nil?
    result = IupLib.IupGetAttribute(@handle, 'POSX').first
    result.to_f
  else
    IupLib.IupSetAttribute @handle, 'POSX', val.to_s
  end
end

#posy(val = nil) ⇒ Object

Position of vertical thumbnail. Size starts at 0.0, and must be in range ymin < value < (ymax-dy).



53
54
55
56
57
58
59
60
# File 'lib/wrapped/scrollbar-attributes.rb', line 53

def posy val=nil
  if val.nil?
    result = IupLib.IupGetAttribute(@handle, 'POSY').first
    result.to_f
  else
    IupLib.IupSetAttribute @handle, 'POSY', val.to_s
  end
end

#scroll_cb(callback) ⇒ Object

Called when scrollbar used. Callback must take three arguments:

op

operation performed on scrollbar, see Iup

posx

x position of scroll thumb (same as posx attribute)

posy

y position of scroll thumb (same as posy attribute)



130
131
132
133
134
135
136
137
138
# File 'lib/wrapped/scrollbar-attributes.rb', line 130

def scroll_cb callback
  unless callback.arity == 3
    raise ArgumentError, 'scroll_cb callback must take 3 arguments: (op, posx, posy)'
  end
  cb = Proc.new do |ih, op, posx, posy|
    callback.call op, posx, posy
  end
  define_callback cb, 'SCROLL_CB', :iff_i
end

#xmax(val = nil) ⇒ Object

Maximum value of horizontal scrollbar. Defaults to 1.0.



83
84
85
86
87
88
89
90
# File 'lib/wrapped/scrollbar-attributes.rb', line 83

def xmax val=nil
  if val.nil?
    result = IupLib.IupGetAttribute(@handle, 'XMAX').first
    result.to_f
  else
    IupLib.IupSetAttribute @handle, 'XMAX', val.to_s
  end
end

#xmin(val = nil) ⇒ Object

Minimum value of horizontal scrollbar. Starts at 0.0.



63
64
65
66
67
68
69
70
# File 'lib/wrapped/scrollbar-attributes.rb', line 63

def xmin val=nil
  if val.nil?
    result = IupLib.IupGetAttribute(@handle, 'XMIN').first
    result.to_f
  else
    IupLib.IupSetAttribute @handle, 'XMIN', val.to_s
  end
end

#ymax(val = nil) ⇒ Object

Maximum value of vertical scrollbar. Defaults to 1.0.



93
94
95
96
97
98
99
100
# File 'lib/wrapped/scrollbar-attributes.rb', line 93

def ymax val=nil
  if val.nil?
    result = IupLib.IupGetAttribute(@handle, 'YMAX').first
    result.to_f
  else
    IupLib.IupSetAttribute @handle, 'YMAX', val.to_s
  end
end

#ymin(val = nil) ⇒ Object

Minimum value of vertical scrollbar. Starts at 0.0.



73
74
75
76
77
78
79
80
# File 'lib/wrapped/scrollbar-attributes.rb', line 73

def ymin val=nil
  if val.nil?
    result = IupLib.IupGetAttribute(@handle, 'YMIN').first
    result.to_f
  else
    IupLib.IupSetAttribute @handle, 'YMIN', val.to_s
  end
end