Module: LibUI
- Defined in:
- lib/libui.rb,
lib/libui/ffi.rb,
lib/libui/error.rb,
lib/libui/utils.rb,
lib/libui/version.rb,
lib/libui/platform.rb,
lib/libui/libui_base.rb,
lib/libui/fiddle_patch.rb
Defined Under Namespace
Modules: FFI, Platform, Utils
Classes: Error, LibraryLoadError, LibraryNotFoundError
Constant Summary
collapse
- ForEachContinue =
0
- ForEachStop =
1
- WindowResizeEdgeLeft =
0
- WindowResizeEdgeTop =
1
- WindowResizeEdgeRight =
2
- WindowResizeEdgeBottom =
3
- WindowResizeEdgeTopLeft =
4
- WindowResizeEdgeTopRight =
5
- WindowResizeEdgeBottomLeft =
6
- WindowResizeEdgeBottomRight =
7
- DrawBrushTypeSolid =
0
- DrawBrushTypeLinearGradient =
1
- DrawBrushTypeRadialGradient =
2
- DrawBrushTypeImage =
3
- DrawLineCapFlat =
0
- DrawLineCapRound =
1
- DrawLineCapSquare =
2
- DrawLineJoinMiter =
0
- DrawLineJoinRound =
1
- DrawLineJoinBevel =
2
- DrawDefaultMiterLimit =
10.0
- DrawFillModeWinding =
0
- DrawFillModeAlternate =
1
- AttributeTypeFamily =
0
- AttributeTypeSize =
1
- AttributeTypeWeight =
2
- AttributeTypeItalic =
3
- AttributeTypeStretch =
4
- AttributeTypeColor =
5
- AttributeTypeBackground =
6
- AttributeTypeUnderline =
7
- AttributeTypeUnderlineColor =
8
- AttributeTypeFeatures =
9
- TextWeightMinimum =
0
- TextWeightThin =
100
- TextWeightUltraLight =
200
- TextWeightLight =
300
- TextWeightBook =
350
- TextWeightNormal =
400
- TextWeightMedium =
500
- TextWeightSemiBold =
600
- TextWeightBold =
700
- TextWeightUltraBold =
800
- TextWeightHeavy =
900
- TextWeightUltraHeavy =
950
- TextWeightMaximum =
1000
- TextItalicNormal =
0
- TextItalicOblique =
1
- TextItalicItalic =
2
- TextStretchUltraCondensed =
0
1
- TextStretchCondensed =
2
- TextStretchSemiCondensed =
3
- TextStretchNormal =
4
- TextStretchSemiExpanded =
5
- TextStretchExpanded =
6
- TextStretchExtraExpanded =
7
- TextStretchUltraExpanded =
8
- UnderlineNone =
0
- UnderlineSingle =
1
- UnderlineDouble =
2
- UnderlineSuggestion =
3
- UnderlineColorCustom =
0
- UnderlineColorSpelling =
1
- UnderlineColorGrammar =
2
- UnderlineColorAuxiliary =
3
- DrawTextAlignLeft =
0
- DrawTextAlignCenter =
1
- DrawTextAlignRight =
2
- ModifierCtrl =
(1 << 0)
- ModifierAlt =
(1 << 1)
- ModifierShift =
(1 << 2)
- ModifierSuper =
(1 << 3)
- ExtKeyEscape =
1
- ExtKeyInsert =
2
- ExtKeyDelete =
3
- ExtKeyHome =
4
- ExtKeyEnd =
5
- ExtKeyPageUp =
6
- ExtKeyPageDown =
7
- ExtKeyUp =
8
- ExtKeyDown =
9
- ExtKeyLeft =
10
- ExtKeyRight =
11
- ExtKeyF1 =
12
- ExtKeyF2 =
13
- ExtKeyF3 =
14
- ExtKeyF4 =
15
- ExtKeyF5 =
16
- ExtKeyF6 =
17
- ExtKeyF7 =
18
- ExtKeyF8 =
19
- ExtKeyF9 =
20
- ExtKeyF10 =
21
- ExtKeyF11 =
22
- ExtKeyF12 =
23
- ExtKeyN0 =
24
- ExtKeyN1 =
25
- ExtKeyN2 =
26
- ExtKeyN3 =
27
- ExtKeyN4 =
28
- ExtKeyN5 =
29
- ExtKeyN6 =
30
- ExtKeyN7 =
31
- ExtKeyN8 =
32
- ExtKeyN9 =
33
- ExtKeyNDot =
34
- ExtKeyNEnter =
35
- ExtKeyNAdd =
36
- ExtKeyNSubtract =
37
- ExtKeyNMultiply =
38
- ExtKeyNDivide =
39
- AlignFill =
0
- AlignStart =
1
- AlignCenter =
2
- AlignEnd =
3
- AtLeading =
0
- AtTop =
1
- AtTrailing =
2
- AtBottom =
3
- ImageViewContentCenter =
0
- ImageViewContentFit =
1
- TableValueTypeString =
0
- TableValueTypeImage =
1
- TableValueTypeInt =
2
- TableValueTypeColor =
3
- SortIndicatorNone =
0
- SortIndicatorAscending =
1
- SortIndicatorDescending =
2
- TableModelColumnNeverEditable =
-1
- TableModelColumnAlwaysEditable =
-2
- TableSelectionModeNone =
0
- TableSelectionModeZeroOrOne =
1
- TableSelectionModeOne =
2
- TableSelectionModeZeroOrMany =
3
- VERSION =
'0.3.0.pre2'
Class Attribute Summary collapse
Class Method Summary
collapse
-
.attributed_string_append_unattributed(attributed_string, str = '') ⇒ Object
-
.button_set_text(button, text = '') ⇒ Object
-
.checkbox_set_text(checkbox, text = '') ⇒ Object
-
.combobox_append(combobox, text = '') ⇒ Object
-
.combobox_insert_at(combobox, index, text = '') ⇒ Object
-
.editable_combobox_append(combobox, text = '') ⇒ Object
-
.editable_combobox_set_text(combobox, text = '') ⇒ Object
-
.entry_set_text(entry, text = '') ⇒ Object
-
.group_set_title(group, title = '') ⇒ Object
-
.init(opt = nil) ⇒ Object
-
.label_set_text(label, text = '') ⇒ Object
-
.menu_append_check_item(menu, name = '') ⇒ Object
-
.menu_append_item(menu, name = '') ⇒ Object
-
.msg_box(parent, title, description = '') ⇒ Object
-
.msg_box_error(parent, title, description = '') ⇒ Object
-
.multiline_entry_append(entry, text = '') ⇒ Object
-
.multiline_entry_set_text(entry, text = '') ⇒ Object
-
.new_attributed_string(initial_string = '') ⇒ Object
-
.new_button(text = '') ⇒ Object
-
.new_checkbox(text = '') ⇒ Object
-
.new_group(title = '') ⇒ Object
-
.new_label(text = '') ⇒ Object
-
.new_menu(name = '') ⇒ Object
-
.new_table_value_string(str = '') ⇒ Object
-
.open_type_features_add(otf, a, b, c, d, value) ⇒ Object
FIXME: This is a workaround for a old version of Fiddle.
-
.open_type_features_get(otf, a, b, c, d, value) ⇒ Object
-
.open_type_features_remove(otf, a, b, c, d) ⇒ Object
-
.radio_buttons_append(radio_buttons, text = '') ⇒ Object
-
.window_position(w) ⇒ Array
Gets the window position.
-
.window_set_title(window, title = '') ⇒ Object
Class Attribute Details
.ffi_lib ⇒ Object
Returns the value of attribute ffi_lib.
8
9
10
|
# File 'lib/libui.rb', line 8
def ffi_lib
@ffi_lib
end
|
Class Method Details
.attributed_string_append_unattributed(attributed_string, str = '') ⇒ Object
138
139
140
|
# File 'lib/libui.rb', line 138
def attributed_string_append_unattributed(attributed_string, str = '')
super(attributed_string, str)
end
|
.button_set_text(button, text = '') ⇒ Object
58
59
60
|
# File 'lib/libui.rb', line 58
def button_set_text(button, text = '')
super(button, text)
end
|
.checkbox_set_text(checkbox, text = '') ⇒ Object
62
63
64
|
# File 'lib/libui.rb', line 62
def checkbox_set_text(checkbox, text = '')
super(checkbox, text)
end
|
.combobox_append(combobox, text = '') ⇒ Object
86
87
88
|
# File 'lib/libui.rb', line 86
def combobox_append(combobox, text = '')
super(combobox, text)
end
|
.combobox_insert_at(combobox, index, text = '') ⇒ Object
90
91
92
|
# File 'lib/libui.rb', line 90
def combobox_insert_at(combobox, index, text = '')
super(combobox, index, text)
end
|
.editable_combobox_append(combobox, text = '') ⇒ Object
94
95
96
|
# File 'lib/libui.rb', line 94
def editable_combobox_append(combobox, text = '')
super(combobox, text)
end
|
.editable_combobox_set_text(combobox, text = '') ⇒ Object
98
99
100
|
# File 'lib/libui.rb', line 98
def editable_combobox_set_text(combobox, text = '')
super(combobox, text)
end
|
.entry_set_text(entry, text = '') ⇒ Object
66
67
68
|
# File 'lib/libui.rb', line 66
def entry_set_text(entry, text = '')
super(entry, text)
end
|
.group_set_title(group, title = '') ⇒ Object
78
79
80
|
# File 'lib/libui.rb', line 78
def group_set_title(group, title = '')
super(group, title)
end
|
.init(opt = nil) ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/libui.rb', line 28
def init(opt = nil)
unless opt
opt = FFI::InitOptions.malloc
opt.to_ptr.free = Fiddle::RUBY_FREE
opt.Size = FFI::InitOptions.size
end
err_ptr = super(opt) return nil if err_ptr.null?
err_msg = err_ptr.to_s
free_init_error(err_ptr)
warn err_msg
nil
end
|
.label_set_text(label, text = '') ⇒ Object
70
71
72
|
# File 'lib/libui.rb', line 70
def label_set_text(label, text = '')
super(label, text)
end
|
118
119
120
|
# File 'lib/libui.rb', line 118
def (, name = '')
super(, name)
end
|
114
115
116
|
# File 'lib/libui.rb', line 114
def (, name = '')
super(, name)
end
|
.msg_box(parent, title, description = '') ⇒ Object
126
127
128
|
# File 'lib/libui.rb', line 126
def msg_box(parent, title, description = '')
super(parent, title, description)
end
|
.msg_box_error(parent, title, description = '') ⇒ Object
130
131
132
|
# File 'lib/libui.rb', line 130
def msg_box_error(parent, title, description = '')
super(parent, title, description)
end
|
.multiline_entry_append(entry, text = '') ⇒ Object
110
111
112
|
# File 'lib/libui.rb', line 110
def multiline_entry_append(entry, text = '')
super(entry, text)
end
|
.multiline_entry_set_text(entry, text = '') ⇒ Object
106
107
108
|
# File 'lib/libui.rb', line 106
def multiline_entry_set_text(entry, text = '')
super(entry, text)
end
|
.new_attributed_string(initial_string = '') ⇒ Object
134
135
136
|
# File 'lib/libui.rb', line 134
def new_attributed_string(initial_string = '')
super(initial_string)
end
|
46
47
48
|
# File 'lib/libui.rb', line 46
def new_button(text = '')
super(text)
end
|
.new_checkbox(text = '') ⇒ Object
50
51
52
|
# File 'lib/libui.rb', line 50
def new_checkbox(text = '')
super(text)
end
|
.new_group(title = '') ⇒ Object
82
83
84
|
# File 'lib/libui.rb', line 82
def new_group(title = '')
super(title)
end
|
.new_label(text = '') ⇒ Object
74
75
76
|
# File 'lib/libui.rb', line 74
def new_label(text = '')
super(text)
end
|
122
123
124
|
# File 'lib/libui.rb', line 122
def (name = '')
super(name)
end
|
.new_table_value_string(str = '') ⇒ Object
142
143
144
|
# File 'lib/libui.rb', line 142
def new_table_value_string(str = '')
super(str)
end
|
.open_type_features_add(otf, a, b, c, d, value) ⇒ Object
165
166
167
168
|
# File 'lib/libui.rb', line 165
def open_type_features_add(otf, a, b, c, d, value)
a, b, c, d = [a, b, c, d].map { |s| s.is_a?(String) ? s.ord : s }
super(otf, a, b, c, d, value)
end
|
.open_type_features_get(otf, a, b, c, d, value) ⇒ Object
175
176
177
178
|
# File 'lib/libui.rb', line 175
def open_type_features_get(otf, a, b, c, d, value)
a, b, c, d = [a, b, c, d].map { |s| s.is_a?(String) ? s.ord : s }
super(otf, a, b, c, d, value)
end
|
.open_type_features_remove(otf, a, b, c, d) ⇒ Object
170
171
172
173
|
# File 'lib/libui.rb', line 170
def open_type_features_remove(otf, a, b, c, d)
a, b, c, d = [a, b, c, d].map { |s| s.is_a?(String) ? s.ord : s }
super(otf, a, b, c, d)
end
|
102
103
104
|
# File 'lib/libui.rb', line 102
def radio_buttons_append(radio_buttons, text = '')
super(radio_buttons, text)
end
|
.window_position(w) ⇒ Array
Note:
This method may return inaccurate or dummy values on Unix platforms.
Gets the window position.
Coordinates are measured from the top left corner of the screen.
152
153
154
155
156
157
158
159
|
# File 'lib/libui.rb', line 152
def window_position(w)
x_ptr = Fiddle::Pointer.malloc(Fiddle::SIZEOF_INT, Fiddle::RUBY_FREE)
y_ptr = Fiddle::Pointer.malloc(Fiddle::SIZEOF_INT, Fiddle::RUBY_FREE)
super(w, x_ptr, y_ptr)
x = x_ptr[0, Fiddle::SIZEOF_INT].unpack1('i*')
y = y_ptr[0, Fiddle::SIZEOF_INT].unpack1('i*')
[x, y]
end
|
.window_set_title(window, title = '') ⇒ Object
54
55
56
|
# File 'lib/libui.rb', line 54
def window_set_title(window, title = '')
super(window, title)
end
|