Class: LibuiParadise::GUI::LibUI::TableExample
- Inherits:
-
Base
- Object
- Base
- LibuiParadise::GUI::LibUI::TableExample
show all
- Defined in:
- lib/libui_paradise/examples/complex/010_table_example.rb
Overview
LibuiParadise::GUI::LibUI::TableExample
Constant Summary
collapse
- DATA =
[
%w( cat calm meow ),
%w( dog loyal woof ),
%w( chicken bird cock-a-doodle-doo ),
%w( horse fast neigh ),
%w( cow slow moo ),
%w( one two three ),
%w( 1 2 3 ),
%w( 4 5 6 ),
%w( 7 8 9 )
- TITLE =
'A TableExample for LibUI'
- WIDTH =
800
- HEIGHT =
520
Instance Method Summary
collapse
Methods inherited from Base
[], #add_these_widgets_to_the_main_window, #create_the_skeleton, #default_title_width_height, #run_in_the_background, #update_the_main_window
Methods included from BaseModule
#abort_on_exception, #append_this_array_to_that_combobox, #area, #assumed_height?, #assumed_width?, #bold_button, #bold_label, #bold_text_left_aligned, #button, #chdir, #checkbox, #checked_checkbox, #close_properly, #colour_button, #colour_to_rgb, #combobox, #commandline_arguments?, #connect_skeleton, #copy, #copy_file, #create_directory, #create_grid, #create_skeleton_then_connect_skeleton, #create_table, #create_the_skeleton, #current_widget_pointer_type?, #delete_file, #do_quit, #editable_combobox, #entry, #error_msg, #esystem, #exit_from, #fancy_text, #font, #font_button, #free_table_model, #gtk3?, #hbox, #height?, #horizontal_separator, #image, #is_on_roebe?, #is_on_windows?, #label, #last_pointer?, #left_arrow?, #main_hash?, #main_then_quit, #menu, #message_box_error, #multiline_entry, #new_brush, #non_wrapping_multiline_entry, #parse_this_file_into_a_table, #password_entry, #quit_button, #radio_buttons, #register_this_fiddle_pointer_widget, #reset_the_internal_hash, #return_button_for_opening_a_local_file, #return_default_window, #return_pwd, #return_the_resolution_using_xrandr, #run_main, #scrolling_area, #search_entry, #selected?, #set_commandline_arguments, #set_height, #set_main_window, #set_title, #set_width, #set_window, #sfancy, #sfile, #slider, #spinbox, #tab, #table, #text?, #text_layout, #title?, #title_width_height, #title_width_height_font, #try_to_parse_this_config_file, #try_to_use_this_font, #two_elements_hbox, #ui_draw_text_layout_params, #ui_font_descriptor, #ui_margined_main_window, #ui_msg_box, #ui_open_file, #ui_padded_grid, #ui_padded_hbox, #ui_padded_vbox, #ui_sync_connect, #ui_table_params_malloc, #ui_text_then_entry, #use_gtk3?, #use_gtk?, #use_libui?, #vbox, #vertical_separator, #width?, #window, #window?, #without_trailing_comment, #wrapper_new_progress_bar
Constructor Details
#initialize(run_already = true) ⇒ TableExample
50
51
52
53
54
55
|
# File 'lib/libui_paradise/examples/complex/010_table_example.rb', line 50
def initialize(
run_already = true
)
reset
run if run_already
end
|
Instance Method Details
#create_skeleton ⇒ Object
#
create_skeleton (create tag, skeleton tag)
#
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/libui_paradise/examples/complex/010_table_example.rb', line 68
def create_skeleton
set_window(return_default_window)
@block_callers = []
end
|
#rbcallback(*args, &block) ⇒ Object
82
83
84
85
86
87
|
# File 'lib/libui_paradise/examples/complex/010_table_example.rb', line 82
def rbcallback(*args, &block)
args << [0] if args.size == 1 block_caller = Fiddle::Closure::BlockCaller.new(*args, &block)
@block_callers << block_caller
block_caller
end
|
#run ⇒ Object
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
# File 'lib/libui_paradise/examples/complex/010_table_example.rb', line 92
def run
super()
outer_vbox = padded_vbox
outer_vbox.add_hsep
grid = padded_grid
grid.ui_grid_append(text('Testing tables'), 0, 0, 1, 1, 0, 0.5, 1, 0)
outer_vbox.minimal(grid)
model_handler = ::LibUI::FFI::TableModelHandler.malloc
model_handler.to_ptr.free = Fiddle::RUBY_FREE
model_handler.NumColumns = rbcallback(4) { 2 }
model_handler.ColumnType = rbcallback(4) { 0 }
model_handler.NumRows = rbcallback(4) { 5 }
model_handler.CellValue = rbcallback(1, [1, 1, 4, 4]) do |_, _, row, column|
::LibUI.new_table_value_string(
DATA[row][column] )
end
model_handler.SetCellValue = rbcallback(0, [0]) {}
model = ::LibUI.new_table_model(model_handler)
table_params = ui_table_params_malloc(model)
table = create_table(table_params)
table.append_text_column('Animal', 0)
table.append_text_column('Description', 1)
table.append_text_column('TEST', 2)
outer_vbox.maximal(table)
button1 = button('Show the current selection in the table')
button1.on_clicked {
e 'This is currently not implemented.'
}
outer_vbox.minimal(
button1
)
outer_vbox.minimal(quit_button)
main_window? << outer_vbox
main_window?.intelligent_exit
free_table_model(model)
end
|