gtk_paradise 0.12.25 → 0.13.33

Sign up to get free protection for your applications and to get access to all the features.
Files changed (393) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +997 -1065
  3. data/bin/gtk_display_this_file +0 -2
  4. data/bin/run_this_widget +7 -0
  5. data/doc/README.gen +995 -1063
  6. data/doc/todo/recurring_todo_tasks.md +8 -8
  7. data/doc/todo/{TODO_FOR_THE_GTK_EDITOR.md → todo_for_the_gtk_editor.md} +4 -3
  8. data/doc/todo/{TODO_FOR_THE_GTK_PARADISE_PROJECT.md → todo_for_the_gtk_paradise_project.md} +55 -36
  9. data/gtk_paradise.gemspec +0 -7
  10. data/lib/gtk_paradise/base_module/base_module.rb +5965 -5054
  11. data/lib/gtk_paradise/base_module/internal_hash_module/internal_hash_module.rb +205 -0
  12. data/lib/gtk_paradise/{base_module_and_app_module/base_module_and_app_module.rb → base_module_and_run_module/base_module_and_run_module.rb} +5 -5
  13. data/lib/gtk_paradise/{base_module/widgets/widgets.rb → base_module_widgets/base_module_widgets.rb} +28 -5
  14. data/lib/gtk_paradise/{css_files → cascading_style_sheets}/colours.css +58 -57
  15. data/lib/gtk_paradise/{css_files → cascading_style_sheets}/css_accordion.css +2 -1
  16. data/lib/gtk_paradise/{css_files → cascading_style_sheets}/hover_effects.css +0 -1
  17. data/lib/gtk_paradise/{css_files → cascading_style_sheets}/project.css +16 -13
  18. data/lib/gtk_paradise/colours/colour_palette/material_design.rb +35 -18
  19. data/lib/gtk_paradise/colours/parse.rb +4 -2
  20. data/lib/gtk_paradise/commandline/commandline.rb +13 -7
  21. data/lib/gtk_paradise/constants/constants.rb +84 -174
  22. data/lib/gtk_paradise/{gtk_classes → core_classes}/about.rb +2 -2
  23. data/lib/gtk_paradise/{gtk_classes → core_classes}/about_dialog.rb +1 -1
  24. data/lib/gtk_paradise/{gtk_classes → core_classes}/accel_group.rb +3 -7
  25. data/lib/gtk_paradise/{gtk_classes → core_classes}/alignment.rb +1 -1
  26. data/lib/gtk_paradise/{gtk_classes → core_classes}/application.rb +2 -2
  27. data/lib/gtk_paradise/{gtk_classes → core_classes}/application_window.rb +1 -1
  28. data/lib/gtk_paradise/{gtk_classes → core_classes}/box.rb +11 -7
  29. data/lib/gtk_paradise/{gtk_classes → core_classes}/button.rb +59 -61
  30. data/lib/gtk_paradise/{gtk_classes → core_classes}/button_box.rb +1 -1
  31. data/lib/gtk_paradise/{gtk_classes → core_classes}/cairo/context.rb +2 -2
  32. data/lib/gtk_paradise/{gtk_classes → core_classes}/calendar.rb +1 -1
  33. data/lib/gtk_paradise/{gtk_classes → core_classes}/cell_renderer_text.rb +2 -2
  34. data/lib/gtk_paradise/{gtk_classes → core_classes}/check_button.rb +60 -58
  35. data/lib/gtk_paradise/{gtk_classes → core_classes}/combo_box.rb +1 -1
  36. data/lib/gtk_paradise/{gtk_classes → core_classes}/combo_box_entry.rb +5 -4
  37. data/lib/gtk_paradise/{gtk_classes → core_classes}/combo_box_text.rb +54 -18
  38. data/lib/gtk_paradise/{gtk_classes → core_classes}/dialog.rb +1 -1
  39. data/lib/gtk_paradise/{gtk_classes → core_classes}/entry.rb +17 -3
  40. data/lib/gtk_paradise/{gtk_classes → core_classes}/entry_completion.rb +5 -3
  41. data/lib/gtk_paradise/{gtk_classes → core_classes}/event_box.rb +1 -1
  42. data/lib/gtk_paradise/{gtk_classes → core_classes}/event_button.rb +6 -8
  43. data/lib/gtk_paradise/{gtk_classes → core_classes}/event_key.rb +2 -2
  44. data/lib/gtk_paradise/{gtk_classes → core_classes}/expander.rb +1 -1
  45. data/lib/gtk_paradise/{gtk_classes → core_classes}/file_chooser_dialog.rb +1 -1
  46. data/lib/gtk_paradise/{gtk_classes → core_classes}/file_filter.rb +1 -1
  47. data/lib/gtk_paradise/{gtk_classes → core_classes}/file_selection.rb +11 -7
  48. data/lib/gtk_paradise/{gtk_classes → core_classes}/frame.rb +4 -4
  49. data/lib/gtk_paradise/{gtk_classes → core_classes}/grid.rb +136 -80
  50. data/lib/gtk_paradise/{gtk_classes → core_classes}/hbox.rb +4 -2
  51. data/lib/gtk_paradise/{gtk_classes → core_classes}/header_bar.rb +1 -1
  52. data/lib/gtk_paradise/{gtk_classes → core_classes}/hscale.rb +5 -7
  53. data/lib/gtk_paradise/{gtk_classes → core_classes}/image.rb +15 -12
  54. data/lib/gtk_paradise/{gtk_classes → core_classes}/image_menu_item.rb +1 -1
  55. data/lib/gtk_paradise/{gtk_classes → core_classes}/label.rb +29 -22
  56. data/lib/gtk_paradise/{gtk_classes → core_classes}/list_store.rb +6 -1
  57. data/lib/gtk_paradise/{gtk_classes → core_classes}/menu.rb +2 -6
  58. data/lib/gtk_paradise/{gtk_classes → core_classes}/menu_bar.rb +1 -1
  59. data/lib/gtk_paradise/{gtk_classes → core_classes}/menu_item.rb +1 -1
  60. data/lib/gtk_paradise/{gtk_classes → core_classes}/notebook.rb +35 -20
  61. data/lib/gtk_paradise/{gtk_classes → core_classes}/option_menu.rb +1 -1
  62. data/lib/gtk_paradise/{gtk_classes → core_classes}/paned.rb +7 -4
  63. data/lib/gtk_paradise/{gtk_classes → core_classes}/popover.rb +1 -1
  64. data/lib/gtk_paradise/{gtk_classes → core_classes}/radio_button.rb +2 -2
  65. data/lib/gtk_paradise/{gtk_classes → core_classes}/radio_menu_item.rb +6 -14
  66. data/lib/gtk_paradise/{gtk_classes → core_classes}/scale_button.rb +1 -1
  67. data/lib/gtk_paradise/{gtk_classes → core_classes}/scrolled_window.rb +75 -48
  68. data/lib/gtk_paradise/{gtk_classes → core_classes}/search_bar.rb +1 -1
  69. data/lib/gtk_paradise/{gtk_classes → core_classes}/size_group.rb +1 -1
  70. data/lib/gtk_paradise/{gtk_classes → core_classes}/source_buffer.rb +2 -2
  71. data/lib/gtk_paradise/{gtk_classes → core_classes}/source_view.rb +1 -1
  72. data/lib/gtk_paradise/{gtk_classes → core_classes}/spin_button.rb +1 -1
  73. data/lib/gtk_paradise/{gtk_classes → core_classes}/spinner.rb +1 -1
  74. data/lib/gtk_paradise/{gtk_classes → core_classes}/status_icon.rb +2 -6
  75. data/lib/gtk_paradise/{gtk_classes → core_classes}/statusbar.rb +1 -1
  76. data/lib/gtk_paradise/{gtk_classes → core_classes}/style_context.rb +1 -1
  77. data/lib/gtk_paradise/{gtk_classes → core_classes}/text_buffer.rb +3 -7
  78. data/lib/gtk_paradise/{gtk_classes → core_classes}/text_tag.rb +1 -1
  79. data/lib/gtk_paradise/{gtk_classes → core_classes}/text_view.rb +19 -14
  80. data/lib/gtk_paradise/{gtk_classes → core_classes}/toggle_button.rb +2 -2
  81. data/lib/gtk_paradise/{gtk_classes → core_classes}/toolbar.rb +1 -1
  82. data/lib/gtk_paradise/{gtk_classes → core_classes}/tree_iter.rb +2 -2
  83. data/lib/gtk_paradise/{gtk_classes → core_classes}/tree_selection.rb +5 -3
  84. data/lib/gtk_paradise/{gtk_classes → core_classes}/tree_view.rb +28 -39
  85. data/lib/gtk_paradise/{gtk_classes → core_classes}/tree_view_column.rb +1 -1
  86. data/lib/gtk_paradise/{gtk_classes → core_classes}/vbox.rb +2 -2
  87. data/lib/gtk_paradise/{gtk_classes → core_classes}/vscale.rb +5 -7
  88. data/lib/gtk_paradise/{gtk_classes → core_classes}/vte.rb +1 -1
  89. data/lib/gtk_paradise/{gtk_classes → core_classes}/widget.rb +1086 -1111
  90. data/lib/gtk_paradise/{gtk_classes → core_classes}/window.rb +25 -12
  91. data/lib/gtk_paradise/drawing/README.md +2 -2
  92. data/lib/gtk_paradise/drawing/drawing.rb +6 -4
  93. data/lib/gtk_paradise/drawing/event.rb +7 -5
  94. data/lib/gtk_paradise/drawing/star.rb +20 -9
  95. data/lib/gtk_paradise/drawing/tool.rb +3 -1
  96. data/lib/gtk_paradise/drawing/turtle.rb +4 -2
  97. data/lib/gtk_paradise/emojis/emojis.rb +4 -676
  98. data/lib/gtk_paradise/examples/advanced/001_5x5_grid_example.rb +4 -7
  99. data/lib/gtk_paradise/examples/advanced/002_advanced_drag_and_drop_example.rb +3 -9
  100. data/lib/gtk_paradise/examples/advanced/003_html_like_support.rb +4 -11
  101. data/lib/gtk_paradise/examples/advanced/005_csv_example.rb +0 -2
  102. data/lib/gtk_paradise/examples/advanced/006_file_chooser_button_example.rb +6 -13
  103. data/lib/gtk_paradise/examples/advanced/007_label_responding_to_events_example.rb +5 -13
  104. data/lib/gtk_paradise/examples/advanced/008_options_example.rb +0 -4
  105. data/lib/gtk_paradise/examples/advanced/009_key_events.rb +3 -12
  106. data/lib/gtk_paradise/examples/advanced/010_extensive_text_view_example.rb +2 -10
  107. data/lib/gtk_paradise/examples/advanced/011_moving_blocks_example.rb +0 -7
  108. data/lib/gtk_paradise/examples/advanced/012_cell_data_sorting_example.rb +0 -4
  109. data/lib/gtk_paradise/examples/advanced/013_advanced_css_example.rb +3 -12
  110. data/lib/gtk_paradise/examples/advanced/014_popup_example.rb +3 -12
  111. data/lib/gtk_paradise/examples/advanced/015_advanced_button_example.rb +8 -13
  112. data/lib/gtk_paradise/examples/advanced/016_change_background_on_click_event.rb +0 -2
  113. data/lib/gtk_paradise/examples/advanced/017_lean_CSS_example.rb +2 -10
  114. data/lib/gtk_paradise/examples/advanced/018_coloured_text_example.rb +2 -10
  115. data/lib/gtk_paradise/examples/advanced/019_gtk_entry_showing_the_cursor_position.rb +1 -3
  116. data/lib/gtk_paradise/examples/advanced/020_scale_this_image.rb +8 -12
  117. data/lib/gtk_paradise/examples/advanced/021_scroll_events_on_gtk_entry.rb +0 -1
  118. data/lib/gtk_paradise/examples/advanced/022_autogenerated_CSS_rounded_borders.rb +15 -19
  119. data/lib/gtk_paradise/examples/advanced/023_append_image_to_buffer.rb +8 -14
  120. data/lib/gtk_paradise/examples/advanced/024_notebook_with_tab_example.rb +1 -1
  121. data/lib/gtk_paradise/examples/advanced/025_showing_a_gold_caret_on_black_background.rb +6 -5
  122. data/lib/gtk_paradise/examples/advanced/026_status_bar_example.rb +2 -5
  123. data/lib/gtk_paradise/examples/advanced/027_customized_frame_example.rb +4 -7
  124. data/lib/gtk_paradise/examples/advanced/028_widgets_described_in_a_yaml_file.rb +17 -20
  125. data/lib/gtk_paradise/examples/advanced/029_entry_completion_example.rb +4 -9
  126. data/lib/gtk_paradise/examples/advanced/030_parse_into_table_example.rb +132 -0
  127. data/lib/gtk_paradise/{widgets/gtk3/calculator/calculator.rb → examples/advanced/031_combo_box_example.rb} +77 -92
  128. data/lib/gtk_paradise/examples/cairo/three_rectangles.rb +4 -4
  129. data/lib/gtk_paradise/examples/controller/controller.rb +27 -24
  130. data/lib/gtk_paradise/examples/gir_ffi/advanced/001_advanced_treeview_example.rb +1 -1
  131. data/lib/gtk_paradise/examples/gir_ffi/gtk2/001_hello_world.rb +30 -0
  132. data/lib/gtk_paradise/examples/gir_ffi/gtk2/002_upgraded_hello_world.rb +42 -0
  133. data/lib/gtk_paradise/examples/gir_ffi/gtk2/004_treeview_example.rb +62 -0
  134. data/lib/gtk_paradise/examples/gir_ffi/gtk2/005_complex_example.rb +102 -0
  135. data/lib/gtk_paradise/examples/gir_ffi/gtk2/101_all_in_one_example.rb +23 -0
  136. data/lib/gtk_paradise/examples/gir_ffi/{005_complex_example.rb → gtk3/005_complex_example.rb} +2 -2
  137. data/lib/gtk_paradise/examples/glib/parse_glib_settings.rb +1 -1
  138. data/lib/gtk_paradise/examples/gtk2/001_tooltips_example.rb +15 -6
  139. data/lib/gtk_paradise/examples/gtk2/003_draw_rectangle.rb +1 -1
  140. data/lib/gtk_paradise/examples/gtk2/011_password_example.rb +10 -4
  141. data/lib/gtk_paradise/examples/gtk2/README.md +5 -0
  142. data/lib/gtk_paradise/examples/gtk3/001_examples_with_css.rb +320 -0
  143. data/lib/gtk_paradise/examples/gtk3/{077_button_box_example.rb → 003_button_box_example.rb} +13 -4
  144. data/lib/gtk_paradise/examples/gtk3/{056_font_chooser_dialog_example.rb → 005_font_chooser_dialog_example.rb} +3 -2
  145. data/lib/gtk_paradise/examples/gtk3/{073_image_example.rb → 007_image_example.rb} +4 -1
  146. data/lib/gtk_paradise/examples/gtk3/{051_combo_box_example.rb → 009_combo_box_example.rb} +3 -2
  147. data/lib/gtk_paradise/examples/gtk3/{033_list_box_example.rb → 010_list_box_example.rb} +1 -0
  148. data/lib/gtk_paradise/examples/gtk3/{021_tiny_button_via_css.rb → 013_tiny_button_via_css.rb} +4 -3
  149. data/lib/gtk_paradise/examples/gtk3/{025_password_example.rb → 014_password_example.rb} +3 -2
  150. data/lib/gtk_paradise/examples/gtk3/{047_draw_rectangles.rb → 016_draw_rectangles.rb} +4 -0
  151. data/lib/gtk_paradise/examples/gtk3/{005_spinner_example.rb → 017_spinner_example.rb} +1 -0
  152. data/lib/gtk_paradise/examples/gtk3/{078_tree_view_column_example.rb → 018_tree_view_column_example.rb} +1 -1
  153. data/lib/gtk_paradise/examples/gtk3/{084_recent_chooser_dialog.rb → 019_recent_chooser_dialog.rb} +1 -0
  154. data/lib/gtk_paradise/examples/gtk3/{072_text_iterator_example.rb → 021_text_iterator_example.rb} +13 -6
  155. data/lib/gtk_paradise/examples/gtk3/{067_gtk_label_example.rb → 024_gtk_label_example.rb} +3 -3
  156. data/lib/gtk_paradise/examples/gtk3/{081_vbox_with_spacing_and_border_width.rb → 032_vbox_with_spacing_and_border_width.rb} +1 -1
  157. data/lib/gtk_paradise/examples/gtk3/{006_text_view_example.rb → 034_text_view_example.rb} +2 -1
  158. data/lib/gtk_paradise/examples/gtk3/{054_ten_labels_in_a_vertical_box_example.rb → 036_ten_labels_in_a_vertical_box_example.rb} +1 -0
  159. data/lib/gtk_paradise/examples/gtk3/{029_sockets.rb → 039_sockets.rb} +2 -2
  160. data/lib/gtk_paradise/examples/gtk3/{053_revealer_example.rb → 041_revealer_example.rb} +11 -2
  161. data/lib/gtk_paradise/examples/gtk3/{034_hello_world_in_gtk3_and_bold_font.rb → 042_hello_world_in_gtk3_and_bold_font.rb} +1 -1
  162. data/lib/gtk_paradise/examples/gtk3/{052_notebook_css_example.rb → 043_notebook_css_example.rb} +6 -4
  163. data/lib/gtk_paradise/examples/gtk3/{038_radio_button_window.rb → 055_radio_button_window.rb} +1 -1
  164. data/lib/gtk_paradise/examples/gtk3/{085_showcase_the_cursors.rb → 058_showcase_the_cursors.rb} +10 -1
  165. data/lib/gtk_paradise/examples/gtk3/{024_small_paned_example.rb → 059_small_paned_example.rb} +1 -0
  166. data/lib/gtk_paradise/examples/gtk3/{039_scale_button_demo.rb → 060_scale_button_demo.rb} +2 -2
  167. data/lib/gtk_paradise/examples/gtk3/{010_switch_example.rb → 062_switch_example.rb} +2 -1
  168. data/lib/gtk_paradise/examples/gtk3/{009_simple_window.rb → 063_simple_window.rb} +1 -0
  169. data/lib/gtk_paradise/examples/gtk3/{043_hover_button_example_via_css.rb → 066_hover_button_example_via_css.rb} +1 -0
  170. data/lib/gtk_paradise/examples/gtk3/{020_stack_example.rb → 069_stack_example.rb} +1 -1
  171. data/lib/gtk_paradise/examples/gtk3/{031_icon_theme_example.rb → 072_icon_theme_example.rb} +8 -4
  172. data/lib/gtk_paradise/examples/gtk3/{041_horizontal_and_vertical_scale.rb → 073_horizontal_and_vertical_scale.rb} +2 -1
  173. data/lib/gtk_paradise/examples/gtk3/{022_font_related_information.rb → 076_font_related_information.rb} +5 -3
  174. data/lib/gtk_paradise/examples/gtk3/{004_simple_dialog_example.rb → 079_simple_dialog_example.rb} +1 -1
  175. data/lib/gtk_paradise/examples/gtk3/vte/vte3_terminal.rb +1 -1
  176. data/lib/gtk_paradise/examples/gtk4/001_examples_with_css.rb +320 -0
  177. data/lib/gtk_paradise/examples/gtk4/{076_ten_vboxes_example.rb → 023_ten_vboxes_example.rb} +10 -10
  178. data/lib/gtk_paradise/examples/gtk4/{030_notebook_example.rb → 061_notebook_example.rb} +3 -4
  179. data/lib/gtk_paradise/examples/gtk4/{007_two_windows_example.rb → 087_two_windows_example.rb} +4 -1
  180. data/lib/gtk_paradise/examples/gtk4/{100_changed_events_example.rb → 200_changed_events_example.rb} +0 -1
  181. data/lib/gtk_paradise/examples/gtk4/{102_picture_example.rb → 202_picture_example.rb} +1 -1
  182. data/lib/gtk_paradise/examples/pango/pango_power.rb +11 -6
  183. data/lib/gtk_paradise/experimental/experimental.rb +2 -2
  184. data/lib/gtk_paradise/gdk/event_crossing.rb +1 -1
  185. data/lib/gtk_paradise/gdk/gdk.rb +3 -29
  186. data/lib/gtk_paradise/gdk/screen.rb +29 -0
  187. data/lib/gtk_paradise/gnome/README.md +3 -0
  188. data/lib/gtk_paradise/hello_world/README.md +7 -7
  189. data/lib/gtk_paradise/hello_world/hello_world_gtk4.rb +1 -1
  190. data/lib/gtk_paradise/images/misc/investigate.png +0 -0
  191. data/lib/gtk_paradise/pango/fonts.rb +1 -3
  192. data/lib/gtk_paradise/pango/pango_renderer.rb +2 -0
  193. data/lib/gtk_paradise/project/project.rb +2 -1
  194. data/lib/gtk_paradise/prototypes/gtk3_standalone.rb +7 -7
  195. data/lib/gtk_paradise/prototypes/gtk4_standalone.rb +1 -1
  196. data/lib/gtk_paradise/prototypes/unified_gtk_prototype.rb +1 -1
  197. data/lib/gtk_paradise/requires/{base_module_and_app_module.rb → base_module_and_run_module.rb} +1 -1
  198. data/lib/gtk_paradise/requires/do_require_the_files_under_the_gtk_classes_subdirectory.rb +2 -2
  199. data/lib/gtk_paradise/requires/require_files_irrespective_of_the_gtk_version_at_hand.rb +2 -2
  200. data/lib/gtk_paradise/requires/require_gtk2.rb +16 -3
  201. data/lib/gtk_paradise/requires/require_gtk3.rb +7 -3
  202. data/lib/gtk_paradise/requires/{require_gtk2_or_gtk3_or_gtk4.rb → require_gtk3_or_gtk4.rb} +1 -3
  203. data/lib/gtk_paradise/requires/require_gtk4.rb +7 -4
  204. data/lib/gtk_paradise/requires/require_the_base_module_and_gtk_run.rb +1 -1
  205. data/lib/gtk_paradise/requires/{require_the_base_module_the_app_module_and_the_toplevel_methods.rb → require_the_base_module_the_run_module_and_the_toplevel_methods.rb} +2 -2
  206. data/lib/gtk_paradise/requires/require_the_base_module_widgets.rb +9 -0
  207. data/lib/gtk_paradise/requires/require_the_default_gtk_version.rb +1 -1
  208. data/lib/gtk_paradise/requires/run_this_widget.rb +1 -1
  209. data/lib/gtk_paradise/run/run.rb +410 -0
  210. data/lib/gtk_paradise/run.rb +5 -29
  211. data/lib/gtk_paradise/{app/app_module/app_module.rb → run_module/run_module.rb} +946 -1016
  212. data/lib/gtk_paradise/toplevel_methods/css.rb +18 -15
  213. data/lib/gtk_paradise/toplevel_methods/cursor.rb +5 -4
  214. data/lib/gtk_paradise/toplevel_methods/determine_which_gtk_version_is_in_use.rb +1 -1
  215. data/lib/gtk_paradise/toplevel_methods/e.rb +12 -0
  216. data/lib/gtk_paradise/toplevel_methods/keys.rb +1 -1
  217. data/lib/gtk_paradise/toplevel_methods/screen_resolution.rb +7 -6
  218. data/lib/gtk_paradise/toplevel_methods/{text_buffer_tags.rb → tokenizer_and_text_buffer_tags.rb} +115 -0
  219. data/lib/gtk_paradise/toplevel_methods/toplevel_methods.rb +667 -673
  220. data/lib/gtk_paradise/utility_scripts/commandline_to_automatic_gui.rb +8 -8
  221. data/lib/gtk_paradise/utility_scripts/generate_gtk_prototype.rb +5 -31
  222. data/lib/gtk_paradise/version/upstream_gtk_version.rb +3 -25
  223. data/lib/gtk_paradise/version/version.rb +4 -3
  224. data/lib/gtk_paradise/widgets/gtk2/README.md +5 -0
  225. data/lib/gtk_paradise/widgets/gtk2/pdfwalker/imgview.rb +1 -2
  226. data/lib/gtk_paradise/widgets/gtk2/table_example.rb +0 -1
  227. data/lib/gtk_paradise/widgets/gtk3/audio_button/audio_button.rb +13 -7
  228. data/lib/gtk_paradise/widgets/gtk3/burn_this_iso_file/burn_this_iso_file.rb +5 -21
  229. data/lib/gtk_paradise/widgets/gtk3/button_open_remote_webpage/button_open_remote_webpage.rb +1 -1
  230. data/lib/gtk_paradise/widgets/gtk3/button_with_border/button_with_border.rb +1 -1
  231. data/lib/gtk_paradise/widgets/gtk3/button_xorg_buffer/button_xorg_buffer.rb +6 -20
  232. data/lib/gtk_paradise/widgets/gtk3/checkbox_image/checkbox_image.rb +4 -20
  233. data/lib/gtk_paradise/widgets/gtk3/coloured_button/coloured_button.rb +3 -6
  234. data/lib/gtk_paradise/widgets/gtk3/coloured_unit/coloured_unit.rb +1 -1
  235. data/lib/gtk_paradise/widgets/gtk3/cpu_widget/cpu_widget.rb +3 -15
  236. data/lib/gtk_paradise/widgets/gtk3/directory_content_widget/directory_content_widget.rb +1 -1
  237. data/lib/gtk_paradise/widgets/gtk3/editor/editor.rb +1 -1
  238. data/lib/gtk_paradise/widgets/gtk3/editor/internal_widgets/goto_line_widget.rb +1 -1
  239. data/lib/gtk_paradise/widgets/gtk3/files_in_directory/files_in_directory.rb +1 -13
  240. data/lib/gtk_paradise/widgets/gtk3/font_size_widget/action_button.rb +2 -4
  241. data/lib/gtk_paradise/widgets/gtk3/font_size_widget/font_size_widget.rb +6 -27
  242. data/lib/gtk_paradise/widgets/gtk3/four_components_entry/four_components_entry.rb +8 -8
  243. data/lib/gtk_paradise/widgets/gtk3/gidnight_commander/gidnight_commander.rb +1 -1
  244. data/lib/gtk_paradise/widgets/gtk3/image_viewer/image_viewer.rb +1 -1
  245. data/lib/gtk_paradise/widgets/gtk3/keyboard/keyboard.rb +1 -1
  246. data/lib/gtk_paradise/widgets/gtk3/linux_users/linux_users.rb +9 -9
  247. data/lib/gtk_paradise/widgets/gtk3/my_calendar/my_calendar.rb +1 -1
  248. data/lib/gtk_paradise/widgets/gtk3/my_image_menu_item/my_image_menu_item.rb +1 -1
  249. data/lib/gtk_paradise/widgets/gtk3/non_numbers_only/non_numbers_only.rb +1 -1
  250. data/lib/gtk_paradise/widgets/gtk3/note_window/note_window.rb +1 -1
  251. data/lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb +2 -3
  252. data/lib/gtk_paradise/widgets/gtk3/notebook_with_storage_functionality/notebook_with_storage_functionality.rb +1 -1
  253. data/lib/gtk_paradise/widgets/gtk3/numbers_only/numbers_only.rb +9 -3
  254. data/lib/gtk_paradise/widgets/gtk3/regex_matcher/regex_matcher.rb +1 -1
  255. data/lib/gtk_paradise/widgets/gtk3/rename_widget/rename_widget.rb +1 -1
  256. data/lib/gtk_paradise/widgets/gtk3/show_which_key_was_pressed/show_which_key_was_pressed.rb +1 -1
  257. data/lib/gtk_paradise/widgets/gtk3/stopwatch/stopwatch.rb +12 -14
  258. data/lib/gtk_paradise/widgets/gtk3/sys_message/sys_message.rb +2 -4
  259. data/lib/gtk_paradise/widgets/gtk3/system_information/system_information.rb +2 -2
  260. data/lib/gtk_paradise/widgets/gtk3/type_trainer/type_trainer.rb +14 -6
  261. data/lib/gtk_paradise/widgets/gtk3/view_webpage/view_webpage.rb +16 -28
  262. data/lib/gtk_paradise/widgets/gtk3/widget_switcher/widget_switcher.rb +1 -1
  263. data/lib/gtk_paradise/widgets/gtk3/wiki/README.md +3 -4
  264. data/lib/gtk_paradise/widgets/gtk3/wiki/wiki.rb +13 -15
  265. data/lib/gtk_paradise/widgets/gtk4/show_icon_theme/show_icon_theme.rb +1 -1
  266. data/lib/gtk_paradise/widgets/gtk4/sys_message/sys_message.rb +1 -1
  267. data/lib/gtk_paradise/widgets/shared_code/browser/browser_module.rb +5 -8
  268. data/lib/gtk_paradise/widgets/shared_code/burning_widget/burning_widget_module.rb +3 -20
  269. data/lib/gtk_paradise/widgets/shared_code/cdripper/cdripper_module.rb +2 -18
  270. data/lib/gtk_paradise/widgets/shared_code/colour_filled_widget/colour_filled_widget_module.rb +2 -3
  271. data/lib/gtk_paradise/widgets/shared_code/colour_palette/colour_palette_module.rb +4 -20
  272. data/lib/gtk_paradise/widgets/shared_code/conky/conky_module.rb +18 -29
  273. data/lib/gtk_paradise/widgets/shared_code/customizable_dialog/customizable_dialog.rb +1 -6
  274. data/lib/gtk_paradise/widgets/shared_code/emoji_toggle_widget/emoji_toggle_widget_module.rb +2 -14
  275. data/lib/gtk_paradise/widgets/shared_code/emoji_widget/emoji_widget_module.rb +3 -12
  276. data/lib/gtk_paradise/widgets/shared_code/error_widget/error_widget_module.rb +4 -8
  277. data/lib/gtk_paradise/widgets/shared_code/file_path_widget/file_path_widget_module.rb +5 -3
  278. data/lib/gtk_paradise/widgets/shared_code/file_viewer/file_viewer_module.rb +2 -34
  279. data/lib/gtk_paradise/widgets/shared_code/lsmod/lsmod_module.rb +1 -1
  280. data/lib/gtk_paradise/widgets/shared_code/lspci/lspci_module.rb +2 -5
  281. data/lib/gtk_paradise/widgets/shared_code/mini_clock/mini_clock_module.rb +1 -3
  282. data/lib/gtk_paradise/widgets/shared_code/pid_displayer/pid_displayer_module.rb +7 -18
  283. data/lib/gtk_paradise/widgets/shared_code/random_image/random_image_module.rb +6 -18
  284. data/lib/gtk_paradise/widgets/shared_code/select_file/select_file_module.rb +2 -18
  285. data/lib/gtk_paradise/widgets/shared_code/user/user_module.rb +43 -32
  286. data/lib/gtk_paradise/widgets/shared_code/wget_wrapper/wget_wrapper_module.rb +10 -27
  287. data/lib/gtk_paradise/www/index.cgi +4 -4
  288. data/lib/gtk_paradise/xbm_icons/xbm_icons.rb +118 -0
  289. data/lib/gtk_paradise/yaml/browser_URLs.yml +4 -4
  290. data/lib/gtk_paradise/yaml/notebook_controller.yml +0 -2
  291. data/lib/gtk_paradise.rb +0 -0
  292. data/test/gir_ffi_gtk/testing_gir_ffi_gtk2.rb +55 -0
  293. data/test/gir_ffi_gtk/testing_gir_ffi_gtk3.rb +55 -0
  294. data/test/gtk3/testing_app.rb +1 -1
  295. data/test/gtk3/testing_base_module.rb +13 -7
  296. data/test/misc/testing_a_gtk_frame.rb +3 -2
  297. data/test/misc/testing_gtk4_simplifications.rb +2 -4
  298. data/test/misc/testing_gtk_paradise_runner.rb +3 -4
  299. data/test/misc/testing_numbered_lines.rb +2 -0
  300. data/test/misc/testing_the_gtk_classes.rb +1 -1
  301. metadata +234 -236
  302. data/lib/gtk_paradise/app/app.rb +0 -239
  303. data/lib/gtk_paradise/base_module/class_methods/class_methods.rb +0 -0
  304. data/lib/gtk_paradise/base_module/colours.rb +0 -125
  305. data/lib/gtk_paradise/base_module/css.rb +0 -487
  306. data/lib/gtk_paradise/base_module/html_support.rb +0 -255
  307. data/lib/gtk_paradise/base_module/these_methods_work_for_gtk3_and_gtk4.rb +0 -171
  308. data/lib/gtk_paradise/examples/gtk3/063_examples_with_css.rb +0 -261
  309. data/lib/gtk_paradise/examples/gtk4/009_text_view_example.rb +0 -30
  310. data/lib/gtk_paradise/requires/require_base_module.rb +0 -7
  311. data/lib/gtk_paradise/run_this_widget/run_this_widget.rb +0 -129
  312. data/lib/gtk_paradise/toplevel_methods/tokenizer.rb +0 -118
  313. data/lib/gtk_paradise/widgets/gtk3/ping_widget/ping_widget.rb +0 -513
  314. data/lib/gtk_paradise/widgets/shared_code/calculator/calculator_module.rb +0 -581
  315. data/lib/gtk_paradise/widgets/shared_code/simple_clock/simple_clock_module.rb +0 -255
  316. /data/lib/gtk_paradise/{css_files → cascading_style_sheets}/borders.css +0 -0
  317. /data/lib/gtk_paradise/{css_files → cascading_style_sheets}/themes/README.md +0 -0
  318. /data/lib/gtk_paradise/{css_files → cascading_style_sheets}/themes/rainbow_theme.css +0 -0
  319. /data/lib/gtk_paradise/examples/gdk/{001_gdk_screen_properties.rb → gdk_screen_properties.rb} +0 -0
  320. /data/lib/gtk_paradise/examples/gir_ffi/{001_hello_world.rb → gtk3/001_hello_world.rb} +0 -0
  321. /data/lib/gtk_paradise/examples/gir_ffi/{002_upgraded_hello_world.rb → gtk3/002_upgraded_hello_world.rb} +0 -0
  322. /data/lib/gtk_paradise/examples/gir_ffi/{003_gtk_application_example.rb → gtk3/003_gtk_application_example.rb} +0 -0
  323. /data/lib/gtk_paradise/examples/gir_ffi/{004_treeview_example.rb → gtk3/004_treeview_example.rb} +0 -0
  324. /data/lib/gtk_paradise/examples/gtk3/{001_gtk_entry.rb → 002_gtk_entry.rb} +0 -0
  325. /data/lib/gtk_paradise/examples/gtk3/{075_gtk_expander.rb → 004_gtk_expander.rb} +0 -0
  326. /data/lib/gtk_paradise/examples/gtk3/{036_buttons_showcasing_the_relief.rb → 006_buttons_showcasing_the_relief.rb} +0 -0
  327. /data/lib/gtk_paradise/examples/gtk3/{050_cell_renderer_pixbuf_example.rb → 008_cell_renderer_pixbuf_example.rb} +0 -0
  328. /data/lib/gtk_paradise/examples/gtk3/{044_spin_button_example.rb → 011_spin_button_example.rb} +0 -0
  329. /data/lib/gtk_paradise/examples/gtk3/{064_accel_group_example.rb → 012_accel_group_example.rb} +0 -0
  330. /data/lib/gtk_paradise/examples/gtk3/{048_colour_choose_button.rb → 015_colour_choose_button.rb} +0 -0
  331. /data/lib/gtk_paradise/examples/gtk3/{086_app_chooser_button_example.rb → 020_app_chooser_button_example.rb} +0 -0
  332. /data/lib/gtk_paradise/examples/gtk3/{018_message_dialog_example.rb → 022_message_dialog_example.rb} +0 -0
  333. /data/lib/gtk_paradise/examples/gtk3/{076_ten_vboxes_example.rb → 023_ten_vboxes_example.rb} +0 -0
  334. /data/lib/gtk_paradise/examples/gtk3/{071_button_demo.rb → 025_button_demo.rb} +0 -0
  335. /data/lib/gtk_paradise/examples/gtk3/{074_frame_example.rb → 026_frame_example.rb} +0 -0
  336. /data/lib/gtk_paradise/examples/gtk3/{080_vertical_boxes.rb → 027_vertical_boxes.rb} +0 -0
  337. /data/lib/gtk_paradise/examples/gtk3/{032_switcher_window.rb → 028_switcher_window.rb} +0 -0
  338. /data/lib/gtk_paradise/examples/gtk3/{057_flowbox.rb → 029_flowbox.rb} +0 -0
  339. /data/lib/gtk_paradise/examples/gtk3/{066_header_bar_example.rb → 030_header_bar_example.rb} +0 -0
  340. /data/lib/gtk_paradise/examples/gtk3/{049_drag_and_drop_example.rb → 031_drag_and_drop_example.rb} +0 -0
  341. /data/lib/gtk_paradise/examples/gtk3/{055_threads_example.rb → 033_threads_example.rb} +0 -0
  342. /data/lib/gtk_paradise/examples/gtk3/{079_tooltips_example.rb → 035_tooltips_example.rb} +0 -0
  343. /data/lib/gtk_paradise/examples/gtk3/{087_calendar_example.rb → 037_calendar_example.rb} +0 -0
  344. /data/lib/gtk_paradise/examples/gtk3/{060_check_button.rb → 038_check_button.rb} +0 -0
  345. /data/lib/gtk_paradise/examples/gtk3/{062_event_box_example.rb → 040_event_box_example.rb} +0 -0
  346. /data/lib/gtk_paradise/examples/gtk3/{042_installation_assistant.rb → 044_installation_assistant.rb} +0 -0
  347. /data/lib/gtk_paradise/examples/gtk3/{053_css_example_of_a_button_changing_the_background_colour_on_click_event.rb → 045_css_example_of_a_button_changing_the_background_colour_on_click_event.rb} +0 -0
  348. /data/lib/gtk_paradise/examples/gtk3/{017_extensive_markup_example.rb → 046_extensive_markup_example.rb} +0 -0
  349. /data/lib/gtk_paradise/examples/gtk3/{059_form_example.rb → 047_form_example.rb} +0 -0
  350. /data/lib/gtk_paradise/examples/gtk3/{068_popover_example.rb → 048_popover_example.rb} +0 -0
  351. /data/lib/gtk_paradise/examples/gtk3/{012_show_the_xid_example.rb → 049_show_the_xid_example.rb} +0 -0
  352. /data/lib/gtk_paradise/examples/gtk3/{016_scrolling_example.rb → 050_scrolling_example.rb} +0 -0
  353. /data/lib/gtk_paradise/examples/gtk3/{065_change_the_application_theme.rb → 051_change_the_application_theme.rb} +0 -0
  354. /data/lib/gtk_paradise/examples/gtk3/{058_colourized_button_example.rb → 052_colourized_button_example.rb} +0 -0
  355. /data/lib/gtk_paradise/examples/gtk3/{035_grid_example.rb → 053_grid_example.rb} +0 -0
  356. /data/lib/gtk_paradise/examples/gtk3/{027_menubar_example.rb → 054_menubar_example.rb} +0 -0
  357. /data/lib/gtk_paradise/examples/gtk3/{040_popup_example.rb → 056_popup_example.rb} +0 -0
  358. /data/lib/gtk_paradise/examples/gtk3/{069_entry_completion.rb → 057_entry_completion.rb} +0 -0
  359. /data/lib/gtk_paradise/examples/gtk3/{030_notebook_example.rb → 061_notebook_example.rb} +0 -0
  360. /data/lib/gtk_paradise/examples/gtk3/{014_undecorated_window_example.rb → 064_undecorated_window_example.rb} +0 -0
  361. /data/lib/gtk_paradise/examples/gtk3/{026_progress_bar_example.rb → 065_progress_bar_example.rb} +0 -0
  362. /data/lib/gtk_paradise/examples/gtk3/{028_paned_widget_example.rb → 067_paned_widget_example.rb} +0 -0
  363. /data/lib/gtk_paradise/examples/gtk3/{082_file_chooser_dialog.rb → 068_file_chooser_dialog.rb} +0 -0
  364. /data/lib/gtk_paradise/examples/gtk3/{037_text_buffer_example.rb → 070_text_buffer_example.rb} +0 -0
  365. /data/lib/gtk_paradise/examples/gtk3/{013_grab_pointer_forcefully.rb → 071_grab_pointer_forcefully.rb} +0 -0
  366. /data/lib/gtk_paradise/examples/gtk3/{008_search_bar_example.rb → 074_search_bar_example.rb} +0 -0
  367. /data/lib/gtk_paradise/examples/gtk3/{061_fixed_example.rb → 075_fixed_example.rb} +0 -0
  368. /data/lib/gtk_paradise/examples/gtk3/{011_colour_chooser_example.rb → 077_colour_chooser_example.rb} +0 -0
  369. /data/lib/gtk_paradise/examples/gtk3/{015_bottom_left_placement.rb → 078_bottom_left_placement.rb} +0 -0
  370. /data/lib/gtk_paradise/examples/gtk3/{045_radio_menu_item_example.rb → 080_radio_menu_item_example.rb} +0 -0
  371. /data/lib/gtk_paradise/examples/gtk3/{046_gtk_dialog_sample.rb → 081_gtk_dialog_sample.rb} +0 -0
  372. /data/lib/gtk_paradise/examples/gtk3/{003_toggle_button_example.rb → 082_toggle_button_example.rb} +0 -0
  373. /data/lib/gtk_paradise/examples/gtk3/{019_status_icon_example.rb → 083_status_icon_example.rb} +0 -0
  374. /data/lib/gtk_paradise/examples/gtk3/{023_sorted_tree.rb → 084_sorted_tree.rb} +0 -0
  375. /data/lib/gtk_paradise/examples/gtk3/{083_bindings.rb → 085_bindings.rb} +0 -0
  376. /data/lib/gtk_paradise/examples/gtk3/{002_scrolled_window_example.rb → 086_scrolled_window_example.rb} +0 -0
  377. /data/lib/gtk_paradise/examples/gtk3/{007_two_windows_example.rb → 087_two_windows_example.rb} +0 -0
  378. /data/lib/gtk_paradise/examples/gtk3/{070_svg_viewer.rb → 088_svg_viewer.rb} +0 -0
  379. /data/lib/gtk_paradise/examples/gtk4/{001_gtk_entry.rb → 002_gtk_entry.rb} +0 -0
  380. /data/lib/gtk_paradise/examples/gtk4/{005_spinner_example.rb → 017_spinner_example.rb} +0 -0
  381. /data/lib/gtk_paradise/examples/gtk4/{074_frame_example.rb → 026_frame_example.rb} +0 -0
  382. /data/lib/gtk_paradise/examples/gtk4/{006_text_view_example.rb → 034_text_view_example.rb} +0 -0
  383. /data/lib/gtk_paradise/examples/gtk4/{087_calendar_example.rb → 037_calendar_example.rb} +0 -0
  384. /data/lib/gtk_paradise/examples/gtk4/{027_menubar_example.rb → 054_menubar_example.rb} +0 -0
  385. /data/lib/gtk_paradise/examples/gtk4/{010_switch_example.rb → 062_switch_example.rb} +0 -0
  386. /data/lib/gtk_paradise/examples/gtk4/{008_search_bar_example.rb → 074_search_bar_example.rb} +0 -0
  387. /data/lib/gtk_paradise/examples/gtk4/{004_simple_dialog_example.rb → 079_simple_dialog_example.rb} +0 -0
  388. /data/lib/gtk_paradise/examples/gtk4/{003_toggle_button_example.rb → 082_toggle_button_example.rb} +0 -0
  389. /data/lib/gtk_paradise/examples/gtk4/{002_scrolled_window_example.rb → 086_scrolled_window_example.rb} +0 -0
  390. /data/lib/gtk_paradise/examples/gtk4/{101_actionbar_example.rb → 201_actionbar_example.rb} +0 -0
  391. /data/lib/gtk_paradise/examples/gtk4/{103_drawing_example.rb → 203_drawing_example.rb} +0 -0
  392. /data/lib/gtk_paradise/examples/gtk4/{104_quit_on_keypress_event.rb → 204_quit_on_keypress_event.rb} +0 -0
  393. /data/lib/gtk_paradise/widgets/gtk2/{status_icon_example.rb → status_icon_example/status_icon_example.rb} +0 -0
