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/libui_base.rb,
lib/libui/fiddle_patch.rb
Defined Under Namespace
Modules: FFI, Utils Classes: Error, LibraryLoadError, LibraryNotFoundError
Constant Summary collapse
- ForEachContinue =
ForEach
0- ForEachStop =
1- WindowResizeEdgeLeft =
WindowResizeEdge
0- WindowResizeEdgeTop =
1- WindowResizeEdgeRight =
2- WindowResizeEdgeBottom =
3- WindowResizeEdgeTopLeft =
4- WindowResizeEdgeTopRight =
5- WindowResizeEdgeBottomLeft =
6- WindowResizeEdgeBottomRight =
7- DrawBrushTypeSolid =
DrawBrushType
0- DrawBrushTypeLinearGradient =
1- DrawBrushTypeRadialGradient =
2- DrawBrushTypeImage =
3- DrawLineCapFlat =
DrawLineCap
0- DrawLineCapRound =
1- DrawLineCapSquare =
2- DrawLineJoinMiter =
DrawLineJoin
0- DrawLineJoinRound =
1- DrawLineJoinBevel =
2- DrawDefaultMiterLimit =
10.0- DrawFillModeWinding =
DrawFillMode
0- DrawFillModeAlternate =
1- AttributeTypeFamily =
AttributeType
0- AttributeTypeSize =
1- AttributeTypeWeight =
2- AttributeTypeItalic =
3- AttributeTypeStretch =
4- AttributeTypeColor =
5- AttributeTypeBackground =
6- AttributeTypeUnderline =
7- AttributeTypeUnderlineColor =
8- AttributeTypeFeatures =
9- TextWeightMinimum =
TextWeight
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 =
TextItalic
0- TextItalicOblique =
1- TextItalicItalic =
2- TextStretchUltraCondensed =
TextStretch
0- TextStretchExtraCondensed =
1- TextStretchCondensed =
2- TextStretchSemiCondensed =
3- TextStretchNormal =
4- TextStretchSemiExpanded =
5- TextStretchExpanded =
6- TextStretchExtraExpanded =
7- TextStretchUltraExpanded =
8- UnderlineNone =
Underline
0- UnderlineSingle =
1- UnderlineDouble =
2- UnderlineSuggestion =
3- UnderlineColorCustom =
UnderlineColor
0- UnderlineColorSpelling =
1- UnderlineColorGrammar =
2- UnderlineColorAuxiliary =
3- DrawTextAlignLeft =
DrawTextAlign
0- DrawTextAlignCenter =
1- DrawTextAlignRight =
2- ModifierCtrl =
Modifiers
(1 << 0)
- ModifierAlt =
(1 << 1)
- ModifierShift =
(1 << 2)
- ModifierSuper =
(1 << 3)
- ExtKeyEscape =
ExtKey
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 =
Align
0- AlignStart =
1- AlignCenter =
2- AlignEnd =
3- AtLeading =
At
0- AtTop =
1- AtTrailing =
2- AtBottom =
3- ImageViewContentCenter =
ImageViewContentMode
0- ImageViewContentFit =
1- TableValueTypeString =
TableValueType
0- TableValueTypeImage =
1- TableValueTypeInt =
2- TableValueTypeColor =
3- SortIndicatorNone =
SortIndicator
0- SortIndicatorAscending =
1- SortIndicatorDescending =
2- TableModelColumnNeverEditable =
editable
-1
- TableModelColumnAlwaysEditable =
-2
- TableSelectionModeNone =
TableSelectionMode
0- TableSelectionModeZeroOrOne =
1- TableSelectionModeOne =
2- TableSelectionModeZeroOrMany =
3- VERSION =
'0.3.0.pre'
Class Attribute Summary collapse
-
.ffi_lib ⇒ Object
Returns the value of attribute ffi_lib.
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
154 155 156 |
# File 'lib/libui.rb', line 154 def attributed_string_append_unattributed(attributed_string, str = '') super(attributed_string, str) end |
.button_set_text(button, text = '') ⇒ Object
74 75 76 |
# File 'lib/libui.rb', line 74 def (, text = '') super(, text) end |
.checkbox_set_text(checkbox, text = '') ⇒ Object
78 79 80 |
# File 'lib/libui.rb', line 78 def checkbox_set_text(checkbox, text = '') super(checkbox, text) end |
.combobox_append(combobox, text = '') ⇒ Object
102 103 104 |
# File 'lib/libui.rb', line 102 def combobox_append(combobox, text = '') super(combobox, text) end |
.combobox_insert_at(combobox, index, text = '') ⇒ Object
106 107 108 |
# File 'lib/libui.rb', line 106 def combobox_insert_at(combobox, index, text = '') super(combobox, index, text) end |
.editable_combobox_append(combobox, text = '') ⇒ Object
110 111 112 |
# File 'lib/libui.rb', line 110 def editable_combobox_append(combobox, text = '') super(combobox, text) end |
.editable_combobox_set_text(combobox, text = '') ⇒ Object
114 115 116 |
# File 'lib/libui.rb', line 114 def editable_combobox_set_text(combobox, text = '') super(combobox, text) end |
.entry_set_text(entry, text = '') ⇒ Object
82 83 84 |
# File 'lib/libui.rb', line 82 def entry_set_text(entry, text = '') super(entry, text) end |
.group_set_title(group, title = '') ⇒ Object
94 95 96 |
# File 'lib/libui.rb', line 94 def group_set_title(group, title = '') super(group, title) end |
.init(opt = nil) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/libui.rb', line 44 def init(opt = nil) # Allocate uiInitOptions if not provided unless opt opt = FFI::InitOptions.malloc opt.to_ptr.free = Fiddle::RUBY_FREE opt.Size = FFI::InitOptions.size end err_ptr = super(opt) # uiInit returns const char* error or NULL on success return nil if err_ptr.null? # Convert C string to Ruby string and free the error string per API contract err_msg = err_ptr.to_s free_init_error(err_ptr) warn err_msg nil end |
.label_set_text(label, text = '') ⇒ Object
86 87 88 |
# File 'lib/libui.rb', line 86 def label_set_text(label, text = '') super(label, text) end |
.menu_append_check_item(menu, name = '') ⇒ Object
134 135 136 |
# File 'lib/libui.rb', line 134 def (, name = '') super(, name) end |
.menu_append_item(menu, name = '') ⇒ Object
130 131 132 |
# File 'lib/libui.rb', line 130 def (, name = '') super(, name) end |
.msg_box(parent, title, description = '') ⇒ Object
142 143 144 |
# File 'lib/libui.rb', line 142 def msg_box(parent, title, description = '') super(parent, title, description) end |
.msg_box_error(parent, title, description = '') ⇒ Object
146 147 148 |
# File 'lib/libui.rb', line 146 def msg_box_error(parent, title, description = '') super(parent, title, description) end |
.multiline_entry_append(entry, text = '') ⇒ Object
126 127 128 |
# File 'lib/libui.rb', line 126 def multiline_entry_append(entry, text = '') super(entry, text) end |
.multiline_entry_set_text(entry, text = '') ⇒ Object
122 123 124 |
# File 'lib/libui.rb', line 122 def multiline_entry_set_text(entry, text = '') super(entry, text) end |
.new_attributed_string(initial_string = '') ⇒ Object
150 151 152 |
# File 'lib/libui.rb', line 150 def new_attributed_string(initial_string = '') super(initial_string) end |
.new_button(text = '') ⇒ Object
62 63 64 |
# File 'lib/libui.rb', line 62 def (text = '') super(text) end |
.new_checkbox(text = '') ⇒ Object
66 67 68 |
# File 'lib/libui.rb', line 66 def new_checkbox(text = '') super(text) end |
.new_group(title = '') ⇒ Object
98 99 100 |
# File 'lib/libui.rb', line 98 def new_group(title = '') super(title) end |
.new_label(text = '') ⇒ Object
90 91 92 |
# File 'lib/libui.rb', line 90 def new_label(text = '') super(text) end |
.new_menu(name = '') ⇒ Object
138 139 140 |
# File 'lib/libui.rb', line 138 def (name = '') super(name) end |
.new_table_value_string(str = '') ⇒ Object
158 159 160 |
# File 'lib/libui.rb', line 158 def new_table_value_string(str = '') super(str) end |
.open_type_features_add(otf, a, b, c, d, value) ⇒ Object
FIXME: This is a workaround for a old version of Fiddle. Fiddle 1.1.2 and above should be able to handle one character string. See https://github.com/ruby/fiddle/issues/96
181 182 183 184 |
# File 'lib/libui.rb', line 181 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
191 192 193 194 |
# File 'lib/libui.rb', line 191 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
186 187 188 189 |
# File 'lib/libui.rb', line 186 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 |
.radio_buttons_append(radio_buttons, text = '') ⇒ Object
118 119 120 |
# File 'lib/libui.rb', line 118 def (, text = '') super(, text) end |
.window_position(w) ⇒ Array
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.
168 169 170 171 172 173 174 175 |
# File 'lib/libui.rb', line 168 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
70 71 72 |
# File 'lib/libui.rb', line 70 def window_set_title(window, title = '') super(window, title) end |