gtk_paradise 0.9.120 → 0.11.19

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of gtk_paradise might be problematic. Click here for more details.

Files changed (492) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4521 -2997
  3. data/bin/genity +26 -0
  4. data/bin/gtk_editor +7 -0
  5. data/doc/README.gen +4484 -2975
  6. data/doc/todo/TODO_FOR_THE_GTK_PARADISE_PROJECT.md +281 -218
  7. data/doc/todo/recurring_todo_tasks.md +4 -3
  8. data/gtk_paradise.gemspec +28 -17
  9. data/lib/gtk_paradise/app/app.rb +77 -45
  10. data/lib/gtk_paradise/app/{app_module.rb → app_module/app_module.rb} +1064 -899
  11. data/lib/gtk_paradise/base_module/base_module.rb +7043 -33
  12. data/lib/gtk_paradise/base_module/class_methods/class_methods.rb +0 -0
  13. data/lib/gtk_paradise/base_module/css.rb +200 -268
  14. data/lib/gtk_paradise/base_module/experimental.rb +119 -0
  15. data/lib/gtk_paradise/base_module/html_support.rb +40 -15
  16. data/lib/gtk_paradise/base_module/these_methods_work_for_gtk3_and_gtk4.rb +155 -0
  17. data/lib/gtk_paradise/base_module_and_app_module/base_module_and_app_module.rb +1 -1
  18. data/lib/gtk_paradise/colours/colour_palette/material_design.rb +239 -0
  19. data/lib/gtk_paradise/colours/gtk_colour_constants.rb +8 -2
  20. data/lib/gtk_paradise/colours/parse.rb +8 -1
  21. data/lib/gtk_paradise/commandline/commandline.rb +20 -19
  22. data/lib/gtk_paradise/constants/constants.rb +227 -7
  23. data/lib/gtk_paradise/css_files/borders.css +81 -0
  24. data/lib/gtk_paradise/css_files/colours.css +329 -328
  25. data/lib/gtk_paradise/css_files/css_accordion.css +6 -2
  26. data/lib/gtk_paradise/css_files/hover_effects.css +588 -0
  27. data/lib/gtk_paradise/css_files/project.css +153 -189
  28. data/lib/gtk_paradise/drawing/README.md +3 -0
  29. data/lib/gtk_paradise/drawing/drawing.rb +68 -0
  30. data/lib/gtk_paradise/{base_module/colours.rb → drawing/event.rb} +37 -45
  31. data/lib/gtk_paradise/drawing/star.rb +96 -0
  32. data/lib/gtk_paradise/drawing/tool.rb +268 -0
  33. data/lib/gtk_paradise/drawing/turtle.rb +138 -0
  34. data/lib/gtk_paradise/emojis/emojis.rb +14 -13
  35. data/lib/gtk_paradise/examples/advanced/001_5x5_grid_example.rb +35 -50
  36. data/lib/gtk_paradise/examples/advanced/002_advanced_drag_and_drop_example.rb +21 -13
  37. data/lib/gtk_paradise/examples/advanced/003_html_like_support.rb +4 -25
  38. data/lib/gtk_paradise/examples/advanced/004_on_hover_example_on_gtk_entry.rb +4 -4
  39. data/lib/gtk_paradise/examples/advanced/005_csv_example.rb +6 -2
  40. data/lib/gtk_paradise/examples/advanced/007_label_responding_to_events_example.rb +1 -10
  41. data/lib/gtk_paradise/examples/advanced/008_options_example.rb +6 -3
  42. data/lib/gtk_paradise/examples/advanced/009_key_events.rb +1 -1
  43. data/lib/gtk_paradise/examples/advanced/010_extensive_text_view_example.rb +18 -17
  44. data/lib/gtk_paradise/examples/advanced/011_moving_blocks_example.rb +3 -3
  45. data/lib/gtk_paradise/examples/advanced/012_cell_data_sorting_example.rb +3 -4
  46. data/lib/gtk_paradise/examples/advanced/013_advanced_css_example.rb +86 -49
  47. data/lib/gtk_paradise/examples/advanced/014_popup_example.rb +9 -9
  48. data/lib/gtk_paradise/examples/advanced/015_advanced_button_example.rb +7 -19
  49. data/lib/gtk_paradise/examples/advanced/017_lean_CSS_example.rb +10 -13
  50. data/lib/gtk_paradise/examples/advanced/018_coloured_text_example.rb +7 -13
  51. data/lib/gtk_paradise/examples/advanced/019_gtk_entry_showing_the_cursor_position.rb +1 -1
  52. data/lib/gtk_paradise/examples/advanced/020_scale_this_image.rb +1 -10
  53. data/lib/gtk_paradise/examples/advanced/021_scroll_events_on_gtk_entry.rb +4 -0
  54. data/lib/gtk_paradise/examples/advanced/022_autogenerated_CSS_rounded_borders.rb +142 -0
  55. data/lib/gtk_paradise/examples/advanced/023_append_image_to_buffer.rb +145 -0
  56. data/lib/gtk_paradise/examples/advanced/024_notebook_with_tab_example.rb +151 -0
  57. data/lib/gtk_paradise/examples/advanced/025_showing_a_gold_caret_on_black_background.rb +144 -0
  58. data/lib/gtk_paradise/examples/advanced/026_status_bar_example.rb +153 -0
  59. data/lib/gtk_paradise/examples/advanced/027_customized_frame_example.rb +141 -0
  60. data/lib/gtk_paradise/examples/advanced/028_widgets_described_in_a_yaml_file.rb +240 -0
  61. data/lib/gtk_paradise/examples/cairo/basic_cairo_shapes.rb +1 -1
  62. data/lib/gtk_paradise/examples/cairo/cairo_transparent_rectangles.rb +9 -5
  63. data/lib/gtk_paradise/examples/cairo/cairo_write_via_custom_font.rb +81 -0
  64. data/lib/gtk_paradise/examples/cairo/donut_shape.rb +19 -6
  65. data/lib/gtk_paradise/examples/cairo/ping_pong_game.rb +2 -3
  66. data/lib/gtk_paradise/examples/controller/README.md +4 -0
  67. data/lib/gtk_paradise/examples/controller/controller.rb +2 -0
  68. data/lib/gtk_paradise/examples/css/001_border_examples.rb +30 -13
  69. data/lib/gtk_paradise/examples/css/002_import_CSS_file.rb +10 -5
  70. data/lib/gtk_paradise/examples/drawing/001_example.rb +61 -0
  71. data/lib/gtk_paradise/examples/drawing/002_example.rb +51 -0
  72. data/lib/gtk_paradise/examples/drawing/003_example.rb +38 -0
  73. data/lib/gtk_paradise/examples/drawing/004_example.rb +36 -0
  74. data/lib/gtk_paradise/examples/drawing/005_example.rb +92 -0
  75. data/lib/gtk_paradise/examples/drawing/006_example.rb +58 -0
  76. data/lib/gtk_paradise/examples/drawing/007_example.rb +22 -0
  77. data/lib/gtk_paradise/examples/drawing/008_example.rb +43 -0
  78. data/lib/gtk_paradise/examples/drawing/009_example.rb +43 -0
  79. data/lib/gtk_paradise/examples/drawing/010_example.rb +25 -0
  80. data/lib/gtk_paradise/examples/drawing/011_example.rb +72 -0
  81. data/lib/gtk_paradise/examples/drawing/012_example.rb +59 -0
  82. data/lib/gtk_paradise/examples/drawing/README.md +3 -0
  83. data/lib/gtk_paradise/examples/drawing/moving_turtle_example.rb +43 -0
  84. data/lib/gtk_paradise/examples/gdk/001_gdk_screen_properties.rb +58 -0
  85. data/lib/gtk_paradise/examples/gdk_pixbuf/save_image_example.rb +1 -1
  86. data/lib/gtk_paradise/examples/gir_ffi/001_hello_world.rb +29 -0
  87. data/lib/gtk_paradise/examples/gir_ffi/002_upgraded_hello_world.rb +40 -0
  88. data/lib/gtk_paradise/examples/gir_ffi/003_gtk_application_example.rb +30 -0
  89. data/lib/gtk_paradise/examples/gir_ffi/004_treeview_example.rb +64 -0
  90. data/lib/gtk_paradise/examples/gir_ffi/005_complex_example.rb +104 -0
  91. data/lib/gtk_paradise/examples/gir_ffi/README.md +5 -0
  92. data/lib/gtk_paradise/examples/glib/parse_glib_settings.rb +1 -1
  93. data/lib/gtk_paradise/examples/gtk2/008_list_store_example.rb +1 -1
  94. data/lib/gtk_paradise/examples/gtk3/{061_gtk_entry.rb → 001_gtk_entry.rb} +11 -6
  95. data/lib/gtk_paradise/examples/gtk3/{009_scrolled_window_example.rb → 002_scrolled_window_example.rb} +6 -4
  96. data/lib/gtk_paradise/examples/gtk3/{062_toggle_button_example.rb → 003_toggle_button_example.rb} +3 -2
  97. data/lib/gtk_paradise/examples/gtk3/{081_simple_dialog_example.rb → 004_simple_dialog_example.rb} +19 -12
  98. data/lib/gtk_paradise/examples/gtk3/005_spinner_example.rb +30 -10
  99. data/lib/gtk_paradise/examples/gtk3/006_text_view_example.rb +78 -0
  100. data/lib/gtk_paradise/examples/gtk3/{079_two_windows_example.rb → 007_two_windows_example.rb} +3 -1
  101. data/lib/gtk_paradise/examples/gtk3/008_search_bar_example.rb +91 -0
  102. data/lib/gtk_paradise/examples/gtk3/{002_simple_window.rb → 009_simple_window.rb} +14 -6
  103. data/lib/gtk_paradise/examples/gtk3/{025_switch_example.rb → 010_switch_example.rb} +6 -7
  104. data/lib/gtk_paradise/examples/gtk3/011_colour_chooser_example.rb +71 -0
  105. data/lib/gtk_paradise/examples/gtk3/012_show_the_xid_example.rb +18 -0
  106. data/lib/gtk_paradise/examples/gtk3/013_grab_pointer_forcefully.rb +31 -0
  107. data/lib/gtk_paradise/examples/gtk3/{083_bottom_left_placement.rb → 015_bottom_left_placement.rb} +3 -1
  108. data/lib/gtk_paradise/examples/gtk3/{082_scrolling_example.rb → 016_scrolling_example.rb} +2 -2
  109. data/lib/gtk_paradise/examples/gtk3/{080_extensive_markup_example.rb → 017_extensive_markup_example.rb} +8 -7
  110. data/lib/gtk_paradise/examples/gtk3/{078_message_dialog_example.rb → 018_message_dialog_example.rb} +3 -5
  111. data/lib/gtk_paradise/examples/gtk3/{075_tiny_button_via_css.rb → 021_tiny_button_via_css.rb} +1 -0
  112. data/lib/gtk_paradise/examples/gtk3/{001_font_related_information.rb → 022_font_related_information.rb} +1 -1
  113. data/lib/gtk_paradise/examples/gtk3/023_sorted_tree.rb +166 -0
  114. data/lib/gtk_paradise/examples/gtk3/{004_small_paned_example.rb → 024_small_paned_example.rb} +4 -3
  115. data/lib/gtk_paradise/examples/gtk3/{007_progress_bar_example.rb → 026_progress_bar_example.rb} +1 -2
  116. data/lib/gtk_paradise/examples/gtk3/{008_menubar_example.rb → 027_menubar_example.rb} +1 -1
  117. data/lib/gtk_paradise/examples/gtk3/{010_paned_widget_example.rb → 028_paned_widget_example.rb} +1 -0
  118. data/lib/gtk_paradise/examples/gtk3/{011_sockets.rb → 029_sockets.rb} +1 -0
  119. data/lib/gtk_paradise/examples/gtk3/{012_notebook_example.rb → 030_notebook_example.rb} +1 -0
  120. data/lib/gtk_paradise/examples/gtk3/{013_icon_theme_example.rb → 031_icon_theme_example.rb} +6 -0
  121. data/lib/gtk_paradise/examples/gtk3/{014_switcher_window.rb → 032_switcher_window.rb} +16 -10
  122. data/lib/gtk_paradise/examples/gtk3/{016_hello_world_in_gtk3_and_bold_font.rb → 034_hello_world_in_gtk3_and_bold_font.rb} +1 -1
  123. data/lib/gtk_paradise/examples/gtk3/{017_grid_example.rb → 035_grid_example.rb} +5 -1
  124. data/lib/gtk_paradise/examples/gtk3/{018_buttons_showcasing_the_relief.rb → 036_buttons_showcasing_the_relief.rb} +1 -0
  125. data/lib/gtk_paradise/examples/gtk3/{019_text_buffer_example.rb → 037_text_buffer_example.rb} +12 -10
  126. data/lib/gtk_paradise/examples/gtk3/{022_popup_example.rb → 040_popup_example.rb} +2 -2
  127. data/lib/gtk_paradise/examples/gtk3/{023_horizontal_and_vertical_scale.rb → 041_horizontal_and_vertical_scale.rb} +1 -1
  128. data/lib/gtk_paradise/examples/gtk3/{026_hover_button_example_via_css.rb → 043_hover_button_example_via_css.rb} +3 -1
  129. data/lib/gtk_paradise/examples/gtk3/{027_spin_button_example.rb → 044_spin_button_example.rb} +4 -3
  130. data/lib/gtk_paradise/examples/gtk3/{028_radio_menu_item_example.rb → 045_radio_menu_item_example.rb} +4 -1
  131. data/lib/gtk_paradise/examples/gtk3/{029_gtk_dialog_sample.rb → 046_gtk_dialog_sample.rb} +4 -1
  132. data/lib/gtk_paradise/examples/gtk3/{030_draw_rectangles.rb → 047_draw_rectangles.rb} +1 -1
  133. data/lib/gtk_paradise/examples/gtk3/{031_colour_choose_button.rb → 048_colour_choose_button.rb} +17 -3
  134. data/lib/gtk_paradise/examples/gtk3/{032_drag_and_drop_example.rb → 049_drag_and_drop_example.rb} +13 -5
  135. data/lib/gtk_paradise/examples/gtk3/{033_cell_renderer_pixbuf_example.rb → 050_cell_renderer_pixbuf_example.rb} +17 -6
  136. data/lib/gtk_paradise/examples/gtk3/051_combo_box_example.rb +74 -0
  137. data/lib/gtk_paradise/examples/gtk3/{037_css_example_of_a_button_changing_the_background_colour_on_click_event.rb → 053_css_example_of_a_button_changing_the_background_colour_on_click_event.rb} +14 -4
  138. data/lib/gtk_paradise/examples/gtk3/{036_revealer_example.rb → 053_revealer_example.rb} +10 -6
  139. data/lib/gtk_paradise/examples/gtk3/{038_ten_labels_in_a_vertical_box_example.rb → 054_ten_labels_in_a_vertical_box_example.rb} +1 -1
  140. data/lib/gtk_paradise/examples/gtk3/{039_threads_example.rb → 055_threads_example.rb} +1 -1
  141. data/lib/gtk_paradise/examples/gtk3/{042_colourized_button_example.rb → 058_colourized_button_example.rb} +1 -2
  142. data/lib/gtk_paradise/examples/gtk3/{043_form_example.rb → 059_form_example.rb} +1 -3
  143. data/lib/gtk_paradise/examples/gtk3/{044_check_button.rb → 060_check_button.rb} +4 -2
  144. data/lib/gtk_paradise/examples/gtk3/{046_event_box_example.rb → 062_event_box_example.rb} +2 -1
  145. data/lib/gtk_paradise/examples/gtk3/{047_examples_with_css.rb → 063_examples_with_css.rb} +91 -3
  146. data/lib/gtk_paradise/examples/gtk3/{048_accel_group_example.rb → 064_accel_group_example.rb} +1 -0
  147. data/lib/gtk_paradise/examples/gtk3/{049_change_the_application_theme.rb → 065_change_the_application_theme.rb} +4 -2
  148. data/lib/gtk_paradise/examples/gtk3/{050_header_bar_example.rb → 066_header_bar_example.rb} +3 -0
  149. data/lib/gtk_paradise/examples/gtk3/{051_gtk_label_example.rb → 067_gtk_label_example.rb} +3 -2
  150. data/lib/gtk_paradise/examples/gtk3/{052_popover_example.rb → 068_popover_example.rb} +2 -2
  151. data/lib/gtk_paradise/examples/gtk3/{053_entry_completion.rb → 069_entry_completion.rb} +2 -0
  152. data/lib/gtk_paradise/examples/gtk3/{055_button_demo.rb → 071_button_demo.rb} +6 -5
  153. data/lib/gtk_paradise/examples/gtk3/{056_text_iterator_example.rb → 072_text_iterator_example.rb} +30 -21
  154. data/lib/gtk_paradise/examples/gtk3/{057_image_example.rb → 073_image_example.rb} +1 -1
  155. data/lib/gtk_paradise/examples/gtk3/{058_frame_example.rb → 074_frame_example.rb} +1 -1
  156. data/lib/gtk_paradise/examples/gtk3/{059_gtk_expander.rb → 075_gtk_expander.rb} +2 -0
  157. data/lib/gtk_paradise/examples/gtk3/{060_ten_vboxes_example.rb → 076_ten_vboxes_example.rb} +1 -0
  158. data/lib/gtk_paradise/examples/gtk3/{063_button_box_example.rb → 077_button_box_example.rb} +11 -1
  159. data/lib/gtk_paradise/examples/gtk3/{064_tree_view_column_example.rb → 078_tree_view_column_example.rb} +2 -1
  160. data/lib/gtk_paradise/examples/gtk3/{066_vertical_boxes.rb → 080_vertical_boxes.rb} +2 -1
  161. data/lib/gtk_paradise/examples/gtk3/{067_vbox_with_spacing_and_border_width.rb → 081_vbox_with_spacing_and_border_width.rb} +2 -1
  162. data/lib/gtk_paradise/examples/gtk3/{069_file_chooser_dialog.rb → 082_file_chooser_dialog.rb} +3 -0
  163. data/lib/gtk_paradise/examples/gtk3/{070_bindings.rb → 083_bindings.rb} +14 -8
  164. data/lib/gtk_paradise/examples/gtk3/{072_recent_chooser_dialog.rb → 084_recent_chooser_dialog.rb} +2 -2
  165. data/lib/gtk_paradise/examples/gtk3/{073_showcase_the_cursors.rb → 085_showcase_the_cursors.rb} +30 -5
  166. data/lib/gtk_paradise/examples/gtk3/{074_app_chooser_button_example.rb → 086_app_chooser_button_example.rb} +1 -0
  167. data/lib/gtk_paradise/examples/gtk3/087_calendar_example.rb +41 -0
  168. data/lib/gtk_paradise/examples/gtk4/001_gtk_entry.rb +88 -0
  169. data/lib/gtk_paradise/examples/gtk4/002_scrolled_window_example.rb +62 -0
  170. data/lib/gtk_paradise/examples/gtk4/003_toggle_button_example.rb +23 -0
  171. data/lib/gtk_paradise/examples/gtk4/004_simple_dialog_example.rb +41 -0
  172. data/lib/gtk_paradise/examples/gtk4/005_spinner_example.rb +64 -0
  173. data/lib/gtk_paradise/examples/gtk4/006_text_view_example.rb +77 -0
  174. data/lib/gtk_paradise/examples/gtk4/007_two_windows_example.rb +55 -0
  175. data/lib/gtk_paradise/examples/gtk4/008_search_bar_example.rb +88 -0
  176. data/lib/gtk_paradise/examples/gtk4/009_text_view_example.rb +30 -0
  177. data/lib/gtk_paradise/examples/gtk4/010_switch_example.rb +52 -0
  178. data/lib/gtk_paradise/examples/gtk4/074_frame_example.rb +105 -0
  179. data/lib/gtk_paradise/examples/gtk4/076_ten_vboxes_example.rb +35 -0
  180. data/lib/gtk_paradise/examples/gtk4/087_calendar_example.rb +47 -0
  181. data/lib/gtk_paradise/examples/gtk4/100_changed_events_example.rb +77 -0
  182. data/lib/gtk_paradise/examples/gtk4/101_actionbar_example.rb +55 -0
  183. data/lib/gtk_paradise/examples/gtk4/102_picture_example.rb +35 -0
  184. data/lib/gtk_paradise/examples/pango/pango_power.rb +1 -0
  185. data/lib/gtk_paradise/experimental/experimental.rb +3 -11
  186. data/lib/gtk_paradise/experimental/experimental_for_gtk4.rb +92 -0
  187. data/lib/gtk_paradise/fonts/fonts.rb +5 -1
  188. data/lib/gtk_paradise/gdk/cursor.rb +2 -2
  189. data/lib/gtk_paradise/{base_module/e.rb → gdk/event_crossing.rb} +6 -8
  190. data/lib/gtk_paradise/gdk/gdk.rb +1 -1
  191. data/lib/gtk_paradise/gtk_classes/about.rb +11 -2
  192. data/lib/gtk_paradise/gtk_classes/about_dialog.rb +6 -2
  193. data/lib/gtk_paradise/gtk_classes/alignment.rb +4 -1
  194. data/lib/gtk_paradise/gtk_classes/application.rb +94 -4
  195. data/lib/gtk_paradise/gtk_classes/application_window.rb +25 -0
  196. data/lib/gtk_paradise/gtk_classes/box.rb +116 -279
  197. data/lib/gtk_paradise/gtk_classes/button.rb +55 -37
  198. data/lib/gtk_paradise/gtk_classes/button_box.rb +9 -1
  199. data/lib/gtk_paradise/gtk_classes/cell_renderer_text.rb +5 -3
  200. data/lib/gtk_paradise/gtk_classes/check_button.rb +27 -8
  201. data/lib/gtk_paradise/gtk_classes/combo_box.rb +4 -1
  202. data/lib/gtk_paradise/gtk_classes/combo_box_entry.rb +17 -11
  203. data/lib/gtk_paradise/gtk_classes/combo_box_text.rb +21 -19
  204. data/lib/gtk_paradise/gtk_classes/dialog.rb +2 -2
  205. data/lib/gtk_paradise/gtk_classes/entry.rb +256 -124
  206. data/lib/gtk_paradise/gtk_classes/entry_completion.rb +4 -0
  207. data/lib/gtk_paradise/gtk_classes/event_box.rb +21 -2
  208. data/lib/gtk_paradise/gtk_classes/event_button.rb +1 -1
  209. data/lib/gtk_paradise/gtk_classes/expander.rb +8 -1
  210. data/lib/gtk_paradise/gtk_classes/file_chooser_dialog.rb +1 -1
  211. data/lib/gtk_paradise/gtk_classes/file_filter.rb +4 -2
  212. data/lib/gtk_paradise/gtk_classes/file_selection.rb +4 -3
  213. data/lib/gtk_paradise/gtk_classes/frame.rb +19 -1
  214. data/lib/gtk_paradise/gtk_classes/grid.rb +206 -160
  215. data/lib/gtk_paradise/gtk_classes/hbox.rb +145 -0
  216. data/lib/gtk_paradise/gtk_classes/header_bar.rb +19 -8
  217. data/lib/gtk_paradise/gtk_classes/image.rb +1 -1
  218. data/lib/gtk_paradise/gtk_classes/label.rb +174 -135
  219. data/lib/gtk_paradise/gtk_classes/menu.rb +7 -3
  220. data/lib/gtk_paradise/gtk_classes/menu_bar.rb +1 -1
  221. data/lib/gtk_paradise/gtk_classes/menu_item.rb +1 -1
  222. data/lib/gtk_paradise/gtk_classes/notebook.rb +114 -64
  223. data/lib/gtk_paradise/gtk_classes/paned.rb +52 -0
  224. data/lib/gtk_paradise/gtk_classes/radio_menu_item.rb +19 -1
  225. data/lib/gtk_paradise/gtk_classes/scale_button.rb +16 -1
  226. data/lib/gtk_paradise/gtk_classes/scrolled_window.rb +8 -6
  227. data/lib/gtk_paradise/gtk_classes/search_bar.rb +1 -1
  228. data/lib/gtk_paradise/gtk_classes/source_buffer.rb +4 -5
  229. data/lib/gtk_paradise/gtk_classes/spin_button.rb +9 -1
  230. data/lib/gtk_paradise/gtk_classes/spinner.rb +32 -2
  231. data/lib/gtk_paradise/gtk_classes/status_icon.rb +2 -0
  232. data/lib/gtk_paradise/gtk_classes/statusbar.rb +1 -0
  233. data/lib/gtk_paradise/gtk_classes/style_context.rb +71 -0
  234. data/lib/gtk_paradise/gtk_classes/text_buffer.rb +45 -19
  235. data/lib/gtk_paradise/gtk_classes/text_view.rb +20 -3
  236. data/lib/gtk_paradise/gtk_classes/toggle_button.rb +3 -0
  237. data/lib/gtk_paradise/gtk_classes/toolbar.rb +2 -2
  238. data/lib/gtk_paradise/gtk_classes/tree_iter.rb +1 -1
  239. data/lib/gtk_paradise/gtk_classes/tree_view.rb +93 -70
  240. data/lib/gtk_paradise/gtk_classes/tree_view_column.rb +2 -1
  241. data/lib/gtk_paradise/gtk_classes/vbox.rb +71 -10
  242. data/lib/gtk_paradise/gtk_classes/vscale.rb +2 -2
  243. data/lib/gtk_paradise/gtk_classes/widget.rb +1057 -590
  244. data/lib/gtk_paradise/gtk_classes/window.rb +37 -2
  245. data/lib/gtk_paradise/hello_world/README.md +1 -1
  246. data/lib/gtk_paradise/hello_world/hello_world_gtk4.rb +20 -0
  247. data/lib/gtk_paradise/images/icons/close_image.png +0 -0
  248. data/lib/gtk_paradise/images/icons/closed.png +0 -0
  249. data/lib/gtk_paradise/images/icons/directory.png +0 -0
  250. data/lib/gtk_paradise/images/icons/icon_cool.gif +0 -0
  251. data/lib/gtk_paradise/images/icons/icon_lol.gif +0 -0
  252. data/lib/gtk_paradise/images/icons/icon_smile.gif +0 -0
  253. data/lib/gtk_paradise/images/icons/opened.png +0 -0
  254. data/lib/gtk_paradise/images/internal/gtk_label_example.png +0 -0
  255. data/lib/gtk_paradise/images/misc/wiki_logo.png +0 -0
  256. data/lib/gtk_paradise/images/small/GREEN_CIRCLE.png +0 -0
  257. data/lib/gtk_paradise/images/small/README.md +2 -0
  258. data/lib/gtk_paradise/images/small/RED_CIRCLE.png +0 -0
  259. data/lib/gtk_paradise/pango/{pango_fonts.rb → fonts.rb} +2 -2
  260. data/lib/gtk_paradise/pango/{pango.rb → layout.rb} +1 -1
  261. data/lib/gtk_paradise/pango/pango_renderer.rb +9 -2
  262. data/lib/gtk_paradise/project/project.rb +4 -3
  263. data/lib/gtk_paradise/prototypes/README.md +8 -0
  264. data/lib/gtk_paradise/prototypes/gtk3_standalone.rb +8 -21
  265. data/lib/gtk_paradise/prototypes/gtk4_standalone.rb +135 -0
  266. data/lib/gtk_paradise/prototypes/shared_code.rb +5 -15
  267. data/lib/gtk_paradise/prototypes/unified_gtk_prototype.rb +179 -0
  268. data/lib/gtk_paradise/require_gtk4.rb +7 -0
  269. data/lib/gtk_paradise/requires/require_base_module.rb +7 -0
  270. data/lib/gtk_paradise/requires/require_files_irrespective_of_the_gtk_version_at_hand.rb +25 -16
  271. data/lib/gtk_paradise/requires/require_gtk2.rb +6 -4
  272. data/lib/gtk_paradise/requires/{require_gtk2_or_gtk3.rb → require_gtk2_or_gtk3_or_gtk4.rb} +33 -12
  273. data/lib/gtk_paradise/requires/require_gtk3.rb +5 -20
  274. data/lib/gtk_paradise/requires/require_gtk4.rb +13 -0
  275. data/lib/gtk_paradise/requires/require_gtk_runner.rb +1 -0
  276. data/lib/gtk_paradise/requires/require_the_base_module_and_gtk_run.rb +1 -1
  277. data/lib/gtk_paradise/requires/require_the_base_module_the_app_module_and_the_toplevel_methods.rb +9 -0
  278. data/lib/gtk_paradise/requires/require_the_classes_files_for_gtk4.rb +11 -0
  279. data/lib/gtk_paradise/requires/require_the_colours_gem.rb +9 -0
  280. data/lib/gtk_paradise/requires/require_the_default_gtk_version.rb +4 -2
  281. data/lib/gtk_paradise/requires/require_the_toplevel_methods.rb +1 -1
  282. data/lib/gtk_paradise/run.rb +1 -0
  283. data/lib/gtk_paradise/run_this_widget/run_this_widget.rb +7 -3
  284. data/lib/gtk_paradise/threads/threads.rb +15 -10
  285. data/lib/gtk_paradise/toplevel_methods/css.rb +183 -35
  286. data/lib/gtk_paradise/toplevel_methods/cursor.rb +17 -3
  287. data/lib/gtk_paradise/toplevel_methods/determine_which_gtk_version_is_in_use.rb +90 -8
  288. data/lib/gtk_paradise/toplevel_methods/events.rb +6 -0
  289. data/lib/gtk_paradise/toplevel_methods/keys.rb +1 -1
  290. data/lib/gtk_paradise/toplevel_methods/screen_resolution.rb +32 -5
  291. data/lib/gtk_paradise/toplevel_methods/text_buffer_tags.rb +13 -4
  292. data/lib/gtk_paradise/toplevel_methods/tokenizer.rb +18 -3
  293. data/lib/gtk_paradise/toplevel_methods/{misc.rb → toplevel_methods.rb} +728 -181
  294. data/lib/gtk_paradise/utility_scripts/commandline_to_automatic_gui.rb +244 -0
  295. data/lib/gtk_paradise/version/version.rb +2 -2
  296. data/lib/gtk_paradise/widgets/gtk2/cat_merge.rb +2 -6
  297. data/lib/gtk_paradise/widgets/gtk2/cell_renderer_progress_example.rb +0 -5
  298. data/lib/gtk_paradise/widgets/gtk2/foto_lister.rb +2 -6
  299. data/lib/gtk_paradise/widgets/gtk2/gidnight_commander/gidnight_commander.rb +3 -3
  300. data/lib/gtk_paradise/widgets/gtk2/hbox_example.rb +1 -5
  301. data/lib/gtk_paradise/widgets/gtk2/multiple_select_in_a_tree_view_widget.rb +2 -6
  302. data/lib/gtk_paradise/widgets/gtk2/paned_example.rb +1 -1
  303. data/lib/gtk_paradise/widgets/gtk2/slider_changing_button.rb +2 -6
  304. data/lib/gtk_paradise/widgets/gtk2/status_icon_example.rb +2 -6
  305. data/lib/gtk_paradise/widgets/gtk2/table2.rb +2 -6
  306. data/lib/gtk_paradise/widgets/gtk2/toolbar_example.rb +2 -6
  307. data/lib/gtk_paradise/widgets/{version_agnostic → gtk3/audio_button}/audio_button.rb +15 -26
  308. data/lib/gtk_paradise/widgets/gtk3/burn_this_iso_file/burn_this_iso_file.rb +2 -6
  309. data/lib/gtk_paradise/widgets/{version_agnostic → gtk3/button_open_remote_webpage}/button_open_remote_webpage.rb +105 -50
  310. data/lib/gtk_paradise/widgets/gtk3/button_with_border/button_with_border.rb +155 -0
  311. data/lib/gtk_paradise/widgets/{version_agnostic → gtk3/button_xorg_buffer}/button_xorg_buffer.rb +76 -18
  312. data/lib/gtk_paradise/widgets/gtk3/calculator/calculator.rb +183 -76
  313. data/lib/gtk_paradise/widgets/gtk3/checkbox_image/checkbox_image.rb +3 -7
  314. data/lib/gtk_paradise/widgets/{version_agnostic → gtk3/coloured_button}/coloured_button.rb +94 -24
  315. data/lib/gtk_paradise/widgets/gtk3/coloured_square/coloured_square.rb +2 -6
  316. data/lib/gtk_paradise/widgets/gtk3/coloured_unit/coloured_unit.rb +151 -0
  317. data/lib/gtk_paradise/widgets/gtk3/cpu_widget/cpu_widget.rb +2 -6
  318. data/lib/gtk_paradise/widgets/gtk3/directory_content_widget/directory_content_widget.rb +937 -7
  319. data/lib/gtk_paradise/widgets/gtk3/editor/connect_skeleton.rb +33 -38
  320. data/lib/gtk_paradise/widgets/gtk3/editor/create.rb +66 -41
  321. data/lib/gtk_paradise/widgets/gtk3/editor/editor.rb +256 -270
  322. data/lib/gtk_paradise/widgets/gtk3/editor/internal_widgets/goto_line_widget.rb +52 -65
  323. data/lib/gtk_paradise/widgets/gtk3/editor/misc.rb +358 -111
  324. data/lib/gtk_paradise/widgets/gtk3/files_in_directory/files_in_directory.rb +2 -7
  325. data/lib/gtk_paradise/widgets/gtk3/flexible_vte/flexible_vte.rb +3 -7
  326. data/lib/gtk_paradise/widgets/gtk3/font_size_widget/action_button.rb +1 -5
  327. data/lib/gtk_paradise/widgets/gtk3/font_size_widget/font_size_widget.rb +2 -6
  328. data/lib/gtk_paradise/widgets/{gtk2 → gtk3}/gidnight_commander/gidnight_commander.config +1 -2
  329. data/lib/gtk_paradise/widgets/gtk3/gidnight_commander/gidnight_commander.rb +165 -125
  330. data/lib/gtk_paradise/widgets/gtk3/image_close_on_click_action/image_close_on_click_action.rb +34 -2
  331. data/lib/gtk_paradise/widgets/gtk3/image_viewer/image_viewer.rb +23 -26
  332. data/lib/gtk_paradise/widgets/gtk3/information_about_the_harddisc/harddisc_information.rb +161 -0
  333. data/lib/gtk_paradise/widgets/gtk3/insert_character/insert_character.rb +24 -29
  334. data/lib/gtk_paradise/widgets/gtk3/linux_users/linux_users.rb +32 -32
  335. data/lib/gtk_paradise/widgets/gtk3/my_calendar/my_calendar.rb +330 -7
  336. data/lib/gtk_paradise/widgets/gtk3/my_image_menu_item/my_image_menu_item.rb +179 -0
  337. data/lib/gtk_paradise/widgets/gtk3/non_numbers_only/non_numbers_only.rb +136 -0
  338. data/lib/gtk_paradise/widgets/gtk3/note_window/note_window.rb +199 -0
  339. data/lib/gtk_paradise/widgets/gtk3/notebook_controller/notebook_controller.rb +311 -7
  340. data/lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb +402 -7
  341. data/lib/gtk_paradise/widgets/gtk3/numbered_lines/numbered_lines.rb +128 -82
  342. data/lib/gtk_paradise/widgets/{version_agnostic → gtk3/numbers_only}/numbers_only.rb +15 -3
  343. data/lib/gtk_paradise/widgets/gtk3/ping_widget/ping_widget.rb +491 -8
  344. data/lib/gtk_paradise/widgets/gtk3/regex_matcher/regex_matcher.rb +362 -43
  345. data/lib/gtk_paradise/widgets/gtk3/rename_widget/rename_widget.rb +8 -25
  346. data/lib/gtk_paradise/widgets/gtk3/show_which_key_was_pressed/show_which_key_was_pressed.rb +190 -0
  347. data/lib/gtk_paradise/widgets/gtk3/stopwatch/stopwatch.rb +318 -7
  348. data/lib/gtk_paradise/widgets/gtk3/sys_message/sys_message.rb +219 -7
  349. data/lib/gtk_paradise/widgets/gtk3/system_information/system_information.rb +58 -34
  350. data/lib/gtk_paradise/widgets/gtk3/tabble/admin_panel.rb +2 -6
  351. data/lib/gtk_paradise/widgets/gtk3/tabble/image_and_button.rb +2 -6
  352. data/lib/gtk_paradise/widgets/gtk3/tabble/tabble.rb +2 -6
  353. data/lib/gtk_paradise/widgets/gtk3/view_webpage/view_webpage.rb +2 -6
  354. data/lib/gtk_paradise/widgets/gtk3/wiki/README.md +4 -0
  355. data/lib/gtk_paradise/widgets/gtk3/wiki/wiki.rb +388 -0
  356. data/lib/gtk_paradise/widgets/gtk4/ping_widget/ping_widget.rb +4 -0
  357. data/lib/gtk_paradise/widgets/gtk4/show_icon_theme/show_icon_theme.rb +134 -0
  358. data/lib/gtk_paradise/widgets/gtk4/sys_message/sys_message.rb +269 -0
  359. data/lib/gtk_paradise/widgets/{gtk2/stopwatch/stopwatch.rb → gtk4/xpm_loader/xpm_loader.rb} +13 -11
  360. data/lib/gtk_paradise/widgets/shared_code/browser/browser_module.rb +4 -16
  361. data/lib/gtk_paradise/widgets/shared_code/cdripper/cdripper_module.rb +1 -1
  362. data/lib/gtk_paradise/widgets/shared_code/colour_filled_widget/colour_filled_widget_module.rb +25 -28
  363. data/lib/gtk_paradise/widgets/shared_code/colour_palette/colour_palette_module.rb +2 -2
  364. data/lib/gtk_paradise/widgets/shared_code/contacts/contacts_module.rb +62 -64
  365. data/lib/gtk_paradise/widgets/shared_code/flip_state_widget/flip_state_widget_module.rb +3 -19
  366. data/lib/gtk_paradise/widgets/shared_code/information_about_the_harddisc/harddisc_information.rb +0 -155
  367. data/lib/gtk_paradise/widgets/shared_code/information_about_the_harddisc/information_about_the_harddisc_module.rb +0 -444
  368. data/lib/gtk_paradise/widgets/shared_code/lsmod/lsmod_module.rb +22 -26
  369. data/lib/gtk_paradise/widgets/shared_code/lspci/lspci_module.rb +24 -36
  370. data/lib/gtk_paradise/widgets/shared_code/mini_clock/mini_clock_module.rb +74 -58
  371. data/lib/gtk_paradise/widgets/shared_code/my_calendar/my_calendar_module.rb +0 -327
  372. data/lib/gtk_paradise/widgets/shared_code/pid_displayer/pid_displayer_module.rb +53 -41
  373. data/lib/gtk_paradise/widgets/shared_code/random_image/random_image_module.rb +46 -29
  374. data/lib/gtk_paradise/widgets/shared_code/select_file/select_file_module.rb +1 -1
  375. data/lib/gtk_paradise/widgets/shared_code/show_icon_theme/show_icon_theme_module.rb +56 -44
  376. data/lib/gtk_paradise/widgets/shared_code/simple_clock/simple_clock_module.rb +1 -12
  377. data/lib/gtk_paradise/widgets/shared_code/stopwatch/stopwatch_module.rb +0 -341
  378. data/lib/gtk_paradise/widgets/shared_code/sys_message/sys_message_module.rb +0 -211
  379. data/lib/gtk_paradise/widgets/shared_code/tabby/tabby_module.rb +3 -15
  380. data/lib/gtk_paradise/widgets/shared_code/xpm_loader/xpm_loader_module.rb +15 -23
  381. data/lib/gtk_paradise/www/index.cgi +2 -2
  382. data/lib/gtk_paradise/yaml/browser_URLs.yml +3 -4
  383. data/lib/gtk_paradise/yaml/configuration_options_for_class_gtk_runner.yml +6 -6
  384. data/lib/gtk_paradise/yaml/experimental/README.md +3 -0
  385. data/lib/gtk_paradise/yaml/experimental/all_widgets.yml +37 -0
  386. data/lib/gtk_paradise/yaml/menu.yml +6 -3
  387. data/lib/gtk_paradise/yaml/notebook_controller.yml +62 -29
  388. data/lib/gtk_paradise.rb +0 -5
  389. data/test/gtk2/testing_combo_box.rb +1 -0
  390. data/test/gtk2/testing_display.rb +23 -0
  391. data/test/gtk2/testing_gtk_image.rb +4 -3
  392. data/test/gtk2/testing_hbox_and_vbox.rb +37 -0
  393. data/test/gtk2/testing_label_with_ampersand.rb +5 -2
  394. data/test/gtk2/testing_notebook.rb +11 -5
  395. data/test/gtk3/test_widget.rb +2 -1
  396. data/test/gtk3/testing_app.rb +0 -1
  397. data/test/gtk3/testing_base_module.rb +2 -1
  398. data/test/gtk3/testing_numbered_lines.rb +20 -0
  399. data/test/gtk3/testing_project_base_directory.rb +6 -1
  400. data/test/gtk3/testing_the_html_pseudo_tags.rb +2 -2
  401. data/test/gtk4/testing_gtk_entry.rb +24 -0
  402. data/test/misc/testing_a_gtk_frame.rb +14 -0
  403. data/test/misc/testing_gtk4_simplifications.rb +105 -0
  404. data/test/misc/testing_gtk_paradise_runner.rb +19 -4
  405. data/test/misc/testing_the_gtk_classes.rb +83 -0
  406. metadata +246 -199
  407. data/lib/gtk_paradise/base_module/change_directory.rb +0 -22
  408. data/lib/gtk_paradise/base_module/combo_box_and_combo_box_entry.rb +0 -113
  409. data/lib/gtk_paradise/base_module/commandline_arguments.rb +0 -36
  410. data/lib/gtk_paradise/base_module/configuration.rb +0 -50
  411. data/lib/gtk_paradise/base_module/constants.rb +0 -23
  412. data/lib/gtk_paradise/base_module/debug.rb +0 -127
  413. data/lib/gtk_paradise/base_module/draggable.rb +0 -95
  414. data/lib/gtk_paradise/base_module/emoji.rb +0 -107
  415. data/lib/gtk_paradise/base_module/esystem.rb +0 -22
  416. data/lib/gtk_paradise/base_module/events.rb +0 -111
  417. data/lib/gtk_paradise/base_module/fonts.rb +0 -119
  418. data/lib/gtk_paradise/base_module/graphics_display.rb +0 -47
  419. data/lib/gtk_paradise/base_module/gtk3.rb +0 -43
  420. data/lib/gtk_paradise/base_module/gtk_buttons.rb +0 -562
  421. data/lib/gtk_paradise/base_module/gtk_entry.rb +0 -126
  422. data/lib/gtk_paradise/base_module/gtk_fixed.rb +0 -18
  423. data/lib/gtk_paradise/base_module/gtk_grid.rb +0 -61
  424. data/lib/gtk_paradise/base_module/gtk_image.rb +0 -501
  425. data/lib/gtk_paradise/base_module/gtk_label.rb +0 -211
  426. data/lib/gtk_paradise/base_module/gtk_notebook.rb +0 -88
  427. data/lib/gtk_paradise/base_module/gtk_scrolled_window.rb +0 -155
  428. data/lib/gtk_paradise/base_module/misc.rb +0 -2949
  429. data/lib/gtk_paradise/base_module/pango.rb +0 -24
  430. data/lib/gtk_paradise/base_module/popover.rb +0 -241
  431. data/lib/gtk_paradise/base_module/register_sigint.rb +0 -20
  432. data/lib/gtk_paradise/base_module/reset.rb +0 -128
  433. data/lib/gtk_paradise/base_module/return_corresponding_gtk_stock_item.rb +0 -92
  434. data/lib/gtk_paradise/base_module/roebe.rb +0 -19
  435. data/lib/gtk_paradise/base_module/table.rb +0 -438
  436. data/lib/gtk_paradise/base_module/time.rb +0 -35
  437. data/lib/gtk_paradise/constants/available_cursors.rb +0 -52
  438. data/lib/gtk_paradise/constants/fonts.rb +0 -38
  439. data/lib/gtk_paradise/constants/misc.rb +0 -56
  440. data/lib/gtk_paradise/constants/newline.rb +0 -14
  441. data/lib/gtk_paradise/constants/xbm_icons.rb +0 -121
  442. data/lib/gtk_paradise/examples/gtk3/003_sorted_tree.rb +0 -141
  443. data/lib/gtk_paradise/examples/gtk3/034_combo_box_example.rb +0 -49
  444. data/lib/gtk_paradise/examples/gtk3/068_text_view_example.rb +0 -34
  445. data/lib/gtk_paradise/examples/gtk3/071_search_bar_example.rb +0 -59
  446. data/lib/gtk_paradise/gtk_classes/colours/colours.rb +0 -158
  447. data/lib/gtk_paradise/requires/require_the_minesweeper_files.rb +0 -11
  448. data/lib/gtk_paradise/toplevel_methods/allow_only_numbers.rb +0 -59
  449. data/lib/gtk_paradise/toplevel_methods/csv.rb +0 -102
  450. data/lib/gtk_paradise/toplevel_methods/e.rb +0 -18
  451. data/lib/gtk_paradise/toplevel_methods/enable_and_disable_warnings.rb +0 -58
  452. data/lib/gtk_paradise/toplevel_methods/keyboard.rb +0 -25
  453. data/lib/gtk_paradise/toplevel_methods/main_file.rb +0 -31
  454. data/lib/gtk_paradise/toplevel_methods/register_sigint.rb +0 -17
  455. data/lib/gtk_paradise/toplevel_methods/roebe.rb +0 -22
  456. data/lib/gtk_paradise/toplevel_methods/select_file.rb +0 -168
  457. data/lib/gtk_paradise/toplevel_methods/spacer.rb +0 -55
  458. data/lib/gtk_paradise/toplevel_methods/tooltips.rb +0 -71
  459. data/lib/gtk_paradise/toplevel_methods/we_use_this_gtk_version.rb +0 -65
  460. data/lib/gtk_paradise/widgets/gtk2/directory_content_widget/directory_content_widget.rb +0 -30
  461. data/lib/gtk_paradise/widgets/gtk2/my_calendar/my_calendar.config +0 -6
  462. data/lib/gtk_paradise/widgets/gtk2/my_calendar/my_calendar.rb +0 -34
  463. data/lib/gtk_paradise/widgets/gtk2/notebook_tab_with_icon/notebook_tab_with_icon.rb +0 -30
  464. data/lib/gtk_paradise/widgets/gtk2/ping_widget/ping_widget.rb +0 -30
  465. data/lib/gtk_paradise/widgets/gtk2/sys_message/sys_message.config +0 -6
  466. data/lib/gtk_paradise/widgets/gtk2/sys_message/sys_message.rb +0 -29
  467. data/lib/gtk_paradise/widgets/shared_code/directory_content_widget/constants.rb +0 -53
  468. data/lib/gtk_paradise/widgets/shared_code/directory_content_widget/directory_content_widget_module.rb +0 -777
  469. data/lib/gtk_paradise/widgets/shared_code/directory_content_widget/handle_this_file_or_symlink.rb +0 -83
  470. data/lib/gtk_paradise/widgets/shared_code/notebook_controller/notebook_controller_module.rb +0 -339
  471. data/lib/gtk_paradise/widgets/shared_code/notebook_tab_with_icon/notebook_tab_with_icon_module.rb +0 -297
  472. data/lib/gtk_paradise/widgets/shared_code/ping_widget/ping_widget_module.rb +0 -326
  473. data/lib/gtk_paradise/widgets/version_agnostic/button_with_border.rb +0 -63
  474. data/lib/gtk_paradise/widgets/version_agnostic/coloured_unit.rb +0 -54
  475. data/lib/gtk_paradise/widgets/version_agnostic/my_image_menu_item.rb +0 -103
  476. data/lib/gtk_paradise/widgets/version_agnostic/my_menu_item_separator.rb +0 -31
  477. data/lib/gtk_paradise/widgets/version_agnostic/non_numbers_only.rb +0 -66
  478. data/lib/gtk_paradise/widgets/version_agnostic/note_window.rb +0 -107
  479. /data/lib/gtk_paradise/examples/gtk3/{084_undecorated_window_example.rb → 014_undecorated_window_example.rb} +0 -0
  480. /data/lib/gtk_paradise/examples/gtk3/{077_status_icon_example.rb → 019_status_icon_example.rb} +0 -0
  481. /data/lib/gtk_paradise/examples/gtk3/{076_stack_example.rb → 020_stack_example.rb} +0 -0
  482. /data/lib/gtk_paradise/examples/gtk3/{006_password_example.rb → 025_password_example.rb} +0 -0
  483. /data/lib/gtk_paradise/examples/gtk3/{015_list_box_example.rb → 033_list_box_example.rb} +0 -0
  484. /data/lib/gtk_paradise/examples/gtk3/{020_radio_button_window.rb → 038_radio_button_window.rb} +0 -0
  485. /data/lib/gtk_paradise/examples/gtk3/{021_scale_button_demo.rb → 039_scale_button_demo.rb} +0 -0
  486. /data/lib/gtk_paradise/examples/gtk3/{024_installation_assistant.rb → 042_installation_assistant.rb} +0 -0
  487. /data/lib/gtk_paradise/examples/gtk3/{035_notebook_css_example.rb → 052_notebook_css_example.rb} +0 -0
  488. /data/lib/gtk_paradise/examples/gtk3/{040_font_chooser_dialog_example.rb → 056_font_chooser_dialog_example.rb} +0 -0
  489. /data/lib/gtk_paradise/examples/gtk3/{041_flowbox.rb → 057_flowbox.rb} +0 -0
  490. /data/lib/gtk_paradise/examples/gtk3/{045_fixed_example.rb → 061_fixed_example.rb} +0 -0
  491. /data/lib/gtk_paradise/examples/gtk3/{054_svg_viewer.rb → 070_svg_viewer.rb} +0 -0
  492. /data/lib/gtk_paradise/examples/gtk3/{065_tooltips_example.rb → 079_tooltips_example.rb} +0 -0