data/doc/README.gen CHANGED
@@ -26,7 +26,7 @@ gem and eventually replace ruby-gtk3 - although that remains to be seen.
26
26
  As of <b>April 2023</b>, the primary target and focus for the
27
27
  <b>gtk_paradise</b> lies on ruby-gtk3, though.
28
28
 
29
- What is <b>GTK</b>?
29
+ ## What is <b>GTK</b>?
30
30
 
31
31
  **GTK** itself is a toolkit for classical "oldschool" desktop applications
32
32
  first and foremost. These may not be <em>en vogue</em> anymore, but for
@@ -40,518 +40,297 @@ everywhere. Write once, run everywhere! \o/
40
40
  ## Deprecation notice
41
41
 
42
42
  ruby-gtk2 appears to be barely maintained actively anymore. As I can no
43
- longer compile it from source, since as of October 2023 support for
44
- ruby-gtk2 via the gtk_paradise project is semi-deprecated. I will retain
45
- the old code as-is, as well as the documentation; and I may fix bugs
46
- and improve things otherwise. But other than that, consider moving to
47
- ruby-gtk3 or ruby-gtk4. The primary focus as of 2023 is ruby-gtk3,
48
- with ruby-gtk4 one day being available too.
43
+ longer compile it from source, since as of <b>October 2023</b>, support
44
+ for ruby-gtk2 via the gtk_paradise project is semi-deprecated. I will
45
+ retain the old code in examples/gtk2/ as-is, as well as the documentation;
46
+ and I may fix bugs and improve things otherwise. But other than that,
47
+ consider moving to ruby-gtk3 or ruby-gtk4. The primary focus as of 2023
48
+ is ruby-gtk3, with ruby-gtk4 one day being fully supported as well.
49
49
 
50
- ## A brief history of the gtk_paradise project
51
-
52
- The **gtk_paradise project** itself was created many years ago, and
53
- then eventually published on **rubygems.org** in **March 2015**,
54
- under its old name **gtk_module**
55
-
56
- Due to various reasons, including a seemingly necessary clean-up of the
57
- old code base that was part of the **gtk_module** project, the project
58
- was eventually <b>renamed</b> (and subsequently restructured) into the
59
- newly named **gtk_paradise** gem, in **January 2020**.
60
-
61
- The new structure for the project should be more logical, and thus make
62
- more sense as well, at the least compared to the older project called
63
- **gtk_module**. Furthermore, one focus was on being able to support
64
- both ruby-gtk2 and ruby-gtk3 (and eventually ruby-gtk4) - although,
65
- as previously mentioned, support for ruby-gtk2 is no longer as strong
66
- and some old code may no longer work either.
67
-
68
- ## Use cases and goals for the gtk_paradise project
69
-
70
- Over the years, the **gtk_paradise** project has had **different primary
71
- use cases**. These will be listed now, starting with the more important
72
- goals:
73
-
74
- (1) provide **a set of convenience bindings/code** that may enhance the
75
- whole gtk-stack in ruby.
76
-
77
- I did not want to be limited solely by the official upstream bindings
78
- to GTK alone. Instead, I wanted to use ruby more naturally when writing
79
- ruby-gtk applications. Certain DSL-like commands appeared to make sense
80
- to me in the widget sets, such as **.on_clicked {}**.
81
-
82
- For instance, rather than use this variant:
83
-
84
- button.signal_connect(:clicked) {
85
- puts 'The button was clicked.'
86
- }
87
-
88
- I wanted to use this variant instead:
89
-
90
- button.on_clicked {
91
- puts 'The button was clicked.'
92
- }
93
-
94
- This seemed more natural and logical to me, but this was not possible
95
- because the official ruby-gtk bindings are more closely trying to match
96
- the official C API that governs GTK - and stop right at that point.
97
-
98
- This is largely due to gobject-introspection these days, and in part
99
- to simplify maintaining these upstream bindings. Either way I wanted
100
- to have more freedom in how to write ruby-code for ruby-gtk. See also
101
- the glimmer-project by Andy - you can find it on rubygems.org. Perhaps
102
- one day glimmer may unify all of desktop, web-related widgets and
103
- so forth. One codebase to rule them all. \o/
104
-
105
- (2) distribute a common code base for different gtk-applications,
106
- to allow **re-use of the code**, as a **secondary goal**.
107
-
108
- For example, **Gtk::BaseModule** is a convenience module that can
109
- be included into subclasses, like in the following manner:
50
+ ## CSS Handling in GTK and the gtk_paradise gem
110
51
 
