gtk_paradise 0.9.120 → 0.11.19
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of gtk_paradise might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +4521 -2997
- data/bin/genity +26 -0
- data/bin/gtk_editor +7 -0
- data/doc/README.gen +4484 -2975
- data/doc/todo/TODO_FOR_THE_GTK_PARADISE_PROJECT.md +281 -218
- data/doc/todo/recurring_todo_tasks.md +4 -3
- data/gtk_paradise.gemspec +28 -17
- data/lib/gtk_paradise/app/app.rb +77 -45
- data/lib/gtk_paradise/app/{app_module.rb → app_module/app_module.rb} +1064 -899
- data/lib/gtk_paradise/base_module/base_module.rb +7043 -33
- data/lib/gtk_paradise/base_module/class_methods/class_methods.rb +0 -0
- data/lib/gtk_paradise/base_module/css.rb +200 -268
- data/lib/gtk_paradise/base_module/experimental.rb +119 -0
- data/lib/gtk_paradise/base_module/html_support.rb +40 -15
- data/lib/gtk_paradise/base_module/these_methods_work_for_gtk3_and_gtk4.rb +155 -0
- data/lib/gtk_paradise/base_module_and_app_module/base_module_and_app_module.rb +1 -1
- data/lib/gtk_paradise/colours/colour_palette/material_design.rb +239 -0
- data/lib/gtk_paradise/colours/gtk_colour_constants.rb +8 -2
- data/lib/gtk_paradise/colours/parse.rb +8 -1
- data/lib/gtk_paradise/commandline/commandline.rb +20 -19
- data/lib/gtk_paradise/constants/constants.rb +227 -7
- data/lib/gtk_paradise/css_files/borders.css +81 -0
- data/lib/gtk_paradise/css_files/colours.css +329 -328
- data/lib/gtk_paradise/css_files/css_accordion.css +6 -2
- data/lib/gtk_paradise/css_files/hover_effects.css +588 -0
- data/lib/gtk_paradise/css_files/project.css +153 -189
- data/lib/gtk_paradise/drawing/README.md +3 -0
- data/lib/gtk_paradise/drawing/drawing.rb +68 -0
- data/lib/gtk_paradise/{base_module/colours.rb → drawing/event.rb} +37 -45
- data/lib/gtk_paradise/drawing/star.rb +96 -0
- data/lib/gtk_paradise/drawing/tool.rb +268 -0
- data/lib/gtk_paradise/drawing/turtle.rb +138 -0
- data/lib/gtk_paradise/emojis/emojis.rb +14 -13
- data/lib/gtk_paradise/examples/advanced/001_5x5_grid_example.rb +35 -50
- data/lib/gtk_paradise/examples/advanced/002_advanced_drag_and_drop_example.rb +21 -13
- data/lib/gtk_paradise/examples/advanced/003_html_like_support.rb +4 -25
- data/lib/gtk_paradise/examples/advanced/004_on_hover_example_on_gtk_entry.rb +4 -4
- data/lib/gtk_paradise/examples/advanced/005_csv_example.rb +6 -2
- data/lib/gtk_paradise/examples/advanced/007_label_responding_to_events_example.rb +1 -10
- data/lib/gtk_paradise/examples/advanced/008_options_example.rb +6 -3
- data/lib/gtk_paradise/examples/advanced/009_key_events.rb +1 -1
- data/lib/gtk_paradise/examples/advanced/010_extensive_text_view_example.rb +18 -17
- data/lib/gtk_paradise/examples/advanced/011_moving_blocks_example.rb +3 -3
- data/lib/gtk_paradise/examples/advanced/012_cell_data_sorting_example.rb +3 -4
- data/lib/gtk_paradise/examples/advanced/013_advanced_css_example.rb +86 -49
- data/lib/gtk_paradise/examples/advanced/014_popup_example.rb +9 -9
- data/lib/gtk_paradise/examples/advanced/015_advanced_button_example.rb +7 -19
- data/lib/gtk_paradise/examples/advanced/017_lean_CSS_example.rb +10 -13
- data/lib/gtk_paradise/examples/advanced/018_coloured_text_example.rb +7 -13
- data/lib/gtk_paradise/examples/advanced/019_gtk_entry_showing_the_cursor_position.rb +1 -1
- data/lib/gtk_paradise/examples/advanced/020_scale_this_image.rb +1 -10
- data/lib/gtk_paradise/examples/advanced/021_scroll_events_on_gtk_entry.rb +4 -0
- data/lib/gtk_paradise/examples/advanced/022_autogenerated_CSS_rounded_borders.rb +142 -0
- data/lib/gtk_paradise/examples/advanced/023_append_image_to_buffer.rb +145 -0
- data/lib/gtk_paradise/examples/advanced/024_notebook_with_tab_example.rb +151 -0
- data/lib/gtk_paradise/examples/advanced/025_showing_a_gold_caret_on_black_background.rb +144 -0
- data/lib/gtk_paradise/examples/advanced/026_status_bar_example.rb +153 -0
- data/lib/gtk_paradise/examples/advanced/027_customized_frame_example.rb +141 -0
- data/lib/gtk_paradise/examples/advanced/028_widgets_described_in_a_yaml_file.rb +240 -0
- data/lib/gtk_paradise/examples/cairo/basic_cairo_shapes.rb +1 -1
- data/lib/gtk_paradise/examples/cairo/cairo_transparent_rectangles.rb +9 -5
- data/lib/gtk_paradise/examples/cairo/cairo_write_via_custom_font.rb +81 -0
- data/lib/gtk_paradise/examples/cairo/donut_shape.rb +19 -6
- data/lib/gtk_paradise/examples/cairo/ping_pong_game.rb +2 -3
- data/lib/gtk_paradise/examples/controller/README.md +4 -0
- data/lib/gtk_paradise/examples/controller/controller.rb +2 -0
- data/lib/gtk_paradise/examples/css/001_border_examples.rb +30 -13
- data/lib/gtk_paradise/examples/css/002_import_CSS_file.rb +10 -5
- data/lib/gtk_paradise/examples/drawing/001_example.rb +61 -0
- data/lib/gtk_paradise/examples/drawing/002_example.rb +51 -0
- data/lib/gtk_paradise/examples/drawing/003_example.rb +38 -0
- data/lib/gtk_paradise/examples/drawing/004_example.rb +36 -0
- data/lib/gtk_paradise/examples/drawing/005_example.rb +92 -0
- data/lib/gtk_paradise/examples/drawing/006_example.rb +58 -0
- data/lib/gtk_paradise/examples/drawing/007_example.rb +22 -0
- data/lib/gtk_paradise/examples/drawing/008_example.rb +43 -0
- data/lib/gtk_paradise/examples/drawing/009_example.rb +43 -0
- data/lib/gtk_paradise/examples/drawing/010_example.rb +25 -0
- data/lib/gtk_paradise/examples/drawing/011_example.rb +72 -0
- data/lib/gtk_paradise/examples/drawing/012_example.rb +59 -0
- data/lib/gtk_paradise/examples/drawing/README.md +3 -0
- data/lib/gtk_paradise/examples/drawing/moving_turtle_example.rb +43 -0
- data/lib/gtk_paradise/examples/gdk/001_gdk_screen_properties.rb +58 -0
- data/lib/gtk_paradise/examples/gdk_pixbuf/save_image_example.rb +1 -1
- data/lib/gtk_paradise/examples/gir_ffi/001_hello_world.rb +29 -0
- data/lib/gtk_paradise/examples/gir_ffi/002_upgraded_hello_world.rb +40 -0
- data/lib/gtk_paradise/examples/gir_ffi/003_gtk_application_example.rb +30 -0
- data/lib/gtk_paradise/examples/gir_ffi/004_treeview_example.rb +64 -0
- data/lib/gtk_paradise/examples/gir_ffi/005_complex_example.rb +104 -0
- data/lib/gtk_paradise/examples/gir_ffi/README.md +5 -0
- data/lib/gtk_paradise/examples/glib/parse_glib_settings.rb +1 -1
- data/lib/gtk_paradise/examples/gtk2/008_list_store_example.rb +1 -1
- data/lib/gtk_paradise/examples/gtk3/{061_gtk_entry.rb → 001_gtk_entry.rb} +11 -6
- data/lib/gtk_paradise/examples/gtk3/{009_scrolled_window_example.rb → 002_scrolled_window_example.rb} +6 -4
- data/lib/gtk_paradise/examples/gtk3/{062_toggle_button_example.rb → 003_toggle_button_example.rb} +3 -2
- data/lib/gtk_paradise/examples/gtk3/{081_simple_dialog_example.rb → 004_simple_dialog_example.rb} +19 -12
- data/lib/gtk_paradise/examples/gtk3/005_spinner_example.rb +30 -10
- data/lib/gtk_paradise/examples/gtk3/006_text_view_example.rb +78 -0
- data/lib/gtk_paradise/examples/gtk3/{079_two_windows_example.rb → 007_two_windows_example.rb} +3 -1
- data/lib/gtk_paradise/examples/gtk3/008_search_bar_example.rb +91 -0
- data/lib/gtk_paradise/examples/gtk3/{002_simple_window.rb → 009_simple_window.rb} +14 -6
- data/lib/gtk_paradise/examples/gtk3/{025_switch_example.rb → 010_switch_example.rb} +6 -7
- data/lib/gtk_paradise/examples/gtk3/011_colour_chooser_example.rb +71 -0
- data/lib/gtk_paradise/examples/gtk3/012_show_the_xid_example.rb +18 -0
- data/lib/gtk_paradise/examples/gtk3/013_grab_pointer_forcefully.rb +31 -0
- data/lib/gtk_paradise/examples/gtk3/{083_bottom_left_placement.rb → 015_bottom_left_placement.rb} +3 -1
- data/lib/gtk_paradise/examples/gtk3/{082_scrolling_example.rb → 016_scrolling_example.rb} +2 -2
- data/lib/gtk_paradise/examples/gtk3/{080_extensive_markup_example.rb → 017_extensive_markup_example.rb} +8 -7
- data/lib/gtk_paradise/examples/gtk3/{078_message_dialog_example.rb → 018_message_dialog_example.rb} +3 -5
- data/lib/gtk_paradise/examples/gtk3/{075_tiny_button_via_css.rb → 021_tiny_button_via_css.rb} +1 -0
- data/lib/gtk_paradise/examples/gtk3/{001_font_related_information.rb → 022_font_related_information.rb} +1 -1
- data/lib/gtk_paradise/examples/gtk3/023_sorted_tree.rb +166 -0
- data/lib/gtk_paradise/examples/gtk3/{004_small_paned_example.rb → 024_small_paned_example.rb} +4 -3
- data/lib/gtk_paradise/examples/gtk3/{007_progress_bar_example.rb → 026_progress_bar_example.rb} +1 -2
- data/lib/gtk_paradise/examples/gtk3/{008_menubar_example.rb → 027_menubar_example.rb} +1 -1
- data/lib/gtk_paradise/examples/gtk3/{010_paned_widget_example.rb → 028_paned_widget_example.rb} +1 -0
- data/lib/gtk_paradise/examples/gtk3/{011_sockets.rb → 029_sockets.rb} +1 -0
- data/lib/gtk_paradise/examples/gtk3/{012_notebook_example.rb → 030_notebook_example.rb} +1 -0
- data/lib/gtk_paradise/examples/gtk3/{013_icon_theme_example.rb → 031_icon_theme_example.rb} +6 -0
- data/lib/gtk_paradise/examples/gtk3/{014_switcher_window.rb → 032_switcher_window.rb} +16 -10
- data/lib/gtk_paradise/examples/gtk3/{016_hello_world_in_gtk3_and_bold_font.rb → 034_hello_world_in_gtk3_and_bold_font.rb} +1 -1
- data/lib/gtk_paradise/examples/gtk3/{017_grid_example.rb → 035_grid_example.rb} +5 -1
- data/lib/gtk_paradise/examples/gtk3/{018_buttons_showcasing_the_relief.rb → 036_buttons_showcasing_the_relief.rb} +1 -0
- data/lib/gtk_paradise/examples/gtk3/{019_text_buffer_example.rb → 037_text_buffer_example.rb} +12 -10
- data/lib/gtk_paradise/examples/gtk3/{022_popup_example.rb → 040_popup_example.rb} +2 -2
- data/lib/gtk_paradise/examples/gtk3/{023_horizontal_and_vertical_scale.rb → 041_horizontal_and_vertical_scale.rb} +1 -1
- data/lib/gtk_paradise/examples/gtk3/{026_hover_button_example_via_css.rb → 043_hover_button_example_via_css.rb} +3 -1
- data/lib/gtk_paradise/examples/gtk3/{027_spin_button_example.rb → 044_spin_button_example.rb} +4 -3
- data/lib/gtk_paradise/examples/gtk3/{028_radio_menu_item_example.rb → 045_radio_menu_item_example.rb} +4 -1
- data/lib/gtk_paradise/examples/gtk3/{029_gtk_dialog_sample.rb → 046_gtk_dialog_sample.rb} +4 -1
- data/lib/gtk_paradise/examples/gtk3/{030_draw_rectangles.rb → 047_draw_rectangles.rb} +1 -1
- data/lib/gtk_paradise/examples/gtk3/{031_colour_choose_button.rb → 048_colour_choose_button.rb} +17 -3
- data/lib/gtk_paradise/examples/gtk3/{032_drag_and_drop_example.rb → 049_drag_and_drop_example.rb} +13 -5
- data/lib/gtk_paradise/examples/gtk3/{033_cell_renderer_pixbuf_example.rb → 050_cell_renderer_pixbuf_example.rb} +17 -6
- data/lib/gtk_paradise/examples/gtk3/051_combo_box_example.rb +74 -0
- data/lib/gtk_paradise/examples/gtk3/{037_css_example_of_a_button_changing_the_background_colour_on_click_event.rb → 053_css_example_of_a_button_changing_the_background_colour_on_click_event.rb} +14 -4
- data/lib/gtk_paradise/examples/gtk3/{036_revealer_example.rb → 053_revealer_example.rb} +10 -6
- data/lib/gtk_paradise/examples/gtk3/{038_ten_labels_in_a_vertical_box_example.rb → 054_ten_labels_in_a_vertical_box_example.rb} +1 -1
- data/lib/gtk_paradise/examples/gtk3/{039_threads_example.rb → 055_threads_example.rb} +1 -1
- data/lib/gtk_paradise/examples/gtk3/{042_colourized_button_example.rb → 058_colourized_button_example.rb} +1 -2
- data/lib/gtk_paradise/examples/gtk3/{043_form_example.rb → 059_form_example.rb} +1 -3
- data/lib/gtk_paradise/examples/gtk3/{044_check_button.rb → 060_check_button.rb} +4 -2
- data/lib/gtk_paradise/examples/gtk3/{046_event_box_example.rb → 062_event_box_example.rb} +2 -1
- data/lib/gtk_paradise/examples/gtk3/{047_examples_with_css.rb → 063_examples_with_css.rb} +91 -3
- data/lib/gtk_paradise/examples/gtk3/{048_accel_group_example.rb → 064_accel_group_example.rb} +1 -0
- data/lib/gtk_paradise/examples/gtk3/{049_change_the_application_theme.rb → 065_change_the_application_theme.rb} +4 -2
- data/lib/gtk_paradise/examples/gtk3/{050_header_bar_example.rb → 066_header_bar_example.rb} +3 -0
- data/lib/gtk_paradise/examples/gtk3/{051_gtk_label_example.rb → 067_gtk_label_example.rb} +3 -2
- data/lib/gtk_paradise/examples/gtk3/{052_popover_example.rb → 068_popover_example.rb} +2 -2
- data/lib/gtk_paradise/examples/gtk3/{053_entry_completion.rb → 069_entry_completion.rb} +2 -0
- data/lib/gtk_paradise/examples/gtk3/{055_button_demo.rb → 071_button_demo.rb} +6 -5
- data/lib/gtk_paradise/examples/gtk3/{056_text_iterator_example.rb → 072_text_iterator_example.rb} +30 -21
- data/lib/gtk_paradise/examples/gtk3/{057_image_example.rb → 073_image_example.rb} +1 -1
- data/lib/gtk_paradise/examples/gtk3/{058_frame_example.rb → 074_frame_example.rb} +1 -1
- data/lib/gtk_paradise/examples/gtk3/{059_gtk_expander.rb → 075_gtk_expander.rb} +2 -0
- data/lib/gtk_paradise/examples/gtk3/{060_ten_vboxes_example.rb → 076_ten_vboxes_example.rb} +1 -0
- data/lib/gtk_paradise/examples/gtk3/{063_button_box_example.rb → 077_button_box_example.rb} +11 -1
- data/lib/gtk_paradise/examples/gtk3/{064_tree_view_column_example.rb → 078_tree_view_column_example.rb} +2 -1
- data/lib/gtk_paradise/examples/gtk3/{066_vertical_boxes.rb → 080_vertical_boxes.rb} +2 -1
- data/lib/gtk_paradise/examples/gtk3/{067_vbox_with_spacing_and_border_width.rb → 081_vbox_with_spacing_and_border_width.rb} +2 -1
- data/lib/gtk_paradise/examples/gtk3/{069_file_chooser_dialog.rb → 082_file_chooser_dialog.rb} +3 -0
- data/lib/gtk_paradise/examples/gtk3/{070_bindings.rb → 083_bindings.rb} +14 -8
- data/lib/gtk_paradise/examples/gtk3/{072_recent_chooser_dialog.rb → 084_recent_chooser_dialog.rb} +2 -2
- data/lib/gtk_paradise/examples/gtk3/{073_showcase_the_cursors.rb → 085_showcase_the_cursors.rb} +30 -5
- data/lib/gtk_paradise/examples/gtk3/{074_app_chooser_button_example.rb → 086_app_chooser_button_example.rb} +1 -0
- data/lib/gtk_paradise/examples/gtk3/087_calendar_example.rb +41 -0
- data/lib/gtk_paradise/examples/gtk4/001_gtk_entry.rb +88 -0
- data/lib/gtk_paradise/examples/gtk4/002_scrolled_window_example.rb +62 -0
- data/lib/gtk_paradise/examples/gtk4/003_toggle_button_example.rb +23 -0
- data/lib/gtk_paradise/examples/gtk4/004_simple_dialog_example.rb +41 -0
- data/lib/gtk_paradise/examples/gtk4/005_spinner_example.rb +64 -0
- data/lib/gtk_paradise/examples/gtk4/006_text_view_example.rb +77 -0
- data/lib/gtk_paradise/examples/gtk4/007_two_windows_example.rb +55 -0
- data/lib/gtk_paradise/examples/gtk4/008_search_bar_example.rb +88 -0
- data/lib/gtk_paradise/examples/gtk4/009_text_view_example.rb +30 -0
- data/lib/gtk_paradise/examples/gtk4/010_switch_example.rb +52 -0
- data/lib/gtk_paradise/examples/gtk4/074_frame_example.rb +105 -0
- data/lib/gtk_paradise/examples/gtk4/076_ten_vboxes_example.rb +35 -0
- data/lib/gtk_paradise/examples/gtk4/087_calendar_example.rb +47 -0
- data/lib/gtk_paradise/examples/gtk4/100_changed_events_example.rb +77 -0
- data/lib/gtk_paradise/examples/gtk4/101_actionbar_example.rb +55 -0
- data/lib/gtk_paradise/examples/gtk4/102_picture_example.rb +35 -0
- data/lib/gtk_paradise/examples/pango/pango_power.rb +1 -0
- data/lib/gtk_paradise/experimental/experimental.rb +3 -11
- data/lib/gtk_paradise/experimental/experimental_for_gtk4.rb +92 -0
- data/lib/gtk_paradise/fonts/fonts.rb +5 -1
- data/lib/gtk_paradise/gdk/cursor.rb +2 -2
- data/lib/gtk_paradise/{base_module/e.rb → gdk/event_crossing.rb} +6 -8
- data/lib/gtk_paradise/gdk/gdk.rb +1 -1
- data/lib/gtk_paradise/gtk_classes/about.rb +11 -2
- data/lib/gtk_paradise/gtk_classes/about_dialog.rb +6 -2
- data/lib/gtk_paradise/gtk_classes/alignment.rb +4 -1
- data/lib/gtk_paradise/gtk_classes/application.rb +94 -4
- data/lib/gtk_paradise/gtk_classes/application_window.rb +25 -0
- data/lib/gtk_paradise/gtk_classes/box.rb +116 -279
- data/lib/gtk_paradise/gtk_classes/button.rb +55 -37
- data/lib/gtk_paradise/gtk_classes/button_box.rb +9 -1
- data/lib/gtk_paradise/gtk_classes/cell_renderer_text.rb +5 -3
- data/lib/gtk_paradise/gtk_classes/check_button.rb +27 -8
- data/lib/gtk_paradise/gtk_classes/combo_box.rb +4 -1
- data/lib/gtk_paradise/gtk_classes/combo_box_entry.rb +17 -11
- data/lib/gtk_paradise/gtk_classes/combo_box_text.rb +21 -19
- data/lib/gtk_paradise/gtk_classes/dialog.rb +2 -2
- data/lib/gtk_paradise/gtk_classes/entry.rb +256 -124
- data/lib/gtk_paradise/gtk_classes/entry_completion.rb +4 -0
- data/lib/gtk_paradise/gtk_classes/event_box.rb +21 -2
- data/lib/gtk_paradise/gtk_classes/event_button.rb +1 -1
- data/lib/gtk_paradise/gtk_classes/expander.rb +8 -1
- data/lib/gtk_paradise/gtk_classes/file_chooser_dialog.rb +1 -1
- data/lib/gtk_paradise/gtk_classes/file_filter.rb +4 -2
- data/lib/gtk_paradise/gtk_classes/file_selection.rb +4 -3
- data/lib/gtk_paradise/gtk_classes/frame.rb +19 -1
- data/lib/gtk_paradise/gtk_classes/grid.rb +206 -160
- data/lib/gtk_paradise/gtk_classes/hbox.rb +145 -0
- data/lib/gtk_paradise/gtk_classes/header_bar.rb +19 -8
- data/lib/gtk_paradise/gtk_classes/image.rb +1 -1
- data/lib/gtk_paradise/gtk_classes/label.rb +174 -135
- data/lib/gtk_paradise/gtk_classes/menu.rb +7 -3
- data/lib/gtk_paradise/gtk_classes/menu_bar.rb +1 -1
- data/lib/gtk_paradise/gtk_classes/menu_item.rb +1 -1
- data/lib/gtk_paradise/gtk_classes/notebook.rb +114 -64
- data/lib/gtk_paradise/gtk_classes/paned.rb +52 -0
- data/lib/gtk_paradise/gtk_classes/radio_menu_item.rb +19 -1
- data/lib/gtk_paradise/gtk_classes/scale_button.rb +16 -1
- data/lib/gtk_paradise/gtk_classes/scrolled_window.rb +8 -6
- data/lib/gtk_paradise/gtk_classes/search_bar.rb +1 -1
- data/lib/gtk_paradise/gtk_classes/source_buffer.rb +4 -5
- data/lib/gtk_paradise/gtk_classes/spin_button.rb +9 -1
- data/lib/gtk_paradise/gtk_classes/spinner.rb +32 -2
- data/lib/gtk_paradise/gtk_classes/status_icon.rb +2 -0
- data/lib/gtk_paradise/gtk_classes/statusbar.rb +1 -0
- data/lib/gtk_paradise/gtk_classes/style_context.rb +71 -0
- data/lib/gtk_paradise/gtk_classes/text_buffer.rb +45 -19
- data/lib/gtk_paradise/gtk_classes/text_view.rb +20 -3
- data/lib/gtk_paradise/gtk_classes/toggle_button.rb +3 -0
- data/lib/gtk_paradise/gtk_classes/toolbar.rb +2 -2
- data/lib/gtk_paradise/gtk_classes/tree_iter.rb +1 -1
- data/lib/gtk_paradise/gtk_classes/tree_view.rb +93 -70
- data/lib/gtk_paradise/gtk_classes/tree_view_column.rb +2 -1
- data/lib/gtk_paradise/gtk_classes/vbox.rb +71 -10
- data/lib/gtk_paradise/gtk_classes/vscale.rb +2 -2
- data/lib/gtk_paradise/gtk_classes/widget.rb +1057 -590
- data/lib/gtk_paradise/gtk_classes/window.rb +37 -2
- data/lib/gtk_paradise/hello_world/README.md +1 -1
- data/lib/gtk_paradise/hello_world/hello_world_gtk4.rb +20 -0
- data/lib/gtk_paradise/images/icons/close_image.png +0 -0
- data/lib/gtk_paradise/images/icons/closed.png +0 -0
- data/lib/gtk_paradise/images/icons/directory.png +0 -0
- data/lib/gtk_paradise/images/icons/icon_cool.gif +0 -0
- data/lib/gtk_paradise/images/icons/icon_lol.gif +0 -0
- data/lib/gtk_paradise/images/icons/icon_smile.gif +0 -0
- data/lib/gtk_paradise/images/icons/opened.png +0 -0
- data/lib/gtk_paradise/images/internal/gtk_label_example.png +0 -0
- data/lib/gtk_paradise/images/misc/wiki_logo.png +0 -0
- data/lib/gtk_paradise/images/small/GREEN_CIRCLE.png +0 -0
- data/lib/gtk_paradise/images/small/README.md +2 -0
- data/lib/gtk_paradise/images/small/RED_CIRCLE.png +0 -0
- data/lib/gtk_paradise/pango/{pango_fonts.rb → fonts.rb} +2 -2
- data/lib/gtk_paradise/pango/{pango.rb → layout.rb} +1 -1
- data/lib/gtk_paradise/pango/pango_renderer.rb +9 -2
- data/lib/gtk_paradise/project/project.rb +4 -3
- data/lib/gtk_paradise/prototypes/README.md +8 -0
- data/lib/gtk_paradise/prototypes/gtk3_standalone.rb +8 -21
- data/lib/gtk_paradise/prototypes/gtk4_standalone.rb +135 -0
- data/lib/gtk_paradise/prototypes/shared_code.rb +5 -15
- data/lib/gtk_paradise/prototypes/unified_gtk_prototype.rb +179 -0
- data/lib/gtk_paradise/require_gtk4.rb +7 -0
- data/lib/gtk_paradise/requires/require_base_module.rb +7 -0
- data/lib/gtk_paradise/requires/require_files_irrespective_of_the_gtk_version_at_hand.rb +25 -16
- data/lib/gtk_paradise/requires/require_gtk2.rb +6 -4
- data/lib/gtk_paradise/requires/{require_gtk2_or_gtk3.rb → require_gtk2_or_gtk3_or_gtk4.rb} +33 -12
- data/lib/gtk_paradise/requires/require_gtk3.rb +5 -20
- data/lib/gtk_paradise/requires/require_gtk4.rb +13 -0
- data/lib/gtk_paradise/requires/require_gtk_runner.rb +1 -0
- data/lib/gtk_paradise/requires/require_the_base_module_and_gtk_run.rb +1 -1
- data/lib/gtk_paradise/requires/require_the_base_module_the_app_module_and_the_toplevel_methods.rb +9 -0
- data/lib/gtk_paradise/requires/require_the_classes_files_for_gtk4.rb +11 -0
- data/lib/gtk_paradise/requires/require_the_colours_gem.rb +9 -0
- data/lib/gtk_paradise/requires/require_the_default_gtk_version.rb +4 -2
- data/lib/gtk_paradise/requires/require_the_toplevel_methods.rb +1 -1
- data/lib/gtk_paradise/run.rb +1 -0
- data/lib/gtk_paradise/run_this_widget/run_this_widget.rb +7 -3
- data/lib/gtk_paradise/threads/threads.rb +15 -10
- data/lib/gtk_paradise/toplevel_methods/css.rb +183 -35
- data/lib/gtk_paradise/toplevel_methods/cursor.rb +17 -3
- data/lib/gtk_paradise/toplevel_methods/determine_which_gtk_version_is_in_use.rb +90 -8
- data/lib/gtk_paradise/toplevel_methods/events.rb +6 -0
- data/lib/gtk_paradise/toplevel_methods/keys.rb +1 -1
- data/lib/gtk_paradise/toplevel_methods/screen_resolution.rb +32 -5
- data/lib/gtk_paradise/toplevel_methods/text_buffer_tags.rb +13 -4
- data/lib/gtk_paradise/toplevel_methods/tokenizer.rb +18 -3
- data/lib/gtk_paradise/toplevel_methods/{misc.rb → toplevel_methods.rb} +728 -181
- data/lib/gtk_paradise/utility_scripts/commandline_to_automatic_gui.rb +244 -0
- data/lib/gtk_paradise/version/version.rb +2 -2
- data/lib/gtk_paradise/widgets/gtk2/cat_merge.rb +2 -6
- data/lib/gtk_paradise/widgets/gtk2/cell_renderer_progress_example.rb +0 -5
- data/lib/gtk_paradise/widgets/gtk2/foto_lister.rb +2 -6
- data/lib/gtk_paradise/widgets/gtk2/gidnight_commander/gidnight_commander.rb +3 -3
- data/lib/gtk_paradise/widgets/gtk2/hbox_example.rb +1 -5
- data/lib/gtk_paradise/widgets/gtk2/multiple_select_in_a_tree_view_widget.rb +2 -6
- data/lib/gtk_paradise/widgets/gtk2/paned_example.rb +1 -1
- data/lib/gtk_paradise/widgets/gtk2/slider_changing_button.rb +2 -6
- data/lib/gtk_paradise/widgets/gtk2/status_icon_example.rb +2 -6
- data/lib/gtk_paradise/widgets/gtk2/table2.rb +2 -6
- data/lib/gtk_paradise/widgets/gtk2/toolbar_example.rb +2 -6
- data/lib/gtk_paradise/widgets/{version_agnostic → gtk3/audio_button}/audio_button.rb +15 -26
- data/lib/gtk_paradise/widgets/gtk3/burn_this_iso_file/burn_this_iso_file.rb +2 -6
- data/lib/gtk_paradise/widgets/{version_agnostic → gtk3/button_open_remote_webpage}/button_open_remote_webpage.rb +105 -50
- data/lib/gtk_paradise/widgets/gtk3/button_with_border/button_with_border.rb +155 -0
- data/lib/gtk_paradise/widgets/{version_agnostic → gtk3/button_xorg_buffer}/button_xorg_buffer.rb +76 -18
- data/lib/gtk_paradise/widgets/gtk3/calculator/calculator.rb +183 -76
- data/lib/gtk_paradise/widgets/gtk3/checkbox_image/checkbox_image.rb +3 -7
- data/lib/gtk_paradise/widgets/{version_agnostic → gtk3/coloured_button}/coloured_button.rb +94 -24
- data/lib/gtk_paradise/widgets/gtk3/coloured_square/coloured_square.rb +2 -6
- data/lib/gtk_paradise/widgets/gtk3/coloured_unit/coloured_unit.rb +151 -0
- data/lib/gtk_paradise/widgets/gtk3/cpu_widget/cpu_widget.rb +2 -6
- data/lib/gtk_paradise/widgets/gtk3/directory_content_widget/directory_content_widget.rb +937 -7
- data/lib/gtk_paradise/widgets/gtk3/editor/connect_skeleton.rb +33 -38
- data/lib/gtk_paradise/widgets/gtk3/editor/create.rb +66 -41
- data/lib/gtk_paradise/widgets/gtk3/editor/editor.rb +256 -270
- data/lib/gtk_paradise/widgets/gtk3/editor/internal_widgets/goto_line_widget.rb +52 -65
- data/lib/gtk_paradise/widgets/gtk3/editor/misc.rb +358 -111
- data/lib/gtk_paradise/widgets/gtk3/files_in_directory/files_in_directory.rb +2 -7
- data/lib/gtk_paradise/widgets/gtk3/flexible_vte/flexible_vte.rb +3 -7
- data/lib/gtk_paradise/widgets/gtk3/font_size_widget/action_button.rb +1 -5
- data/lib/gtk_paradise/widgets/gtk3/font_size_widget/font_size_widget.rb +2 -6
- data/lib/gtk_paradise/widgets/{gtk2 → gtk3}/gidnight_commander/gidnight_commander.config +1 -2
- data/lib/gtk_paradise/widgets/gtk3/gidnight_commander/gidnight_commander.rb +165 -125
- data/lib/gtk_paradise/widgets/gtk3/image_close_on_click_action/image_close_on_click_action.rb +34 -2
- data/lib/gtk_paradise/widgets/gtk3/image_viewer/image_viewer.rb +23 -26
- data/lib/gtk_paradise/widgets/gtk3/information_about_the_harddisc/harddisc_information.rb +161 -0
- data/lib/gtk_paradise/widgets/gtk3/insert_character/insert_character.rb +24 -29
- data/lib/gtk_paradise/widgets/gtk3/linux_users/linux_users.rb +32 -32
- data/lib/gtk_paradise/widgets/gtk3/my_calendar/my_calendar.rb +330 -7
- data/lib/gtk_paradise/widgets/gtk3/my_image_menu_item/my_image_menu_item.rb +179 -0
- data/lib/gtk_paradise/widgets/gtk3/non_numbers_only/non_numbers_only.rb +136 -0
- data/lib/gtk_paradise/widgets/gtk3/note_window/note_window.rb +199 -0
- data/lib/gtk_paradise/widgets/gtk3/notebook_controller/notebook_controller.rb +311 -7
- data/lib/gtk_paradise/widgets/gtk3/notebook_tab_with_icon/notebook_tab_with_icon.rb +402 -7
- data/lib/gtk_paradise/widgets/gtk3/numbered_lines/numbered_lines.rb +128 -82
- data/lib/gtk_paradise/widgets/{version_agnostic → gtk3/numbers_only}/numbers_only.rb +15 -3
- data/lib/gtk_paradise/widgets/gtk3/ping_widget/ping_widget.rb +491 -8
- data/lib/gtk_paradise/widgets/gtk3/regex_matcher/regex_matcher.rb +362 -43
- data/lib/gtk_paradise/widgets/gtk3/rename_widget/rename_widget.rb +8 -25
- data/lib/gtk_paradise/widgets/gtk3/show_which_key_was_pressed/show_which_key_was_pressed.rb +190 -0
- data/lib/gtk_paradise/widgets/gtk3/stopwatch/stopwatch.rb +318 -7
- data/lib/gtk_paradise/widgets/gtk3/sys_message/sys_message.rb +219 -7
- data/lib/gtk_paradise/widgets/gtk3/system_information/system_information.rb +58 -34
- data/lib/gtk_paradise/widgets/gtk3/tabble/admin_panel.rb +2 -6
- data/lib/gtk_paradise/widgets/gtk3/tabble/image_and_button.rb +2 -6
- data/lib/gtk_paradise/widgets/gtk3/tabble/tabble.rb +2 -6
- data/lib/gtk_paradise/widgets/gtk3/view_webpage/view_webpage.rb +2 -6
- data/lib/gtk_paradise/widgets/gtk3/wiki/README.md +4 -0
- data/lib/gtk_paradise/widgets/gtk3/wiki/wiki.rb +388 -0
- data/lib/gtk_paradise/widgets/gtk4/ping_widget/ping_widget.rb +4 -0
- data/lib/gtk_paradise/widgets/gtk4/show_icon_theme/show_icon_theme.rb +134 -0
- data/lib/gtk_paradise/widgets/gtk4/sys_message/sys_message.rb +269 -0
- data/lib/gtk_paradise/widgets/{gtk2/stopwatch/stopwatch.rb → gtk4/xpm_loader/xpm_loader.rb} +13 -11
- data/lib/gtk_paradise/widgets/shared_code/browser/browser_module.rb +4 -16
- data/lib/gtk_paradise/widgets/shared_code/cdripper/cdripper_module.rb +1 -1
- data/lib/gtk_paradise/widgets/shared_code/colour_filled_widget/colour_filled_widget_module.rb +25 -28
- data/lib/gtk_paradise/widgets/shared_code/colour_palette/colour_palette_module.rb +2 -2
- data/lib/gtk_paradise/widgets/shared_code/contacts/contacts_module.rb +62 -64
- data/lib/gtk_paradise/widgets/shared_code/flip_state_widget/flip_state_widget_module.rb +3 -19
- data/lib/gtk_paradise/widgets/shared_code/information_about_the_harddisc/harddisc_information.rb +0 -155
- data/lib/gtk_paradise/widgets/shared_code/information_about_the_harddisc/information_about_the_harddisc_module.rb +0 -444
- data/lib/gtk_paradise/widgets/shared_code/lsmod/lsmod_module.rb +22 -26
- data/lib/gtk_paradise/widgets/shared_code/lspci/lspci_module.rb +24 -36
- data/lib/gtk_paradise/widgets/shared_code/mini_clock/mini_clock_module.rb +74 -58
- data/lib/gtk_paradise/widgets/shared_code/my_calendar/my_calendar_module.rb +0 -327
- data/lib/gtk_paradise/widgets/shared_code/pid_displayer/pid_displayer_module.rb +53 -41
- data/lib/gtk_paradise/widgets/shared_code/random_image/random_image_module.rb +46 -29
- data/lib/gtk_paradise/widgets/shared_code/select_file/select_file_module.rb +1 -1
- data/lib/gtk_paradise/widgets/shared_code/show_icon_theme/show_icon_theme_module.rb +56 -44
- data/lib/gtk_paradise/widgets/shared_code/simple_clock/simple_clock_module.rb +1 -12
- data/lib/gtk_paradise/widgets/shared_code/stopwatch/stopwatch_module.rb +0 -341
- data/lib/gtk_paradise/widgets/shared_code/sys_message/sys_message_module.rb +0 -211
- data/lib/gtk_paradise/widgets/shared_code/tabby/tabby_module.rb +3 -15
- data/lib/gtk_paradise/widgets/shared_code/xpm_loader/xpm_loader_module.rb +15 -23
- data/lib/gtk_paradise/www/index.cgi +2 -2
- data/lib/gtk_paradise/yaml/browser_URLs.yml +3 -4
- data/lib/gtk_paradise/yaml/configuration_options_for_class_gtk_runner.yml +6 -6
- data/lib/gtk_paradise/yaml/experimental/README.md +3 -0
- data/lib/gtk_paradise/yaml/experimental/all_widgets.yml +37 -0
- data/lib/gtk_paradise/yaml/menu.yml +6 -3
- data/lib/gtk_paradise/yaml/notebook_controller.yml +62 -29
- data/lib/gtk_paradise.rb +0 -5
- data/test/gtk2/testing_combo_box.rb +1 -0
- data/test/gtk2/testing_display.rb +23 -0
- data/test/gtk2/testing_gtk_image.rb +4 -3
- data/test/gtk2/testing_hbox_and_vbox.rb +37 -0
- data/test/gtk2/testing_label_with_ampersand.rb +5 -2
- data/test/gtk2/testing_notebook.rb +11 -5
- data/test/gtk3/test_widget.rb +2 -1
- data/test/gtk3/testing_app.rb +0 -1
- data/test/gtk3/testing_base_module.rb +2 -1
- data/test/gtk3/testing_numbered_lines.rb +20 -0
- data/test/gtk3/testing_project_base_directory.rb +6 -1
- data/test/gtk3/testing_the_html_pseudo_tags.rb +2 -2
- data/test/gtk4/testing_gtk_entry.rb +24 -0
- data/test/misc/testing_a_gtk_frame.rb +14 -0
- data/test/misc/testing_gtk4_simplifications.rb +105 -0
- data/test/misc/testing_gtk_paradise_runner.rb +19 -4
- data/test/misc/testing_the_gtk_classes.rb +83 -0
- metadata +246 -199
- data/lib/gtk_paradise/base_module/change_directory.rb +0 -22
- data/lib/gtk_paradise/base_module/combo_box_and_combo_box_entry.rb +0 -113
- data/lib/gtk_paradise/base_module/commandline_arguments.rb +0 -36
- data/lib/gtk_paradise/base_module/configuration.rb +0 -50
- data/lib/gtk_paradise/base_module/constants.rb +0 -23
- data/lib/gtk_paradise/base_module/debug.rb +0 -127
- data/lib/gtk_paradise/base_module/draggable.rb +0 -95
- data/lib/gtk_paradise/base_module/emoji.rb +0 -107
- data/lib/gtk_paradise/base_module/esystem.rb +0 -22
- data/lib/gtk_paradise/base_module/events.rb +0 -111
- data/lib/gtk_paradise/base_module/fonts.rb +0 -119
- data/lib/gtk_paradise/base_module/graphics_display.rb +0 -47
- data/lib/gtk_paradise/base_module/gtk3.rb +0 -43
- data/lib/gtk_paradise/base_module/gtk_buttons.rb +0 -562
- data/lib/gtk_paradise/base_module/gtk_entry.rb +0 -126
- data/lib/gtk_paradise/base_module/gtk_fixed.rb +0 -18
- data/lib/gtk_paradise/base_module/gtk_grid.rb +0 -61
- data/lib/gtk_paradise/base_module/gtk_image.rb +0 -501
- data/lib/gtk_paradise/base_module/gtk_label.rb +0 -211
- data/lib/gtk_paradise/base_module/gtk_notebook.rb +0 -88
- data/lib/gtk_paradise/base_module/gtk_scrolled_window.rb +0 -155
- data/lib/gtk_paradise/base_module/misc.rb +0 -2949
- data/lib/gtk_paradise/base_module/pango.rb +0 -24
- data/lib/gtk_paradise/base_module/popover.rb +0 -241
- data/lib/gtk_paradise/base_module/register_sigint.rb +0 -20
- data/lib/gtk_paradise/base_module/reset.rb +0 -128
- data/lib/gtk_paradise/base_module/return_corresponding_gtk_stock_item.rb +0 -92
- data/lib/gtk_paradise/base_module/roebe.rb +0 -19
- data/lib/gtk_paradise/base_module/table.rb +0 -438
- data/lib/gtk_paradise/base_module/time.rb +0 -35
- data/lib/gtk_paradise/constants/available_cursors.rb +0 -52
- data/lib/gtk_paradise/constants/fonts.rb +0 -38
- data/lib/gtk_paradise/constants/misc.rb +0 -56
- data/lib/gtk_paradise/constants/newline.rb +0 -14
- data/lib/gtk_paradise/constants/xbm_icons.rb +0 -121
- data/lib/gtk_paradise/examples/gtk3/003_sorted_tree.rb +0 -141
- data/lib/gtk_paradise/examples/gtk3/034_combo_box_example.rb +0 -49
- data/lib/gtk_paradise/examples/gtk3/068_text_view_example.rb +0 -34
- data/lib/gtk_paradise/examples/gtk3/071_search_bar_example.rb +0 -59
- data/lib/gtk_paradise/gtk_classes/colours/colours.rb +0 -158
- data/lib/gtk_paradise/requires/require_the_minesweeper_files.rb +0 -11
- data/lib/gtk_paradise/toplevel_methods/allow_only_numbers.rb +0 -59
- data/lib/gtk_paradise/toplevel_methods/csv.rb +0 -102
- data/lib/gtk_paradise/toplevel_methods/e.rb +0 -18
- data/lib/gtk_paradise/toplevel_methods/enable_and_disable_warnings.rb +0 -58
- data/lib/gtk_paradise/toplevel_methods/keyboard.rb +0 -25
- data/lib/gtk_paradise/toplevel_methods/main_file.rb +0 -31
- data/lib/gtk_paradise/toplevel_methods/register_sigint.rb +0 -17
- data/lib/gtk_paradise/toplevel_methods/roebe.rb +0 -22
- data/lib/gtk_paradise/toplevel_methods/select_file.rb +0 -168
- data/lib/gtk_paradise/toplevel_methods/spacer.rb +0 -55
- data/lib/gtk_paradise/toplevel_methods/tooltips.rb +0 -71
- data/lib/gtk_paradise/toplevel_methods/we_use_this_gtk_version.rb +0 -65
- data/lib/gtk_paradise/widgets/gtk2/directory_content_widget/directory_content_widget.rb +0 -30
- data/lib/gtk_paradise/widgets/gtk2/my_calendar/my_calendar.config +0 -6
- data/lib/gtk_paradise/widgets/gtk2/my_calendar/my_calendar.rb +0 -34
- data/lib/gtk_paradise/widgets/gtk2/notebook_tab_with_icon/notebook_tab_with_icon.rb +0 -30
- data/lib/gtk_paradise/widgets/gtk2/ping_widget/ping_widget.rb +0 -30
- data/lib/gtk_paradise/widgets/gtk2/sys_message/sys_message.config +0 -6
- data/lib/gtk_paradise/widgets/gtk2/sys_message/sys_message.rb +0 -29
- data/lib/gtk_paradise/widgets/shared_code/directory_content_widget/constants.rb +0 -53
- data/lib/gtk_paradise/widgets/shared_code/directory_content_widget/directory_content_widget_module.rb +0 -777
- data/lib/gtk_paradise/widgets/shared_code/directory_content_widget/handle_this_file_or_symlink.rb +0 -83
- data/lib/gtk_paradise/widgets/shared_code/notebook_controller/notebook_controller_module.rb +0 -339
- data/lib/gtk_paradise/widgets/shared_code/notebook_tab_with_icon/notebook_tab_with_icon_module.rb +0 -297
- data/lib/gtk_paradise/widgets/shared_code/ping_widget/ping_widget_module.rb +0 -326
- data/lib/gtk_paradise/widgets/version_agnostic/button_with_border.rb +0 -63
- data/lib/gtk_paradise/widgets/version_agnostic/coloured_unit.rb +0 -54
- data/lib/gtk_paradise/widgets/version_agnostic/my_image_menu_item.rb +0 -103
- data/lib/gtk_paradise/widgets/version_agnostic/my_menu_item_separator.rb +0 -31
- data/lib/gtk_paradise/widgets/version_agnostic/non_numbers_only.rb +0 -66
- data/lib/gtk_paradise/widgets/version_agnostic/note_window.rb +0 -107
- /data/lib/gtk_paradise/examples/gtk3/{084_undecorated_window_example.rb → 014_undecorated_window_example.rb} +0 -0
- /data/lib/gtk_paradise/examples/gtk3/{077_status_icon_example.rb → 019_status_icon_example.rb} +0 -0
- /data/lib/gtk_paradise/examples/gtk3/{076_stack_example.rb → 020_stack_example.rb} +0 -0
- /data/lib/gtk_paradise/examples/gtk3/{006_password_example.rb → 025_password_example.rb} +0 -0
- /data/lib/gtk_paradise/examples/gtk3/{015_list_box_example.rb → 033_list_box_example.rb} +0 -0
- /data/lib/gtk_paradise/examples/gtk3/{020_radio_button_window.rb → 038_radio_button_window.rb} +0 -0
- /data/lib/gtk_paradise/examples/gtk3/{021_scale_button_demo.rb → 039_scale_button_demo.rb} +0 -0
- /data/lib/gtk_paradise/examples/gtk3/{024_installation_assistant.rb → 042_installation_assistant.rb} +0 -0
- /data/lib/gtk_paradise/examples/gtk3/{035_notebook_css_example.rb → 052_notebook_css_example.rb} +0 -0
- /data/lib/gtk_paradise/examples/gtk3/{040_font_chooser_dialog_example.rb → 056_font_chooser_dialog_example.rb} +0 -0
- /data/lib/gtk_paradise/examples/gtk3/{041_flowbox.rb → 057_flowbox.rb} +0 -0
- /data/lib/gtk_paradise/examples/gtk3/{045_fixed_example.rb → 061_fixed_example.rb} +0 -0
- /data/lib/gtk_paradise/examples/gtk3/{054_svg_viewer.rb → 070_svg_viewer.rb} +0 -0
- /data/lib/gtk_paradise/examples/gtk3/{065_tooltips_example.rb → 079_tooltips_example.rb} +0 -0
@@ -16,6 +16,7 @@ class CairoDonut < Gtk::Window
|
|
16
16
|
# ========================================================================= #
|
17
17
|
def initialize
|
18
18
|
super
|
19
|
+
reset
|
19
20
|
set_title 'Donut'
|
20
21
|
signal_connect(:destroy) { Gtk.main_quit }
|
21
22
|
init_ui
|
@@ -24,28 +25,40 @@ class CairoDonut < Gtk::Window
|
|
24
25
|
show_all
|
25
26
|
end
|
26
27
|
|
28
|
+
# ========================================================================= #
|
29
|
+
# === reset
|
30
|
+
# ========================================================================= #
|
31
|
+
def reset
|
32
|
+
@line_width_to_use = 0.85
|
33
|
+
end
|
34
|
+
|
27
35
|
# ========================================================================= #
|
28
36
|
# === init_ui
|
29
37
|
# ========================================================================= #
|
30
38
|
def init_ui
|
31
|
-
|
32
|
-
|
33
|
-
|
39
|
+
# ======================================================================= #
|
40
|
+
# === @drawing_area
|
41
|
+
#
|
42
|
+
# We will draw onto this area.
|
43
|
+
# ======================================================================= #
|
44
|
+
@drawing_area = Gtk::DrawingArea.new
|
45
|
+
@drawing_area.signal_connect(:draw) { on_draw }
|
46
|
+
add(@drawing_area)
|
34
47
|
end
|
35
48
|
|
36
49
|
# ========================================================================= #
|
37
50
|
# === on_draw
|
38
51
|
# ========================================================================= #
|
39
52
|
def on_draw
|
40
|
-
cr = @
|
53
|
+
cr = @drawing_area.window.create_cairo_context
|
41
54
|
draw_donut(cr)
|
42
55
|
end
|
43
56
|
|
44
57
|
# ========================================================================= #
|
45
58
|
# === draw_donut
|
46
59
|
# ========================================================================= #
|
47
|
-
def draw_donut(cr)
|
48
|
-
cr.set_line_width
|
60
|
+
def draw_donut(cr = @drawing_area.window.create_cairo_context)
|
61
|
+
cr.set_line_width @line_width_to_use
|
49
62
|
w = allocation.width
|
50
63
|
h = allocation.height
|
51
64
|
# First, we draw the outer ellipse.
|
@@ -4,13 +4,12 @@
|
|
4
4
|
# =========================================================================== #
|
5
5
|
require 'gtk2'
|
6
6
|
|
7
|
-
#require 'gtk_paradise'
|
8
|
-
|
9
7
|
module Pong
|
10
8
|
|
11
9
|
class CenteredItem
|
12
10
|
|
13
|
-
attr_accessor :x
|
11
|
+
attr_accessor :x
|
12
|
+
attr_accessor :y
|
14
13
|
|
15
14
|
# ========================================================================= #
|
16
15
|
# === initialize
|
@@ -1,3 +1,7 @@
|
|
1
1
|
The idea for the controller (the file called controller.rb) is to load
|
2
2
|
up all the different examples that are available for either ruby-gtk3
|
3
3
|
or ruby-gtk2, and allow the user to have a look at each one of them.
|
4
|
+
|
5
|
+
It does not work that well, because several examples have not been
|
6
|
+
ported to a class-centric structure, but in the future we may want
|
7
|
+
to fix these issues, so the code will remain here.
|
@@ -40,6 +40,7 @@ display_these_files << 'gtk_paradise/examples/gtk3/020_radio_button_window.rb'
|
|
40
40
|
display_these_files << 'gtk_paradise/examples/gtk3/021_scale_button_demo.rb'
|
41
41
|
display_these_files << 'gtk_paradise/examples/gtk3/026_hover_button_example_via_css.rb'
|
42
42
|
display_these_files << 'gtk_paradise/examples/gtk3/027_spin_button_example.rb'
|
43
|
+
display_these_files << 'gtk_paradise/examples/gtk3/071_search_bar_example.rb'
|
43
44
|
|
44
45
|
# =========================================================================== #
|
45
46
|
# This example only works on ruby-gtk3, as Gtk::Switch is not part of gtk2.
|
@@ -73,6 +74,7 @@ notebook.append_page(Gtk::HoverButtonExampleViaCss.new, Gtk::Label.new('(12) G
|
|
73
74
|
notebook.append_page(Gtk::SpinButtonExample.new, Gtk::Label.new('(13) Gtk::SpinButtonExample'))
|
74
75
|
notebook.append_page(Gtk::SmallPanedExample.new, Gtk::Label.new('(14) Gtk::SmallPanedExample'))
|
75
76
|
notebook.append_page(Gtk::SpinnerExample.new, Gtk::Label.new('(15) Gtk::SpinnerExample'))
|
77
|
+
notebook.append_page(Gtk::SearchBarExample.new, Gtk::Label.new('(16) Gtk::SearchBarExample'))
|
76
78
|
|
77
79
|
notebook.show_all
|
78
80
|
window.add(notebook)
|
@@ -13,7 +13,7 @@ class BorderExamples < ::Gtk::ScrolledWindow
|
|
13
13
|
# ========================================================================= #
|
14
14
|
# === USE_THIS_FONT
|
15
15
|
# ========================================================================= #
|
16
|
-
USE_THIS_FONT = :
|
16
|
+
USE_THIS_FONT = :hack_18
|
17
17
|
|
18
18
|
# ========================================================================= #
|
19
19
|
# === initialize
|
@@ -94,7 +94,11 @@ class BorderExamples < ::Gtk::ScrolledWindow
|
|
94
94
|
border: 25px solid '+random_html_colour6+';
|
95
95
|
border-radius: 16px;
|
96
96
|
box-shadow:inset rgba(15,55,123, .8) 1.5em .2em 5em;
|
97
|
+
}
|
97
98
|
|
99
|
+
.border12 {
|
100
|
+
border: 12px solid steelblue;
|
101
|
+
border-radius: 25px;
|
98
102
|
}
|
99
103
|
|
100
104
|
'
|
@@ -114,9 +118,9 @@ class BorderExamples < ::Gtk::ScrolledWindow
|
|
114
118
|
# ======================================================================= #
|
115
119
|
hbox_border1 = gtk_hbox
|
116
120
|
hbox_border1.css_class('border1')
|
117
|
-
hbox_border1.
|
121
|
+
hbox_border1.pad8px
|
118
122
|
hbox_border1.add(
|
119
|
-
|
123
|
+
selectable_text('This is inside of a box with border-bottom: 3px solid darkblue.')
|
120
124
|
)
|
121
125
|
@outer_vbox.minimal(hbox_border1, 10)
|
122
126
|
|
@@ -125,7 +129,7 @@ class BorderExamples < ::Gtk::ScrolledWindow
|
|
125
129
|
# ======================================================================= #
|
126
130
|
hbox_border2 = gtk_hbox
|
127
131
|
hbox_border2.css_class('border2')
|
128
|
-
hbox_border2.
|
132
|
+
hbox_border2.pad8px
|
129
133
|
hbox_border2.add(
|
130
134
|
text('This one makes use of differential side borders.')
|
131
135
|
)
|
@@ -136,7 +140,7 @@ class BorderExamples < ::Gtk::ScrolledWindow
|
|
136
140
|
# ======================================================================= #
|
137
141
|
hbox_border3 = gtk_hbox
|
138
142
|
hbox_border3.css_class('border3')
|
139
|
-
hbox_border3.
|
143
|
+
hbox_border3.pad8px
|
140
144
|
hbox_border3.add(
|
141
145
|
text('This one shows a rounded border.')
|
142
146
|
)
|
@@ -147,7 +151,7 @@ class BorderExamples < ::Gtk::ScrolledWindow
|
|
147
151
|
# ======================================================================= #
|
148
152
|
hbox_border4 = gtk_hbox
|
149
153
|
hbox_border4.css_class('border4')
|
150
|
-
hbox_border4.
|
154
|
+
hbox_border4.pad8px
|
151
155
|
hbox_border4.add(
|
152
156
|
text('As above but with a solid border.')
|
153
157
|
)
|
@@ -158,7 +162,7 @@ class BorderExamples < ::Gtk::ScrolledWindow
|
|
158
162
|
# ======================================================================= #
|
159
163
|
hbox_border5 = gtk_hbox
|
160
164
|
hbox_border5.css_class('border5')
|
161
|
-
hbox_border5.
|
165
|
+
hbox_border5.pad8px
|
162
166
|
hbox_border5.add(
|
163
167
|
text('As above but with an inset border.')
|
164
168
|
)
|
@@ -169,7 +173,7 @@ class BorderExamples < ::Gtk::ScrolledWindow
|
|
169
173
|
# ======================================================================= #
|
170
174
|
hbox_border6 = gtk_hbox
|
171
175
|
hbox_border6.css_class('border6')
|
172
|
-
hbox_border6.
|
176
|
+
hbox_border6.pad8px
|
173
177
|
hbox_border6.add(
|
174
178
|
text('As above but with an outset border.')
|
175
179
|
)
|
@@ -181,7 +185,7 @@ class BorderExamples < ::Gtk::ScrolledWindow
|
|
181
185
|
hbox_border7 = gtk_hbox
|
182
186
|
hbox_border7 = gtk_hbox
|
183
187
|
hbox_border7.css_class('border7')
|
184
|
-
hbox_border7.
|
188
|
+
hbox_border7.pad8px
|
185
189
|
hbox_border7.add(
|
186
190
|
text('As above but with a dashed border.')
|
187
191
|
)
|
@@ -192,7 +196,7 @@ class BorderExamples < ::Gtk::ScrolledWindow
|
|
192
196
|
# ======================================================================= #
|
193
197
|
hbox_border8 = gtk_hbox
|
194
198
|
hbox_border8.css_class('border8')
|
195
|
-
hbox_border8.
|
199
|
+
hbox_border8.pad8px
|
196
200
|
hbox_border8.add(
|
197
201
|
text('As above but with a double border.')
|
198
202
|
)
|
@@ -203,7 +207,7 @@ class BorderExamples < ::Gtk::ScrolledWindow
|
|
203
207
|
# ======================================================================= #
|
204
208
|
hbox_border9 = gtk_hbox
|
205
209
|
hbox_border9.css_class('border9')
|
206
|
-
hbox_border9.
|
210
|
+
hbox_border9.pad8px
|
207
211
|
hbox_border9.add(
|
208
212
|
text('As above but with a groove border.')
|
209
213
|
)
|
@@ -214,7 +218,7 @@ class BorderExamples < ::Gtk::ScrolledWindow
|
|
214
218
|
# ======================================================================= #
|
215
219
|
hbox_border10 = gtk_hbox
|
216
220
|
hbox_border10.css_class('border10')
|
217
|
-
hbox_border10.
|
221
|
+
hbox_border10.pad8px
|
218
222
|
hbox_border10.add(
|
219
223
|
text('As above but with a ridge border.')
|
220
224
|
)
|
@@ -225,12 +229,23 @@ class BorderExamples < ::Gtk::ScrolledWindow
|
|
225
229
|
# ======================================================================= #
|
226
230
|
hbox_border11 = gtk_hbox
|
227
231
|
hbox_border11.css_class('border11')
|
228
|
-
hbox_border11.
|
232
|
+
hbox_border11.pad8px
|
229
233
|
hbox_border11.add(
|
230
234
|
text('This one also shows a shadow.')
|
231
235
|
)
|
232
236
|
@outer_vbox.minimal(hbox_border11, 10)
|
233
237
|
|
238
|
+
# ======================================================================= #
|
239
|
+
# === hbox_border12
|
240
|
+
# ======================================================================= #
|
241
|
+
hbox_border12 = gtk_hbox
|
242
|
+
hbox_border12.css_class('border12')
|
243
|
+
hbox_border12.pad8px
|
244
|
+
hbox_border12.add(
|
245
|
+
text('This one shows a rounded border.')
|
246
|
+
)
|
247
|
+
@outer_vbox.minimal(hbox_border12, 10)
|
248
|
+
|
234
249
|
add(@outer_vbox)
|
235
250
|
set_size_request(1400, 900)
|
236
251
|
end
|
@@ -241,6 +256,8 @@ if __FILE__ == $PROGRAM_NAME
|
|
241
256
|
require 'gtk_paradise/run'
|
242
257
|
_ = Gtk::BorderExamples.new
|
243
258
|
r = Gtk.runner
|
259
|
+
r.title = 'Showcasing CSS borders in GTK'
|
244
260
|
r << _
|
261
|
+
r.padding 18
|
245
262
|
r.top_left_then_run
|
246
263
|
end
|
@@ -33,6 +33,9 @@ class ImportCSSFile < ::Gtk::ScrolledWindow
|
|
33
33
|
reset_the_internal_variables
|
34
34
|
set_use_this_font(USE_THIS_FONT)
|
35
35
|
# random_html_colour1 = random_html_colour
|
36
|
+
# ======================================================================= #
|
37
|
+
# Next load the colours.css file via an @import statement:
|
38
|
+
# ======================================================================= #
|
36
39
|
more_CSS_then_apply_it '
|
37
40
|
|
38
41
|
@import url("'+Gtk.project_base_directory?+'css_files/colours.css");
|
@@ -62,12 +65,13 @@ class ImportCSSFile < ::Gtk::ScrolledWindow
|
|
62
65
|
sample_widget.css_class('fancy_border')
|
63
66
|
text = left_aligned_text(
|
64
67
|
"This text will appear in crimson colour if a certain .css file "\
|
65
|
-
"has been found.\n\nSo if you see this in a reddish colour then "\
|
66
|
-
"that step has worked properly.\n\nThe CSS code in use will tap
|
67
|
-
"<b>@import url()</b>.\n\nThe code to the CSS in use for
|
68
|
-
"widget is shown below this box."
|
68
|
+
"has been found.\n\nSo if you see this in a ~reddish colour then "\
|
69
|
+
"that step has worked properly.\n\nThe CSS code in use will tap "\
|
70
|
+
"into <b>@import url()</b>.\n\nThe code to the CSS in use for "\
|
71
|
+
"this widget is shown below this box."
|
69
72
|
)
|
70
73
|
sample_widget.add(text)
|
74
|
+
sample_widget.set_border_width(15)
|
71
75
|
@outer_vbox.minimal(sample_widget, 10)
|
72
76
|
scrolled_widget = return_scrollable_CSS_in_use_widget
|
73
77
|
scrolled_widget.use_this_font = :dejavu_15
|
@@ -81,7 +85,8 @@ end; end
|
|
81
85
|
if __FILE__ == $PROGRAM_NAME
|
82
86
|
require 'gtk_paradise/run'
|
83
87
|
_ = Gtk::ImportCSSFile.new
|
84
|
-
r = Gtk.
|
88
|
+
r = Gtk.run(title: 'Importing .css files example')
|
85
89
|
r << _
|
90
|
+
r.apply_the_internal_title
|
86
91
|
r.top_left_then_run
|
87
92
|
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
require 'gtk_paradise/drawing/drawing.rb'
|
6
|
+
|
7
|
+
include Math
|
8
|
+
|
9
|
+
WIDTH = 600
|
10
|
+
HEIGHT = 400
|
11
|
+
V0 = 10.0
|
12
|
+
A = 0.75
|
13
|
+
G = 5.0
|
14
|
+
|
15
|
+
v = lambda {|n|
|
16
|
+
- A ** n * sqrt(2 * G * HEIGHT)
|
17
|
+
}
|
18
|
+
|
19
|
+
t = lambda { |n|
|
20
|
+
if n.zero?
|
21
|
+
sqrt(2 * HEIGHT / G)
|
22
|
+
else
|
23
|
+
array = [1]
|
24
|
+
n.times {|i|
|
25
|
+
array << 2 * A ** (i + 1)
|
26
|
+
}
|
27
|
+
sqrt(2 * HEIGHT / G) * array.inject(:+)
|
28
|
+
end
|
29
|
+
}
|
30
|
+
|
31
|
+
y = lambda { |n, t1|
|
32
|
+
if n.zero?
|
33
|
+
HEIGHT - G * t1 ** 2 / 2
|
34
|
+
else
|
35
|
+
t2 = t1 - t.call(n - 1)
|
36
|
+
- v.call(n) * t2 - G * t2 ** 2 / 2
|
37
|
+
end
|
38
|
+
}
|
39
|
+
|
40
|
+
x = lambda {|t1| V0 * t1}
|
41
|
+
|
42
|
+
num = lambda { |tm|
|
43
|
+
1000.times {|i| return i if tm <= t.call(i)}
|
44
|
+
}
|
45
|
+
|
46
|
+
i = 0
|
47
|
+
|
48
|
+
Drawing.app(width: WIDTH, height: HEIGHT) {
|
49
|
+
draw { clear }
|
50
|
+
|
51
|
+
id = timer(20) {
|
52
|
+
tm = i / V0
|
53
|
+
x1 = x.call(tm)
|
54
|
+
y1 = HEIGHT - y.call(num[tm], tm)
|
55
|
+
color(65535, 0, 0)
|
56
|
+
arc(false, x1, y1, 4, 4, 0, 64 * 360)
|
57
|
+
timer_stop(id) if i >= WIDTH
|
58
|
+
i += 1
|
59
|
+
}
|
60
|
+
|
61
|
+
}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
require 'gtk_paradise/drawing/drawing.rb'
|
6
|
+
|
7
|
+
include Math
|
8
|
+
|
9
|
+
L = 500
|
10
|
+
|
11
|
+
# =========================================================================== #
|
12
|
+
# === RADIUS_TO_USE
|
13
|
+
# =========================================================================== #
|
14
|
+
RADIUS_TO_USE = 25
|
15
|
+
|
16
|
+
Drawing.app(width: L, height: L) {
|
17
|
+
draw { clear }
|
18
|
+
|
19
|
+
quit_window = proc {
|
20
|
+
make_window { |window|
|
21
|
+
set_title('')
|
22
|
+
add(
|
23
|
+
button {
|
24
|
+
set_size_request(120, 40)
|
25
|
+
text = ::Gtk::Label.new.set_markup('<span size="x-large">Quit!</span>')
|
26
|
+
add(text)
|
27
|
+
signal_connect(:clicked) { ::Gtk.main_quit }
|
28
|
+
}
|
29
|
+
)
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
mouse_button { |w, e|
|
34
|
+
quit_window.call if e.button != 1
|
35
|
+
# ======================================================================= #
|
36
|
+
# Find some random RGB colours next:
|
37
|
+
# ======================================================================= #
|
38
|
+
color(
|
39
|
+
rand(65536), rand(65536), rand(65536)
|
40
|
+
)
|
41
|
+
arc(
|
42
|
+
true,
|
43
|
+
e.x - RADIUS_TO_USE,
|
44
|
+
e.y - RADIUS_TO_USE,
|
45
|
+
RADIUS_TO_USE * 2,
|
46
|
+
RADIUS_TO_USE * 2,
|
47
|
+
0,
|
48
|
+
64 * 360
|
49
|
+
)
|
50
|
+
}
|
51
|
+
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
require 'gtk_paradise/drawing/drawing.rb'
|
6
|
+
|
7
|
+
L = 300
|
8
|
+
O = L / 2
|
9
|
+
R = 140
|
10
|
+
step = 20
|
11
|
+
|
12
|
+
i = 0
|
13
|
+
|
14
|
+
Drawing.app(width: L, height: L) {
|
15
|
+
N_TIMES = 5
|
16
|
+
draw {
|
17
|
+
clear
|
18
|
+
color(0x87 * 256, 0xce * 256, 0xeb * 256) #skyblue
|
19
|
+
arc(false, O - R, O - R, R * 2, R * 2, 0, 64 * 360)
|
20
|
+
}
|
21
|
+
|
22
|
+
id = timer(500) do
|
23
|
+
ar = []
|
24
|
+
θ = i * step * Math::PI / 180
|
25
|
+
x = R * Math.cos(θ)
|
26
|
+
y = R * Math.sin(θ)
|
27
|
+
ar << [O + x, O - y]
|
28
|
+
N_TIMES.times {
|
29
|
+
x, y = -y, x
|
30
|
+
ar << [O + x, O - y]
|
31
|
+
}
|
32
|
+
color(0x22 * 256, 0x8b * 256, 0x22 * 256) #forestgreen
|
33
|
+
polygon(false, ar)
|
34
|
+
i += 1
|
35
|
+
timer_stop(id) if i * step > 180
|
36
|
+
true
|
37
|
+
end
|
38
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
require 'gtk_paradise/drawing/drawing.rb'
|
6
|
+
|
7
|
+
HEIGHT_AND_WIDTH = 400
|
8
|
+
R1 = 150
|
9
|
+
R2 = (HEIGHT_AND_WIDTH - R1 * 2) / 2 - 5
|
10
|
+
STP1 = (Math::PI / 180) * 0.5
|
11
|
+
STP2 = (Math::PI / 180) * 10
|
12
|
+
|
13
|
+
Drawing.app(width: HEIGHT_AND_WIDTH, height: HEIGHT_AND_WIDTH) {
|
14
|
+
# ========================================================================= #
|
15
|
+
# === TIMER_ANIMATION_SPEED
|
16
|
+
# ========================================================================= #
|
17
|
+
TIMER_ANIMATION_SPEED = 20
|
18
|
+
draw {
|
19
|
+
clear(color(5000, 0, 10000))
|
20
|
+
}
|
21
|
+
|
22
|
+
i = 0
|
23
|
+
|
24
|
+
# ========================================================================= #
|
25
|
+
# The higher the timer-value, the faster the animation.
|
26
|
+
# ========================================================================= #
|
27
|
+
id = timer(TIMER_ANIMATION_SPEED) {
|
28
|
+
x = HEIGHT_AND_WIDTH / 2 + (R1 * Math.cos(STP1 * i) + R2 * Math.cos(STP2 * i))
|
29
|
+
y = HEIGHT_AND_WIDTH / 2 - (R1 * Math.sin(STP1 * i) + R2 * Math.sin(STP2 * i))
|
30
|
+
color(0, 65535, 0)
|
31
|
+
arc(false, x, y, 3, 3, 0, 64 * 360)
|
32
|
+
i += 1
|
33
|
+
timer_stop(id) if STP1 * i > Math::PI * 2
|
34
|
+
true
|
35
|
+
}
|
36
|
+
}
|
@@ -0,0 +1,92 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
require 'gtk_paradise/drawing/drawing.rb'
|
6
|
+
|
7
|
+
L = 400
|
8
|
+
C_MAX = 65536
|
9
|
+
|
10
|
+
class Field
|
11
|
+
|
12
|
+
attr_reader :x
|
13
|
+
attr_reader :y
|
14
|
+
|
15
|
+
# ========================================================================= #
|
16
|
+
# === initialize
|
17
|
+
# ========================================================================= #
|
18
|
+
def initialize
|
19
|
+
@x = rand(L)
|
20
|
+
@y = rand(L)
|
21
|
+
n = Vector[rand, rand]
|
22
|
+
@n = [n[0] * 2 / n.norm, n[1] * 2 / n.norm]
|
23
|
+
end
|
24
|
+
|
25
|
+
# ========================================================================= #
|
26
|
+
# === next
|
27
|
+
# ========================================================================= #
|
28
|
+
def next
|
29
|
+
@x, @y = @x + @n[0], @y + @n[1]
|
30
|
+
@n[0] = -@n[0] if @x < 2 or @x >= L - 2
|
31
|
+
@n[1] = -@n[1] if @y < 2 or @y >= L - 2
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class Color
|
36
|
+
|
37
|
+
# ========================================================================= #
|
38
|
+
# === C_STEP
|
39
|
+
# ========================================================================= #
|
40
|
+
C_STEP = 1000
|
41
|
+
|
42
|
+
attr_reader :x
|
43
|
+
attr_reader :y
|
44
|
+
attr_reader :z
|
45
|
+
|
46
|
+
# ========================================================================= #
|
47
|
+
# === initialize
|
48
|
+
# ========================================================================= #
|
49
|
+
def initialize(
|
50
|
+
run_already = true
|
51
|
+
)
|
52
|
+
run if run_already
|
53
|
+
end
|
54
|
+
|
55
|
+
# ========================================================================= #
|
56
|
+
# === run
|
57
|
+
# ========================================================================= #
|
58
|
+
def run
|
59
|
+
@x = rand(C_MAX)
|
60
|
+
@y = rand(C_MAX)
|
61
|
+
@z = rand(C_MAX)
|
62
|
+
cn = Vector[rand, rand, rand]
|
63
|
+
@cn = [cn[0] / cn.norm, cn[1] / cn.norm, cn[2]/ cn.norm]
|
64
|
+
end
|
65
|
+
|
66
|
+
# ========================================================================= #
|
67
|
+
# === next
|
68
|
+
# ========================================================================= #
|
69
|
+
def next
|
70
|
+
@x, @y, @z = @x + @cn[0] * C_STEP, @y + @cn[1] * C_STEP, @z + @cn[2] * C_STEP
|
71
|
+
@cn[0] = -@cn[0] if @x < C_STEP or @x >= C_MAX - C_STEP
|
72
|
+
@cn[1] = -@cn[1] if @y < C_STEP or @y >= C_MAX - C_STEP
|
73
|
+
@cn[2] = -@cn[2] if @z < C_STEP or @z >= C_MAX - C_STEP
|
74
|
+
init if rand < 0.001
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
pos = Field.new
|
80
|
+
col = Color.new
|
81
|
+
|
82
|
+
Drawing.app(width: L, height: L) {
|
83
|
+
draw { clear }
|
84
|
+
|
85
|
+
timer(20) {
|
86
|
+
color(col.x.to_i, col.y.to_i, col.z.to_i)
|
87
|
+
arc(true, pos.x.to_i + 2, pos.y.to_i + 2, 4, 4, 0, 64 * 360)
|
88
|
+
pos.next
|
89
|
+
col.next
|
90
|
+
true
|
91
|
+
}
|
92
|
+
}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
# This example will draw some stars.
|
6
|
+
# =========================================================================== #
|
7
|
+
require 'gtk_paradise/drawing/drawing.rb'
|
8
|
+
|
9
|
+
# =========================================================================== #
|
10
|
+
# === DIMENSION
|
11
|
+
# =========================================================================== #
|
12
|
+
DIMENSION = 400
|
13
|
+
|
14
|
+
Drawing.app(width: DIMENSION, height: DIMENSION) {
|
15
|
+
|
16
|
+
# ========================================================================= #
|
17
|
+
# === BASE_FACTOR_USED_BY_GTK_FOR_RGB_VALUES
|
18
|
+
# ========================================================================= #
|
19
|
+
BASE_FACTOR_USED_BY_GTK_FOR_RGB_VALUES = 65535
|
20
|
+
|
21
|
+
# ========================================================================= #
|
22
|
+
# === USE_THIS_COLOUR_IN_RGB_VALUE
|
23
|
+
#
|
24
|
+
# 255 ... 65535
|
25
|
+
# 0 ... 0
|
26
|
+
#
|
27
|
+
# ========================================================================= #
|
28
|
+
USE_THIS_COLOUR_IN_RGB_VALUE = [
|
29
|
+
BASE_FACTOR_USED_BY_GTK_FOR_RGB_VALUES / 255 * 63.8,
|
30
|
+
BASE_FACTOR_USED_BY_GTK_FOR_RGB_VALUES / 255 * 100.0,
|
31
|
+
BASE_FACTOR_USED_BY_GTK_FOR_RGB_VALUES / 255 * 94.9
|
32
|
+
] # R: 21.0, G: 71.0, B: 64.0 (is teal)
|
33
|
+
|
34
|
+
draw {
|
35
|
+
clear
|
36
|
+
color(*USE_THIS_COLOUR_IN_RGB_VALUE)
|
37
|
+
po = Vector[0, 50]
|
38
|
+
θ = Math::PI / 15
|
39
|
+
a = Matrix[
|
40
|
+
[
|
41
|
+
Math.cos(θ),
|
42
|
+
-Math.sin(θ)
|
43
|
+
],
|
44
|
+
[
|
45
|
+
Math.sin(θ),
|
46
|
+
Math.cos(θ)
|
47
|
+
]
|
48
|
+
]
|
49
|
+
for y in 0..3
|
50
|
+
for x in 0..3
|
51
|
+
x1 = x * 100 + 50
|
52
|
+
y1 = y * 100 + 50
|
53
|
+
star(false, x1, y1, x1 + po[0], y1 - po[1])
|
54
|
+
po = a * po
|
55
|
+
end
|
56
|
+
end
|
57
|
+
}
|
58
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
require 'gtk_paradise/drawing/drawing.rb'
|
6
|
+
|
7
|
+
Drawing.app {
|
8
|
+
draw { clear }
|
9
|
+
|
10
|
+
po = Vector[0, 150]
|
11
|
+
θ = Math::PI / 50
|
12
|
+
a = Matrix[
|
13
|
+
[Math.cos(θ), -Math.sin(θ)], [Math.sin(θ), Math.cos(θ)]
|
14
|
+
]
|
15
|
+
|
16
|
+
timer(20) {
|
17
|
+
clear
|
18
|
+
color(0, 65535, 0)
|
19
|
+
star(false, 150, 150, 150 + po[0], 150 - po[1])
|
20
|
+
po = a * po
|
21
|
+
}
|
22
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
require 'gtk_paradise/drawing/drawing.rb'
|
6
|
+
|
7
|
+
Width = 400
|
8
|
+
Height = 300
|
9
|
+
Turn = 20
|
10
|
+
Length = 40
|
11
|
+
Ratio = 0.9
|
12
|
+
Depth = 8
|
13
|
+
|
14
|
+
θ = Math::PI * Turn / 180
|
15
|
+
left = Matrix[[Math.cos(θ), -Math.sin(θ)], [Math.sin(θ), Math.cos(θ)]]
|
16
|
+
right = Matrix[[Math.cos(-θ), -Math.sin(-θ)], [Math.sin(-θ), Math.cos(-θ)]]
|
17
|
+
|
18
|
+
Drawing.app(width: Width, height: Height, title: 'tree') {
|
19
|
+
draw {
|
20
|
+
clear
|
21
|
+
}
|
22
|
+
|
23
|
+
ar = [[Vector[Width / 2, 1], Vector[0, Length]]]
|
24
|
+
branch_num = 0
|
25
|
+
|
26
|
+
id = timer(80) {
|
27
|
+
ob = ar.shift
|
28
|
+
v1 = left * ob[1]
|
29
|
+
v2 = right * ob[1]
|
30
|
+
p1 = ob[0] + v1
|
31
|
+
p2 = ob[0] + v2
|
32
|
+
|
33
|
+
color(0, 65535, 0)
|
34
|
+
line(ob[0][0], Height - ob[0][1], p1[0], Height - p1[1])
|
35
|
+
line(ob[0][0], Height - ob[0][1], p2[0], Height - p2[1])
|
36
|
+
|
37
|
+
ar << [p1, v1 * Ratio]
|
38
|
+
ar << [p2, v2 * Ratio]
|
39
|
+
branch_num += 2
|
40
|
+
timer_stop(id) if branch_num >= 2 ** (Depth + 1) - 2
|
41
|
+
true
|
42
|
+
}
|
43
|
+
}
|