@@ -2,227 +2,279 @@
2
2
  # Encoding: UTF-8
3
3
  # frozen_string_literal: true
4
4
  # =========================================================================== #
5
+ #
5
6
  # This file may contain some custom code for ruby-gtk.
6
7
  #
7
- # The various gtk-related buttons such as Gtk::Buttons will be stored in
8
- # another file, called gtk_buttons.rb, or required from that file.
8
+ # You can use code in this file to enable or disable warnings.
9
+ #
10
+ # Usage examples:
11
+ #
12
+ # Gtk.enable_warnings
13
+ # Gtk.disable_warnings
14
+ #
9
15
  # =========================================================================== #
10
- # require 'gtk_paradise/toplevel_methods/misc.rb'
16
+ # require 'gtk_paradise/toplevel_methods/toplevel_methods.rb'
17
+ # Gtk.default_base_module
18
+ # ::Gtk.spacer
11
19
  # Gtk.return_editable_cell_renderer_text
12
20
  # Gtk.register_sigint
13
21
  # =========================================================================== #
14
22
  module Gtk
15
23
 
24
+ require 'gtk_paradise/toplevel_methods/css.rb'
25
+ require 'gtk_paradise/toplevel_methods/determine_which_gtk_version_is_in_use.rb'
16
26
  require 'gtk_paradise/toplevel_methods/events.rb'