111
- require 'gtk_paradise/requires/require_the_base_module.rb'
112
- include ::Gtk::BaseModule
113
-
114
- Or, even simpler than that, to just use this:
115
-
116
- require 'gtk_paradise/require_gtk3'
117
- class Foobar < Gtk::BaseModuleFrame # This automatically has include ::Gtk::BaseModule
118
- end
119
-
120
- Then, once that was done, certain methods, such as **gtk_text()**, or
121
- just **text()**, can be used, rather than the slightly longer variant
122
- called **Gtk::Text.new()**, or **gtk_label()** or just **label()**
123
- rather than **Gtk::Label.new()**.
124
-
125
- So really, this was mostly done due reasons of my laziness or simply
126
- convenience, but additionally to avoid or reduce on **code
127
- duplication**. Other users of this gem can then also rely that these
128
- methods are supported by the gtk_paradise project in future versions -
129
- at the least once version 1.0 is released. (Right now this gem is
130
- still in a beta release state, so things may change. I will try to
131
- not break things unless absolutely necessary, though.)
132
-
133
- If we use a single method, such as text(), then we can easily change
134
- this at a later time, even if the upstream names change. This is
135
- one additional use case for the project: to allow working with
136
- ruby-gtk2, ruby-gtk3 and ruby-gtk4 (and ruby-gtk5 eventually, and
137
- so forth): one code base to rule-them-all.
138
-
139
- Take note that in regards to **::Gtk::BaseModule**, I use the leading
140
- **::** here because I want this all to be part of **module Gtk**. The
141
- reason for this is mostly due to <b>long-term convenience</b> when
142
- making use of this project. Of course typing a leading :: is a bit
143
- annoying, so this is a downside, but it is better to modify the
144
- toplevel namespace Gtk directly, in my opinion: keep everything
145
- coordinated in one namespace. (This was different in the older
146
- gtk_module gem, which is another reason why that was changed for
147
- the gtk_paradise gem.)
148
-
149
- (3) to **distribute some smaller classes** and even games written
150
- in ruby-gtk.
151
-
152
- Before the gtk_paradise project existed, I collected these different
153
- classes into local .rb files mostly (naturally), and put them into
154
- different projects - but in hindsight I think it may be better if
155
- there is a dedicated project that bundles together code, in regards to
156
- GTK, and publishes that code as well, ideally in an improved manner.
157
-
158
- Here a hope is that if you or anyone else creates some ruby-gtk
159
- application, say a small game or something like that, to send it to
160
- my email address (if you would like to), and if you deem the licence in
161
- the gtk_paradise to be an acceptable one; then I could integrate
162
- this game. (Please also add some documentation if you can; not everything
163
- has to be documented and commented fully, mind you, but at the least
164
- an introduction, the basic usage, and perhaps some comments within
165
- the .rb files.)
166
-
167
- Note that since as of **2021** I bundle games-related code into another
168
- gem called **games_paradise** - this one will include some ruby-gtk
169
- based games as well, so games are no longer distributed in the
170
- gtk_paradise project. Nonetheless, the gtk_paradise project retains its
171
- use case of trying to distribute a shared code base, for other projects
172
- to operate from, and re-use (and share) different new gtk-widgets and
173
- new gtk-based applications.
174
-
175
- (4) last, but not least, provide stellar documentation and explanations.
176
-
177
- This is still ongoing, but hopefully this may be useful to you even
178
- if you do not use this project. I benefitted from tutorials based on
179
- python-gtk3, so I found this to be a useful and laudable goal for ruby
180
- too: teach people, explain things, document stuff.
181
-
182
- These are the four major goals for this gem. There are some minor
183
- goals as well, but they are not that important to mention them here;
184
- if you are interested in more minor goals, have a look at the
185
- todo/ subdirectory of this gem - these minor goals are, to some
186
- extent, mentioned there. As a todo-list.
187
-
188
- ## The licence of the gtk_paradise project
189
-
190
- Since as of the **19th July 2021** (**19.07.2021**) the **gtk_paradise**
191
- project now uses the **MIT licence**. Before that the **gtk_paradise** project
192
- used the **LGPL-2.1 licence** (GNU LESSER GENERAL PUBLIC LICENSE Version 2.1),
193
- without the later clause though.
194
-
195
- I am perfectly fine with both **GPL** and **LGPL** licences - they are good
196
- licences. But they also tend to cause more hassle than what often seems necessary
197
- when it comes to <b>enforcement</b> of the licence part. The project here is a
198
- hobby project, so I am not even paying that much attention as to what others
199
- do with this code to begin with really - it's not a "key project" for me at all
200
- whatsoever, in this regard.
201
-
202
- The MIT licence is much, much simpler than the GPL - other than the <b>no-warranty
203
- clause</b> (aka "you are on your own when using this project"), there isn't really
204
- that much else to worry about it. Whereas the **LGPL licence** is like really
205
- huge compared to the MIT licence ... and we haven't even gotten to the **GPL**
206
- yet, forcing all downstream code to have the same licence (and permissions,
207
- granted upon other users, too).
208
-
209
- Anyway - here is a good summary for the MIT licence:
210
-
211
- https://opensource.org/licenses/MIT
212
-
213
- I don't even 'care' about the copyright statement as such, per se, but in some
214
- jurisdictions there is no way to forego the copyright notice (I think in
215
- Germany), so simply substitute as appropriate in such jurisdictions. How courts
216
- evaluate anything is not up to me - for this project, the MIT licence is
217
- used. That's it.
218
-
219
- ## Towards a version 1.0 for this gem
220
-
221
- Right now (in 2021, but also in April 2023, when this document was again
222
- updated massively) the gtk_paradise gem is not yet ready for a 1.0 release.
223
- I am still experimenting **a lot** in 2021 - as well as in 2023.
224
-
225
- At some later time I will decide which features will be retained, and
226
- which ones will be removed. Then the documentation and examples will
227
- be improved, everything will be significantly polished, and a "final" 1.0
228
- release will be published. This one will be made available for a significantly
229
- longer time, so that people can begin to use it for more serious projects.
52
+ ### CSS files distributed in the gtk_paradise gem
230
53
 
231
- Final here means that this will be the final 1.0 release. Of course later
232
- releases may follow past 1.0, but 1.0 will remain hosted on rubygems.org
233
- for a longer time than subsequent releases.
54
+ All <b>.css</b> files that are distributed in the gtk_paradise gem
55
+ will reside at the following location:
234
56
 
235
- But this will probably take a few years, so stay tuned in this regard.
57
+ gtk_paradise/cascading_style_sheets/
236
58
 
237
- ## Documentation for the gtk-paradise project
59
+ This has to be documented, as previous releases of the gtk_paradise
60
+ gem used another path for .css files.
238
61
 
239
- The <b>documentation</b> for the gtk-paradise project is currently lacking,
240
- admittedly so. This is not good and should be remedied in the long run.
241
62
 
242
- There are several personal reasons as to why documentation is lacking
243
- currently: laziness, lack of time and lack of motivation. But another,
244
- somewhat trivial additional reason is that I am experimenting a **LOT**
245
- right now.
63
+ ### Using Gtk::BaseModule to handle CSS rules
246
64
 
247
- I have no real idea what happens with the **gtk_paradise project** in its
248
- current form in the long run, in regards to future changes. I want to
249
- simplify the project, which means that old code may be removed every now
250
- and then. Retaining the ability to change a project is very important,
251
- unless it becomes stable. Sometimes you may find better ways to express an
252
- idea in code - or in less code. So the gtk_paradise project is not very
253
- stable right now, and probably will not be for a long time, until I
254
- feel sufficiently pleased with its present form.
65
+ The <b>gtk_paradise gem</b> includes a few .css files which cater to my use
66
+ case. If you want to make use of these CSS rules then, after including
67
+ <b>Gtk::BaseModule</b>, call the following method:
255
68
 
256
- I once had that crazy idea that it would be nice to have a **GUI-like
257
- DSL-layer** over the terminal interface, the www, as well as classical
258
- desktop elements, as pointed out above. To **use one unified code base
259
- for all GUI-elements**.
69
+ apply_the_default_css_rules
260
70
 
261
- While this is probably too ambitious a goal, I still want to try
262
- at the least some of those ideas that can help us write more desktop-GUIs
263
- in ruby-gtk, at a much faster "implementation speed" than before (I refer
264
- to our human life time that we invest in creating this, NOT to the speed
265
- of code-execution once an application is run). So ideas in this regard are
266
- very welcome - and I am experimenting with these as well.
71
+ This will read in the file content of the two files **project.css**
72
+ and **colours.css**. The latter is for colours; and the former is
73
+ for everything else. This will actually append the default
74
+ CSS rules, so if you want to add CSS manually while also using
75
+ this method, it is recommend to append these custom CSS rules
76
+ <b>before</b> calling **.apply_the_default_css_rules()**.
267
77
 
268
- Nonetheless, whenever possible I will try to **slowly** improve
269
- on the existing documentation distributed as part of the **gtk_paradise**
270
- project - but ultimately I think for the time being, it may often be
271
- better to simply peek at the source code itself for the different
272
- widgets used in the gtk_paradise project. Some errors and mistakes
273
- may exist as well, so have a look at the official gtk-documentation
274
- aside from the project here.
78
+ If you want to quickly verify the CSS in use for the widget
79
+ at hand, as a <b>String</b>, then you can simply use this
80
+ method:
275
81
 
276
- The whole **gtk_paradise project** is definitely more geared towards
277
- people already knowing ruby quite well, not necessarily aimed for
278
- beginners. Beginners should start with the upstream ruby-gtk bindings
279
- instead, and work through the examples and demo, until they have a
280
- sufficient grasp of the underlying concepts used by upstream GTK. Of
281
- course nothing prevents you from giving the gtk_paradise project a
282
- try as-it-is; beginners are, however had, not necessarily the main,
283
- primary target audience for this gem.
82
+ display_the_CSS_rules
284
83
 
285
- I, on the other hand, wanted to write widgets in a more ruby-centric
286
- manner, including some **DSL-like elements**, such as simply using
287
- **gtk_button** or even just **button** in order to create a button,
288
- or add methods such as **.on_clicked** to capture on-click events
289
- to such a button. If we are using code such as **button {}** then,
290
- in theory, we could eventually expand this to different toolkits,
291
- such as **tk** or **qt**, but also make such applications usable on the
292
- www if we map this to a functional interface - but these are mostly
293
- hypothetical thoughts for now. In practice, this project really just
294
- focuses on **polishing ruby-gtk widgets** directly.
84
+ You can still append CSS lateron, such as:
295
85
 
296
- ## How to benefit from the gtk_paradise project?
86
+ append_these_CSS_rules '.bblack20 { border: 20px solid black; }'
297
87
 
298
- How to make use of this project in a way that may be useful to you
299
- or other people?
88
+ ### CSS - how to add a CSS class to a gtk-widget in general
300
89
 
301
- The **gtk_paradise** project tries to support different styles and
302
- remain flexible overall, so I can not tell **you** how you "should"
303
- use it - it all depends on various factors. It also depends on the
304
- way how you decide how to lay out the code.
90
+ Say that your use case is to add a CSS class to a specific
91
+ gtk-widget.
305
92
 
306
- So, rather than try to answer this fairly large and complex question,
307
- I will try to explain how I tend to use the project, which may
308
- serve as a general introduction into the gtk_paradise project
309
- as well.
93
+ The default <b>upstream API</b> for achieving this, goes as follows:
310
94
 
311
- First, I typically add code to a **standalone** widget; then
312
- I instantiate this widget into **Gtk::Runner**, via **Gtk.run**.
313
- In other words, that widget is put into a Gtk::Runner
314
- instance.
95
+ widget.style_context.add_class('your_css_name_goes_in_here')
96
+ widget.style_context.add_class('bblack1') # For example, use the CSS class called bblack1. On my system this is equivalent to "border: 1px solid black"
315
97
 
316
- That way - and one advantage of doing this - I can <b>avoid</b>
317
- having to work with Gtk::Window directly, which I find to be a
318
- somewhat annoying widget. I find it more convenient to operate
319
- via **Gtk::Runner**. I can also modify <b>Gtk::Runner</b>
320
- easily and, for instance, automatically add all custom CSS
321
- rules that I use onto it. So you can see that it is more
322
- flexible than subclassing from Gtk::Window directly.
98
+ More specifically with a real gtk-widget as example:
323
99
 
324
- In the past, I used another approach, at the least for
325
- ruby-gtk3. Here I was subclassing from Gtk::Window directly,
326
- but since as of **March 2021** I simplified this old
327
- approach - now I use the very same approach for both
328
- ruby-gtk2 and ruby-gtk3 in this regard. That was one reason
329
- for the rewrite from gtk_module to gtk_paradise, by the
330
- way.
100
+ label = Gtk::Label.new('Hello world!!!')
101
+ label.style_context.add_class('bblack5')
331
102
 
332
- Note that because of gtk3 changing things quite a bit, I
333
- created the directory called **base_module_and_runner_module/**,
334
- specifically for **ruby-gtk3**. I needed to improve support
335
- on the toplevel-instance directly.
103
+ Let's show yet another example, this time with the CSS rules coming first,
104
+ and the widget that uses this CSS rule coming second:
336
105
 
337
- The simplest way for me is to <b>then</b> use **Gtk::BaseModule**
338
- via the following code in custom widgets:
106
+ # First the CSS rule is defined:
107
+ .fancy_styling {
108
+ font-size: 50px;
109
+ border: 8px solid darkgreen;
110
+ border-radius: 32px;
111
+ }
112
+ button = Gtk::Button.new('Hello world!!!')
113
+ button_context = button.style_context
114
+ # Next, we add that CSS class to the button:
115
+ button_context.add_class('fancy_styling') # This will add the CSS class.
339
116
 
340
- require 'gtk_paradise/requires/require_the_base_module.rb'
341
- include ::Gtk::BaseModule
117
+ Note that <b>Gtk::BaseModule</b>, distributed via the gtk_paradise gem,
118
+ simplifies this a lot. See other subsections in this document to
119
+ showcase how this has been simplified.
342
120
 
343
- Note that this is put in **requires/** - this should be guaranteed
344
- to work for a long time, even if I may change the code
345
- internally.
121
+ Adding a new class goes via .add_class():
346
122
 
347
- It should never become any more complicated than these two
348
- lines.
123
+ button_context.add_class('white')
349
124
 
350
- These two **prior** requires should then suffice, depending on
351
- whether you want to use gtk2 or gtk3:
125
+ And removing it goes via .remove_class():
352
126
 
353
- require 'gtk_paradise/require_gtk2'
127
+ button_context.remove_class('white')
354
128
 
355
- or
129
+ You may have to remove an old CSS class before you can add a new
130
+ CSS class.
356
131
 
357
- require 'gtk_paradise/require_gtk3' # This one should be more common these days.
132
+ Note that you can give a widget a name, similar to an ID in HTML,
133
+ via .set_name():
358
134
 
359
- So, put any (either, rather) of these two require lines on
360
- top of the .rb file at hand. If you are still unsure about
361
- the layout, simply look at the files that come distributed
362
- via the gtk_paradise gem. You will typically see them
363
- begin with this as the first line of ruby code.
135
+ widget.set_name("red_label")
136
+ label.set_name("red_label")
364
137
 
365
- I recommend to use gtk3 these days; the CSS rules are making
366
- it much more convenient to work with gtk3.
138
+ This allows you to use specific CSS classes too.
367
139
 
368
- ## Structure of the gtk_paradise project
140
+ To create a hover effect, you could tweak the following CSS:
369
141
 
370
- This subsection will include some information about the overall
371
- structure of the gtk_paradise project. This will **NOT** be
372
- complete; instead it merely provides some pointers. Note that
373
- this may become slightly deprecated over time, so consider it
374
- to be more of something that may have been correct at one point
375
- in time, but may have changed since then.
142
+ .button { border-radius: 15; border-width: 2; border-style: outset; }
143
+ .button:hover { background: #dff; border-color: #8bb; }
376
144
 
377
- All files that are part of Gtk::BaseModule will reside under
378
- the subdirectory called **base_module/**.
145
+ If you would like to see a longer explanation then have a look at the
146
+ following URL:
379
147
 
380
- The file **app.rb**, which can be found at **gtk_paradise/app/app.rb**,
381
- contains the code for the toplevel method call **Gtk.app()** -
382
- this one is aliased to **Gtk.run()**, which used to be the original
383
- name at one point in time.
148
+ https://shallowsky.com/blog/programming/styling-gtk3-with-css-python.html
384
149
 
385
- This code can be used to **quickly start a gtk-widget**, and embed
386
- it into **Gtk::Window.new()** essentially. It reduces a bit of
387
- the necessary boilerplate code.
150
+ ### Gtk::CssProvider
388
151
 
389
- Some of the default gtk-classes are modified by the gtk_paradise
390
- project. These modifications will be stored under the **gtk_classes/**
391
- subdirectory. The rule for entries in that directory is very simple:
392
- the name of the class will become the corresponding .rb file name.
152
+ This subsection contains some information about class **Gtk::CssProvider**.
393
153
 
394
- So class **Gtk::SourceBuffer** would reside at **gtk_classes/source_buffer.rb**.
395
- Note that not all modifications can be applied, for various reasons, but
396
- many of the default classes are modified. Remember this when using the
397
- gtk_paradise project: it is NOT a project for the 'default', assumed usage. For
398
- that you are recommended to use **vanilla** ruby-gtk instead, without
399
- the custom modifications done by the gtk-paradise project. The primary
400
- focus for the gtk_paradise project is to try to be of help when it
401
- comes to efficiency, when writing code - thus, the gtk_paradise
402
- project is more of an applied toolset project that tries to enhance
403
- the current status quo. (The ruby-gtk bindings are, unfortunately,
404
- mostly just a wrapper over the C API itself. This limits the way
405
- how users can think about application code.)
154
+ This class can be used to make CSS rules available for gtk-widgets. It is
155
+ available by default if you require 'gtk3'.
406
156
 
407
- ## Demo
157
+ If you have a local <b>.css</b> file and want to load it, consider using
158
+ the following API (and adjust accordingly to your use case):
408
159
 
409
- The **gtk_paradise** gem comes with many example files, collected from
410
- different sources.
160
+ require 'gtk3'
411
161
 
412
- If you want to use a controller-widget to show some of them, consider
413
- looking at the subdirectory examples/controller/, the controller.rb
414
- file there. This defaults to ruby-gtk3. One day it should work
415
- for both ruby-gtk2 and ruby-gtk3, but I prioritise on ruby-gtk3
416
- these days, so support for ruby-gtk2 may lag behind.
162
+ css_provider = Gtk::CssProvider.new
163
+ css_provider.load_from_path('/home/x/programming/ruby/src/gtk_paradise/lib/gtk_paradise/css/default.css') # ← Provide the path to the .css file here.
417
164
 
418
- At any rate, run the controller.rb file to see what is available
419
- as demo. The basic idea is that the demo showcases all standalone
420
- examples, similar to main.rb of the official ruby-gnome / ruby-gtk
421
- bindings.
165
+ ### CSS rules - various examples
422
166
 
423
- ## How to determine the version of ruby-gtk?
167
+ This subsection will contain a few CSS rules as examples.
424
168
 
425
- First, use either:
169
+ This is mostly just a <b>quickref</b> (quick reference), in the event that
170
+ people want to refresh their knowledge about how GTK handles CSS rules.
426
171
 
427
- require 'gtk2'
428
- require 'gtk3' # or this one here for ruby-gtk3.
172
+ Showing specific examples that work is best, because it is very simple and
173
+ straightforward, in my opinion.
429
174
 
430
- Next, you can query some constants:
175
+ <b>First</b>: keep all widget names **lowercase**. There are old examples on
176
+ the www available where the widget-names in use for CSS start with "Gtk",
177
+ such as <b>GtkEntry</b>. Such examples no longer work and are deprecated.
178
+ Instead, simply use, for instance, <b>entry</b> instead these days.
431
179
 
432
- pp ::Gtk::Version::MAJOR
433
- pp ::Gtk::Version::MICRO
434
- pp ::Gtk::Version::MINOR
435
- pp ::Gtk::Version::STRING # => "2.24.32"
180
+ At any rate and without further ado, next come a multitude of different,
181
+ specific examples.
436
182
 
437
- ## Querying the GTK theme in use
183
+ Picking a proper font via CSS:
438
184
 
439
- You can issue the following command in order to query the theme GTK is
440
- using:
185
+ font-family: Monospace;
186
+ font-family: Cantarell; # Or use this family.
441
187
 
442
- gtk-query-settings theme
188
+ <b>Set the size of the font</b> at hand, via CSS:
443
189
 
444
- ## CSS Handling in GTK
190
+ font-size: 25px; # don't forget to put this inside the {}, of course.
445
191
 
446
- ### CSS files distributed in the gtk_paradise gem
192
+ Set the background colour of <b>every window</b> to a particular
193
+ colour:
447
194
 
448
- All .css files that are distributed in the gtk_paradise gem will reside at:
195
+ window {
196
+ background-color: white; # replace this here with a colour of your choice; and use 'color' rather than 'colour'
197
+ }
449
198
 
450
- gtk_paradise/css_files/
199
+ To make a button show a <b>hover-effect</b> (when the mouse is "above"
200
+ the button), try the <b>:hover</b> directive, such as the following
201
+ example shows:
451
202
 
452
- I wanted to document this, because this was different in the 0.7.x release
453
- saga of the gtk_paradise gem.
203
+ .button:hover {
204
+ padding: 12px 48px;
205
+ background-color: #4870bc;
206
+ }
454
207
 
455
- ### CSS - how to add a CSS class to a gtk-widget
208
+ (An alternative to the above CSS rule may be to make use of the method
209
+ .override_background_color(), but here we focus primarily on CSS rules.)
456
210
 
457
- The default **upstream API** is this:
211
+ It is possible to target specific children in a gtk-widget. For example,
212
+ in order to specifically <b>style the first child of a gtk-widget</b>,
213
+ such as for a <b>button</b>, try the following CSS rule:
458
214
 
459
- widget.style_context.add_class('your_css_name_goes_in_here')
460
- widget.style_context.add_class('bblack1') # For example, use the CSS class called bblack1. On my system this is equivalent to "border: 1px solid black"
215
+ .button:first-child {
216
+ border-radius: 5px 0 0 5px;
217
+ }
461
218
 
462
- More specifically with a real gtk-widget as example:
219
+ Modifying <b>two widgets at the same time</b> via the same CSS style - in
220
+ this case a gtk-button and a gtk-entry:
463
221
 
464
- label = Gtk::Label.new('Hello world!!!')
465
- label.style_context.add_class('bblack5')
222
+ button, entry { /* Keep in mind that this would modify ALL buttons and entries at the same time.
223
+ color: #ff00ea;
224
+ font: 12px "Comic Sans";
225
+ }
466
226
 
467
- Let's show yet another example, this time with the CSS rules coming first:
227
+ You can also style / theme <b>insensitive widgets</b> in general, via:
468
228
 
469
- .fancy_styling {
470
- font-size: 50px;
471
- border: 8px solid darkgreen;
472
- border-radius: 32px;
229
+ *:disabled {
230
+ background-color: #320a91;
473
231
  }
474
- button = Gtk::Button.new('Hello world!!!')
475
- button_context = button.style_context
476
- button_context.add_class('fancy_styling') # This will add the CSS class.
477
232
 
478
- Note that **Gtk::BaseModule**, distributed via the gtk_paradise gem,
479
- simplifies this a lot. See other subsections in this document to
480
- find out how this has been simplified.
233
+ Theme all <b>labels</b> in the <b>first notebook tab</b>:
481
234
 
482
- If you would like to see a longer explanation then have a look at
483
- the following URL:
235
+ notebook tab:first-child label {
236
+ color: #89d012;
237
+ }
484
238
 
485
- https://shallowsky.com/blog/programming/styling-gtk3-with-css-python.html
239
+ Theme the entry of a <b>Gtk::SpinButton</b> specifically:
486
240
 
487
- ### Gtk::Calendar
241
+ spinbutton entry {
242
+ color: #900185;
243
+ }
488
244
 
489
- <b>Gtk::Calendar</b> can be used to show a calendar in your application.
245
+ Apply the green colour to every gtk-widget, via <b>*</b>:
490
246
 
491
- A new calendar can be instantiated in the following way:
247
+ * {
248
+ color: green;
249
+ }
492
250
 
493
- calendar = Gtk::Calendar.new
251
+ If you want to style a <b>Gtk::TextView widget</b>, use a CSS
252
+ rule such as the following:
494
253
 
495
- Setting a different month can be done via the method
496
- <b>.select_month()</b>.
497
-
498
- ### Gtk::CheckMenuItem
254
+ textview.view {
255
+ margin: 10px;
256
+ padding: 10px;
257
+ border: 2px solid rgba(0, 255, 255, 0.3);
258
+ }
499
259
 
500
- Let's first show a small image, to indicate how this widget looks like
501
- in general:
260
+ To make a <b>rounded border effect</b> you can use CSS rules such as the
261
+ following, via <b>border-radius</b>:
502
262
 
503
- <img src="https://i.imgur.com/pkipGZF.png" style="margin: 1em">
263
+ button {
264
+ border: 6px solid steelblue;
265
+ border-radius: 8px;
266
+ }
504
267
 
505
- The Gtk::CheckMenuItem widget is that small arrow-icon, associated
506
- with a label-widget on the right side, such as can be seen by the
507
- 'Toolbar' text or the 'Statusbar' text.
268
+ Or, via an ID, use the following:
508
269
 
509
- <b>Gtk::CheckMenuItem</b> is a subclass of Gtk::MenuItem.
270
+ #button1 {
271
+ border: 6px solid steelblue;
272
+ border-radius: 8px;
273
+ }
510
274
 
511
- This widget can be used to add a menu item that the user can select and
512
- deselect again. That way this menu element can be used as <b>a boolean
513
- toggle</b>, between <b>true</b> and <b>false</b>.
275
+ You can also give each coordinate a different value, such as via:
514
276
 
515
- Every time the user clicks on this item the value is changed, so it
516
- really acts like a <b>flip-switch</b>.
277
+ .rounded_corner {
278
+ border-radius: 0px 0px 6px 6px;
279
+ }
517
280
 
518
- ### Gtk::CssProvider
281
+ This would lead to rounded borders on the bottom, but not on the top.
282
+ In general, though, I think each of these four values being the same
283
+ looks a <b>lot</b> better.
519
284
 
520
- This subsection contains some information about class **Gtk::CssProvider**.
285
+ Either way, adjust the values to your preferences.
521
286
 
522
- This class can be used to make CSS rules available for gtk-widgets.
287
+ Make <b>all selections</b> appear in <b>steelblue</b> colour can be
288
+ done via:
523
289
 
524
- If you have a local .css file and want to load it, consider using
525
- the following API (and adjust accordingly to your use case):
290
+ selection {
291
+ color: steelblue;
292
+ }
526
293
 
527
- require 'gtk3'
294
+ Use an unequal border-width (e. g. empty on one area):
528
295
 
529
- css_provider = Gtk::CssProvider.new
530
- css_provider.load_from_path('/home/x/programming/ruby/src/gtk_paradise/lib/gtk_paradise/css/default.css') # Provide the path to the .css file here.
296
+ border-width: 2px 0 2px 2px; # This setting would factually omit the right border.
297
+ .small_border { border-width: 2px 0 2px 2px; } # Ready for copy-paste. \o/
531
298
 
532
- ### Using Gtk::BaseModule to handle CSS rules
299
+ If you have a need or use case to change the colour of the pulsing cursor in
300
+ a gtk-entry or gtk-textview, also called a <b>caret</b>, then you could use
301
+ something like this:
533
302
 
534
- The gtk_paradise gem includes a few .css files which cater to my use
535
- case. If you want to make use of these CSS rules then, after
536
- including Gtk::BaseModule, call the following method:
303
+ * {
304
+ caret-color: gold;
305
+ }
537
306
 
538
- apply_the_default_css_rules
307
+ This would change the colour of the caret to <b>gold</b>. This may be useful if
308
+ your gtk-entry has a black background colour and you want to change this to a
309
+ more visible caret - hence gold. The example
310
+ at <b>gtk_paradise/examples/advanced/025_showing_a_gold_caret_on_black_background.rb</b>
311
+ shows this via a simple entry.
539
312
 
540
- This will read in the file content of the two files **project.css**
541
- and **colours.css**. The latter is for colours; and the former is
542
- for everything else. This will actually append the default
543
- CSS rules, so if you want to add CSS manually while also using
544
- this method, it is recommend to append these custom CSS rules
545
- before calling **.apply_the_default_css_rules()**.
313
+ You can also associate this with a specific CSS class or make
314
+ the caret transparent, such as in:
546
315
 
547
- If you want to quickly verify the CSS in use for the widget
548
- at hand, as String, then use this method:
316
+ .my_label { caret-color: transparent; }
317
+ .foobar { caret-color: green; }
549
318
 
550
- display_the_CSS_rules
319
+ To give the whole window a fancy background, use a CSS rule such as
320
+ the following (for <b>Gtk::Window</b>):
551
321
 
552
- You can still append CSS lateron, such as:
322
+ window {
323
+ background: linear-gradient(153deg, #151515, #151515 5px, transparent 5px) 0 0,
324
+ linear-gradient(333deg, #151515, #151515 5px, transparent 5px) 10px 5px,
325
+ linear-gradient(153deg, #222, #222 5px, transparent 5px) 0 5px,
326
+ linear-gradient(333deg, #222, #222 5px, transparent 5px) 10px 10px,
327
+ linear-gradient(90deg, #1b1b1b, #1b1b1b 10px, transparent 10px),
328
+ linear-gradient(#1d1d1d, #1d1d1d 25%, #1a1a1a 25%, #1a1a1a 50%, transparent 50%, transparent 75%, #242424 75%, #242424);
329
+ background-color: #131313;
330
+ background-size: 20px 20px;
331
+ }
553
332
 
554
- append_these_CSS_rules '.bblack20 { border: 20px solid black; }'
333
+ So you can use <b>linear-gradient</b> too.
555
334
 
556
335
  ### CSS Support in gtk3: using CSS in ruby-gtk3 and using CSS via the gtk_paradise gem
557
336
 
@@ -584,7 +363,7 @@ Next, ruby code is shown to benefit from these CSS rules:
584
363
  )
585
364
 
586
365
  I am not sure how much of CSS is supported in GTK+, but sticking to
587
- the commonly used CSS rules, such as **color**, **background-color**
366
+ the commonly used CSS rules, such as <b>color</b>, **background-color**
588
367
  and so forth, appears to be working fairly well. Since I keep on
589
368
  forgetting which rules may work and which ones may not, I intend
590
369
  to keep this subsection here as a **quick reference**; expect
@@ -768,11 +547,18 @@ in ruby-gtk3 and CSS, like the following example demonstrates:
768
547
 
769
548
  background-color: rgb(241, 135, 135);
770
549
 
771
- Or, if you also want to provide the **transparence value** at
550
+ Or, if you also want to provide the <b>transparence value</b> at
772
551
  the end:
773
552
 
774
553
  background-color: rgba (0, 0, 0, 0);
775
554
 
555
+ The four parameters stand for:
556
+
557
+ red: value
558
+ green: value
559
+ blue: value
560
+ alpha: value
561
+
776
562
  You can use <b>custom images</b>, such as .png files, to replace the
777
563
  default check button and radio button.
778
564
 
@@ -978,7 +764,7 @@ Styling an entry of a **spin button** via CSS:
978
764
  color: #900185;
979
765
  }
980
766
 
981
- To style a **Gtk::Grid** via CSS, you can use something like this:
767
+ To style a <b>Gtk::Grid</b> via CSS, you can use something like this:
982
768
 
983
769
  grid {
984
770
  border: 1px solid steelblue;
@@ -1056,7 +842,7 @@ use the **CSS-provider**):
1056
842
  label = Gtk::Label.new('Test!')
1057
843
  label.set_name('foo-bar')
1058
844
 
1059
- To modify all **Gtk::ScrolledWindow** instances you can use the
845
+ To modify all <b>Gtk::ScrolledWindow</b> instances you can use the
1060
846
  following CSS rule:
1061
847
 
1062
848
  /* Style our main scrolled-window a little bit. */
@@ -1280,169 +1066,434 @@ You can also work with IDs similar to HTML/CSS. For instance:
1280
1066
  label.set_name("red_label")
1281
1067
  css = '#red_label { background-color: #f00; }'
1282
1068
 
1283
- But I find it often better to simply use CSS classes and attach
1284
- them as-is, depending on what you'd like to see instead.
1069
+ But I find it often better to simply use CSS classes and attach
1070
+ them as-is, depending on what you'd like to see instead.
1071
+
1072
+ ## A brief history of the gtk_paradise project
1073
+
1074
+ The **gtk_paradise project** itself was created many years ago, and
1075
+ then eventually published on **rubygems.org** in **March 2015**,
1076
+ under its old name **gtk_module**
1077
+
1078
+ Due to various reasons, including a seemingly necessary clean-up of the
1079
+ old code base that was part of the **gtk_module** project, the project
1080
+ was eventually <b>renamed</b> (and subsequently restructured) into the
1081
+ newly named **gtk_paradise** gem, in **January 2020**.
1082
+
1083
+ The new structure for the project should be more logical, and thus make
1084
+ more sense as well, at the least compared to the older project called
1085
+ **gtk_module**. Furthermore, one focus was on being able to support
1086
+ both ruby-gtk2 and ruby-gtk3 (and eventually ruby-gtk4) - although,
1087
+ as previously mentioned, support for ruby-gtk2 is no longer as strong
1088
+ and some old code may no longer work either.
1089
+
1090
+ ## Use cases and goals for the gtk_paradise project
1091
+
1092
+ Over the years, the **gtk_paradise** project has had **different primary
1093
+ use cases**. These will be listed now, starting with the more important
1094
+ goals:
1095
+
1096
+ (1) provide **a set of convenience bindings/code** that may enhance the
1097
+ whole gtk-stack in ruby.
1098
+
1099
+ I did not want to be limited solely by the official upstream bindings
1100
+ to GTK alone. Instead, I wanted to use ruby more naturally when writing
1101
+ ruby-gtk applications. Certain DSL-like commands appeared to make sense
1102
+ to me in the widget sets, such as **.on_clicked {}**.
1103
+
1104
+ For instance, rather than use this variant:
1105
+
1106
+ button.signal_connect(:clicked) {
1107
+ puts 'The button was clicked.'
1108
+ }
1109
+
1110
+ I wanted to use this variant instead:
1111
+
1112
+ button.on_clicked {
1113
+ puts 'The button was clicked.'
1114
+ }
1115
+
1116
+ This seemed more natural and logical to me, but this was not possible
1117
+ because the official ruby-gtk bindings are more closely trying to match
1118
+ the official C API that governs GTK - and stop right at that point.
1119
+
1120
+ This is largely due to gobject-introspection these days, and in part
1121
+ to simplify maintaining these upstream bindings. Either way I wanted
1122
+ to have more freedom in how to write ruby-code for ruby-gtk. See also
1123
+ the glimmer-project by Andy - you can find it on rubygems.org. Perhaps
1124
+ one day glimmer may unify all of desktop, web-related widgets and
1125
+ so forth. One codebase to rule them all. \o/
1126
+
1127
+ (2) distribute a common code base for different gtk-applications,
1128
+ to allow **re-use of the code**, as a **secondary goal**.
1129
+
1130
+ For example, **Gtk::BaseModule** is a convenience module that can
1131
+ be included into subclasses, like in the following manner:
1132
+
1133
+ require 'gtk_paradise/requires/require_the_base_module.rb'
1134
+ include ::Gtk::BaseModule
1135
+
1136
+ Or, even simpler than that, to just use this:
1137
+
1138
+ require 'gtk_paradise/require_gtk3'
1139
+ class Foobar < Gtk::BaseModuleFrame # This automatically has include ::Gtk::BaseModule
1140
+ end
1141
+
1142
+ Then, once that was done, certain methods, such as **gtk_text()**, or
1143
+ just **text()**, can be used, rather than the slightly longer variant
1144
+ called **Gtk::Text.new()**, or **gtk_label()** or just **label()**
1145
+ rather than **Gtk::Label.new()**.
1146
+
1147
+ So really, this was mostly done due reasons of my laziness or simply
1148
+ convenience, but additionally to avoid or reduce on **code
1149
+ duplication**. Other users of this gem can then also rely that these
1150
+ methods are supported by the gtk_paradise project in future versions -
1151
+ at the least once version 1.0 is released. (Right now this gem is
1152
+ still in a beta release state, so things may change. I will try to
1153
+ not break things unless absolutely necessary, though.)
1154
+
1155
+ If we use a single method, such as text(), then we can easily change
1156
+ this at a later time, even if the upstream names change. This is
1157
+ one additional use case for the project: to allow working with
1158
+ ruby-gtk2, ruby-gtk3 and ruby-gtk4 (and ruby-gtk5 eventually, and
1159
+ so forth): one code base to rule-them-all.
1160
+
1161
+ Take note that in regards to **::Gtk::BaseModule**, I use the leading
1162
+ **::** here because I want this all to be part of **module Gtk**. The
1163
+ reason for this is mostly due to <b>long-term convenience</b> when
1164
+ making use of this project. Of course typing a leading :: is a bit
1165
+ annoying, so this is a downside, but it is better to modify the
1166
+ toplevel namespace Gtk directly, in my opinion: keep everything
1167
+ coordinated in one namespace. (This was different in the older
1168
+ gtk_module gem, which is another reason why that was changed for
1169
+ the gtk_paradise gem.)
1170
+
1171
+ (3) to **distribute some smaller classes** and even games written
1172
+ in ruby-gtk.
1173
+
1174
+ Before the gtk_paradise project existed, I collected these different
1175
+ classes into local .rb files mostly (naturally), and put them into
1176
+ different projects - but in hindsight I think it may be better if
1177
+ there is a dedicated project that bundles together code, in regards to
1178
+ GTK, and publishes that code as well, ideally in an improved manner.
1179
+
1180
+ Here a hope is that if you or anyone else creates some ruby-gtk
1181
+ application, say a small game or something like that, to send it to
1182
+ my email address (if you would like to), and if you deem the licence in
1183
+ the gtk_paradise to be an acceptable one; then I could integrate
1184
+ this game. (Please also add some documentation if you can; not everything
1185
+ has to be documented and commented fully, mind you, but at the least
1186
+ an introduction, the basic usage, and perhaps some comments within
1187
+ the .rb files.)
1188
+
1189
+ Note that since as of **2021** I bundle games-related code into another
1190
+ gem called **games_paradise** - this one will include some ruby-gtk
1191
+ based games as well, so games are no longer distributed in the
1192
+ gtk_paradise project. Nonetheless, the gtk_paradise project retains its
1193
+ use case of trying to distribute a shared code base, for other projects
1194
+ to operate from, and re-use (and share) different new gtk-widgets and
1195
+ new gtk-based applications.
1196
+
1197
+ (4) last, but not least, provide stellar documentation and explanations.
1198
+
1199
+ This is still ongoing, but hopefully this may be useful to you even
1200
+ if you do not use this project. I benefitted from tutorials based on
1201
+ python-gtk3, so I found this to be a useful and laudable goal for ruby
1202
+ too: teach people, explain things, document stuff.
1203
+
1204
+ These are the four major goals for this gem. There are some minor
1205
+ goals as well, but they are not that important to mention them here;
1206
+ if you are interested in more minor goals, have a look at the
1207
+ todo/ subdirectory of this gem - these minor goals are, to some
1208
+ extent, mentioned there. As a todo-list.
1209
+
1210
+ ## The licence of the gtk_paradise project
1211
+
1212
+ Since as of the **19th July 2021** (**19.07.2021**) the **gtk_paradise**
1213
+ project now uses the **MIT licence**. Before that the **gtk_paradise** project
1214
+ used the **LGPL-2.1 licence** (GNU LESSER GENERAL PUBLIC LICENSE Version 2.1),
1215
+ without the later clause though.
1216
+
1217
+ I am perfectly fine with both **GPL** and **LGPL** licences - they are good
1218
+ licences. But they also tend to cause more hassle than what often seems necessary
1219
+ when it comes to <b>enforcement</b> of the licence part. The project here is a
1220
+ hobby project, so I am not even paying that much attention as to what others
1221
+ do with this code to begin with really - it's not a "key project" for me at all
1222
+ whatsoever, in this regard.
1223
+
1224
+ The MIT licence is much, much simpler than the GPL - other than the <b>no-warranty
1225
+ clause</b> (aka "you are on your own when using this project"), there isn't really
1226
+ that much else to worry about it. Whereas the **LGPL licence** is like really
1227
+ huge compared to the MIT licence ... and we haven't even gotten to the **GPL**
1228
+ yet, forcing all downstream code to have the same licence (and permissions,
1229
+ granted upon other users, too).
1230
+
1231
+ Anyway - here is a good summary for the MIT licence:
1232
+
1233
+ https://opensource.org/licenses/MIT
1234
+
1235
+ I don't even 'care' about the copyright statement as such, per se, but in some
1236
+ jurisdictions there is no way to forego the copyright notice (I think in
1237
+ Germany), so simply substitute as appropriate in such jurisdictions. How courts
1238
+ evaluate anything is not up to me - for this project, the MIT licence is
1239
+ used. That's it.
1240
+
1241
+ ## Towards a version 1.0 for this gem
1242
+
1243
+ Right now (in 2021, but also in April 2023, when this document was again
1244
+ updated massively, and again in November 2023) the gtk_paradise gem is
1245
+ not yet ready for a 1.0 release. I am still experimenting <b>a lot</b>
1246
+ in 2021 - as well as in 2023.
1247
+
1248
+ At some later time I will decide which features will be retained, and
1249
+ which ones will be removed. Then the documentation and examples will
1250
+ be improved, everything will be significantly polished, and a "final" 1.0
1251
+ release will be published. This one will be made available for a significantly
1252
+ longer time, so that people can begin to use it for more serious projects.
1253
+
1254
+ Final here means that this will be the final 1.0 release. Of course later
1255
+ releases may follow past 1.0, but 1.0 will remain hosted on rubygems.org
1256
+ for a longer time than subsequent releases.
1257
+
1258
+ But this will probably take a few years, so stay tuned in this regard.
1259
+
1260
+ ## Documentation for the gtk-paradise project
1261
+
1262
+ The <b>documentation</b> for the gtk-paradise project is currently lacking,
1263
+ admittedly so. This is not good and should be remedied in the long run.
1264
+
1265
+ There are several personal reasons as to why documentation is lacking
1266
+ currently: laziness, lack of time and lack of motivation. But another,
1267
+ somewhat trivial additional reason is that I am experimenting a **LOT**
1268
+ right now.
1269
+
1270
+ I have no real idea what happens with the **gtk_paradise project** in its
1271
+ current form in the long run, in regards to future changes. I want to
1272
+ simplify the project, which means that old code may be removed every now
1273
+ and then. Retaining the ability to change a project is very important,
1274
+ unless it becomes stable. Sometimes you may find better ways to express an
1275
+ idea in code - or in less code. So the gtk_paradise project is not very
1276
+ stable right now, and probably will not be for a long time, until I
1277
+ feel sufficiently pleased with its present form.
1278
+
1279
+ I once had that crazy idea that it would be nice to have a **GUI-like
1280
+ DSL-layer** over the terminal interface, the www, as well as classical
1281
+ desktop elements, as pointed out above. To **use one unified code base
1282
+ for all GUI-elements**.
1283
+
1284
+ While this is probably too ambitious a goal, I still want to try
1285
+ at the least some of those ideas that can help us write more desktop-GUIs
1286
+ in ruby-gtk, at a much faster "implementation speed" than before (I refer
1287
+ to our human life time that we invest in creating this, NOT to the speed
1288
+ of code-execution once an application is run). So ideas in this regard are
1289
+ very welcome - and I am experimenting with these as well.
1290
+
1291
+ Nonetheless, whenever possible I will try to **slowly** improve
1292
+ on the existing documentation distributed as part of the **gtk_paradise**
1293
+ project - but ultimately I think for the time being, it may often be
1294
+ better to simply peek at the source code itself for the different
1295
+ widgets used in the gtk_paradise project. Some errors and mistakes
1296
+ may exist as well, so have a look at the official gtk-documentation
1297
+ aside from the project here.
1298
+
1299
+ The whole **gtk_paradise project** is definitely more geared towards
1300
+ people already knowing ruby quite well, not necessarily aimed for
1301
+ beginners. Beginners should start with the upstream ruby-gtk bindings
1302
+ instead, and work through the examples and demo, until they have a
1303
+ sufficient grasp of the underlying concepts used by upstream GTK. Of
1304
+ course nothing prevents you from giving the gtk_paradise project a
1305
+ try as-it-is; beginners are, however had, not necessarily the main,
1306
+ primary target audience for this gem.
1307
+
1308
+ I, on the other hand, wanted to write widgets in a more ruby-centric
1309
+ manner, including some **DSL-like elements**, such as simply using
1310
+ **gtk_button** or even just **button** in order to create a button,
1311
+ or add methods such as **.on_clicked** to capture on-click events
1312
+ to such a button. If we are using code such as **button {}** then,
1313
+ in theory, we could eventually expand this to different toolkits,
1314
+ such as **tk** or **qt**, but also make such applications usable on the
1315
+ www if we map this to a functional interface - but these are mostly
1316
+ hypothetical thoughts for now. In practice, this project really just
1317
+ focuses on **polishing ruby-gtk widgets** directly.
1318
+
1319
+ ## How to benefit from the gtk_paradise project?
1320
+
1321
+ How to make use of this project in a way that may be useful to you
1322
+ or other people?
1323
+
1324
+ The **gtk_paradise** project tries to support different styles and
1325
+ remain flexible overall, so I can not tell **you** how you "should"
1326
+ use it - it all depends on various factors. It also depends on the
1327
+ way how you decide how to lay out the code.
1285
1328
 
1286
- ### CSS rules - various examples
1329
+ So, rather than try to answer this fairly large and complex question,
1330
+ I will try to explain how I tend to use the project, which may
1331
+ serve as a general introduction into the gtk_paradise project
1332
+ as well.
1287
1333
 
1288
- This subsection will contain a few CSS rules as examples. This is mostly just
1289
- a quickref (quick reference), in the event that people want to refresh their
1290
- knowledge. Showing specific examples that work is best, in my opinion.
1334
+ First, I typically add code to a **standalone** widget; then
1335
+ I instantiate this widget into **Gtk::Runner**, via **Gtk.run**.
1336
+ In other words, that widget is put into a Gtk::Runner
1337
+ instance.
1291
1338
 
1292
- **First**: keep all widget names **lowercase**. There are old examples on
1293
- the www available where the widget-names in use for CSS start with "Gtk",
1294
- such as **GtkEntry**. This should be simply **entry** instead these days.
1339
+ That way - and one advantage of doing this - I can <b>avoid</b>
1340
+ having to work with Gtk::Window directly, which I find to be a
1341
+ somewhat annoying widget. I find it more convenient to operate
1342
+ via **Gtk::Runner**. I can also modify <b>Gtk::Runner</b>
1343
+ easily and, for instance, automatically add all custom CSS
1344
+ rules that I use onto it. So you can see that it is more
1345
+ flexible than subclassing from Gtk::Window directly.
1295
1346
 
1296
- At any rate and without further ado, here come some specific examples.
1347
+ In the past, I used another approach, at the least for
1348
+ ruby-gtk3. Here I was subclassing from Gtk::Window directly,
1349
+ but since as of **March 2021** I simplified this old
1350
+ approach - now I use the very same approach for both
1351
+ ruby-gtk2 and ruby-gtk3 in this regard. That was one reason
1352
+ for the rewrite from gtk_module to gtk_paradise, by the
1353
+ way.
1297
1354
 