17
- require 'gtk_paradise/toplevel_methods/register_sigint.rb'
18
- require 'gtk_paradise/toplevel_methods/roebe.rb'
27
+ require 'gtk_paradise/toplevel_methods/keys.rb'
19
28
 
20
29
  # ========================================================================= #
21
- # === Gtk.replace_with_proper_tags
22
- #
23
- # This method can be used to add ad-hoc colour support for HTML-like
24
- # tags (markup).
30
+ # === @old_verbose_value
25
31
  #
26
- # The method will return a String.
32
+ # This can be either true or false.
27
33
  # ========================================================================= #
28
- def self.replace_with_proper_tags(
29
- i = '<green>green</green>
30
- <blue>blue</blue>
31
- <steelblue>steelblue</steelblue>
34
+ @old_verbose_value = $VERBOSE # Keep a "reference" to the old value.
32
35
 
33
- <green>Hello</green><span foreground="blue"> world!</span>
36
+ # ========================================================================= #
37
+ # === Gtk.old_verbose_value?
38
+ # ========================================================================= #
39
+ def self.old_verbose_value?
40
+ return @old_verbose_value
41
+ end
34
42
 
43
+ # ========================================================================= #
44
+ # === Gtk.disable_warnings
45
+ # ========================================================================= #
46
+ def self.disable_warnings
47
+ @old_verbose_value = $VERBOSE # Must keep a reference.
48
+ $VERBOSE = nil # And now we silence it.
49
+ end
35
50
 
36
- <steelblue>longer text</steelblue>
37
- longer text
38
- ')
39
- begin
40
- require 'colours'
41
- rescue LoadError; end
42
- splitted = i.split("\n")
43
- _ = ''.dup
44
- html_colours = ::Colours.available_html_colours?
45
- splitted.each {|line|
46
- # ===================================================================== #
47
- # <steelblue>steelblue</steelblue>
48
- # The first part has to become a <span> tag and the last entry a
49
- # </span> tag.
50
- # ===================================================================== #
51
- if html_colours.any? {|inner_html_colour| line.include? '<'+inner_html_colour+'>' }
52
- scanned_results = html_colours.select {|inner_html_colour|
53
- line.include? '<'+inner_html_colour+'>'
54
- }
55
- scanned_results.each {|this_is_the_colour|
56
- line.gsub!(/<\/#{this_is_the_colour}>/, '</span>')
57
- line.gsub!(/<#{this_is_the_colour}>/, '<span foreground="'+this_is_the_colour.to_s+'">')
58
- }
59
- end
60
- _ << "#{line}\n"
61
- }
51
+ # ========================================================================= #
52
+ # === Gtk.revert_to_the_old_warnings
53
+ # ========================================================================= #
54
+ def self.revert_to_the_old_warnings
55
+ $VERBOSE = @old_verbose_value
56
+ end
57
+
58
+ # ========================================================================= #
59
+ # === Gtk.left_aligned_text
60
+ # ========================================================================= #
61
+ def self.left_aligned_text(i = nil)
62
+ _ = text(i)
63
+ _.left_align
62
64
  return _
63
65
  end
64
66
 
65
67
  # ========================================================================= #
66
- # === Gtk.return_n_characters_up_to_array_position
68
+ # === Gtk.return_custom_generic_widget
67
69
  #
68
- # We follow simple array-logic here, so the given input argument, the
69
- # first one, is using the same logic as Arrays in general: the counting
70
- # starts at 0.
70
+ # Usage example:
71
+ #
72
+ # x = Gtk.return_custom_generic_widget
71
73
  #
72
- # The method was specifically added because a "goto-this-line"
73
- # functionality was needed for a gtk-based editor.
74
74
  # ========================================================================= #
75
- def self.return_n_characters_up_to_array_position(
76
- i = 3,
77
- array = [
78
- "This is some text.\n", # 0
79
- "class Foobar # this is a comment\n", # 1
80
- "end\n", # 2
81
- "AHIFOUVEUHIVE\n", # 3
82
- "underlined!!!\n", # 4
83
- "bold text example!!!\n" # 5
84
- ]
75
+ def self.return_custom_generic_widget
76
+ require 'gtk_paradise/requires/require_the_base_module.rb'
77
+ box = ::Gtk.vbox
78
+ box.extend(::Gtk::BaseModule)
79
+ return box
80
+ end; self.instance_eval { alias return_custom_widget return_custom_generic_widget } # === Gtk.return_custom_widget
81
+ self.instance_eval { alias default_base_module return_custom_generic_widget } # === Gtk.default_base_module
82
+
83
+ # ========================================================================= #
84
+ # === Gtk.enable_warnings
85
+ #
86
+ # Note that the functionality in this method depends on
87
+ # @old_verbose_value really.
88
+ # ========================================================================= #
89
+ def self.enable_warnings(
90
+ i = @old_verbose_value
85
91
  )
86
- position = 0
87
- # ======================================================================= #
88
- # We must re-adjust i if the Array does not have enough elements. We
89
- # will deduct -1 lateron anyway, so the following code is correct.
90
- # ======================================================================= #
91
- if i > array.size
92
- i = array.size
93
- end
94
- 0.upto(i).each {|entry_number|
95
- if entry_number == 0
96
- else # else calculate the line BFEORE.
97
- position += array[entry_number - 1].size
98
- end
99
- }
100
- return position
101
- end
92
+ $VERBOSE = i
93
+ end; self.instance_eval { alias re_enable_warnings enable_warnings } # === Gtk.re_enable_warnings
102
94
 
103
95
  # ========================================================================= #
104
- # === Gtk.set_double_click_time
96
+ # === @main_file
105
97
  #
106
- # This method sets the double click time for the default display.
107
- # Applications should NOT set this, as it is a global user-configured
108
- # setting.
98
+ # This method can be used to keep track of any file that was selected
99
+ # via the gtk-file-picker widget. Only one file can be selected at
100
+ # any given moment in time.
109
101
  # ========================================================================= #
110
- def self.set_double_click_time(msec = 50)
111
- Gdk.set_double_click_time(msec)
102
+ @main_file = nil
103
+
104
+ # ========================================================================= #
105
+ # === Gtk.set_main_file
106
+ # ========================================================================= #
107
+ def self.set_main_file(i)
108
+ @main_file = i
112
109
  end
113
110
 
114
111
  # ========================================================================= #
115
- # === Gtk.textview_with_text
116
- #
117
- # This method can be used to create a textview-widget.
112
+ # === Gtk.main_file?
118
113
  # ========================================================================= #
119
- def self.textview_with_text(use_this_text = '')
120
- textview_widget = ::Gtk.textview
121
- textview_widget.set_text(use_this_text)
122
- # textview.cursor_visible = false # cursor is nit mehr zu sehen.
123
- return textview_widget
114
+ def self.main_file?
115
+ @main_file
124
116
  end
125
117
 
126
118
  # ========================================================================= #
127
- # === Gtk.create_gtk_source_view
128
- #
129
- # Creates a default Gtk::SourceView object.
119
+ # === Gtk.register_sigint
130
120
  # ========================================================================= #
131
- def self.create_gtk_source_view(buffer_to_use)
132
- _ = ::Gtk::SourceView.new(buffer_to_use)
133
- _.show_line_numbers = true
134
- _.show_line_markers = true if _.respond_to? :show_line_markers
135
- _.smart_home_end = true
136
- _.tabs_width = 2
137
- return _
121
+ def self.register_sigint
122
+ Signal.trap('SIGINT') { exit }
138
123
  end
139
124
 
140
125
  # ========================================================================= #
141
- # === Gtk.make_shortcut_key_for_gtk_entry
142
- #
143
- # This method will "make" a shortcut key.
144
- #
145
- # Arguments to this method:
146
- #
147
- # - main_window is the main window which covers all your
148
- # sub-windows. It should be of Gtk::Window
149
- # type.
150
- #
151
- # Usage example:
152
- #
153
- # Gtk.make_shortcut_key_for_gtk_entry(@main_window, @accel_group, '1', @entry)
126
+ # === Gtk.e
154
127
  #
128
+ # This method is simply a wrapper over puts.
155
129
  # ========================================================================= #
156
- def self.make_shortcut_key_for_gtk_entry(
157
- main_window,
158
- accel_group,
159
- shortcut_key = 'b',
160
- the_entry = ''
161
- )
162
- accel_group.connect(
163
- Gdk::Keyval.from_name(shortcut_key.to_s),
164
- Gdk::Window::MOD1_MASK,
165
- :visible
166
- ) { set_focus_and_select(the_entry) }
167
- main_window.add_accel_group(accel_group).show_all
130
+ def self.e(i = '')
131
+ puts i
168
132
  end
169
133
 
170
134
  # ========================================================================= #
171
- # === Gtk.create_event_image
135
+ # === Gtk.is_on_roebe?
136
+ # ========================================================================= #
137
+ def self.is_on_roebe?
138
+ ENV['IS_ROEBE'].to_s == '1'
139
+ end; self.instance_eval { alias on_roebe? is_on_roebe? } # === Gtk.on_roebe?
140
+ self.instance_eval { alias are_we_on_roebe? is_on_roebe? } # === Gtk.are_we_on_roebe?
141
+
142
+ # ========================================================================= #
143
+ # === Gtk.do_grab_the_keyboard
172
144
  #
173
- # Simple event-image. Will embed an image into an EventBox.
145
+ # This works on ruby-gtk2. It is not entirely clear whether it works
146
+ # on ruby-gtk3 and ruby-gtk4, though.
174
147
  # ========================================================================= #
175
- def self.create_event_image(
176
- file_url = ENV['IMG_RPG'].to_s+'/ADOPTION/WALDSZENE.jpg'
148
+ def self.do_grab_the_keyboard(i)
149
+ ::Gdk.keyboard_grab(
150
+ i.window,
151
+ true,
152
+ Gdk::Event::CURRENT_TIME
177
153
  )
178
- image = ::Gtk::Image.new(file_url)
179
- event_box = ::Gtk::EventBox.new.add(image)
180
- event_box.signal_connect(:button_press_event) { puts 'Clicked.' }
181
- return event_box
182
154
  end
183
155
 
184
156
  # ========================================================================= #
185
- # === Gtk.populate_this_liststore
157
+ # === Gtk.do_ungrab_the_keyboard
158
+ # ========================================================================= #
159
+ def self.do_ungrab_the_keyboard
160
+ ::Gdk.keyboard_ungrab(Gdk::Event::CURRENT_TIME)
161
+ end
162
+
163
+ # ========================================================================= #
164
+ # === Gtk.spacer
186
165
  #
187
- # This convenience method can be used to populate a liststore
188
- # with data. The dataset, the second argument, should be an
189
- # Array. You need to make sure that the input-array is
190
- # correct and has the correct number of elements as well.
166
+ # This method will add a horizontal spacer.
191
167
  #
192
- # Note that the old dataset will be cleared by default, as decided
193
- # by the third argument to this method.
168
+ # Note that the Gtk::Separator widget is an abstract class, used only
169
+ # for deriving the subclasses Gtk::HSeparator and Gtk::VSeparator.
194
170
  # ========================================================================= #
195
- def self.populate_this_liststore(
196
- list_store,
197
- dataset,
198
- shall_we_clear_the_liststore = true
199
- )
200
- list_store.clear if shall_we_clear_the_liststore
201
- if dataset.is_a? String
202
- end
203
- dataset.each { |inner_array_containing_the_dataset|
204
- iter = list_store.append # Set to the new iter here.
205
- inner_array_containing_the_dataset.each_with_index {|element, inner_index|
206
- # =================================================================== #
207
- # Next, update every iter element; inner_index keeps track of the
208
- # position.
209
- # =================================================================== #
210
- iter.set_value(inner_index, element)
211
- }
212
- }
171
+ def self.spacer
172
+ # ::Gtk::Separator.new(:horizontal) # ^^^ see above for an explanation why this is commented out.
173
+ return Gtk.horizontal_spacer
213
174
  end
214
175
 
215
176
  # ========================================================================= #
216
- # === Gtk.load_icon
177
+ # === Gtk.create_gtk_source_view
178
+ #
179
+ # This method will create a default Gtk::SourceView object.
217
180
  # ========================================================================= #
218
- def self.load_icon(
219
- a = 'application-exit',
220
- b = 32,
221
- c = 0
222
- )
223
- ::Gtk::IconTheme.default.load_icon(a, b, c)
181
+ def self.create_gtk_source_view(buffer_to_use)
182
+ _ = ::Gtk::SourceView.new(buffer_to_use)
183
+ _.show_line_numbers = true
184
+ _.show_line_markers = true if _.respond_to? :show_line_markers
185
+ _.smart_home_end = true
186
+ _.tabs_width = 2
187
+ return _
224
188
  end
225
189
 
190
+ # ========================================================================= #
191
+ # === Gtk.read_in_from_this_csv_file
192
+ #
193
+ # This method will combine Gtk::ListStore.new and Gtk::TreeView.new().
194
+ #
195
+ # The third argument can use symbols such as :strip_quotes.
196
+ # ========================================================================= #
197
+ def self.read_in_from_this_csv_file(
198
+ i = :default,
199
+ use_this_token_for_the_split_action = :default,
200
+ extra_commands = nil
201
+ )
202
+ require 'gtk_paradise/gtk_classes/tree_view.rb'
203
+ # ======================================================================= #
204
+ # === Handle Hash as input first
205
+ # ======================================================================= #
206
+ if i.is_a? Hash
207
+ # ===================================================================== #
208
+ # === :split_on
209
+ # ===================================================================== #
210
+ if i.has_key? :split_on
211
+ use_this_token_for_the_split_action = i[:split_on]
212
+ end
213
+ end
214
+ case use_this_token_for_the_split_action
215
+ when :default
216
+ use_this_token_for_the_split_action = ','
217
+ end
218
+
219
+ if i.is_a? Array
220
+ i = i.join(' ').strip
221
+ end
222
+ case i
223
+ # ======================================================================= #
224
+ # === :default
225
+ #
226
+ # Make use of a default file. This is catered to my own use case.
227
+ #
228
+ # Simply supply your own .csv file if you want to test this
229
+ # functionality.
230
+ # ======================================================================= #
231
+ when :default, nil, ''
232
+ i = '/home/x/programming/ruby/src/cyberweb/examples/csv/sample.csv' # A test-file on my home setup.
233
+ end
234
+ if File.exist? i
235
+ dataset = File.readlines(i)
236
+ if dataset.is_a? Array
237
+ dataset.map! {|string|
238
+ string.strip.split(use_this_token_for_the_split_action)
239
+ }
240
+ end
241
+ # ===================================================================== #
242
+ # The first row, which will be removed, can be used as the main
243
+ # header for our gtk-datastructure.
244
+ # ===================================================================== #
245
+ list_store = ::Gtk::ListStore.new(
246
+ *([String] * dataset.first.size)
247
+ )
248
+ tree_view = ::Gtk::TreeView.new(list_store)
249
+ use_these_headers = dataset.shift
250
+ if extra_commands == :strip_quotes
251
+ if use_these_headers.is_a? String
252
+ use_these_headers.delete!('"')
253
+ else
254
+ use_these_headers.map! {|entry| entry.delete('"') }
255
+ end
256
+ end
257
+ tree_view.use_these_headers = use_these_headers
258
+ dataset.each {|inner_array|
259
+ iter = list_store.append
260
+ inner_array.each_with_index {|inner_entry, index|
261
+ if extra_commands
262
+ case extra_commands
263
+ # ================================================================ #
264
+ # === :strip_quotes
265
+ # ================================================================ #
266
+ when :strip_quotes
267
+ inner_entry.delete!('"')
268
+ end
269
+ end
270
+ iter.set_value(index, inner_entry)
271
+ }
272
+ }
273
+ tree_view.headers_can_be_moved
274
+ return tree_view
275
+ end
276
+ end; self.instance_eval { alias csv read_in_from_this_csv_file } # === Gtk.csv
277
+
226
278
  # ========================================================================= #
227
279
  # === Gtk.translate_this_gtk_c_code_into_ruby_code
228
280
  #
@@ -335,10 +387,11 @@ longer text
335
387
  # ========================================================================= #
336
388
  # === Gtk.create_entry_with_text_and_max_length
337
389
  #
338
- # Creates a new gtk entry.
390
+ # Creates a new gtk entry. The text displayed is given via the first
391
+ # argument to this method.
339
392
  # ========================================================================= #
340
393
  def self.create_entry_with_text_and_max_length(
341
- text = 'bla',
394
+ text = '',
342
395
  max_length = 50
343
396
  )
344
397
  _ = ::Gtk::Entry.new
@@ -570,9 +623,6 @@ longer text
570
623
  self.instance_eval { alias horizontal_separator gtk_hseparator } # === Gtk.horizontal_separator
571
624
  self.instance_eval { alias hsep gtk_hseparator } # === Gtk.hsep
572
625
 
573
- begin
574
- require 'gtk_paradise/widgets/version_agnostic/coloured_button.rb'
575
- rescue LoadError => error; pp error; end
576
626
  # ========================================================================= #
577
627
  # === Gtk.coloured_button
578
628
  #
@@ -597,6 +647,9 @@ longer text
597
647
  i << "_#{Gtk::ColouredButton.default_colour?}"
598
648
  end
599
649
  end
650
+ begin
651
+ require 'gtk_paradise/widgets/gtk3/coloured_button/coloured_button.rb'
652
+ rescue LoadError => error; pp error; end
600
653
  coloured_button = ::Gtk::ColouredButton.new(i, optional_second_argument)
601
654
  return coloured_button
602
655
  end
@@ -659,8 +712,8 @@ longer text
659
712
  # ========================================================================= #
660
713
  # === Gtk.clipboard_get
661
714
  #
662
- # Obtain an instance/handle to the Clipboard functionality made
663
- # available through Gtk.
715
+ # Obtain an instance/handle to the Clipboard functionality made available
716
+ # through Gtk.
664
717
  # ========================================================================= #
665
718
  def self.clipboard_get
666
719
  @clipboard = ::Gtk::Clipboard.get(
@@ -694,15 +747,6 @@ longer text
694
747
  return black_pixbuf
695
748
  end
696
749
 
697
- # ========================================================================= #
698
- # === Gtk.name_of_this_event?
699
- #
700
- # This method will simply return the name of the event.
701
- # ========================================================================= #
702
- def self.name_of_this_event?(event)
703
- return event.event_type.name
704
- end
705
-
706
750
  # ========================================================================= #
707
751
  # === Gtk.do_exit
708
752
  # ========================================================================= #
@@ -772,10 +816,513 @@ longer text
772
816
  return _
773
817
  end
774
818
 
775
- end
819
+ # ========================================================================= #
820
+ # === Gtk.name_of_this_event?
821
+ #
822
+ # This method will simply return the name of the event.
823
+ # ========================================================================= #
824
+ def self.name_of_this_event?(event)
825
+ return event.event_type.name
826
+ end
776
827
 
777
- if __FILE__ == $PROGRAM_NAME
778
- alias e puts
828
+ # ========================================================================= #
829
+ # === Gtk.calculate_the_true_value_represented_via_a_percentage_value
830
+ # ========================================================================= #
831
+ def self.calculate_the_true_value_represented_via_a_percentage_value(
832
+ i = '55% or minimum 500px',
833
+ max_width_or_max_height = max_width?
834
+ )
835
+ if i.is_a?(String) and i.include?('%')
836
+ # ===================================================================== #
837
+ # Handle something like '80%'. Since as of October 2021 this also
838
+ # has to handle input such as '30% or minimum 300px'.
839
+ # ===================================================================== #
840
+ if i.include? ' '
841
+ if i.include? 'minimum'
842
+ splitted = i.split(' ')
843
+ minimum_value = splitted.last.to_s.delete('px').to_f
844
+ assumed_new_value = splitted.first.delete('%').to_f
845
+ assumed_new_value = (max_width_or_max_height * assumed_new_value) / 100.0
846
+ i = assumed_new_value
847
+ if minimum_value > assumed_new_value
848
+ i = minimum_value
849
+ end
850
+ end
851
+ else # this clause handles '50%'
852
+ i = (max_width_or_max_height * i.delete('%').to_f) / 100.0
853
+ end
854
+ end
855
+ return i
856
+ end
857
+
858
+ # ========================================================================= #
859
+ # === Gtk.replace_with_proper_tags
860
+ #
861
+ # This method can be used to add ad-hoc colour support for HTML-like
862
+ # tags (markup).
863
+ #
864
+ # The method will return a String.
865
+ # ========================================================================= #
866
+ def self.replace_with_proper_tags(
867
+ i = '<green>green</green>
868
+ <blue>blue</blue>
869
+ <steelblue>steelblue</steelblue>
870
+
871
+ <green>Hello</green><span foreground="blue"> world!</span>
872
+
873
+
874
+ <steelblue>longer text</steelblue>
875
+ longer text
876
+ ')
877
+ begin
878
+ require 'colours'
879
+ rescue LoadError; end
880
+ splitted = i.split("\n")
881
+ _ = ''.dup
882
+ html_colours = ::Colours.available_html_colours?
883
+ splitted.each {|line|
884
+ # ===================================================================== #
885
+ # <steelblue>steelblue</steelblue>
886
+ # The first part has to become a <span> tag and the last entry a
887
+ # </span> tag.
888
+ # ===================================================================== #
889
+ if html_colours.any? {|inner_html_colour| line.include? '<'+inner_html_colour+'>' }
890
+ scanned_results = html_colours.select {|inner_html_colour|
891
+ line.include? '<'+inner_html_colour+'>'
892
+ }
893
+ scanned_results.each {|this_is_the_colour|
894
+ line.gsub!(/<\/#{this_is_the_colour}>/, '</span>')
895
+ line.gsub!(
896
+ /<#{this_is_the_colour}>/, '<span foreground="'+this_is_the_colour.to_s+'">'
897
+ )
898
+ }
899
+ end
900
+ _ << "#{line}\n"
901
+ }
902
+ return _
903
+ end
904
+
905
+ # ========================================================================= #
906
+ # === Gtk.return_n_characters_up_to_array_position
907
+ #
908
+ # We follow simple array-logic here, so the given input argument, the
909
+ # first one, is using the same logic as Arrays in general: the counting
910
+ # starts at 0.
911
+ #
912
+ # The method was specifically added because a "goto-this-line"
913
+ # functionality was needed for a gtk-based editor.
914
+ # ========================================================================= #
915
+ def self.return_n_characters_up_to_array_position(
916
+ i = 3,
917
+ array = [
918
+ "This is some text.\n", # 0
919
+ "class Foobar # this is a comment\n", # 1
920
+ "end\n", # 2
921
+ "AHIFOUVEUHIVE\n", # 3
922
+ "underlined!!!\n", # 4
923
+ "bold text example!!!\n" # 5
924
+ ]
925
+ )
926
+ position = 0
927
+ # ======================================================================= #
928
+ # We must re-adjust i if the Array does not have enough elements. We
929
+ # will deduct -1 lateron anyway, so the following code is correct.
930
+ # ======================================================================= #
931
+ if i > array.size
932
+ i = array.size
933
+ end
934
+ 0.upto(i).each {|entry_number|
935
+ if entry_number == 0
936
+ else # else calculate the line BEFORE.
937
+ position += array[entry_number - 1].size
938
+ end
939
+ }
940
+ return position
941
+ end
942
+
943
+ # ========================================================================= #
944
+ # === Gtk.set_double_click_time
945
+ #
946
+ # This method sets the double click time for the default display.
947
+ # Applications should NOT set this, as it is a global user-configured
948
+ # setting.
949
+ # ========================================================================= #
950
+ def self.set_double_click_time(msec = 50)
951
+ Gdk.set_double_click_time(msec) # Delegate towards Gdk.
952
+ end
953
+
954
+ # ========================================================================= #
955
+ # === Gtk.textview_with_text
956
+ #
957
+ # This method can be used to create a textview-widget.
958
+ # ========================================================================= #
959
+ def self.textview_with_text(use_this_text = '')
960
+ textview_widget = ::Gtk.textview
961
+ textview_widget.set_text(use_this_text)
962
+ # textview.cursor_visible = false # Hide the cursor here.
963
+ return textview_widget
964
+ end
965
+
966
+ # ========================================================================= #
967
+ # === Gtk.make_shortcut_key_for_gtk_entry
968
+ #
969
+ # This method will "make" a shortcut key.
970
+ #
971
+ # Arguments to this method:
972
+ #
973
+ # - main_window is the main window which covers all your sub-windows.
974
+ # It should be of Gtk::Window type.
975
+ #
976
+ # Usage example:
977
+ #
978
+ # Gtk.make_shortcut_key_for_gtk_entry(@main_window, @accel_group, '1', @entry)
979
+ #
980
+ # ========================================================================= #
981
+ def self.make_shortcut_key_for_gtk_entry(
982
+ main_window,
983
+ accel_group,
984
+ shortcut_key = 'b',
985
+ the_entry = ''
986
+ )
987
+ accel_group.connect(
988
+ Gdk::Keyval.from_name(shortcut_key.to_s),
989
+ Gdk::Window::MOD1_MASK,
990
+ :visible
991
+ ) { set_focus_and_select(the_entry) }
992
+ main_window.add_accel_group(accel_group).show_all
993
+ end
994
+
995
+ # ========================================================================= #
996
+ # === Gtk.create_event_image
997
+ #
998
+ # Simple event-image. Will embed an image into an EventBox.
999
+ # ========================================================================= #
1000
+ def self.create_event_image(
1001
+ file_url = ENV['IMG_RPG'].to_s+'/ADOPTION/WALDSZENE.jpg'
1002
+ )
1003
+ image = ::Gtk::Image.new(file_url)
1004
+ event_box = ::Gtk::EventBox.new.add(image)
1005
+ event_box.signal_connect(:button_press_event) { puts 'Clicked.' }
1006
+ return event_box
1007
+ end
1008
+
1009
+ # ========================================================================= #
1010
+ # === Gtk.populate_this_liststore
1011
+ #
1012
+ # This convenience method can be used to populate a liststore
1013
+ # with data. The dataset, the second argument, should be an
1014
+ # Array. You need to make sure that the input-array is
1015
+ # correct and has the correct number of elements as well.
1016
+ #
1017
+ # Note that the old dataset will be cleared by default, as decided
1018
+ # by the third argument to this method.
1019
+ # ========================================================================= #
1020
+ def self.populate_this_liststore(
1021
+ list_store,
1022
+ dataset,
1023
+ shall_we_clear_the_liststore = true
1024
+ )
1025
+ list_store.clear if shall_we_clear_the_liststore
1026
+ if dataset.is_a? String
1027
+ end
1028
+ dataset.each { |inner_array_containing_the_dataset|
1029
+ iter = list_store.append # Set to the new iter here.
1030
+ inner_array_containing_the_dataset.each_with_index {|element, inner_index|
1031
+ # =================================================================== #
1032
+ # Next, update every iter element; inner_index keeps track of the
1033
+ # position.
1034
+ # =================================================================== #
1035
+ iter.set_value(inner_index, element)
1036
+ }
1037
+ }
1038
+ end
1039
+
1040
+ # ========================================================================= #
1041
+ # === Gtk.pixbuf_new_from_file
1042
+ # ========================================================================= #
1043
+ def self.pixbuf_new_from_file(this_file)
1044
+ ::GdkPixbuf::Pixbuf.new(file: this_file)
1045
+ end; self.instance_eval { alias pixbuf_from_file pixbuf_new_from_file } # === Gtk.pixbuf_from_file
1046
+ self.instance_eval { alias image_from_file pixbuf_new_from_file } # === Gtk.image_from_file
1047
+
1048
+ # ========================================================================= #
1049
+ # === Gtk.load_icon
1050
+ # ========================================================================= #
1051
+ def self.load_icon(
1052
+ a = 'application-exit',
1053
+ b = 32,
1054
+ c = 0
1055
+ )
1056
+ ::Gtk::IconTheme.default.load_icon(a, b, c)
1057
+ end
1058
+
1059
+ # ========================================================================= #
1060
+ # === Gtk.set_tooltip
1061
+ #
1062
+ # The first argument to this method is the text that is to be displayed,
1063
+ # as a String. For example, "Hello world!".
1064
+ #
1065
+ # The second argument shall be the widget that receives the tooltip.
1066
+ # For example, a gtk-button as widget, or a gtk-label.
1067
+ #
1068
+ # Note that Gtk::Tooltips has been deprecated in ruby-gtk3, so this is
1069
+ # only useful for ruby-gtk2. However had, even in ruby-gtk2 it is not
1070
+ # recommended to use it, as there are other, simpler means to set
1071
+ # a tooltip - namely via .tooltip_text=.
1072
+ #
1073
+ # Usage example:
1074
+ #
1075
+ # Gtk.set_tooltip('Hello world!', widget)
1076
+ #
1077
+ # ========================================================================= #
1078
+ def self.set_tooltip(
1079
+ which_tip_to_use = 'This is a popup.',
1080
+ which_widget_to_use_it_on = nil
1081
+ )
1082
+ ::Gtk::Tooltips.new.set_tip(
1083
+ which_widget_to_use_it_on,
1084
+ which_tip_to_use,
1085
+ nil
1086
+ )
1087
+ end; self.instance_eval { alias tooltip set_tooltip } # === Gtk.tooltip
1088
+ self.instance_eval { alias tooltip_widget set_tooltip } # === Gtk.tooltip_widget
1089
+ self.instance_eval { alias set_tooltip_for_this_widget set_tooltip } # === Gtk.set_tooltip_for_this_widget
1090
+
1091
+ # ========================================================================= #
1092
+ # === Gtk.tooltip_for
1093
+ #
1094
+ # This is like the above method (Gtk.set_tooltip), except that the
1095
+ # arguments are reversed.
1096
+ #
1097
+ # First comes the target-widget, then the specific message to display.
1098
+ #
1099
+ # Two aliass exist for this method, called Gtk.set_tooltip_for() and
1100
+ # Gtk.fancy_tooltip=() respectively.
1101
+ #
1102
+ # The reason as to why this method was added was because I sometimes
1103
+ # confused the order of arguments, so I found it simpler in these
1104
+ # cases to use another API instead.
1105
+ # ========================================================================= #
1106
+ def self.tooltip_for(widget, text)
1107
+ ::Gtk.set_tooltip(text, widget)
1108
+ end; self.instance_eval { alias set_tooltip_for tooltip_for } # === Gtk.set_tooltip_for
1109
+ self.instance_eval { alias fancy_tooltip= tooltip_for } # === Gtk.fancy_tooltip=
1110
+
1111
+ # ========================================================================= #
1112
+ # === Gtk.do_select_file
1113
+ #
1114
+ # This method can be used to select a specific (local) file.
1115
+ #
1116
+ # The filename will be returned by this method, as a String.
1117
+ #
1118
+ # A complex usage example follows next:
1119
+ #
1120
+ # filename = ::Gtk.select_file(parent_widget_here) {{
1121
+ # current_folder: current_folder,
1122
+ # show_hidden: true,
1123
+ # extra_widget: @extra_button,
1124
+ # add_these_shortcut_folders: ARRAY_ADD_THESE_SHORTCUT_FOLDERS,
1125
+ # use_this_file_filter: '.pdf'
1126
+ # }}
1127
+ #
1128
+ # ========================================================================= #
1129
+ def self.do_select_file(
1130
+ parent_widget,
1131
+ use_this_file_filter = nil
1132
+ )
1133
+ yielded = nil
1134
+ # ======================================================================= #
1135
+ # === Handle blocks given to this method
1136
+ # ======================================================================= #
1137
+ if block_given?
1138
+ yielded = yield
1139
+ end
1140
+ action_option = :open
1141
+ # ======================================================================= #
1142
+ # Next, handle ruby-gtk2:
1143
+ # ======================================================================= #
1144
+ if use_gtk2?
1145
+ action_option = Gtk::FileChooser::ACTION_OPEN
1146
+ dialog = Gtk::FileChooserDialog.new(
1147
+ 'Open File',
1148
+ parent_widget,
1149
+ action_option,
1150
+ nil,
1151
+ [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL],
1152
+ [Gtk::Stock::OPEN, Gtk::Dialog::RESPONSE_ACCEPT]
1153
+ )
1154
+ elsif use_gtk3? # else handle ruby-gtk3. ruby-gtk3 is not yet supported here.
1155
+ dialog = Gtk::FileChooserDialog.new(
1156
+ title: 'Open File',
1157
+ action: action_option,
1158
+ buttons: [[Gtk::Stock::CANCEL, :cancel],
1159
+ [Gtk::Stock::OPEN, :accept]]
1160
+ )
1161
+ end
1162
+ # ======================================================================= #
1163
+ # === Handle Hashes given to this method next
1164
+ # ======================================================================= #
1165
+ if yielded and yielded.is_a?(Hash)
1166
+ # ===================================================================== #
1167
+ # === :current_folder
1168
+ #
1169
+ # Usage example for this entry point:
1170
+ #
1171
+ # ::Gtk.select_file {{ current_folder: '/home/' }}
1172
+ #
1173
+ # ===================================================================== #
1174
+ if yielded.has_key? :current_folder
1175
+ _ = yielded[:current_folder]
1176
+ dialog.set_current_folder(_)
1177
+ end
1178
+ # ===================================================================== #
1179
+ # === :show_hidden
1180
+ # ===================================================================== #
1181
+ if yielded.has_key? :show_hidden
1182
+ dialog.show_hidden = yielded[:show_hidden]
1183
+ end
1184
+ # ===================================================================== #
1185
+ # === :extra_widget
1186
+ # ===================================================================== #
1187
+ if yielded.has_key? :extra_widget
1188
+ dialog.extra_widget = yielded[:extra_widget]
1189
+ end
1190
+ # ===================================================================== #
1191
+ # === :add_these_shortcut_folders
1192
+ # ===================================================================== #
1193
+ if yielded.has_key? :add_these_shortcut_folders
1194
+ _ = [yielded[:add_these_shortcut_folders]].flatten.compact
1195
+ _.each {|this_directory|
1196
+ dialog.add_shortcut_folder(this_directory)
1197
+ }
1198
+ # ===================================================================== #
1199
+ # === :additional_directories
1200
+ # ===================================================================== #
1201
+ elsif yielded.has_key? :additional_directories
1202
+ _ = [yielded[:additional_directories]].flatten.compact
1203
+ _.each {|this_directory|
1204
+ dialog.add_shortcut_folder(this_directory)
1205
+ }
1206
+ end
1207
+ # ===================================================================== #
1208
+ # === :use_this_file_filter
1209
+ # ===================================================================== #
1210
+ if yielded.has_key? :use_this_file_filter
1211
+ use_this_file_filter = yielded[:use_this_file_filter]
1212
+ # ===================================================================== #
1213
+ # === :filter_for_these_file_types
1214
+ # ===================================================================== #
1215
+ elsif yielded.has_key? :filter_for_these_file_types
1216
+ use_this_file_filter = yielded[:filter_for_these_file_types]
1217
+ end
1218
+ end
1219
+ if use_this_file_filter
1220
+ use_this_file_filter = use_this_file_filter.to_s.dup
1221
+ if use_this_file_filter.is_a? String
1222
+ filter = ::Gtk::FileFilter.new
1223
+ filter.name = use_this_file_filter.to_s+' files'
1224
+ unless use_this_file_filter.start_with? '.'
1225
+ use_this_file_filter.prepend('.')
1226
+ end
1227
+ unless use_this_file_filter.start_with? '*'
1228
+ use_this_file_filter.prepend('*')
1229
+ end
1230
+ use_this_file_filter = filter.add_pattern(use_this_file_filter)
1231
+ end
1232
+ dialog.add_filter(use_this_file_filter)
1233
+ end
1234
+ # ======================================================================= #
1235
+ # === Add some default shortcut-folders on Roebe
1236
+ #
1237
+ # This is only useful for my home setup really.
1238
+ # ======================================================================= #
1239
+ if is_on_roebe?
1240
+ begin
1241
+ dialog.add_shortcut_folder ENV['MY_SONGS']
1242
+ rescue Exception; end
1243
+ begin
1244
+ dialog.add_shortcut_folder ENV['MY_TEMP']
1245
+ rescue Exception; end
1246
+ begin
1247
+ dialog.add_shortcut_folder ENV['MY_DATA']
1248
+ rescue Exception; end
1249
+ begin
1250
+ dialog.add_shortcut_folder ENV['RUBY_SRC']
1251
+ rescue Exception; end
1252
+ # ===================================================================== #
1253
+ # Add some more directories by default next:
1254
+ # ===================================================================== #
1255
+ dialog.add_shortcut_folder '/Depot/j/' unless Dir.pwd.include?('/Depot/j')
1256
+ dialog.add_shortcut_folder '/Depot/jj/' unless Dir.pwd.include?('/Depot/jj')
1257
+ dialog.add_shortcut_folder '/Depot/jjj/' unless Dir.pwd.include?('/Depot/jjj')
1258
+ dialog.add_shortcut_folder '/Depot/jjjj/' unless Dir.pwd.include?('/Depot/jjjj')
1259
+ # dialog.add_shortcut_folder '/' # <- Can not use this variant.
1260
+ end
1261
+ accept = :accept
1262
+ if use_gtk2?
1263
+ accept = Gtk::Dialog::RESPONSE_ACCEPT
1264
+ end
1265
+ case dialog.run
1266
+ when accept
1267
+ puts "filename = #{dialog.filename}"
1268
+ end
1269
+ result = dialog.filename
1270
+ dialog.destroy # Clean it up here.
1271
+ return result
1272
+ end; self.instance_eval { alias select_file do_select_file } # === Gtk.select_file
1273
+
1274
+ # ========================================================================= #
1275
+ # === Gtk.horizontal_spacer
1276
+ #
1277
+ # We have to check whether gtk2 or gtk3 is used. Depending on this
1278
+ # we will return a "different" separator.
1279
+ # ========================================================================= #
1280
+ def self.horizontal_spacer
1281
+ if is_gtk2_in_use?
1282
+ ::Gtk::HSeparator.new
1283
+ else # Assume gtk3 and gtk4 here.
1284
+ ::Gtk::Separator.new(:horizontal)
1285
+ end
1286
+ end; self.instance_eval { alias hspacer horizontal_spacer } # === Gtk.hspacer
1287
+
1288
+ # ========================================================================= #
1289
+ # === Gtk.vertical_spacer
1290
+ # ========================================================================= #
1291
+ def self.vertical_spacer
1292
+ if is_gtk2_in_use?
1293
+ ::Gtk::VSeparator.new
1294
+ else # Assume gtk3 and gtk4 here.
1295
+ ::Gtk::Separator.new(:vertical)
1296
+ end
1297
+ end; self.instance_eval { alias vspacer vertical_spacer } # === Gtk.vspacer
1298
+
1299
+ # ========================================================================= #
1300
+ # === Gtk.initialize_gtk3
1301
+ # ========================================================================= #
1302
+ def self.initialize_gtk3
1303
+ require 'gtk3'
1304
+ end
1305
+
1306
+ # ========================================================================= #
1307
+ # === Gtk.initialize_gtk4
1308
+ # ========================================================================= #
1309
+ def self.initialize_gtk4
1310
+ require 'gtk4'
1311
+ end
1312
+
1313
+ end
1314
+
1315
+ if __FILE__ == $PROGRAM_NAME
1316
+ alias e puts
1317
+ e Gtk.is_on_roebe?
1318
+ e
1319
+ pp Gtk.read_in_from_this_csv_file(ARGV)
1320
+ e
1321
+ e Gtk.old_verbose_value?
1322
+ e
1323
+ # require 'gtk2'
1324
+ # pp Gtk.is_gtk2_in_use?
1325
+ alias e puts
779
1326
  e
780
1327
  e Gtk.return_path_to_the_sitelibdir
781
1328
  e