1298
- Picking a proper font:
1355
+ Note that because of gtk3 changing things quite a bit, I
1356
+ created the directory called **base_module_and_runner_module/**,
1357
+ specifically for **ruby-gtk3**. I needed to improve support
1358
+ on the toplevel-instance directly.
1299
1359
 
1300
- font-family: Monospace;
1301
- font-family: Cantarell; # Or use this family.
1360
+ The simplest way for me is to <b>then</b> use **Gtk::BaseModule**
1361
+ via the following code in custom widgets:
1302
1362
 
1303
- **Set the size of the font** at hand via CSS:
1363
+ require 'gtk_paradise/requires/require_the_base_module.rb'
1364
+ include ::Gtk::BaseModule
1304
1365
 
1305
- font-size: 20px; # don't forget to put this inside the {}
1366
+ Note that this is put in **requires/** - this should be guaranteed
1367
+ to work for a long time, even if I may change the code
1368
+ internally.
1306
1369
 
1307
- Set the background colour of every window to a particular colour:
1370
+ It should never become any more complicated than these two
1371
+ lines.
1308
1372
 
1309
- window {
1310
- background-color: white; # replace with a colour of your choice; and use 'color' rather than 'colour'
1311
- }
1373
+ These two **prior** requires should then suffice, depending on
1374
+ whether you want to use gtk2 or gtk3:
1312
1375
 
1313
- To make a button show a <b>hover-effect</b> (when the mouse is "above"
1314
- the button), try:
1376
+ require 'gtk_paradise/require_gtk2'
1315
1377
 
1316
- .button:hover {
1317
- padding: 12px 48px;
1318
- background-color: #4870bc;
1319
- }
1378
+ or
1320
1379
 
1321
- (An alternative to the above CSS rule may be to make use of the method
1322
- .override_background_color(), but here we focus primarily on CSS rules.)
1380
+ require 'gtk_paradise/require_gtk3' # This one should be more common these days.
1323
1381
 
1324
- It is possible to target specific children in a gtk-widget. For example,
1325
- in order to specifically **style the first child of a gtk-widget**, such
1326
- as a button, try the following CSS rule:
1382
+ So, put any (either, rather) of these two require lines on
1383
+ top of the .rb file at hand. If you are still unsure about
1384
+ the layout, simply look at the files that come distributed
1385
+ via the gtk_paradise gem. You will typically see them
1386
+ begin with this as the first line of ruby code.
1327
1387
 
1328
- .button:first-child {
1329
- border-radius: 5px 0 0 5px;
1330
- }
1388
+ I recommend to use gtk3 these days; the CSS rules are making
1389
+ it much more convenient to work with gtk3.
1331
1390
 
1332
- Modify two widgets at the same time via the same CSS style - in this
1333
- case a gtk-button and a gtk-entry:
1391
+ ## Structure of the gtk_paradise project
1334
1392
 
1335
- button, entry {
1336
- color: #ff00ea;
1337
- font: 12px "Comic Sans";
1338
- }
1393
+ This subsection will include some information about the overall
1394
+ structure of the gtk_paradise project. This will **NOT** be
1395
+ complete; instead it merely provides some pointers. Note that
1396
+ this may become slightly deprecated over time, so consider it
1397
+ to be more of something that may have been correct at one point
1398
+ in time, but may have changed since then.
1339
1399
 
1340
- You can also style / theme <b>insensitive widgets</b> in general,
1341
- via:
1400
+ All files that are part of Gtk::BaseModule will reside under
1401
+ the subdirectory called **base_module/**.
1342
1402
 
1343
- *:disabled {
1344
- background-color: #320a91;
1345
- }
1403
+ The file **app.rb**, which can be found at **gtk_paradise/app/app.rb**,
1404
+ contains the code for the toplevel method call **Gtk.app()** -
1405
+ this one is aliased to **Gtk.run()**, which used to be the original
1406
+ name at one point in time.
1346
1407
 
1347
- Theme the <b>labels</b> in the first notebook tab:
1408
+ This code can be used to **quickly start a gtk-widget**, and embed
1409
+ it into **Gtk::Window.new()** essentially. It reduces a bit of
1410
+ the necessary boilerplate code.
1348
1411
 
1349
- notebook tab:first-child label {
1350
- color: #89d012;
1351
- }
1412
+ Some of the default gtk-classes are modified by the gtk_paradise
1413
+ project. These modifications will be stored under the **gtk_classes/**
1414
+ subdirectory. The rule for entries in that directory is very simple:
1415
+ the name of the class will become the corresponding .rb file name.
1352
1416
 
1353
- Theme the entry of a <b>Gtk::SpinButton</b> specifically:
1417
+ So class **Gtk::SourceBuffer** would reside at **gtk_classes/source_buffer.rb**.
1418
+ Note that not all modifications can be applied, for various reasons, but
1419
+ many of the default classes are modified. Remember this when using the
1420
+ gtk_paradise project: it is NOT a project for the 'default', assumed usage. For
1421
+ that you are recommended to use **vanilla** ruby-gtk instead, without
1422
+ the custom modifications done by the gtk-paradise project. The primary
1423
+ focus for the gtk_paradise project is to try to be of help when it
1424
+ comes to efficiency, when writing code - thus, the gtk_paradise
1425
+ project is more of an applied toolset project that tries to enhance
1426
+ the current status quo. (The ruby-gtk bindings are, unfortunately,
1427
+ mostly just a wrapper over the C API itself. This limits the way
1428
+ how users can think about application code.)
1354
1429
 
1355
- spinbutton entry {
1356
- color: #900185;
1357
- }
1430
+ ## Demo
1358
1431
 
1359
- Apply the green colour to every gtk-widget:
1432
+ The **gtk_paradise** gem comes with many example files, collected from
1433
+ different sources.
1360
1434
 
1361
- * {
1362
- color: green;
1363
- }
1435
+ If you want to use a controller-widget to show some of them, consider
1436
+ looking at the subdirectory examples/controller/, the controller.rb
1437
+ file there. This defaults to ruby-gtk3. One day it should work
1438
+ for both ruby-gtk2 and ruby-gtk3, but I prioritise on ruby-gtk3
1439
+ these days, so support for ruby-gtk2 may lag behind.
1364
1440
 
1365
- If you want to style a Gtk::TextView widget, use a CSC rule like
1366
- this:
1441
+ At any rate, run the controller.rb file to see what is available
1442
+ as demo. The basic idea is that the demo showcases all standalone
1443
+ examples, similar to main.rb of the official ruby-gnome / ruby-gtk
1444
+ bindings.
1367
1445
 
1368
- textview.view {
1369
- margin: 10px;
1370
- padding: 10px;
1371
- border: 2px solid rgba(0, 255, 255, 0.3);
1372
- }
1446
+ ## How to determine the version of ruby-gtk?
1373
1447
 
1374
- To make a <b>rounded border effect</b> you can use CSS rules such as the
1375
- following
1448
+ First, use either:
1376
1449
 
1377
- button {
1378
- border: 6px solid steelblue;
1379
- border-radius: 8px;
1380
- }
1450
+ require 'gtk2'
1451
+ require 'gtk3' # or this one here for ruby-gtk3.
1381
1452
 
1382
- Or, via an ID, use:
1453
+ Next, you can query some constants:
1383
1454
 
1384
- #button1 {
1385
- border: 6px solid steelblue;
1386
- border-radius: 8px;
1387
- }
1455
+ pp ::Gtk::Version::MAJOR
1456
+ pp ::Gtk::Version::MICRO
1457
+ pp ::Gtk::Version::MINOR
1458
+ pp ::Gtk::Version::STRING # => "2.24.32"
1388
1459
 
1389
- You can also give each coordinate a different value, such as via.
1460
+ ## Querying the GTK theme in use
1390
1461
 
1391
- .rounded_corner {
1392
- border-radius: 0px 0px 6px 6px;
1393
- }
1462
+ You can issue the following command in order to query the theme GTK is
1463
+ using:
1394
1464
 
1395
- This would lead to rounded borders on the bottom, but not on the
1396
- top. In general, though, I think each of these four values being
1397
- the same looks a <b>lot</b> better.
1465
+ gtk-query-settings theme
1398
1466
 
1399
- Either way, adjust the values to your liking.
1467
+ ### Gtk::Calendar
1400
1468
 
1401
- Make <b>all selections</b> appear in <b>steelblue</b> colour can be
1402
- done via:
1469
+ <b>Gtk::Calendar</b> can be used to show a calendar in your application.
1403
1470
 
1404
- selection {
1405
- color: steelblue;
1406
- }
1471
+ A new calendar can be instantiated in the following way:
1407
1472
 
1408
- Use an unequal border-width (e. g. empty on one area):
1473
+ calendar = Gtk::Calendar.new
1409
1474
 
1410
- border-width: 2px 0 2px 2px; # This setting would factually omit the right border.
1411
- .small_border { border-width: 2px 0 2px 2px; } # Ready for copy-paste. \o/
1475
+ Setting a different month can be done via the method
1476
+ <b>.select_month()</b>.
1412
1477
 
1413
- If you have a need or use case to change the colour of the pulsing
1414
- cursor in a gtk-entry or gtk-textview, also called a <b>caret</b>,
1415
- then you could use something like this:
1478
+ ### Gtk::CheckMenuItem
1416
1479
 
1417
- * {
1418
- caret-color: gold;
1419
- }
1480
+ Let's first show a small image, to indicate how this widget looks like
1481
+ in general:
1420
1482
 
1421
- This would change the colour of the caret to gold. This may be useful
1422
- if your gtk-entry has a black background colour and you want to
1423
- change this to a more visible caret - hence gold. The example
1424
- at <b>gtk_paradise/examples/advanced/025_showing_a_gold_caret_on_black_background.rb</b>
1425
- shows this via a simple entry.
1483
+ <img src="https://i.imgur.com/pkipGZF.png" style="margin: 1em">
1426
1484
 
1427
- You can also associate this with a specific CSS class or make
1428
- the caret transparent, such as in:
1485
+ The Gtk::CheckMenuItem widget is that small arrow-icon, associated
1486
+ with a label-widget on the right side, such as can be seen by the
1487
+ 'Toolbar' text or the 'Statusbar' text.
1429
1488
 
1430
- .my_label { caret-color: transparent; }
1431
- .foobar { caret-color: green; }
1489
+ <b>Gtk::CheckMenuItem</b> is a subclass of Gtk::MenuItem.
1432
1490
 
1433
- To give the whole window a fancy background, use a CSS rule such as
1434
- the following (for <b>Gtk::Window</b>):
1491
+ This widget can be used to add a menu item that the user can select and
1492
+ deselect again. That way this menu element can be used as <b>a boolean
1493
+ toggle</b>, between <b>true</b> and <b>false</b>.
1435
1494
 
1436
- window {
1437
- background: linear-gradient(153deg, #151515, #151515 5px, transparent 5px) 0 0,
1438
- linear-gradient(333deg, #151515, #151515 5px, transparent 5px) 10px 5px,
1439
- linear-gradient(153deg, #222, #222 5px, transparent 5px) 0 5px,
1440
- linear-gradient(333deg, #222, #222 5px, transparent 5px) 10px 10px,
1441
- linear-gradient(90deg, #1b1b1b, #1b1b1b 10px, transparent 10px),
1442
- linear-gradient(#1d1d1d, #1d1d1d 25%, #1a1a1a 25%, #1a1a1a 50%, transparent 50%, transparent 75%, #242424 75%, #242424);
1443
- background-color: #131313;
1444
- background-size: 20px 20px;
1445
- }
1495
+ Every time the user clicks on this item the value is changed, so it
1496
+ really acts like a <b>flip-switch</b>.
1446
1497
 
1447
1498
  ## Signals in GTK - showing the available signals and how to emit signals in ruby-gtk
1448
1499
 
@@ -1474,7 +1525,7 @@ attempt to be a complete API reference. But for now, only one entry is here. :)
1474
1525
  .signal_connect(:insert_text) # This is emitted in a Gtk::Entry when text is entered
1475
1526
 
1476
1527
  **GTK+** will emit the **"destroy"** signal when widget.destroy()
1477
- is called.
1528
+ is called explicitely.
1478
1529
 
1479
1530
  Whenever a mouse button is pressed, a **button-press-event**
1480
1531
  signal is emitted.
@@ -1646,6 +1697,16 @@ added.
1646
1697
  <b>Gdk::Drawable</b> can be used for drawing. For instance, one
1647
1698
  can draw a rectangle of a pixbuf onto a <b>Gdk::Drawable</b>.
1648
1699
 
1700
+ Basically <b class="BOLD">Gdk::Drawable</b> is the base
1701
+ class for all objects that respond to <i>drawing commands</i>.
1702
+
1703
+ The API is a bit complicated, such as:
1704
+
1705
+ .draw_drawable(@bgc, @buffer, rec.x, rec.y, rec.x, rec.y, rec.width, rec.height)
1706
+
1707
+ The Gdk::Drawable interface enables one to draw lines, points,
1708
+ elliptical arcs, rectangles, text, or images.
1709
+
1649
1710
  ## Gdk::GC
1650
1711
 
1651
1712
  <b>Gdk::GC</b> is the graphics context library, tasked with
@@ -2311,7 +2372,7 @@ in the desired colour.
2311
2372
 
2312
2373
  ## Gdk::Screen
2313
2374
 
2314
- You can use **Gdk::Screen** to obtain the screen size, respectively the
2375
+ You can use <b>Gdk::Screen</b> to obtain the screen size, respectively the
2315
2376
  resolution.
2316
2377
 
2317
2378
  Example for this:
@@ -2320,23 +2381,24 @@ Example for this:
2320
2381
  x.width # => 1920
2321
2382
  x.height # => 1080
2322
2383
 
2384
+ So, in other words, to obtain the default (current) screen you can use
2385
+ <b>screen = Gdk::Screen.default</b>.
2386
+
2323
2387
  Getting the resolution right is quite important - in the past I used
2324
2388
  hardcoded values for my main monitor, which is quite large. But this
2325
- does not work well on smaller laptop screens, so since as of **September
2326
- 2021** I am slowly transitioning all my ruby-gtk applications to use
2389
+ does not work well on smaller laptop screens, so since as of <b>September
2390
+ 2021</b> I am slowly transitioning all my ruby-gtk applications to use
2327
2391
  a percentage value instead. So, rather than:
2328
2392
 
2329
2393
  set_width(1920)
2330
2394
 
2331
- I may use:
2395
+ I may use this instead:
2332
2396
 
2333
2397
  set_width('80%')
2334
2398
 
2335
- Note that in ruby-gtk4 <b>Gdk::Screen</b> is no longer available.
2336
-
2337
- The **upstream API documentation** for **Gdk::Screen** can be found here:
2338
-
2339
- https://ruby-gnome2.osdn.jp/hiki.cgi?Gdk%3A%3AScreen
2399
+ Note that in ruby-gtk4 <b>Gdk::Screen</b> is no longer available,
2400
+ which is rather unfortunate. I have not yet found a good replacement
2401
+ here.
2340
2402
 
2341
2403
  ## Gdk::PixbufLoader
2342
2404
 
@@ -2408,16 +2470,26 @@ The possible ColorSpaces are::
2408
2470
 
2409
2471
  ## GdkPixbuf::PixbufSimpleAnim
2410
2472
 
2411
- You can instantiate a new **PixbufSimpleAnim** object via:
2473
+ If you wish to animate an image you could use class <b>GdkPixbuf::PixbufSimpleAnim</b>.
2474
+
2475
+ You can instantiate a new <b>PixbufSimpleAnim</b> object via:
2412
2476
 
2413
2477
  pixbuf_simple_anim = Gdk::PixbufSimpleAnim.new(64, 64, 24)
2414
2478
 
2415
- Individual frames can be added via .add_frame():
2479
+ The arguments to this class would be as follows:
2480
+
2481
+ * width: the width of the animation (Fixnum)
2482
+ * height: the height of the animation (Fixnum)
2483
+ * rate: the speed of the animation, in frames per second (Float)
2484
+ * Returns: a newly-created Gdk::PixbufSimpleAnim
2485
+
2486
+ Individual frames can be added via <b>.add_frame()</b>:
2416
2487
 
2417
2488
  pixbuf_simple_anim.add_frame(pixbuf)
2418
2489
 
2419
- This used to work for ruby-gtk2; I am not certain it still works
2420
- in ruby-gtk3 though.
2490
+ This used to work for ruby-gtk2; I am not certain wheter it
2491
+ still works in ruby-gtk3 and ruby-gtk4, though - probably
2492
+ it does not.
2421
2493
 
2422
2494
  ## GdkPixbuf::PixbufAnimation
2423
2495
 
@@ -2592,6 +2664,10 @@ To set the name of a program in an about-dialog you can do this:
2592
2664
 
2593
2665
  about_dialog.set_program_name "Battery"
2594
2666
 
2667
+ To set the copyright use <b>.set_copyright()</b>:
2668
+
2669
+ about.set_copyright "(c) Jan Bodnar"
2670
+
2595
2671
  You can assign a particular <b>logo</b> to be used via the following
2596
2672
  method:
2597
2673
 
@@ -2897,10 +2973,12 @@ This may then look like this:
2897
2973
 
2898
2974
  <img src="https://i.imgur.com/dXX8YVr.png" style="margin-left: 2em">
2899
2975
 
2900
- The upstream API documentation in ruby-gtk for Gtk::Label can be found
2901
- here:
2976
+ You can also use <b>colourized text</b> via the method called
2977
+ <b>set_markup</b>.
2978
+
2979
+ The upstream API documentation for Labels in GTK4 can be found here:
2902
2980
 
2903
- https://ruby-gnome2.osdn.jp/hiki.cgi?cmd=view&p=Gtk%3A%3ALabel
2981
+ https://docs.gtk.org/gtk4/class.Label.html
2904
2982
 
2905
2983
  ## Gtk::AccelLabel
2906
2984
 
@@ -3676,9 +3754,25 @@ Not all colours wered added in the .css file (project.css)
3676
3754
  yet. At some later time I may investigate this again, or
3677
3755
  simply autogenerate all these colours for use in CSS.
3678
3756
 
3757
+ ## Gtk::ComboBox
3758
+
3759
+ First, let's show a picture how a Gtk::ComboBox looked like
3760
+ in the days of ruby-gtk2:
3761
+
3762
+ <img src="https://i.imgur.com/V81daiu.png" style="margin: 1em">
3763
+
3764
+ If you need to set the active element of a <b>Gtk::ComboBox</b>
3765
+ then you can use the following API to achieve that:
3766
+
3767
+ combo_box.active = 0
3768
+
3679
3769
  ## Gtk::ComboBoxText
3680
3770
 
3681
- **Gtk::ComboBoxText** can be used in ruby-gtk3 to create a simple
3771
+ First, for a generic image of a combo-box-text, see the following image:
3772
+
3773
+ <img src="https://i.imgur.com/MbTzdei.png" style="margin-left: 2em">
3774
+
3775
+ <b>Gtk::ComboBoxText</b> can be used in ruby-gtk3 to create a simple
3682
3776
  combo-dropdown-box.
3683
3777
 
3684
3778
  The default listing is to show one entry per line. If you rather want
@@ -3688,11 +3782,12 @@ call:
3688
3782
  combo_box = Gtk::ComboBoxText.new # create a new instance of a combo box here
3689
3783
  combo_box.wrap_width = 7 # Use this here to set to 7 entries per row.
3690
3784
 
3691
- To remove text do:
3785
+ To remove text do make use of the <b>.remove_text()</b> API:
3692
3786
 
3693
3787
  combo_box.remove_text(position)
3694
3788
 
3695
- If you ever have a use case to obtain the model used in a combo-box, try this:
3789
+ If you ever have a use case to obtain the model used in a combo-box, try the
3790
+ following API:
3696
3791
 
3697
3792
  model = combobox.model
3698
3793
  active = combobox.active # This will return e. g. -1
@@ -3701,7 +3796,7 @@ If you ever have a use case to obtain the model used in a combo-box, try this:
3701
3796
  end
3702
3797
  return model[active][0]
3703
3798
 
3704
- To respond to changes, modify the following code:
3799
+ To respond to changes of the combo-box, modify the following code:
3705
3800
 
3706
3801
  combo_box.signal_connect(:changed) { |widget, event|
3707
3802
  on_changed(widget, event, label)
@@ -3715,15 +3810,12 @@ This may look like this:
3715
3810
 
3716
3811
  <img src="https://i.imgur.com/ng9OH92.png" style="margin-left: 2em">
3717
3812
 
3718
- For a generic image of a combo-box-text, see the following image:
3719
-
3720
- <img src="https://i.imgur.com/MbTzdei.png" style="margin-left: 2em">
3721
-
3722
3813
  The official API documentation for ComboBoxText can be found here:
3723
3814
 
3724
3815
  https://docs.gtk.org/gtk3/class.ComboBoxText.html
3725
3816
 
3726
- If you prefer the pygobject documentation, see here:
3817
+ If you prefer the pygobject documentation for a combo-box-text
3818
+ widget, see here the following documentation:
3727
3819
 
3728
3820
  https://lazka.github.io/pgi-docs/Gtk-3.0/classes/ComboBoxText.html
3729
3821
 
@@ -3916,7 +4008,7 @@ distributed in the gtk_paradise gem.
3916
4008
  ## Gtk::ErrorWidget - the error-widget (a custom add-on widget)
3917
4009
 
3918
4010
  This widget is just a gtk-entry really. I wanted something as an alternative
3919
- to **Gtk::StatusBar**, though, with a nicer, more flexible API.
4011
+ to <b>Gtk::StatusBar</b>, though, with a nicer, more flexible API.
3920
4012
 
3921
4013
  Example:
3922
4014
 
@@ -4371,16 +4463,17 @@ field.
4371
4463
 
4372
4464
  ## Gtk::Frame
4373
4465
 
4374
- A **Gtk::Frame** is a <b>Gtk::Bin</b> (a container) that adorns its
4375
- child-widget via a frame, and an (optional) label.
4466
+ A <b>Gtk::Frame</b> is a <b>Gtk::Bin</b> (a container) that adorns
4467
+ its child-widget via a <b>frame</b>, and an (optional) label.
4376
4468
 
4377
- Let's have a look at two examples, how a Gtk::Frame may look like:
4469
+ Let's have a look at two (visual) examples, how a Gtk::Frame may
4470
+ look like:
4378
4471
 
4379
4472
  <img src="https://i.imgur.com/qH7eErb.png" style="margin: 1em">
4380
4473
  <img src="https://i.imgur.com/SiqK7ou.png" style="margin: 1em">
4381
4474
 
4382
- The syntax example for creating a <b>Gtk::Frame</b> in ruby-gtk
4383
- is as follows:
4475
+ The vanilla syntax example for creating a <b>Gtk::Frame</b> in
4476
+ ruby-gtk is as follows:
4384
4477
 
4385
4478
  frame = Gtk::Frame.new('ID3 Tag')
4386
4479
  frame.label = label
@@ -4448,10 +4541,10 @@ To set it you could do:
4448
4541
 
4449
4542
  set_shadow_type(::Gtk::SHADOW_ETCHED_IN)
4450
4543
 
4451
- The API documentation for <b>Gtk::Frame</b> in ruby-gtk
4544
+ The API documentation for <b>Gtk::Frame</b> in gtk4
4452
4545
  can be seen here:
4453
4546
 
4454
- https://ruby-gnome2.osdn.jp/hiki.cgi?Gtk%3A%3AFrame
4547
+ https://docs.gtk.org/gtk4/class.Frame.html
4455
4548
 
4456
4549
  ## Gtk::HandleBox
4457
4550
 
@@ -4602,6 +4695,19 @@ class **Gtk::HtmlView** can be used to view HTML in a gtk-widget.
4602
4695
  It has been required via <b>require 'gtkhtml2'</b>, but has been
4603
4696
  unmaintained - and subsequently abandoned - many years ago.
4604
4697
 
4698
+ ## Gtk::IconSize
4699
+
4700
+ The allowed Gtk::IconSize values, at the least in ruby-gtk3,
4701
+ are:
4702
+
4703
+ IconSize::BUTTON
4704
+ IconSize::DND
4705
+ IconSize::DIALOG
4706
+ IconSize::INVALID
4707
+ IconSize::LARGE_TOOLBAR
4708
+ IconSize::MENU
4709
+ IconSize::SMALL_TOOLBAR
4710
+
4605
4711
  ## Gtk::IconTheme
4606
4712
 
4607
4713
  **Icon themes** are available in ruby-gtk, via:
@@ -4667,7 +4773,7 @@ https://ruby-gnome2.osdn.jp/hiki.cgi?Gtk%3A%3AIconView
4667
4773
 
4668
4774
  ## Gtk::Image
4669
4775
 
4670
- **Gtk::Image** can be used to display an image in the gtk application at
4776
+ <b>Gtk::Image</b> can be used to display an image in the gtk application at
4671
4777
  hand.
4672
4778
 
4673
4779
  Let's first show how to load an existing image:
@@ -4733,7 +4839,7 @@ such as this one here:
4733
4839
  widget = gdk_pixbuf
4734
4840
  widget.set_pixbuf(icon)
4735
4841
 
4736
- To clear (== **remove**) an image again use this method call:
4842
+ To clear (== <b>remove</b>) an image again use this method call:
4737
4843
 
4738
4844
  image.clear
4739
4845
 
@@ -4771,16 +4877,27 @@ There are three possible values for a relief:
4771
4877
  Gtk::RELIEF_HALF
4772
4878
  Gtk::RELIEF_NONE
4773
4879
 
4774
- For **rescaling an image** you may have to modify the pixbuf, before
4880
+ For <b>rescaling an image</b> you may have to modify the pixbuf, before
4775
4881
  then calling **Gtk::Image.new(pixbuf:)**. (In python this would look
4776
4882
  like this: <b>image = Gtk.Image.new_from_pixbuf(pixbuf)</b>.)
4777
4883
 
4778
4884
  If you <b>resize</b> a widget - thus a gtk-image - then the <b>"size-allocate"</b>
4779
4885
  signal is emitted.
4780
4886
 
4781
- For the **upstream API documentation**, have a look at:
4887
+ It is possible to use some <b>padding</b> (x-Achse, y-Achse), via .set_padding():
4888
+
4889
+ @image.set_padding(10,40)
4890
+
4891
+ @image.clear # Or to clear the image again.
4782
4892
 
4783
- https://ruby-gnome2.osdn.jp/hiki.cgi?Gtk%3A%3AImage
4893
+ You can also use stock-icons - examples for this follow:
4894
+
4895
+ Gtk::Image.new(stock_id, size)
4896
+ Gtk::Image.new(Gtk::Stock::CONVERT, Gtk::IconSize::SMALL_TOOLBAR)
4897
+
4898
+ For the **upstream API documentation** of GTK3, have a look at:
4899
+
4900
+ https://docs.gtk.org/gtk3/class.Image.html
4784
4901
 
4785
4902
  ## Gtk::ImageViewer (a custom add-on widget)
4786
4903
 
@@ -5353,7 +5470,7 @@ An example for styling the separator is shown next:
5353
5470
  margin: 20px;
5354
5471
  }
5355
5472
 
5356
- Modifying the inner **padding** can be done, as usual, via:
5473
+ Modifying the inner <b>padding</b> can be done, as usual, via:
5357
5474
 
5358
5475
  vpaned.set_border_width(5)
5359
5476
  # or this variant:
@@ -5510,18 +5627,36 @@ https://stackoverflow.com/questions/38907362/how-i-create-a-headermenu-with-a-po
5510
5627
  The **official upstream API documentation** for **Gtk::Popover**
5511
5628
  can be seen here:
5512
5629
 
5513
- https://docs.gtk.org/gtk3/class.Popover.html
5630
+ https://docs.gtk.org/gtk3/class.Popover.html
5631
+
5632
+ ## Gtk::PrintOperation
5633
+
5634
+ class <b>Gtk::PrintOperation</b> appears to be relevant for printing
5635
+ documents. I have not yet had a use case for using this class,
5636
+ though.
5637
+
5638
+ ## Gtk::Toolbar
5639
+
5640
+ Gtk::Toolbar is deprecated, I believe, since as of GTK3.
5641
+
5642
+ It used to look like this:
5643
+
5644
+ <img src="https://i.imgur.com/vkGqpqd.png" style="margin: 1em">
5514
5645
 
5515
- ## Gtk::PrintOperation
5646
+ ## Gtk::Tooltip
5516
5647
 
5517
- class <b>Gtk::PrintOperation</b> appears to be relevant for printing
5518
- documents. I have not yet had a use case for using this class,
5519
- though.
5648
+ Via <b>tooltips</b> it is possible to use small, helpful <b>popups</b>.
5649
+ These will appear next to a widget - helpful hover elements.
5650
+
5651
+ It is also possible to use markup, via .tooltip_markup=, such as
5652
+ via:
5520
5653
 
5654
+ button.tooltip_markup = 'And this appears in <b>bold</b>.'
5655
+
5521
5656
  ## Gtk::Tooltips (deprecated)
5522
5657
 
5523
5658
  Note that Gtk::Tooltips is deprecated; it could only be used in
5524
- gtk2.
5659
+ <b>gtk2</b>.
5525
5660
 
5526
5661
  It used to look similar to this:
5527
5662
 
@@ -5769,27 +5904,27 @@ And then:
5769
5904
 
5770
5905
  ## Gtk::ScrolledWindow
5771
5906
 
5772
- This represents **a window with a scrollbar**. It will attach <i>scrollbars</i>
5773
- to the child-widget, and create a <b>Frame</b> surrounding this
5774
- <b>child-widget</b>.
5907
+ A <b>Gtk::ScrolledWindow</b> represents <b>a window with a scrollbar</b>. It
5908
+ will attach <i>scrollbars</i> to the child-widget, and create a <b>Frame</b>
5909
+ surrounding this <b>child-widget</b>.
5775
5910
 
5776
- The associated gdk-event for the scroll event is called <b>GDK_SCROLL</b>.
5911
+ The associated <b>gdk-event</b> for the scroll event is called <b>GDK_SCROLL</b>.
5777
5912
 
5778
- Let's first have a look at how this may look - note that this was the default
5779
- variant for ruby-gtk2; nowadays it looks a bit diffferent to ruby-gtk3:
5913
+ Let's next have a look at how this may look - note that the following image
5914
+ shows the old, the default variant for <b>ruby-gtk2</b>; nowadays it looks a
5915
+ bit diffferent, in <b>ruby-gtk3</b>:
5780
5916
 
5781
5917
  <img src="https://i.imgur.com/dlPHPDr.png" style="border: 1px solid black; margin-left: 4em;" id="drag_gtk_scrolled_window">
5782
5918
 
5783
- Let's next show an example how to instantiate a new scrolled window then:
5919
+ Let's next show an example <b>how to instantiate a new scrolled window</b> then:
5784
5920
 
5785
5921
  scrolled_window = Gtk::ScrolledWindow.new
5786
5922
  scrolled_window = Gtk::ScrolledWindow.new(hadjustment = nil, vadjustment = nil)
5787
5923
 
5788
5924
  So-called "policies" determine whether the scrollbars are present. For
5789
- instance, **Gtk::POLICY_ALWAYS** means that the scrollbars are always
5925
+ instance, <b>Gtk::POLICY_ALWAYS</b> means that the scrollbars are always
5790
5926
  present. **Gtk::POLICY_AUTOMATIC** on the other hand only shows the
5791
5927
  scrollbars when they are necessary.
5792
-
5793
5928
 
5794
5929
  So, via <b>.set_policy()</b> one can designate whether horizontal and/or
5795
5930
  vertical scrollbars should be shown.
@@ -5814,7 +5949,7 @@ To determine a specific height or size, use:
5814
5949
  scrolled_window.set_size_request(175, 20)
5815
5950
 
5816
5951
  You can add a child-widget to a gtk-scrolled-window via
5817
- **add_with_viewport()**.
5952
+ <b>add_with_viewport()</b>.
5818
5953
 
5819
5954
  Example:
5820
5955
 
@@ -5837,13 +5972,26 @@ be visible.
5837
5972
  <b>Gtk::POLICY_AUTOMATIC</b>: means that the scrollbars are only
5838
5973
  there when they are necessary.
5839
5974
 
5975
+ Note that you can determine <b>where</b> the <b>scrollbar</b>
5976
+ should appear, via the following constants:
5977
+
5978
+ CORNER_TOP_LEFT
5979
+ CORNER_BOTTOM_LEFT
5980
+ CORNER_TOP_RIGHT
5981
+ CORNER_BOTTOM_RIGHT
5982
+
5983
+ Specific example:
5984
+
5985
+ scrolled_window.window_placement = Gtk::CORNER_BOTTOM_LEFT
5986
+ scrolled_window.window_placement = Gtk::CORNER_BOTTOM_RIGHT
5987
+
5840
5988
  You can read more about this here:
5841
5989
 
5842
5990
  https://ruby-gnome2.osdn.jp/hiki.cgi?Gtk%3A%3AScrolledWindow#set_policy
5843
5991
 
5844
- The **upstream API documentation** for **Gtk::ScrolledWindow** can be found here:
5992
+ Lazka also contains information about <b>Gtk::ScrolledWindow</b> here:
5845
5993
 
5846
- https://ruby-gnome2.osdn.jp/hiki.cgi?Gtk%3A%3AScrolledWindow
5994
+ https://lazka.github.io/pgi-docs/Gtk-3.0/classes/ScrolledWindow.html
5847
5995
 
5848
5996
  ## Gtk::SearchBar
5849
5997
 
@@ -5955,7 +6103,15 @@ A specific line can be obtained via:
5955
6103
 
5956
6104
  ## Gtk::Sourceview
5957
6105
 
5958
- You can install the sourceview bindings via **gem install**.
6106
+ Let's first look at an image of Gtk::Sourceview:
6107
+
6108
+ <img src="https://i.imgur.com/9c3Ultx.png" style="margin: 1em">
6109
+
6110
+ And another image of <b>Gtk::Sourceview</b>:
6111
+
6112
+ <img src="https://i.imgur.com/TUmopVd.png" style="margin: 1em">
6113
+
6114
+ You can install the sourceview bindings via <b>gem install</b>.
5959
6115
 
5960
6116
  After you did so, you can use it specifically, depending on the
5961
6117
  version at hand:
@@ -6005,10 +6161,10 @@ To show the margin, do:
6005
6161
 
6006
6162
  source_view.show_margin = true
6007
6163
 
6008
- To specify a border width, use this:
6164
+ To specify a <b>border width</b>, use this:
6009
6165
 
6010
6166
  source_view.border_width = 4
6011
-
6167
+
6012
6168
  ## Gtk::Socket
6013
6169
 
6014
6170
  <b>Gtk::Socket</b> allows the user to make use of widgets from another
@@ -6172,7 +6328,11 @@ Other transition types are:
6172
6328
 
6173
6329
  ## Gtk::Statusbar
6174
6330
 
6175
- **Gtk::Statusbar** can be used to provide a statusbar that is usually
6331
+ Let's first have a look at how the Gtk::Statusbar widget looks like:
6332
+
6333
+ <img src="https://i.imgur.com/Fq3rdYO.png" style="margin: 1em">
6334
+
6335
+ <b>Gtk::Statusbar</b> can be used to provide a statusbar that is usually
6176
6336
  on the bottom of the application.
6177
6337
 
6178
6338
  I am not sure if it is still recommended to use Gtk::Statusbar
@@ -6203,10 +6363,29 @@ If you want to remove a message you can use <b>.pop()</b>:
6203
6363
 
6204
6364
  status_bar.pop "Foobar" # Remove message here
6205
6365
  status_bar.pop @status_bar.get_context_id('main')
6206
-
6207
- Upstream documentation can be found here:
6208
6366
 
6209
- https://ruby-gnome2.osdn.jp/hiki.cgi?Gtk%3A%3AStatusbar
6367
+ Note that the ID has to be unique. It can be obtained via
6368
+ the method <b>get_context_id</b>.
6369
+
6370
+ status_bar = Gtk::Statusbar.new','Statusbar
6371
+ status_bar.has_resize_grip = true
6372
+ status_bar_context_id = status_bar.get_context_id("A unique ID here")
6373
+
6374
+ To add another message one can use <b>.push()</b>, as in:
6375
+
6376
+ status_bar.push(status_bar_context_id, "DSA4 Simulator") # Add the message here.
6377
+
6378
+ To automatically change a given status-bar, threads can be used. Example:
6379
+
6380
+ x = Thread.new {
6381
+ sleep 10
6382
+ status_bar.push(status_bar_context_id, which_message)
6383
+ }
6384
+
6385
+ Upstream documentation for gtk3 in regards to <b>Statusbar</b> can
6386
+ be found here:
6387
+
6388
+ https://docs.gtk.org/gtk3/class.Statusbar.html
6210
6389
 
6211
6390
  ## Gtk::StatusIcon
6212
6391
 
@@ -6255,7 +6434,11 @@ Let's look at an example of this first:
6255
6434
  <img src="https://i.imgur.com/1CGjOlx.png" style="margin: 1em; margin-left: 2em">
6256
6435
 
6257
6436
  This was an old implementation in ruby-gtk2 of the game called
6258
- **mastermind**.
6437
+ <b>mastermind</b>.
6438
+
6439
+ Let's look at another example:
6440
+
6441
+ <img src="https://i.imgur.com/FZ9et3W.png" style="margin: 1em; margin-left: 2em">
6259
6442
 
6260
6443
  The basic syntax to create a new table in GTK goes like this:
6261
6444
 
@@ -6321,7 +6504,19 @@ More complex example:
6321
6504
 
6322
6505
  ## Gtk::TreeIter
6323
6506
 
6324
- **Gtk::TreeIter** is a <b>reference</b> to a node in a given tree-model.
6507
+ <b>Gtk::TreeIter</b> is a <b>reference</b> to a node in a given tree-model.
6508
+ We thus can access the data in the model via such a TreeIter.
6509
+
6510
+ To obtain the value of a TreeIter you can use the method .get_value(),
6511
+ as in:
6512
+
6513
+ .get_value(column)
6514
+
6515
+ <b>Gtk::TreeIter</b> populates a <b>Gtk::ListStore</b>.
6516
+
6517
+ The API documentation for TreeIter in gtk3 can be found here:
6518
+
6519
+ https://docs.gtk.org/gtk3/struct.TreeIter.html
6325
6520
 
6326
6521
  ## Gtk::TimerWindow::TimerWindow
6327
6522
 
@@ -6636,7 +6831,7 @@ can use:
6636
6831
 
6637
6832
  tree_view.collapse_all
6638
6833
 
6639
- The **upstream API documentation** for **Gtk::TreeView** in ruby-gtk
6834
+ The <b>upstream API documentation</b> for **Gtk::TreeView** in ruby-gtk
6640
6835
  can be found here (at the least before 2022):
6641
6836
 
6642
6837
  https://ruby-gnome2.osdn.jp/hiki.cgi?Gtk%3A%3ATreeView
@@ -6677,6 +6872,9 @@ To append a column to a Gtk::TreeViewColumn do:
6677
6872
  tree_view.append_column(column1)
6678
6873
  tree_view.append_column(column2)
6679
6874
 
6875
+ Rather than <b class="BOLD">.insert_column</b> one can use the simpler
6876
+ <b>append_column</b>, as the above example showed.
6877
+
6680
6878
  To obtain the maximum width for a column, in pixels of the given
6681
6879
  tree column, use:
6682
6880
 
@@ -6745,6 +6943,16 @@ The typical syntax in a **Gtk::TreeStore** goes like this:
6745
6943
 
6746
6944
  Gtk::TreeStore.new(type1, type2, type3, ...)
6747
6945
 
6946
+ A more specific example of this follows:
6947
+
6948
+ tree_store = Gtk::TreeStore.new(
6949
+ String,
6950
+ String,
6951
+ Gdk::Color,
6952
+ Float,
6953
+ GdkPixbuf::Pixbuf
6954
+ )
6955
+
6748
6956
  ## Gtk::TextTag
6749
6957
 
6750
6958
  Gtk::TextTag has various different properties.
@@ -6845,7 +7053,7 @@ value of the argument given to the method
6845
7053
  The vte-terminal can respond to a :child_exited event via:
6846
7054
 
6847
7055
  vte_terminal.signal_connect(:child_exited) { |widget|
6848
- exit_application
7056
+ exit_application # Or call destroy() here.
6849
7057
  }
6850
7058
 
6851
7059
  You can send commands to Vte, via <b>.feed_child()</b>, such as
@@ -6897,7 +7105,7 @@ Pasting the clipboard content onto the terminal is possible via:
6897
7105
 
6898
7106
  vte_terminal.paste_clipboard
6899
7107
 
6900
- The method **.span_sync** in python has this signature:
7108
+ The method <b>.span_sync</b> in python has the following signature:
6901
7109
 
6902
7110
  .spawn_sync(
6903
7111
  pty_flags,
@@ -6973,7 +7181,8 @@ and code:
6973
7181
 
6974
7182
  ## Gtk::Widget
6975
7183
 
6976
- This is the base class for all gtk-widgets.
7184
+ This is the base class for all gtk-widgets. It is somewhat similar to
7185
+ the div-tag in HTML.
6977
7186
 
6978
7187
  It contains convenience methods such as:
6979
7188
 
@@ -7121,6 +7330,10 @@ then you can simply query this via:
7121
7330
 
7122
7331
  pp text_view.wrap_mode
7123
7332
 
7333
+ To obtain the buffer one can use .buffer:
7334
+
7335
+ buffer = @text_view.buffer
7336
+
7124
7337
  The official API documentation for <b>Gtk::TextView</b> in ruby-gtk can
7125
7338
  be seen here:
7126
7339
 
@@ -7196,18 +7409,15 @@ to the values of the scale-button.
7196
7409
  For scaling an image values such as **Gdk.InterpType.Hyper** are
7197
7410
  important. Make sure to read up on them.
7198
7411
 
7199
- **HYPER** is the slowest but highest quality reconstruction
7200
- function. It is derived from the hyperbolic filters in Wolberg's
7201
- "Digital Image Warping", and is formally defined as the
7202
- hyperbolic-filter sampling the ideal hyperbolic-filter
7203
- interpolated image. The filter is designed to be idempotent
7204
- for 1:1 pixel mapping. Note that this interpolation filter
7205
- is deprecated, as in reality it has a lower quality than the
7206
- **GDK_INTERP_BILINEAR** filter since as of gtk 2.38. So
7207
- for ruby-gtk3 this means **:bilinear**. Other values are
7208
- **:nearest**. Note that **::nearest** is the fastest, so if
7209
- you go for speed, consider using this variant. Be aware
7210
- that **scaling down** will lead to a bad quality though.
7412
+ <b>HYPER</b> is the slowest but highest quality reconstruction function. It is
7413
+ derived from the hyperbolic filters in Wolberg's "Digital Image Warping", and
7414
+ is formally defined as the hyperbolic-filter sampling the ideal hyperbolic-filter
7415
+ interpolated image. The filter is designed to be idempotent for 1:1 pixel mapping.
7416
+ Note that this interpolation filter is deprecated, as in reality it has a lower
7417
+ quality than the **GDK_INTERP_BILINEAR** filter since as of gtk 2.38. So for
7418
+ ruby-gtk3 this means **:bilinear**. Other values are **:nearest**. Note that
7419
+ <b>::nearest</b> is the fastest, so if you go for speed, consider using this
7420
+ variant. Be aware that <b>scaling down</b> will lead to a bad quality though.
7211
7421
 
7212
7422
  More documentation about these InterpType values can be
7213
7423
  read here:
@@ -7220,7 +7430,7 @@ https://ruby-gnome2.osdn.jp/hiki.cgi?Gtk%3A%3AScale
7220
7430
 
7221
7431
  ## Gtk::IconFactory
7222
7432
 
7223
- Gtk::IconFactory can be used to handle different Gtk::IconSet instances.
7433
+ <b>Gtk::IconFactory</b> can be used to handle different Gtk::IconSet instances.
7224
7434
 
7225
7435
  Usage example:
7226
7436
 
@@ -7263,7 +7473,7 @@ next example for the 'raw' ruby-gtk variant to use:
7263
7473
  }
7264
7474
 
7265
7475
  As the example above shows, you can in general connect to the
7266
- event when a button is clicked via **.signal_connect(:clicked)**.
7476
+ event when a button is clicked via <b>.signal_connect(:clicked)</b>.
7267
7477
 
7268
7478
  Make the window resizable (which is the default, anyway):
7269
7479
 
@@ -7273,9 +7483,12 @@ Specify a width and height value for the window:
7273
7483
 
7274
7484
  window.set_size_request(250, 250)
7275
7485
 
7276
- Use inner **padding** via:
7486
+ To set the border-width - in HTML and CSS this may be
7487
+ similar to <b>border-width: 1px</b>, use inner
7488
+ <b>padding</b> via:
7277
7489
 
7278
7490
  window.border_width = 10
7491
+ window.border_width = 1
7279
7492
 
7280
7493
  If you do not need decoration in the window, such as the top bar
7281
7494
  that contains the minimize or quit application button, nor
@@ -7327,6 +7540,22 @@ queried for a confirmation dialogue, such as:
7327
7540
 
7328
7541
  <b>Are you really certain that you wish to close the window?</b>
7329
7542
 
7543
+ To destroy the Gtk::Window you can use the following code:
7544
+
7545
+ window.signal_connect(:destroy) { Gtk.main_quit }
7546
+
7547
+ To set the width of the border (aka the margin), you can use this
7548
+ code:
7549
+
7550
+ window.set_border_width(2)
7551
+
7552
+ Or the alias called .border_width =:
7553
+
7554
+ window.border_width = 12
7555
+
7556
+ This also works on <b>Buttons</b> and many other widgets, of
7557
+ course.
7558
+
7330
7559
  ## Gtk::Dialog and dialog-response in ruby-gtk3
7331
7560
 
7332
7561
  Let's show a few images to show how this may look:
@@ -7357,7 +7586,7 @@ You can combine them like so:
7357
7586
 
7358
7587
  Gtk::Dialog::MODAL|Gtk::Dialog::NO_SEPARATOR
7359
7588
 
7360
- **Buttons** can be added like so, via
7589
+ <b>Buttons</b> can be added like so, via
7361
7590
  **Gtk::Dialog#add_button(button_text, response_id)**:
7362
7591
 
7363
7592
  add_button('OK', :ok)
@@ -7557,7 +7786,7 @@ to the focus_vadjustment of another widget.
7557
7786
  ## Gtk::ListStore and filtering on Gtk::ListStore
7558
7787
 
7559
7788
  Let's begin this subsection with a few syntax-examples, to get you
7560
- to understand how **Gtk::ListStore** is properly used.
7789
+ to understand how <b>Gtk::ListStore</b> is properly used.
7561
7790
 
7562
7791
  list_store = Gtk::ListStore.new(type1, type2, type3, type4, ...)','ListStore
7563
7792
  list_store = Gtk::ListStore.new(String, String)
@@ -7607,11 +7836,16 @@ can be used, like this:
7607
7836
 
7608
7837
  ## Gtk::TextBuffer and Gtk::TextBufferTags - selections in a TextBuffer widget and how to make use of Gtk::TextBuffer
7609
7838
 
7610
- You can **style text** in gtk by tapping into the corresponding <b>Iter</b>
7839
+ First, let's look at an image of using colours in a Gtk::TextBuffer -
7840
+ this may simplify reasoning about as to what this widget does:
7841
+
7842
+ <img src="https://i.imgur.com/rjmB1Nb.png" style="margin: 1em">
7843
+
7844
+ You can <b>style text</b> in gtk by tapping into the corresponding <b>Iter</b>
7611
7845
  in the buffer. An Iter will point to a particular place in a buffer,
7612
7846
  and associates that area with a particular tag.
7613
7847
 
7614
- The **module Gtk::TextBufferTags** was once used to create
7848
+ The <b>module Gtk::TextBufferTags</b> was once used to create
7615
7849
  several tags, for use in a gtk-buffer.
7616
7850
 
7617
7851
  I have not updated this in many years, so I am not sure how useful
@@ -7646,9 +7880,9 @@ follows:
7646
7880
  start_position, end_position = buffer.selection_bounds # Returns: [start, end, selected]
7647
7881
  text = buffer.get_text(start_position, end_position, false)
7648
7882
 
7649
- This is now stored in the variable **text**.
7883
+ This is now stored in the variable <b>text</b>.
7650
7884
 
7651
- If you want to make use of **markup** in a **Gtk::TextBuffer** then
7885
+ If you want to make use of **markup** in a <b>Gtk::TextBuffer</b> then
7652
7886
  you can try something like this:
7653
7887
 
7654
7888
  buffer = @view.buffer
@@ -7676,7 +7910,7 @@ For a gray background, consider using this:
7676
7910
 
7677
7911
  grey_background = text_buffer.create_tag(nil, { background: 'gray' })
7678
7912
 
7679
- See also the example file at **text_iterator_example.rb**.
7913
+ See also the example file at <b>text_iterator_example.rb</b>.
7680
7914
 
7681
7915
  To **paste the clipboard** into the buffer, do:
7682
7916
 
@@ -7762,7 +7996,7 @@ The method will delete the range between the "insert" and
7762
7996
  text. If interactive is True, the editability of the selection
7763
7997
  will be considered (users can not delete uneditable text).
7764
7998
 
7765
- Interestingly **Gtk::TextBuffer** does not have **Gtk::Widget**
7999
+ Interestingly <b>Gtk::TextBuffer</b> does not have **Gtk::Widget**
7766
8000
  as a superclass. Its direct superclass is **GLib::Object**.
7767
8001
  This surprised me because the custom <b>.on_changed method</b>
7768
8002
  defined in Gtk::Widget, as part of the gtk_paradise gem, was not
@@ -7775,7 +8009,7 @@ https://ruby-gnome2.osdn.jp/hiki.cgi?Gtk%3A%3ATextBuffer
7775
8009
 
7776
8010
  ## Gtk::Button and other buttons in ruby-gtk3, including the method gtk_button()
7777
8011
 
7778
- A **button** is a basic element for any **GUI** (graphical user interface).
8012
+ A <b>button</b> is a basic element for any **GUI** (graphical user interface).
7779
8013
 
7780
8014
  It typically responds to different events, most importantly the
7781
8015
  "clicked" event, which is triggered when the user clicks on the
@@ -7881,9 +8115,17 @@ surroundung area of a button via the **border** property. You
7881
8115
  can also embed the button into a gtk-container, which can then
7882
8116
  be styled additionally too.
7883
8117
 
7884
- The **upstream API documentation** for **Gtk::Button** can be found here:
8118
+ Buttons in GTK also have certain flags, such as <b>CAN_FOCUS</b>,
8119
+ which can be set via .set_flags().
8120
+
8121
+ Example for this:
8122
+
8123
+ button_quit.set_flags(Gtk::Widget::CAN_FOCUS)
8124
+
8125
+ The **upstream API documentation** for **Gtk::Button** can be found here,
8126
+ for GTK4:
7885
8127
 
7886
- https://ruby-gnome2.osdn.jp/hiki.cgi?Gtk%3A%3AButton
8128
+ https://docs.gtk.org/gtk4/class.Button.html
7887
8129
 
7888
8130
  ## Gtk::Entry, including use cases such as a password widget
7889
8131
 
@@ -8075,7 +8317,7 @@ https://ruby-gnome2.osdn.jp/hiki.cgi?Gtk%3A%3AEntry
8075
8317
 
8076
8318
  ## Gtk::Grid and gtk_grid()
8077
8319
 
8078
- **class Gtk::Grid** can be used to position widgets in a grid-like
8320
+ <b>class Gtk::Grid</b> can be used to position widgets in a grid-like
8079
8321
  layout. It is available since as of **GTK version 3**.
8080
8322
 
8081
8323
  First: here is the upstream API for **.attach()**. I added this because
@@ -8089,7 +8331,7 @@ I keep on forgetting what the individual entries mean.
8089
8331
  int height = 1
8090
8332
  )
8091
8333
 
8092
- So this is - **left**, **top**, **width**, **height**.
8334
+ So this is - **left**, **top**, **width**, <b>height</b>.
8093
8335
 
8094
8336
  The method .attach() will add a widget to the grid. It requires
8095
8337
  5 parameters in total.
@@ -8136,7 +8378,7 @@ Example for this:
8136
8378
  @grid = gtk_grid
8137
8379
  @grid.set_column_spacing(6) # To specify the spacing (distance) between the individual columns.
8138
8380
  @grid.set_row_spacing(6)
8139
- left_entry = gtk_entry('LEFT ENTRY')
8381
+ left_entry = create_entry('LEFT ENTRY')
8140
8382
  left_entry.set_size_request(600, 42)
8141
8383
  @grid.attach(left_entry, 0, 0, 2, 1)
8142
8384
 
@@ -8196,6 +8438,10 @@ Row-spacing and column-spacing can be set as well via:
8196
8438
  grid.set_row_spacing(12)
8197
8439
  grid.set_column_spacing(12)
8198
8440
 
8441
+ The API documentation for gtk-grid in gtk3 can be seen here:
8442
+
8443
+ https://docs.gtk.org/gtk3/class.Grid.html
8444
+
8199
8445
  For more documentation pertaining to <b>Gtk::Grid</b>, at the
8200
8446
  least for GTK4, you can read up more here:
8201
8447
 
@@ -8438,6 +8684,13 @@ An example is shown next:
8438
8684
  rgba_object.parse(:silver)
8439
8685
  button.override_background_color(:normal, rgba_object)
8440
8686
 
8687
+ So via override_background_color() we can set other colours.
8688
+
8689
+ Here is a specific example where all four values are
8690
+ provided to Gdk::RGBA:
8691
+
8692
+ gtk_widget.override_background_color(:normal,Gdk::RGBA.new(0.02, 0.02, 0.02, 1))
8693
+
8441
8694
  ## Which Gtk::Stock icons are available?
8442
8695
 
8443
8696
  Well, I am not sure how to dynamically query this, but here is just
@@ -8796,9 +9049,8 @@ The default size of Gtk.Window should be set via:
8796
9049
  window.set_default_size()
8797
9050
  window.set_default_size(width, height)
8798
9051
 
8799
- This should work if you desire to specify the width
8800
- and height that window should occupy. The values
8801
- will be in n pixel.
9052
+ This should work if you desire to specify the width and height that
9053
+ window should occupy. The values will be in n pixel.
8802
9054
 
8803
9055
  ## Pending events
8804
9056
 
@@ -9041,13 +9293,13 @@ This will use the **right-pointing arrow emoji**.
9041
9293
  I found that this can be useful if you do not want to make
9042
9294
  use of an image.
9043
9295
 
9044
- Not all emojis can be accessed like this so far; stay tuned
9045
- for more emojis to be added at a later time. These will be
9046
- stored in the file at **gtk_paradise/emojis/emojis.rb**.
9296
+ Not all emojis can be accessed like this so far; stay tuned for more emojis to
9297
+ be added at a later time. These will be stored in the file at
9298
+ <b>gtk_paradise/emojis/emojis.rb</b>.
9047
9299
 
9048
9300
  (Internally this will all be handled by the custom modification
9049
9301
  within **Gtk::Emojis**, which is part of the **gtk_paradise**
9050
- project. The submodule is called **Gtk::Emojis**, unsurprisingly
9302
+ project. The submodule is called <b>Gtk::Emojis</b>, unsurprisingly
9051
9303
  so.)
9052
9304
 
9053
9305
  Note that there is also a widget called **EmojiWidget**, as
@@ -9191,7 +9443,7 @@ project.
9191
9443
 
9192
9444
  ## How to add widgets into Gtk::Runner
9193
9445
 
9194
- **Gtk::Runner** offers a simplified way to quickly run other
9446
+ <b>Gtk::Runner</b> offers a simplified way to quickly run other
9195
9447
  gtk-widgets.
9196
9448
 
9197
9449
  It was created primarily so that we can reduce the amount of
@@ -9313,7 +9565,7 @@ Or you can use this toplevel method:
9313
9565
  If you wish to quickly show the content of a file,
9314
9566
  have a look at:
9315
9567
 
9316
- require 'gtk_paradise/gtk_classes/text_view.rb'
9568
+ require 'gtk_paradise/core_classes/text_view.rb'
9317
9569
 
9318
9570
  Gtk.display_this_file(ARGV)
9319
9571
  Gtk.display_this_file('/foo/bar.md')
@@ -9529,7 +9781,7 @@ the gtk_paradise project, via:
9529
9781
 
9530
9782
  The first variable is the widget; the second one is the array that
9531
9783
  keeps track of the gtk-radio-buttons. You can use the method
9532
- **.active?** on them to find out which entry is selected.
9784
+ <b>.active?</b> on them to find out which entry is selected.
9533
9785
 
9534
9786
  Example for this, using the code above:
9535
9787
 
@@ -9661,9 +9913,8 @@ just an attempt at a little helpful information.
9661
9913
 
9662
9914
  ## Key events (keyboard button pressed)
9663
9915
 
9664
- To find out whether the user used the down-arrow key,
9665
- on an instance of Gtk::Runner, you could use this
9666
- code:
9916
+ To find out whether the user used the down-arrow key, on an instance
9917
+ of <b>Gtk::Runner</b>, you could use this code:
9667
9918
 
9668
9919
  r.signal_connect(:key_press_event) {|widget, event|
9669
9920
  if event.is_key?(:down)
@@ -10320,6 +10571,15 @@ and start from scratch in this regard. The gtk_paradise CSS files can
10320
10571
  be used as a substitute for now, as well as .more_css() on an
10321
10572
  ad-hoc basis for now.
10322
10573
 
10574
+ ## Gstreamer
10575
+
10576
+ Working with gstreamer can be a little bit complicated.
10577
+
10578
+ To make use of the Gst-framework, such as by finding the MAD
10579
+ audio codec, the following API can be used:
10580
+
10581
+ element_factory = Gst::ElementFactory.find("mad")
10582
+
10323
10583
  ## Cairo
10324
10584
 
10325
10585
  This subsection may contain some semi-random information about **cairo**.
@@ -10535,7 +10795,7 @@ Examples how to do this:
10535
10795
  **gtk_paradise --tabble** will now default to ruby-gtk3. Make sure
10536
10796
  you have the ruby-gtk bindings installed and work properly!
10537
10797
 
10538
- In **August 2021** the tabble-specific code that was part of
10798
+ In <b>August 2021</b> the tabble-specific code that was part of
10539
10799
  **gtk_paradise** has been rewritten. During the rewrite support
10540
10800
  for ruby-gtk2 has been dropped, unfortunately. Perhaps at a
10541
10801
  later time I may re-enable this, but gtk3 is really so much
@@ -10554,13 +10814,13 @@ again one day.
10554
10814
 
10555
10815
  These are as follows - at the least for ruby-gtk2:
10556
10816
 
10557
- <b>STATE_ACTIVE</b>: State of a currently active widget, such as a de-pressed button.
10817
+ <b>STATE_ACTIVE</b>: State of a currently active widget, such as a de-pressed button.
10558
10818
 
10559
- <b>STATE_NORMAL</b>: State during normal operation
10819
+ <b>STATE_NORMAL</b>: State during normal operation
10560
10820
 
10561
- <b>STATE_PRELIGHT</b>: State indicating that the mouse pointer is over the widget and the widget will respond to mouse clicks.
10821
+ <b>STATE_PRELIGHT</b>: State indicating that the mouse pointer is over the widget and the widget will respond to mouse clicks.
10562
10822
 
10563
- <b>STATE_SELECTED</b>: State of a selected item, such the selected row in a list.
10823
+ <b>STATE_SELECTED</b>: State of a selected item, such the selected row in a list.
10564
10824
 
10565
10825
  <b>STATE_INSENSITIVE</b>: State indicating that the widget is unresponsive to user actions.'
10566
10826
 
@@ -10647,7 +10907,7 @@ you could use this code - at the least in ruby-gtk2:
10647
10907
 
10648
10908
  The following should work if you use the Gtk::BaseModule:
10649
10909
 
10650
- entry = gtk_entry('Some text here')
10910
+ entry = create_entry('Some text here')
10651
10911
  entry.on_mouse_double_click_event {|widget, event|
10652
10912
  do_call_a_method_here
10653
10913
  }
@@ -10659,6 +10919,22 @@ in the event that it presently does not work correctly.
10659
10919
  In my limited findings and tests it did work already, so - who
10660
10920
  knows.
10661
10921
 
10922
+ The general way to let a Gtk::Window to a double-click event,
10923
+ at the least in ruby-gtk2 and possibly in ruby-gtk3,
10924
+ was this way:
10925
+
10926
+ window.add_events(:button_press_mask)
10927
+
10928
+ window.signal_connect(:button_press_event) { |widget, event|
10929
+ if event.event_type == Gdk::Event::BUTTON2_PRESS
10930
+ p "double click" #
10931
+ elsif event.event_type == Gdk::Event::BUTTON3_PRESS
10932
+ p "triple click"
10933
+ elseif event.event_type == Gdk::Event::BUTTON_PRESS
10934
+ p "(should be) one click"
10935
+ end
10936
+ }
10937
+
10662
10938
  ## Border-related settings and supported CSS properties related to borders in GTK
10663
10939
 
10664
10940
  This subsection may become outdated as time passes by, so I add the information
@@ -11001,6 +11277,14 @@ bases. Thus, as of past December 2021, support for ruby-gtk2 is very
11001
11277
  **slightly** deprecated, at the least in regards to **new** code. Old
11002
11278
  code should be supported for a much longer time.
11003
11279
 
11280
+ ## Gtk.gtk_runner_factory
11281
+
11282
+ Typical usage example for this is:
11283
+
11284
+ ::Gtk.gtk_runner_factory(
11285
+ ::Bioroebe::GUI::Gtk::ThreeToOne.new(i)
11286
+ )
11287
+
11004
11288
  ## Setting the title, width, height and font of a gtk-widget
11005
11289
 
11006
11290
  If you use the integrated **Gtk::BaseModule** then you can use
@@ -11029,9 +11313,9 @@ to memorize.
11029
11313
 
11030
11314
  Usage example follows, via **Gtk::BaseModule**:
11031
11315
 
11032
- hbox = gtk_hbox
11316
+ hbox = create_hbox
11033
11317
  # Or if you want to use it via spacing:
11034
- hbox = gtk_hbox {{ spacing: 10 }}
11318
+ hbox = create_hbox {{ spacing: 10 }}
11035
11319
  # Now you can add other widgets into this hbox:
11036
11320
  hbox << bold_text('!!! OK !!!')
11037
11321
  hbox.rounded_border('12px', :default, '25px solid royalblue')
@@ -11461,11 +11745,10 @@ Another interesting gem is **nyle**, see here:
11461
11745
 
11462
11746
  https://rubygems.org/gems/nyle
11463
11747
 
11464
- This one is specifically for gtk3 and has a few games,
11465
- too. Unfortunately the code is a bit ... peculiar, so
11466
- it is hard to benefit from it. This is a problem I see
11467
- with many ruby gems out there - they are not easily
11468
- compatible to one another.
11748
+ This one is specifically for gtk3 and has a few games, too. Unfortunately the
11749
+ code is a bit ... peculiar, so it is hard to benefit from it. This is a problem
11750
+ I see with many ruby gems out there - they are not easily compatible to one
11751
+ another.
11469
11752
 
11470
11753
  Here is a hint in how to resize a gtk-image:
11471
11754
 
@@ -11838,13 +12121,9 @@ bg: the background color(Gdk::Color), used for the bits in
11838
12121
  when 'KP_Home'
11839
12122
  when 'KP_Page_Up'")
11840
12123
 
11841
- # ======================================================================= #
11842
- # === Gtk::TreeStore TAG. tree store tag.
11843
- #
11844
- # ======================================================================= #
11845
- div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gtk_tree_store') {
11846
- @tree_store = Gtk::TreeStore.new(
11847
- String, String, Gdk::Color, Float, GdkPixbuf::Pixbuf)
12124
+ # === Gtk::TreeStore
12125
+
12126
+
11848
12127
 
11849
12128
  Wobei die Argumente für die columns stehen,
11850
12129
  und bestimmte Typen haben, zb Integer oder String.
@@ -11890,19 +12169,6 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gtk_tree_sto
11890
12169
  @root_iter[2] = Gdk::Color.new(0, 65535, 0)
11891
12170
  @root_iter[3] = 5.0
11892
12171
 
11893
- # ======================================================================= #
11894
- # === Gtk::TreeIter GTK TREEITER tag.
11895
- # ======================================================================= #
11896
-
11897
- Mittels Iter erhält man somit eine Schnittstelle zu einem
11898
- bestimmten Model.', '','gtk_tree_iter
11899
-
11900
- Seinen Wert erhält man so:
11901
-
11902
- .get_value(column)
11903
-
11904
- <b>TreeIter</b> populiert Gtk::ListStore.
11905
-
11906
12172
  # ======================================================================= #
11907
12173
  # === Erweitern von GTK
11908
12174
  # ======================================================================= #
@@ -12075,26 +12341,12 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gtk_tree_vie
12075
12341
  Über cell braucht man sich nicht viel Gedanken zu machen, da
12076
12342
  reicht folgendes:', id: 'gtk_renderer
12077
12343
 
12078
- # ===================================================================== #
12079
- # === Gtk::CellRendererText
12080
- # ===================================================================== #
12081
- @renderer = Gtk::CellRendererText.new
12082
-
12083
- s2('Mehr über <b>CellRendererText</b> siehe an anderer Stelle und
12084
- zwar (<i>intern</i>)
12085
- a('#gtk_cell_renderer_text',
12086
- content: 'hier',
12087
- css_class: 'BO'
12088
-
12089
12344
 
12090
12345
 
12091
12346
  e("Und erstellt danach eine neue <b>Gtk::TreeViewColumn</b>,
12092
12347
  mit inseriertem Gtk::TreeView's an der angegebenen
12093
12348
  <b>position</b>.
12094
12349
 
12095
- # === .insert_column()
12096
- Anstatt <b class="BOLD">.insert_column</b> kann man auch das
12097
- einfachere <b>append_column</b> verwenden.
12098
12350
 
12099
12351
  Dazu nutzen wir TreeViewColumn - siehe an anderer Stelle
12100
12352
  in diesem Dokument.
@@ -12165,7 +12417,6 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gtk_tree_vie
12165
12417
  'elsif event.event_type == Gdk::Event::BUTTON_PRESS
12166
12418
  p "(should be) one click here"
12167
12419
  'end
12168
-
12169
12420
  Auf das loslassen kann man wie folgt reagieren:
12170
12421
 
12171
12422
  @tree_view.signal_connect(:button_release_event)
@@ -12230,15 +12481,11 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gtk_tree_vie
12230
12481
  # ======================================================================= #
12231
12482
  # === GTK MAIN, gtk tag
12232
12483
  # ======================================================================= #
12233
- div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gtk_main') {
12234
12484
  ## Gtk.main','gtk_main
12235
12485
  Zum Ausführen des <b>Main Events</b> (kommt meistens am Schluss):
12236
12486
 
12237
12487
  Gtk.main
12238
12488
 
12239
- Explizit kann man Fenster auch mittels destroy zerstören:
12240
-
12241
- @window.destroy
12242
12489
 
12243
12490
  Explizites positionieren ist auch einfach, wie zum Beispiel so:
12244
12491
 
@@ -12461,6 +12708,7 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gtk_tree_vie
12461
12708
  Gtk::Label.new.set_markup(%Q(<span weight="bold" foreground="#009999">_Test</span>), true)
12462
12709
 
12463
12710
 
12711
+
12464
12712
  Gtk::Label.new.set_markup(%Q(<span style="italic"
12465
12713
  weight="bold" foreground="#abc">_Test</span>),
12466
12714
  true)
@@ -12712,11 +12960,11 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'dnd') {
12712
12960
 
12713
12961
  Den Wert einer ComboBox erhält man so:
12714
12962
 
12715
- "@combo_box.signal_connect(:changed) {
12716
- if @combo_box.active_iter
12963
+ @combo_box.signal_connect(:changed) {
12964
+ if @combo_box.active_iter
12717
12965
  p "- #@combo_box.activeend: #@combo_box.active_iter[0]"
12718
- end
12719
- '}
12966
+ end
12967
+ }
12720
12968
 
12721
12969
  Immer wenn es geändert wurde, fragen wir die Nummer des Entry ab
12722
12970
  (mit <b>.active</b>) und mit .active_iter[0] erhält man den
@@ -13091,22 +13339,9 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gtk_entry')
13091
13339
  when Gdk::EventScroll::UP
13092
13340
  when Gdk::EventScroll::DOWN
13093
13341
 
13094
- # ======================================================================= #
13095
- # === Gtk::ComboBox (combo box tag)
13096
- #
13097
- # GTK KEYBOARD TASTEN EINLESEN, KEYBOARD GTK COMBO BOX Gdk::EventKey
13098
- # combobox tag.
13099
- #
13100
- # Remote URL is:
13101
- #
13102
- # http://ruby-gnome2.osdn.jp/hiki.cgi?Gtk%3A%3AComboBox
13103
- #
13104
- # rf ruby gtk_combo_box
13105
- #
13106
- # ======================================================================= #
13107
- # http://localhost/DATA/viewer/ruby_viewer.cgi#gtk_combo_box
13108
- # ======================================================================= #
13109
- div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gtk_combo_box') {
13342
+
13343
+
13344
+ id: 'gtk_combo_box'
13110
13345
  ## Gtk::ComboBox und GTK KEYBOARD (TASTEN EINLESEN)
13111
13346
  <b>keyval</b> ist die Methode, um den Wert der Taste herauszufinden.
13112
13347
  Siehe auch nächster Absatz.
@@ -13148,9 +13383,6 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gtk_combo_bo
13148
13383
 
13149
13384
  %w( abc def ghi ).each { |value| combo_box.append_text(value) }
13150
13385
 
13151
- Das Setzen eines aktiven Elementes geht so: # activate comboboxentry
13152
-
13153
- @combo_box.active = 0
13154
13386
 
13155
13387
  Um herauszufinden welcher Eintrag gerade aktiv ist funktioniert
13156
13388
  dies hier:
@@ -13161,7 +13393,7 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gtk_combo_bo
13161
13393
  am rechten Bild zeigen wir einfach eine Kombination
13162
13394
  diverser Möglichkeiten):
13163
13395
 
13164
- gtk_img('COMBO_BOX2.png','bblack1 marl2em mar1em', :drag)+
13396
+
13165
13397
  gtk_img('COMBOBOX_ALL_IN_ONE_EXAMPLE.png','bblack1 marl2em mar1em', :drag)+
13166
13398
 
13167
13399
 
@@ -14308,12 +14540,11 @@ br+
14308
14540
  # ===================================================================== #
14309
14541
  # === Flags im button
14310
14542
  # ===================================================================== #
14311
- Jeder <b>gtk-button</b> hat bestimmte Flags, die verändert werden
14312
- können - im folgenden Beispiel (<b>CAN_FOCUS</b>):
14313
14543
 
14314
- @button_quit.set_flags(Gtk::Widget::CAN_FOCUS)
14315
14544
 
14316
- lem3('(<b class="BOLD">.set_flags()</b> ist übrigens Widget spezifisch,
14545
+
14546
+
14547
+ (<b class="BOLD">.set_flags()</b> ist übrigens Widget spezifisch,
14317
14548
  nicht Button spezifisch.)
14318
14549
 
14319
14550
  Anstatt set_flags kann man auch dies nutzen:
@@ -14337,16 +14568,8 @@ br+
14337
14568
  Gtk.main_quit
14338
14569
  }
14339
14570
 
14340
- Ich verwende jedoch keine proc-callbacks mehr seit
14341
- einigen Jahren; meiner Meinung nach sind einfache Methoden
14342
- einfacher und logischer als proc-callbacks.
14343
-
14344
-
14345
- # ===================================================================== #
14346
14571
  # === Gtk Relief
14347
- # ===================================================================== #
14348
- Ein <b>Relief</b> setzen kann man wie im folgenden
14349
- Beispiel gezeigt:','','gtk_relief
14572
+
14350
14573
 
14351
14574
 
14352
14575
  (RELIEF_NORMAL ist der Default Zustand, RELIEF_NONE
@@ -15245,13 +15468,10 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gtk_label')
15245
15468
  # ======================================================================= #
15246
15469
  # === Gdk TAG
15247
15470
  # ======================================================================= #
15248
- div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gdk_gdk') {
15249
- ## Alles über GDK','gdk
15250
-
15251
15471
 
15252
15472
  Weitere Beispiele zu Gdk:
15253
15473
 
15254
- Gtk::grab_add(self)','gdk
15474
+ Gtk.grab_add(self)
15255
15475
 
15256
15476
  unless Gdk::pointer_is_grabbed?
15257
15477
  Gdk::pointer_grab(self.window, false,
@@ -15262,7 +15482,7 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gdk_gdk') {
15262
15482
  Gdk::Event::CURRENT_TIME)
15263
15483
  end
15264
15484
 
15265
- if Gdk::pointer_is_grabbed?
15485
+ if Gdk.pointer_is_grabbed?
15266
15486
  Gdk::pointer_ungrab(Gdk::Event::CURRENT_TIME)
15267
15487
  Gtk::grab_remove(self)
15268
15488
  end
@@ -15291,10 +15511,6 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gdk_gdk') {
15291
15511
 
15292
15512
  p Gdk.pointer_is_grabbed?
15293
15513
 
15294
- Den aktuellen Screen kann man so abgreifen:
15295
-
15296
- @screen = Gdk::Screen.default
15297
-
15298
15514
  Werte innerhalb dieses @screen kann man so erhalten:
15299
15515
 
15300
15516
  @screen.get_setting("gtk-double-click-time")
@@ -15319,18 +15535,9 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gdk_gdk') {
15319
15535
  a(WIKI_URL+'Gdk', content: 'Gdk')
15320
15536
 
15321
15537
  # ======================================================================= #
15322
- # === GDK Drawable gdk_drawable tag.
15538
+ # === GDK Drawable gdk_drawable tag
15323
15539
  # ======================================================================= #
15324
- div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'drawable') {
15325
- ## GDK Drawable','gdk_drawable
15326
- <b class="BOLD">Gdk::Drawable</b> ist die Grundklasse für alle Objekte,
15327
- die <i>drawing commands</i> akzeptieren.','','draw
15328
-
15329
- .draw_drawable(@bgc, @buffer, rec.x, rec.y,
15330
- rec.x, rec.y, rec.width, rec.height)
15331
-
15332
- The Gdk::Drawable interface enables one to draw lines,
15333
- points, elliptical arcs, rectangles, text, or images.
15540
+ ## Gdk::Drawable
15334
15541
 
15335
15542
  Um <b class="BOLD">Gdk::Drawable</b> verwenden zu können benötigt
15336
15543
  man eine Instanz von <b class="BOLD">Gdk::GC</b>
@@ -15452,15 +15659,6 @@ require 'gst'
15452
15659
 
15453
15660
  (Der Ausdruck link points bzw pads kommt vom Löten.
15454
15661
  pads sind Drähte, die angelötet werden können.
15455
- # ===================================================================== #
15456
- # gst element factory
15457
- # ===================================================================== #
15458
- h3('Gstreamer und Element Factory
15459
- Zum Erstellen eines Gstreamer Framework, das MAD versteht,
15460
- würde wohl folgender Code helfen:
15461
-
15462
- @element_factory = Gst::ElementFactory.find("mad")
15463
- ')
15464
15662
 
15465
15663
  # ======================================================================= #
15466
15664
  # === GLIB TAG
@@ -15540,11 +15738,7 @@ self.signal_new :value2_changed, GLib::Signal::RUN_FIRST, nil, GLib::Type['void'
15540
15738
  # ======================================================================= #
15541
15739
  div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gdk_colours') {
15542
15740
  ## Gdk::Colour - Farben in GTK/Gdk','gdk_colour
15543
-
15544
15741
 
15545
- include Gtk::Colours','Color
15546
-
15547
- Den Background eines Widgets verändern geht wie folgt:','','Colour
15548
15742
 
15549
15743
  self.modify_bg(Gtk::STATE_NORMAL, BLACK)','colours
15550
15744
  self.modify_bg(Gtk::STATE_NORMAL, DARKBLUE)
@@ -15556,9 +15750,6 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gdk_colours'
15556
15750
  einem also keine besseren Farben einfallen für seine Applikation,
15557
15751
  dann ist dies wohl eine Option.
15558
15752
 
15559
- <b>Farbigen Text</b> kann man auch erreichen, allerdings ist
15560
- dies etwas umständlich, denn es geschieht über <b>GTK::Label.new</b>,
15561
- und der Methode <b>set_markup</b>','','gtk_markup
15562
15753
 
15563
15754
 
15564
15755
  # ======================================================================= #
@@ -15696,11 +15887,6 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gtk_event_ke
15696
15887
  Gtk::VBox.new(homogeneous = false, spacing = nil
15697
15888
  @v_box = Gtk::VBox.new(false,10)
15698
15889
 
15699
-
15700
- a('http://ruby-gnome2.sourceforge.jp/hiki.cgi?cmd=view&p=Gtk%3A%3AContainer&key=set_border_width#set_border_width',
15701
- content: 'Hier etabliert'
15702
-
15703
-
15704
15890
  Nun kann man Methoden wie <b>pack_start</b> und <b>pack_end</b>
15705
15891
  verwenden, oder einfach nur die altbekannte <b>.add</b> Methode. # add tag
15706
15892
 
@@ -16324,11 +16510,6 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'modify_a_fon
16324
16510
  Damit man einen Überblick hat wie das dann mit diesem
16325
16511
  <b>Spacing</b> aussieht:
16326
16512
 
16327
- # ===================================================================== #
16328
- # === EXAMPLE_TABLE.png
16329
- # ===================================================================== #
16330
- gtk_image('EXAMPLE_TABLE.png','bblack1 mars3em mar3px
16331
-
16332
16513
  Hier ein weiteres Beispiel einer Gtk::Table, die in einem
16333
16514
  Gtk::Frame vorzufinden ist:
16334
16515
  # ===================================================================== #
@@ -16453,16 +16634,8 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'modify_a_fon
16453
16634
  # rf rubygtk gtk_toolbar
16454
16635
  #
16455
16636
  # ======================================================================= #
16456
- # http://localhost/DATA/viewer/ruby_viewer.cgi#gtk_toolbar
16457
- # ======================================================================= #
16458
-
16459
- ## Gtk::Toolbar','gtk_toolbar
16460
- Eine GTK Toolbar','BO s1em larger
16461
-
16462
- Eine Toolbar ist eine Leiste mit Icons, Buttons und anderen
16463
- Widgets, und sieht ungefähr so aus:
16464
16637
 
16465
- gtk_image('TOOLBAR.png','mars2em', :drag)+
16638
+ ## Gtk::Toolbar
16466
16639
 
16467
16640
  gtk_image('SMALL_TOOLBAR_EXAMPLE.png',
16468
16641
  'mars2em bblack2', 'drag_small_toolbar_example'
@@ -16607,20 +16780,6 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gtk3') {
16607
16780
 
16608
16781
  @status_icon.set_blinking(true)
16609
16782
 
16610
- # ======================================================================= #
16611
- # === Gtk::Tooltip.new
16612
- # ======================================================================= #
16613
-
16614
- ## Gtk::Tooltip','gtk_tooltip
16615
- Einen Tooltip zu verwenden der fette Schrift inkludiert,
16616
- geht so:
16617
-
16618
- @button1.tooltip_markup = 'And this appears in <b>bold</b>.'
16619
-
16620
- Dokumentation zu <b>Gtk::Tooltip</b> sieht man hier:
16621
-
16622
- a('http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3ATooltip',content:'SELF
16623
-
16624
16783
  # ======================================================================= #
16625
16784
  # === Gtk::ListStore GTK LISTSTORE TAG. list store tag.
16626
16785
  #
@@ -16815,10 +16974,10 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gtk_frame')
16815
16974
  #
16816
16975
  # ======================================================================= #
16817
16976
 
16818
- ## Gtk.main','gtk_gtk
16977
+ ## Gtk.main
16819
16978
  Methoden die man im <b>Gtk.</b>::Modul finden kann, sind
16820
16979
  folgende welche:
16821
- p('s1em'){
16980
+
16822
16981
  Gtk.disable_setlocale
16823
16982
  Gtk.default_language
16824
16983
  Gtk.events_pending?
@@ -16835,20 +16994,7 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gtk_frame')
16835
16994
  }+
16836
16995
  Und noch ein paar mehr.
16837
16996
 
16838
- Hier ein Beispiel wie man <b>Double Clicks</b> realisiert.','',
16839
- 'double_clicks','double_clicks # rf ruby double_clicks
16840
-
16841
- @window.add_events(:button_press_mask)
16842
16997
 
16843
- @window.signal_connect(:button_press_event) do |widget, event|
16844
- if event.event_type == Gdk::Event::BUTTON2_PRESS
16845
- p "double click" #
16846
- elsif event.event_type == Gdk::Event::BUTTON3_PRESS
16847
- p "triple click"
16848
- elseif event.event_type == Gdk::Event::BUTTON_PRESS
16849
- p "(should be) one click"
16850
- end
16851
- end
16852
16998
 
16853
16999
  Zum Abfragen des Event Namens:
16854
17000
 
@@ -16865,20 +17011,16 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gtk_frame')
16865
17011
 
16866
17012
  Die <b>Argumente bedeuten</b>:
16867
17013
 
16868
- marl2em('<b>(a)</b> <b>expand</b>: ist es true dann bekommt das
17014
+ <b>(a)</b> <b>expand</b>: ist es true dann bekommt das
16869
17015
  Child Widget Extraplatz. Dieser Platz wird gleichmässig
16870
17016
  aufgeteilt.
16871
17017
 
16872
- marl2em('<b>(b)</b> <b>fill</b>: ist dieses Argument true,
17018
+ <b>(b)</b> <b>fill</b>: ist dieses Argument true,
16873
17019
  dann wird anstatt gepadded der Extra-Platz dem Kind
16874
17020
  gegeben.
16875
17021
 
16876
17022
  Das geht aber NICHT wenn expand auf <b>false</b> gesetzt ist.
16877
17023
 
16878
- a(
16879
- WIKI_URL+'Gtk%3A%3ABox#pack_start',
16880
- content: 'GtkBox.pack_start '
16881
-
16882
17024
 
16883
17025
 
16884
17026
  # ======================================================================= #
@@ -16889,10 +17031,7 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gtk_frame')
16889
17031
  # rf ruby gtk_about_dialog
16890
17032
  #
16891
17033
  # ======================================================================= #
16892
-
16893
- ## Gtk::AboutDialog','gtk_about_dialog
16894
-
16895
- Einen <b>About Dialog</b> kann man auch erstellen.','','about
17034
+ ## Gtk::AboutDialog
16896
17035
 
16897
17036
  @about_dialog.documenters = ['Robert A. Heiler']
16898
17037
  @about_dialog.license = 'This program is licenced under a ' +
@@ -16937,9 +17076,7 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gtk_frame')
16937
17076
  ' end
16938
17077
 
16939
17078
 
16940
- Copyright des Programmes setzen:
16941
-
16942
- about.set_copyright "(c) Jan Bodnar"
17079
+
16943
17080
 
16944
17081
  Um den Dialog zu starten, und danach zu zerstören:
16945
17082
 
@@ -16948,22 +17085,8 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gtk_frame')
16948
17085
 
16949
17086
  # ======================================================================= #
16950
17087
  # === Gtk::TextView
16951
- #
16952
- # GTK TextView TAG.
16953
- #
16954
- # rf ruby gtk_text_view
16955
- #
16956
17088
  # ======================================================================= #
16957
- div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gtktextview') {
16958
- ## Gtk::TextView','gtk_text_view
16959
- Da man oft die Dokumentation zu <b>TextBuffer</b> brauchen
16960
- wird:
16961
-
16962
-
16963
-
16964
- Den Buffer kann man so manipulieren:
16965
-
16966
- buffer = @text_view.buffer # Mittels .buffer() erhält man
17089
+ ## Gtk::TextView
16967
17090
  the TextBuffer widget.','textview
16968
17091
 
16969
17092
  buffer.signal_connect(:mark_set) { |buffer, iter, mark|
@@ -17034,13 +17157,11 @@ end
17034
17157
  # === GTK SOURCE VIEW TAG SOURCEVIEW TAG. rf ruby gtk_source_view
17035
17158
  # ======================================================================= #
17036
17159
  div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'source_view') {
17037
- ## Gtk::SourceView','gtk_source_view
17038
- gtk_image('SOURCE_VIEW1.png','bblack1 marl2em mar3px',
17039
- 'drag_edit
17040
- gtk_image('SOURCE_VIEW2.png','bblack1 mar3px',
17041
- 'drag_sourceview
17042
- gtk_image('SOURCE_VIEW3.png','bblack0 mar3px',
17043
- 'drag_sourceview_3
17160
+
17161
+ ## Gtk::SourceView
17162
+
17163
+
17164
+ gtk_image('SOURCE_VIEW3.png
17044
17165
 
17045
17166
  Das linke Bild ist <b>SourceView.new</b> in quasi Rohform, das
17046
17167
  mittlere Bild ist SourceView mit etwas Text. Man sieht das man Farbe
@@ -17052,12 +17173,7 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'source_view'
17052
17173
  <a href="gtk_source_buffer">SourceBuffer</a> verändern.)
17053
17174
 
17054
17175
  SourceView ist ein Child von TextView, hat also auch dessen
17055
- Methoden.','','gtksourceview
17056
-
17057
-
17058
-
17059
-
17060
- beziehungsweise
17176
+ Methoden.
17061
17177
 
17062
17178
  @source_view = Gtk::SourceView.new(@source_buffer)
17063
17179
 
@@ -17169,7 +17285,7 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'source_view'
17169
17285
 
17170
17286
  Was haben diese seltsamen <b>create_tag</b>s zu bedeuten?
17171
17287
 
17172
- marMan kann mit ihnen einen TextBuffer <b>farbig</b> darstellen,
17288
+ Man kann mit ihnen einen TextBuffer <b>farbig</b> darstellen,
17173
17289
  ein comment, wie im nächsten Bild unten zu sehen ist, hätte so
17174
17290
  zum Beispiel eine rote Farbe.
17175
17291
 
@@ -17203,11 +17319,7 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'source_view'
17203
17319
 
17204
17320
  @text_buffer.line_count
17205
17321
 
17206
- Hier ein Bild um zu zeigen, das man damit auch farbige Wörter
17207
- im Text gesondert darstellen kann:
17208
- br +
17209
- gtk_image('TEXT_BUFFER1.png','marl3em bblack1 mar5px',
17210
- 'drag_text_buffer1
17322
+
17211
17323
  Hier noch ein wenig Information über meine virtuelle Methode
17212
17324
  <b>get_iter_at_cursor</b>
17213
17325
 
@@ -17232,21 +17344,6 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'source_view'
17232
17344
  # === Gtk::ScrolledWindow
17233
17345
  # ======================================================================= #
17234
17346
 
17235
- ## Gtk::ScrolledWindow','gtk_scrolled_window
17236
-
17237
-
17238
- Man kann natürlich auch festlegen wo die <b>Scrollbar</b>
17239
- zu erscheinen hat. Zuerst die Konstanten dafür angeben,
17240
- danach folgt ein Beispiel:
17241
-
17242
- CORNER_TOP_LEFT
17243
- CORNER_BOTTOM_LEFT
17244
- CORNER_TOP_RIGHT
17245
- CORNER_BOTTOM_RIGHT
17246
-
17247
- @scrolled_window.window_placement = Gtk::CORNER_BOTTOM_LEFT
17248
- @scrolled_window.window_placement = Gtk::CORNER_BOTTOM_RIGHT
17249
-
17250
17347
  <b>window_placement</b> sagt, wo das Child Element ist. BOTTOM_LEFT
17251
17348
  heisst, das es links unten ist, die Scrollbars erscheinen dann
17252
17349
  rechts, und oben.
@@ -17356,13 +17453,6 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'source_view'
17356
17453
  kann man in allen Gtk::Windows setzen, und dies bestimmt
17357
17454
  die Minimum Größe eines Widgets. Darunter geht nichts.
17358
17455
 
17359
- s2('API Doku zu set_size_request
17360
- a(
17361
- WIKI_URL+'Gtk%3A%3AWidget#set_size_request',
17362
- content: 'hier',
17363
- css_class: 'mars1em BOLD'
17364
-
17365
-
17366
17456
  @window.set_size_request(600, 400)
17367
17457
 
17368
17458
  Size Request eines Widgets ist die kleinst-mögliche Größe
@@ -17394,31 +17484,7 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'source_view'
17394
17484
  @window.modify_bg(Gtk::STATE_NORMAL, BLACK)
17395
17485
  @window.modify_bg(Gtk::STATE_NORMAL, GREY)
17396
17486
 
17397
- Die verschiedenen <b>GtkStateType States</b> sind:
17398
-
17399
- table2('s4em','','',
17400
- '<b>STATE_NORMAL</b>','State during normal operation.',
17401
- '<b>STATE_ACTIVE</b>','State of a currently active widget, such
17402
- as a depressed button. ',
17403
- '<b>STATE_PRELIGHT</b>','State indicating that the mouse
17404
- pointer is over the widget and the widget will
17405
- respond to mouse clicks.',
17406
- '<b>STATE_SELECTED</b>','State of a selected item, such the
17407
- selected row in a list.',
17408
- '<b>STATE_INSENSITIVE</b>','State indicating that the
17409
- widget is unresponsive to user actions.'
17410
-
17411
-
17412
- Auch die Größe des Rahmen lässt sich setzen:
17413
-
17414
- @window.set_border_width(2)
17415
-
17416
- bzw auch:
17417
-
17418
- @window.border_width = 12
17419
17487
 
17420
- Lässt sich auch auf <b>Buttons</b> und so weiter
17421
- anwenden.
17422
17488
 
17423
17489
  Will man das Window irgendwo positionen (absolute positioning),
17424
17490
  geht dies mittels <b>.move</b>: # position tag, abs tag.
@@ -17546,30 +17612,13 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gtk_eventbox
17546
17612
 
17547
17613
 
17548
17614
  # ======================================================================= #
17549
- # === DIE GTK STATUSBAR TAG status tag.
17615
+ # === DIE GTK STATUSBAR TAG
17550
17616
  # ======================================================================= #
17617
+ ## Gtk::Statusbar
17551
17618
 
17552
- # Gtk::Statusbar
17553
-
17554
- Diese ID muss einzigartig sein, und kann mittels
17555
- <b>get_context_id</b> generiert werden.
17556
-
17557
- @status_bar = Gtk::Statusbar.new','Statusbar
17558
- @status_bar.has_resize_grip = true
17559
- @status_bar_context_id = @status_bar.get_context_id("DsaSimulator")
17560
-
17561
- Eine neue Nachricht kann man dann mittels <b>push</b> hinzufügen:
17562
-
17563
- @status_bar.push(@status_bar_context_id, "DSA4 Simulator") # Add message
17564
17619
 
17565
- gtk_image('STATUS_BAR.png','bblack1 mart4px mars4em', :drag)+
17566
17620
 
17567
- Um automatisch die Statusbar zu ändern, kann man Threads nutzen
17568
17621
 
17569
- ' x = Thread.new {
17570
- sleep 10
17571
- @status_bar.push(@status_bar_context_id, which_message)
17572
- ' }
17573
17622
 
17574
17623
  Übrigens kann eine Statusbar einen <b>Resize Grip</b> besitze;
17575
17624
  dies ist so eine Art Pfeil nach unten in der rechten, unteren
@@ -17591,10 +17640,10 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gtk_eventbox
17591
17640
  # === Gtk::Image
17592
17641
  # ======================================================================= #
17593
17642
 
17594
- ## Gtk::Image','gtk_image
17643
+ ## Gtk::Image
17644
+
17595
17645
  Normalerweise lädt man ein Image mittels <b>GdkPixbuf::Pixbuf</b>
17596
17646
  ("pixel buffer") aus einem File, und stellt dieses dann dar.
17597
-
17598
17647
 
17599
17648
  beziehungsweise mittels der Nutzung von ENV:
17600
17649
 
@@ -17623,97 +17672,23 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gtk_eventbox
17623
17672
  @event_box = Gtk::EventBox.new.add(@main_image)
17624
17673
  @event_box.signal_connect(:button_press_event) { puts "Clicked." }
17625
17674
 
17626
- Man kann auch stock Icons nutzen:
17627
-
17628
- Gtk::Image.new(stock_id, size)
17629
- Gtk::Image.new(Gtk::Stock::CONVERT, Gtk::IconSize::SMALL_TOOLBAR)
17630
-
17631
- Die erlaubten IconSize sind:
17632
-
17633
- IconSize::BUTTON
17634
- IconSize::DND
17635
- IconSize::DIALOG
17636
- IconSize::INVALID
17637
- IconSize::LARGE_TOOLBAR
17638
- IconSize::MENU
17639
- IconSize::SMALL_TOOLBAR
17640
17675
 
17641
- a(WIKI_URL+'Gtk%3A%3AImage#set', content: 'hier
17642
17676
  set_image könnte man auch nutzen.
17643
17677
 
17644
17678
  Da Gtk::Image ein Kind von Gtk::Misc ist, kann man <b>align
17645
17679
  Methoden</b> anwenden - also <b>center, left, right</b>,
17646
17680
  und auch padding.
17647
17681
 
17648
- Also, nun ein Beispiel zum <b>padding</b> (x-Achse, y-Achse+):
17649
-
17650
- @image.set_padding(10,40)
17651
- @image.clear
17652
17682
 
17653
17683
  Eine Anmerkung: Hat man viele Bilder, kann es zu Speicherproblemen
17654
17684
  kommen. In diesem Fall sollte man immer <b>GC.start</b> aufrufen
17655
17685
  bevor man ein neues Bild anzeigt.
17656
-
17657
- gtk_api_docu('Image')
17658
-
17659
- # ======================================================================= #
17660
- # === Gdk PixbufSimpleAnim tag. gdk_pixbuf_simple_anim. pixma tag.
17661
- # ======================================================================= #
17662
- ## GDK PixbufSimpleAnim','gdk_pixbuf_simple_anim
17663
- Dies erstellt eine neue, leere Animation.
17664
- Argumente sind:
17665
-
17666
- * width: the width of the animation (Fixnum)
17667
- * height: the height of the animation (Fixnum)
17668
- * rate: the speed of the animation, in frames per second (Float)
17669
- * Returns: a newly-created Gdk::PixbufSimpleAnim
17670
17686
 
17671
- # ======================================================================= #
17672
- # === GTK WIDGETS
17673
- #
17674
- # Gtk::Widget tag.
17675
- #
17676
- # Zeigt unter anderem wie man den Maus Pointer erhält.
17677
- #
17678
- # rf ruby gtk_widget
17679
- #
17680
- # ======================================================================= #
17681
- ## Gtk::Widget','gtk_widget
17682
- s2('<b>GTK Widgets</b> (sozusagen die Divs in der <b>GTK-Welt</b>,
17683
- die Arbeitstiere) haben sogenannte Boxen, zB HBox oder VBox.
17684
-
17685
- Will man eine andere Hintergrundfarbe setzen, so kann
17686
- man folgende Methode verwenden:
17687
-
17688
- gtk_widget.override_background_color()
17689
- gtk_widget.override_background_color(:normal,
17690
- Gdk::RGBA.new(0.02, 0.02, 0.02, 1)
17691
- )
17692
-
17693
- Das erste Argument hier, <b>state</b> genannt, definiert den
17694
- state der verändert werden sollte. :normal ist hierbei eine
17695
- Möglichkeit.
17696
-
17697
- Das zweite Argument, <b>color</b>, ist eben die Farbe die
17698
- wir verwenden möchten.
17699
-
17700
- Die Einträge stehen für die Farben:
17701
-
17702
- red: value
17703
- green: value
17704
- blue: value
17705
- alpha: value
17706
17687
 
17707
- gtk_api_docu('Widget
17708
17688
 
17709
17689
 
17710
17690
  # Gtk::Tooltips
17711
17691
 
17712
- Mittels <b>Tooltips</b> kann man kleine, helfende <b>Popups</b>
17713
- einbringen, die neben einem Widget erscheinen. (<i>helping hover</i>)',
17714
- '','tooltip
17715
-
17716
-
17717
17692
  Die <b>API</b> zu den Tooltips ist folgende:
17718
17693
 
17719
17694
  Gtk::Tooltips.new(','hover
@@ -17759,51 +17734,12 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gtk_eventbox
17759
17734
  button.tooltip_window = tooltip_window
17760
17735
 
17761
17736
 
17762
- gtk_api_docu('Tooltips
17763
-
17764
17737
  Gtk::Tooltips ist deprecated. Man sollte Gtk::Tooltip verwenden.
17765
17738
 
17766
17739
  Das geht am besten wie folgt:
17767
17740
 
17768
17741
  object.tooltip_text = 'Hello, I am a static tooltip.'")
17769
17742
 
17770
- # ======================================================================= #
17771
- # === Gtk::Window (GTK WINDOW. GTK2 WINDOW. @window initialisieren)
17772
- #
17773
- # Window tag.
17774
- # rf ruby gtk_main_window
17775
- # ======================================================================= #
17776
- ## Gtk::Window
17777
-
17778
-
17779
- Um ein Fenster zu schliessen (close gtk, close gtk window)
17780
- wird die <b>Message destroy</b> geschickt, die man mit
17781
- main_quit verbinden muss.
17782
-
17783
- Folgendes Beispiel zeigt dies:
17784
-
17785
- @window.signal_connect(:destroy) Gtk.main_quit end
17786
-
17787
- Border-width (in html border-width:10px)
17788
- kann man auch setzen:
17789
-
17790
- window.border_width = 10
17791
-
17792
- Und um den <b>Button ins Fenster</b> reinzugeben nutzt man
17793
- in etwa diesen Code:
17794
-
17795
- window.add(@button_quit)
17796
- window.show_all
17797
-
17798
- Man kann auch multiple Events an einen Button hinzufügen. In
17799
- diesem Falle werden sie nacheinander ausgeführt. Manuell kann man
17800
- diesen Vorgang auch durchführen - dies lädt praktisch dazu ein,
17801
- <b>Automatismen durchzuführen</b>.
17802
-
17803
- Um also einen Button zu <i>"klicken"</i> (ohne diesen aber mit
17804
- der Maus auswählen zu müssen), so schickt man ein <b>Signal</b>
17805
- an diesen "Button Widget":
17806
-
17807
17743
  # ======================================================================= #
17808
17744
  # === GdkPixbuf::Pixbuf (GdkPixbuf::Pixbuf tag)
17809
17745
  #
@@ -17961,9 +17897,6 @@ def to_png(file = 'screenshot')
17961
17897
  GdkPixbuf::Pixbuf.new(colorspace, has_alpha, bits_per_sample, width,
17962
17898
  height)
17963
17899
 
17964
-
17965
-
17966
-
17967
17900
  Weitere Information über das Bild erhält man damit:
17968
17901
 
17969
17902
  p @pixbuf_image.bits_per_sample
@@ -18003,7 +17936,7 @@ def to_png(file = 'screenshot')
18003
17936
 
18004
17937
  Was bedeuten die <b>GdkInterpType</b>?
18005
17938
 
18006
- marGdkInterpType beschreibt die verschiedenen Interpolationsmöglichkeiten,
17939
+ GdkInterpType beschreibt die verschiedenen Interpolationsmöglichkeiten,
18007
17940
  die mit der Scale Funktion genutzt werden können.
18008
17941
 
18009
17942
  GdkPixbuf::Pixbuf::INTERP_NEAREST ist die schnellste Scaling Methode,
@@ -18136,8 +18069,7 @@ div(css_class: 'default extra_css', css_style: 'padding: 1em', id: 'gtk_events')
18136
18069
  stock_cut_24.png 'Gtk::Stock::CUT
18137
18070
  stock_trash_24.png 'Gtk::Stock::DELETE
18138
18071
  stock_dialog_authentication_48.png 'Gtk::Stock::DIALOG_AUTHENTICATION
18139
- stock_dialog_error_48.png
18140
- 'Gtk::Stock::DIALOG_ERROR
18072
+ stock_dialog_error_48.png 'Gtk::Stock::DIALOG_ERROR
18141
18073
  stock_dialog_info_48.png
18142
18074
  'Gtk::Stock::DIALOG_INFO
18143
18075
  stock_dialog_question_48.png
@@ -18325,6 +18257,6 @@ div('s1em BO','anhang_a','border:3px solid darkgrey'){
18325
18257
  RELEASE_MASK - not used in GDK itself. GTK+ uses it
18326
18258
  to differentiate between (keyval, modifiers) pairs from
18327
18259
  key press and release events.
18328
- MODIFIER_MASK - UNKNOWN')
18260
+ MODIFIER_MASK - UNKNOWN'
18329
18261
 
18330
18262
  end