kredki 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/kredki/core/application.rb +314 -0
- data/lib/kredki/core/color.rb +100 -0
- data/lib/kredki/core/event/block_event_reaction.rb +44 -0
- data/lib/kredki/core/event/composite_event_manager.rb +37 -0
- data/lib/kredki/core/event/event.rb +91 -0
- data/lib/kredki/core/event/event_manager.rb +60 -0
- data/lib/kredki/core/event/event_manager_jobs.rb +53 -0
- data/lib/kredki/core/event/event_reaction.rb +36 -0
- data/lib/kredki/core/event/family/drop_event.rb +40 -0
- data/lib/kredki/core/event/family/exit_event.rb +5 -0
- data/lib/kredki/core/event/family/focus_enter_event.rb +5 -0
- data/lib/kredki/core/event/family/focus_leave_event.rb +5 -0
- data/lib/kredki/core/event/family/hide_event.rb +5 -0
- data/lib/kredki/core/event/family/joystick_event.rb +102 -0
- data/lib/kredki/core/event/family/key_event.rb +40 -0
- data/lib/kredki/core/event/family/mouse_event.rb +190 -0
- data/lib/kredki/core/event/family/pastele_event.rb +11 -0
- data/lib/kredki/core/event/family/show_event.rb +5 -0
- data/lib/kredki/core/event/family/text_event.rb +23 -0
- data/lib/kredki/core/event/family/tick_event.rb +5 -0
- data/lib/kredki/core/event/family/update_complete_event.rb +5 -0
- data/lib/kredki/core/event/family/window_event.rb +108 -0
- data/lib/kredki/core/event/job_event_reaction.rb +44 -0
- data/lib/kredki/core/event/joystick_event_manager.rb +30 -0
- data/lib/kredki/core/event/keyboard_event_manager.rb +29 -0
- data/lib/kredki/core/event/method_event_reaction.rb +46 -0
- data/lib/kredki/core/event/mouse_event_manager.rb +27 -0
- data/lib/kredki/core/font.rb +53 -0
- data/lib/kredki/core/job/after_job.rb +59 -0
- data/lib/kredki/core/job/job.rb +108 -0
- data/lib/kredki/core/job/loop_job.rb +87 -0
- data/lib/kredki/core/job/play_animation_job.rb +44 -0
- data/lib/kredki/core/job/play_job.rb +41 -0
- data/lib/kredki/core/job/play_loop_animation_job.rb +98 -0
- data/lib/kredki/core/job/play_loop_job.rb +104 -0
- data/lib/kredki/core/job/side_job.rb +62 -0
- data/lib/kredki/core/kernel-path.rb +71 -0
- data/lib/kredki/core/kredki.rb +89 -0
- data/lib/kredki/core/linear_gradient.rb +43 -0
- data/lib/kredki/core/media/clipboard.rb +35 -0
- data/lib/kredki/core/media/joystick.rb +199 -0
- data/lib/kredki/core/media/keyboard.rb +84 -0
- data/lib/kredki/core/media/keyboard_modifiers_decoder.rb +154 -0
- data/lib/kredki/core/media/mouse.rb +197 -0
- data/lib/kredki/core/paint/animation.rb +247 -0
- data/lib/kredki/core/paint/area.rb +67 -0
- data/lib/kredki/core/paint/block_shape_area.rb +102 -0
- data/lib/kredki/core/paint/ellipse.rb +22 -0
- data/lib/kredki/core/paint/paint.rb +392 -0
- data/lib/kredki/core/paint/picture.rb +126 -0
- data/lib/kredki/core/paint/rectangle.rb +202 -0
- data/lib/kredki/core/paint/scene.rb +277 -0
- data/lib/kredki/core/paint/shape.rb +394 -0
- data/lib/kredki/core/paint/shape_area.rb +57 -0
- data/lib/kredki/core/paint/text.rb +222 -0
- data/lib/kredki/core/pastele/pastele-extern.rb +139 -0
- data/lib/kredki/core/pastele/pastele.rb +205 -0
- data/lib/kredki/core/radial_gradient.rb +45 -0
- data/lib/kredki/core/setup.rb +214 -0
- data/lib/kredki/core/window/pane.rb +178 -0
- data/lib/kredki/core/window/pane_event_manager.rb +44 -0
- data/lib/kredki/core/window/pane_events.rb +366 -0
- data/lib/kredki/core/window/window.rb +584 -0
- data/lib/kredki/core.rb +2 -0
- data/lib/kredki/hide.rb +9 -0
- data/lib/kredki/irb.rb +90 -0
- data/lib/kredki/module.rb +3 -0
- data/lib/kredki/pads/application.rb +13 -0
- data/lib/kredki/pads/button.rb +151 -0
- data/lib/kredki/pads/checkbox/checkbox.rb +68 -0
- data/lib/kredki/pads/checkbox/checkbox_button.rb +65 -0
- data/lib/kredki/pads/context/item.rb +65 -0
- data/lib/kredki/pads/context/item_group.rb +10 -0
- data/lib/kredki/pads/context/layer.rb +59 -0
- data/lib/kredki/pads/context/menu.rb +77 -0
- data/lib/kredki/pads/context/pad.rb +26 -0
- data/lib/kredki/pads/context/primary_layer.rb +51 -0
- data/lib/kredki/pads/context/secondary_layer.rb +60 -0
- data/lib/kredki/pads/item/item.rb +140 -0
- data/lib/kredki/pads/item/item_group.rb +44 -0
- data/lib/kredki/pads/item/item_x.rb +22 -0
- data/lib/kredki/pads/item/item_y.rb +31 -0
- data/lib/kredki/pads/label.rb +71 -0
- data/lib/kredki/pads/layer.rb +326 -0
- data/lib/kredki/pads/layout/align.rb +10 -0
- data/lib/kredki/pads/layout/layout.rb +88 -0
- data/lib/kredki/pads/layout/way.rb +99 -0
- data/lib/kredki/pads/layout/x_way.rb +119 -0
- data/lib/kredki/pads/layout/y_way.rb +120 -0
- data/lib/kredki/pads/list/item.rb +117 -0
- data/lib/kredki/pads/list/item_group.rb +36 -0
- data/lib/kredki/pads/list/pad.rb +74 -0
- data/lib/kredki/pads/list/tree/item.rb +138 -0
- data/lib/kredki/pads/list/tree/item_group.rb +86 -0
- data/lib/kredki/pads/list/tree/pad.rb +94 -0
- data/lib/kredki/pads/module.rb +11 -0
- data/lib/kredki/pads/note.rb +212 -0
- data/lib/kredki/pads/notes.rb +32 -0
- data/lib/kredki/pads/option/option.rb +121 -0
- data/lib/kredki/pads/option/option_item.rb +15 -0
- data/lib/kredki/pads/option/option_item_group.rb +16 -0
- data/lib/kredki/pads/option/option_layer.rb +81 -0
- data/lib/kredki/pads/pad/animation_pad.rb +106 -0
- data/lib/kredki/pads/pad/glyph_pad.rb +71 -0
- data/lib/kredki/pads/pad/pad.rb +1290 -0
- data/lib/kredki/pads/pad/pad_events.rb +358 -0
- data/lib/kredki/pads/pad/picture_pad.rb +89 -0
- data/lib/kredki/pads/pad/rectangle_pad.rb +181 -0
- data/lib/kredki/pads/pad/scroll_pad.rb +176 -0
- data/lib/kredki/pads/pad/shape_pad.rb +148 -0
- data/lib/kredki/pads/pad/space_pad.rb +33 -0
- data/lib/kredki/pads/pad/text_pad.rb +310 -0
- data/lib/kredki/pads/pane.rb +267 -0
- data/lib/kredki/pads/portal_layer.rb +94 -0
- data/lib/kredki/pads/radio/group.rb +45 -0
- data/lib/kredki/pads/radio/item.rb +69 -0
- data/lib/kredki/pads/radio/item_button.rb +143 -0
- data/lib/kredki/pads/service/event_queue.rb +79 -0
- data/lib/kredki/pads/service/service.rb +248 -0
- data/lib/kredki/pads/service/service_event_manager.rb +43 -0
- data/lib/kredki/pads/service/service_filter.rb +98 -0
- data/lib/kredki/pads/service/service_inherited.rb +48 -0
- data/lib/kredki/pads/setup.rb +36 -0
- data/lib/kredki/pads/slider/slider.rb +145 -0
- data/lib/kredki/pads/slider/slider_x.rb +41 -0
- data/lib/kredki/pads/slider/slider_y.rb +41 -0
- data/lib/kredki/pads/table/cell.rb +22 -0
- data/lib/kredki/pads/table/column.rb +63 -0
- data/lib/kredki/pads/table/column_layout.rb +88 -0
- data/lib/kredki/pads/table/pad.rb +116 -0
- data/lib/kredki/pads/table/row.rb +24 -0
- data/lib/kredki/pads/table/scroll_rows.rb +50 -0
- data/lib/kredki/pads/text/editable_text_verse.rb +77 -0
- data/lib/kredki/pads/text/editable_text_verses.rb +59 -0
- data/lib/kredki/pads/text/navigable_text_pad.rb +413 -0
- data/lib/kredki/pads/text/text_edition.rb +97 -0
- data/lib/kredki/pads/text/text_navigation.rb +109 -0
- data/lib/kredki/pads/toolbar/item.rb +62 -0
- data/lib/kredki/pads/toolbar/item_group.rb +22 -0
- data/lib/kredki/pads/toolbar/layer.rb +41 -0
- data/lib/kredki/pads/toolbar/pad.rb +51 -0
- data/lib/kredki/pads/toolbar/primary_layer.rb +64 -0
- data/lib/kredki/pads/window.rb +11 -0
- data/lib/kredki/script.rb +29 -0
- data/lib/kredki/setup.rb +2 -0
- data/lib/kredki/test.rb +35 -0
- data/lib/kredki.rb +10 -0
- data/lib/readme.md +31 -0
- data/stuff/config/config.rb +431 -0
- data/stuff/config/pads_config.rb +111 -0
- data/stuff/dll/SDL3.dll +0 -0
- data/stuff/dll/pastele.dll +0 -0
- data/stuff/dll/thorvg-1.dll +0 -0
- data/stuff/font/MartianMono-StdRg.ttf +0 -0
- data/stuff/font/MavenPro-Medium.ttf +0 -0
- data/stuff/font/MavenPro-Regular.ttf +0 -0
- data/stuff/glyph/alert-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/alert-triangle-svgrepo-com.svg +12 -0
- data/stuff/glyph/archivebox-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-2-ccw-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-2-cw-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-2-rectangle-path-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-4-way-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-ccw-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-circle-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-circle-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-circle-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-circle-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-cw-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-from-line-down-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-from-line-left-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-from-line-right-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-from-line-up-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-from-shape-right-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-from-shape-up-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-right-arrow-left-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-shape-turn-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-shape-turn-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-small-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-small-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-small-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-small-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-thin-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-thin-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-thin-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-thin-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-to-line-down-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-to-line-left-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-to-line-right-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-to-line-up-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-to-shape-down-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-to-shape-right-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-trend-down-svgrepo-com.svg +12 -0
- data/stuff/glyph/arrow-trend-up-svgrepo-com.svg +12 -0
- data/stuff/glyph/arrow-turn-down-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-down-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-left-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-left-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-right-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-right-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-up-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-turn-up-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/arrow-up-arrow-down-svgrepo-com.svg +5 -0
- data/stuff/glyph/arrow-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/at-sign-svgrepo-com.svg +4 -0
- data/stuff/glyph/bag-svgrepo-com.svg +4 -0
- data/stuff/glyph/bell-slash-svgrepo-com.svg +6 -0
- data/stuff/glyph/bell-svgrepo-com.svg +5 -0
- data/stuff/glyph/book-open-svgrepo-com.svg +5 -0
- data/stuff/glyph/bookmark-svgrepo-com.svg +4 -0
- data/stuff/glyph/box-svgrepo-com.svg +6 -0
- data/stuff/glyph/calendar-svgrepo-com.svg +5 -0
- data/stuff/glyph/camera-svgrepo-com.svg +4 -0
- data/stuff/glyph/caret-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/caret-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/caret-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/caret-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/cart-svgrepo-com.svg +6 -0
- data/stuff/glyph/chart-pie-svgrepo-com.svg +5 -0
- data/stuff/glyph/chartbar-2-svgrepo-com.svg +7 -0
- data/stuff/glyph/chartbar-svgrepo-com.svg +7 -0
- data/stuff/glyph/checkmark-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/checkmark-double-svgrepo-com.svg +5 -0
- data/stuff/glyph/checkmark-square-svgrepo-com.svg +4 -0
- data/stuff/glyph/checkmark-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-left-chevron-right-svgrepo-com.svg +5 -0
- data/stuff/glyph/chevron-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-small-down-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-small-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-small-right-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-small-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/chevron-up-chevron-down-svgrepo-com.svg +5 -0
- data/stuff/glyph/chevron-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/clock-svgrepo-com.svg +4 -0
- data/stuff/glyph/cloud-arrow-up-svgrepo-com.svg +4 -0
- data/stuff/glyph/cloud-download-svgrepo-com.svg +4 -0
- data/stuff/glyph/cloud-slash-svgrepo-com.svg +5 -0
- data/stuff/glyph/cloud-svgrepo-com.svg +4 -0
- data/stuff/glyph/columns-svgrepo-com.svg +5 -0
- data/stuff/glyph/command-svgrepo-com.svg +4 -0
- data/stuff/glyph/compass-svgrepo-com.svg +5 -0
- data/stuff/glyph/credit-card-svgrepo-com.svg +5 -0
- data/stuff/glyph/crop-svgrepo-com.svg +5 -0
- data/stuff/glyph/crown-svgrepo-com.svg +4 -0
- data/stuff/glyph/delete-left-svgrepo-com.svg +4 -0
- data/stuff/glyph/device-desktop-svgrepo-com.svg +4 -0
- data/stuff/glyph/device-mobile-svgrepo-com.svg +4 -0
- data/stuff/glyph/device-tablet-svgrepo-com.svg +4 -0
- data/stuff/glyph/doc-svgrepo-com.svg +5 -0
- data/stuff/glyph/dot-small-svgrepo-com.svg +4 -0
- data/stuff/glyph/dots-3-horizontal-svgrepo-com.svg +6 -0
- data/stuff/glyph/dots-3-vertical-svgrepo-com.svg +6 -0
- data/stuff/glyph/dots-6-horizontal-svgrepo-com.svg +9 -0
- data/stuff/glyph/dots-6-vertical-svgrepo-com.svg +9 -0
- data/stuff/glyph/dots-9-svgrepo-com.svg +12 -0
- data/stuff/glyph/emoji-frown-svgrepo-com.svg +4 -0
- data/stuff/glyph/emoji-meh-svgrepo-com.svg +4 -0
- data/stuff/glyph/emoji-smile-svgrepo-com.svg +4 -0
- data/stuff/glyph/envelope-svgrepo-com.svg +5 -0
- data/stuff/glyph/external-link-svgrepo-com.svg +5 -0
- data/stuff/glyph/eye-slash-svgrepo-com.svg +15 -0
- data/stuff/glyph/eye-svgrepo-com.svg +4 -0
- data/stuff/glyph/filter-svgrepo-com.svg +4 -0
- data/stuff/glyph/flame-svgrepo-com.svg +4 -0
- data/stuff/glyph/floppy-disk-svgrepo-com.svg +4 -0
- data/stuff/glyph/folder-svgrepo-com.svg +4 -0
- data/stuff/glyph/fullscreen-alt-svgrepo-com.svg +7 -0
- data/stuff/glyph/fullscreen-exit-alt-svgrepo-com.svg +7 -0
- data/stuff/glyph/fullscreen-exit-svgrepo-com.svg +5 -0
- data/stuff/glyph/fullscreen-svgrepo-com.svg +5 -0
- data/stuff/glyph/gear-svgrepo-com.svg +4 -0
- data/stuff/glyph/giftbox-svgrepo-com.svg +6 -0
- data/stuff/glyph/half-star-svgrepo-com.svg +4 -0
- data/stuff/glyph/hashtag-svgrepo-com.svg +4 -0
- data/stuff/glyph/headphones-svgrepo-com.svg +4 -0
- data/stuff/glyph/heart-half-svgrepo-com.svg +4 -0
- data/stuff/glyph/heart-svgrepo-com.svg +4 -0
- data/stuff/glyph/house-svgrepo-com.svg +4 -0
- data/stuff/glyph/image-svgrepo-com.svg +4 -0
- data/stuff/glyph/info-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/key-svgrepo-com.svg +4 -0
- data/stuff/glyph/layers-3-svgrepo-com.svg +6 -0
- data/stuff/glyph/layout-svgrepo-com.svg +6 -0
- data/stuff/glyph/line-3-svgrepo-com.svg +6 -0
- data/stuff/glyph/link-alt-svgrepo-com.svg +5 -0
- data/stuff/glyph/link-svgrepo-com.svg +6 -0
- data/stuff/glyph/list-bullet-svgrepo-com.svg +9 -0
- data/stuff/glyph/location-svgrepo-com.svg +4 -0
- data/stuff/glyph/lock-open-svgrepo-com.svg +4 -0
- data/stuff/glyph/lock-svgrepo-com.svg +4 -0
- data/stuff/glyph/map-pin-svgrepo-com.svg +4 -0
- data/stuff/glyph/medal-svgrepo-com.svg +13 -0
- data/stuff/glyph/media-backward-end-svgrepo-com.svg +5 -0
- data/stuff/glyph/media-backward-svgrepo-com.svg +5 -0
- data/stuff/glyph/media-forward-end-svgrepo-com.svg +5 -0
- data/stuff/glyph/media-forward-svgrepo-com.svg +4 -0
- data/stuff/glyph/media-pause-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/media-pause-svgrepo-com.svg +5 -0
- data/stuff/glyph/media-play-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/media-play-svgrepo-com.svg +4 -0
- data/stuff/glyph/media-stop-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/media-stop-svgrepo-com.svg +4 -0
- data/stuff/glyph/message-bubble-2-svgrepo-com.svg +4 -0
- data/stuff/glyph/message-bubble-svgrepo-com.svg +4 -0
- data/stuff/glyph/mic-slash-svgrepo-com.svg +6 -0
- data/stuff/glyph/mic-svgrepo-com.svg +5 -0
- data/stuff/glyph/minus-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/minus-square-svgrepo-com.svg +4 -0
- data/stuff/glyph/minus-svgrepo-com.svg +4 -0
- data/stuff/glyph/moon-svgrepo-com.svg +4 -0
- data/stuff/glyph/music-note-svgrepo-com.svg +4 -0
- data/stuff/glyph/nosign-svgrepo-com.svg +4 -0
- data/stuff/glyph/paper-clip-svgrepo-com.svg +4 -0
- data/stuff/glyph/paper-plane-svgrepo-com.svg +4 -0
- data/stuff/glyph/pen-tool-svgrepo-com.svg +4 -0
- data/stuff/glyph/pencil-svgrepo-com.svg +5 -0
- data/stuff/glyph/percent-svgrepo-com.svg +6 -0
- data/stuff/glyph/phone-incoming-svgrepo-com.svg +5 -0
- data/stuff/glyph/phone-missed-svgrepo-com.svg +4 -0
- data/stuff/glyph/phone-outgoing-svgrepo-com.svg +5 -0
- data/stuff/glyph/phone-slash-svgrepo-com.svg +4 -0
- data/stuff/glyph/phone-svgrepo-com.svg +4 -0
- data/stuff/glyph/plus-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/plus-square-svgrepo-com.svg +4 -0
- data/stuff/glyph/plus-svgrepo-com.svg +4 -0
- data/stuff/glyph/power-svgrepo-com.svg +5 -0
- data/stuff/glyph/printer-svgrepo-com.svg +5 -0
- data/stuff/glyph/question-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/scissors-svgrepo-com.svg +5 -0
- data/stuff/glyph/search-svgrepo-com.svg +4 -0
- data/stuff/glyph/server-svgrepo-com.svg +5 -0
- data/stuff/glyph/shape-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/shape-rhombus-svgrepo-com.svg +4 -0
- data/stuff/glyph/shape-square-svgrepo-com.svg +4 -0
- data/stuff/glyph/shape-triangle-svgrepo-com.svg +12 -0
- data/stuff/glyph/share-svgrepo-com.svg +4 -0
- data/stuff/glyph/shield-slash-svgrepo-com.svg +13 -0
- data/stuff/glyph/shield-svgrepo-com.svg +4 -0
- data/stuff/glyph/shippingbox-svgrepo-com.svg +7 -0
- data/stuff/glyph/slider-3-horizontal-svgrepo-com.svg +9 -0
- data/stuff/glyph/slider-3-vertical-svgrepo-com.svg +9 -0
- data/stuff/glyph/speaker-svgrepo-com.svg +4 -0
- data/stuff/glyph/speaker-wave-1-svgrepo-com.svg +5 -0
- data/stuff/glyph/speaker-wave-2-svgrepo-com.svg +6 -0
- data/stuff/glyph/speaker-xmark-svgrepo-com.svg +5 -0
- data/stuff/glyph/square-4-grid-svgrepo-com.svg +7 -0
- data/stuff/glyph/square-on-square-svgrepo-com.svg +5 -0
- data/stuff/glyph/star-svgrepo-com.svg +4 -0
- data/stuff/glyph/sun-svgrepo-com.svg +12 -0
- data/stuff/glyph/tag-svgrepo-com.svg +4 -0
- data/stuff/glyph/text-align-center-svgrepo-com.svg +7 -0
- data/stuff/glyph/text-align-justify-svgrepo-com.svg +7 -0
- data/stuff/glyph/text-align-left-svgrepo-com.svg +7 -0
- data/stuff/glyph/text-align-right-svgrepo-com.svg +7 -0
- data/stuff/glyph/text-bold-svgrepo-com.svg +4 -0
- data/stuff/glyph/text-heading-svgrepo-com.svg +4 -0
- data/stuff/glyph/text-italic-svgrepo-com.svg +4 -0
- data/stuff/glyph/text-svgrepo-com.svg +4 -0
- data/stuff/glyph/text-underline-svgrepo-com.svg +5 -0
- data/stuff/glyph/thumbs-down-svgrepo-com.svg +5 -0
- data/stuff/glyph/thumbs-up-svgrepo-com.svg +5 -0
- data/stuff/glyph/trash-svgrepo-com.svg +5 -0
- data/stuff/glyph/tray-svgrepo-com.svg +4 -0
- data/stuff/glyph/umbrela-svgrepo-com.svg +4 -0
- data/stuff/glyph/user-svgrepo-com.svg +5 -0
- data/stuff/glyph/users-svgrepo-com.svg +7 -0
- data/stuff/glyph/video-svgrepo-com.svg +12 -0
- data/stuff/glyph/waveform-ecg-svgrepo-com.svg +4 -0
- data/stuff/glyph/wi-fi-svgrepo-com.svg +7 -0
- data/stuff/glyph/xmark-circle-svgrepo-com.svg +4 -0
- data/stuff/glyph/xmark-small-svgrepo-com.svg +4 -0
- data/stuff/glyph/xmark-svgrepo-com.svg +4 -0
- data/stuff/glyph/zap-svgrepo-com.svg +4 -0
- data/stuff/glyph/zoom-in-svgrepo-com.svg +5 -0
- data/stuff/glyph/zoom-out-svgrepo-com.svg +5 -0
- data/stuff/readme.md +266 -0
- data/stuff/so/libSDL3.so +0 -0
- data/stuff/so/libpastele.so +0 -0
- data/stuff/so/libthorvg-1.so +0 -0
- metadata +427 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
require_relative 'service/service_filter'
|
|
2
|
+
|
|
3
|
+
module Kredki
|
|
4
|
+
module Pads
|
|
5
|
+
# Pane of Pads module.
|
|
6
|
+
class Pane < Kredki::Pane
|
|
7
|
+
include ServiceFilter
|
|
8
|
+
|
|
9
|
+
# Add new layer.
|
|
10
|
+
def layer! ...
|
|
11
|
+
put(Layer, __method__, ...)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Match self with +filter+.
|
|
15
|
+
def =~ filter
|
|
16
|
+
case filter
|
|
17
|
+
when nil
|
|
18
|
+
true
|
|
19
|
+
when Module, Proc
|
|
20
|
+
filter === self
|
|
21
|
+
when Array
|
|
22
|
+
filter.all?{|it| self =~ it }
|
|
23
|
+
when Hash
|
|
24
|
+
filter.all?{|key, value| respond_to? key and value === send(key) }
|
|
25
|
+
else
|
|
26
|
+
raise "Unsupported =~ (#{filter} : #{filter.class})"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Get lower services iterator - empty because Pane is always the lowest.
|
|
31
|
+
def lower_iterator include_self = false
|
|
32
|
+
[]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
class << self
|
|
36
|
+
attr_accessor :sketch_layer
|
|
37
|
+
|
|
38
|
+
# Define custom base layer for this Pane subclass.
|
|
39
|
+
def layer! &block
|
|
40
|
+
self.sketch_layer = Class.new Layer
|
|
41
|
+
sketch_layer.define_method :sketch do
|
|
42
|
+
super()
|
|
43
|
+
pane.sketch_layer_block self, &block
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# :section: LEVEL 2
|
|
49
|
+
|
|
50
|
+
self.sketch_layer = Layer
|
|
51
|
+
|
|
52
|
+
def initialize *a, **ka
|
|
53
|
+
super()
|
|
54
|
+
|
|
55
|
+
@event_queue = EventQueue.new
|
|
56
|
+
@services = []
|
|
57
|
+
@mouse_stale = false
|
|
58
|
+
@sketch_a = a
|
|
59
|
+
@sketch_ka = ka
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def sketch_layer_block layer, &block
|
|
63
|
+
layer.instance_exec *@sketch_a, **@sketch_ka, &block
|
|
64
|
+
@sketch_a = @sketch_ka = nil
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def sketch
|
|
68
|
+
super
|
|
69
|
+
|
|
70
|
+
put(self.class.sketch_layer).keyboard_request
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def behavior
|
|
74
|
+
super
|
|
75
|
+
on_mouse_move do: method(:mouse_move_event)
|
|
76
|
+
on_mouse_enter do: method(:mouse_enter_event)
|
|
77
|
+
on_mouse_leave do: method(:mouse_leave_event)
|
|
78
|
+
on_mouse_press do: method(:mouse_event)
|
|
79
|
+
on_mouse_release do: method(:mouse_event)
|
|
80
|
+
on_mouse_scroll do: method(:mouse_event)
|
|
81
|
+
on_drop do: method(:mouse_event)
|
|
82
|
+
on_key_press do: method(:keyboard_event)
|
|
83
|
+
on_key_release do: method(:keyboard_event)
|
|
84
|
+
on_text_input do: method(:keyboard_event)
|
|
85
|
+
on_joystick_press do: method(:joystick_event)
|
|
86
|
+
on_joystick_release do: method(:joystick_event)
|
|
87
|
+
on_joystick_move do: method(:joystick_event)
|
|
88
|
+
on_joystick_switch do: method(:joystick_event)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def context_service
|
|
92
|
+
super
|
|
93
|
+
@services.last
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def resize_event event
|
|
97
|
+
super
|
|
98
|
+
sx, sy = event.size
|
|
99
|
+
@services.each do |it|
|
|
100
|
+
it.update_xy 0, 0
|
|
101
|
+
it.set_size sx, sy
|
|
102
|
+
it.update_size sx, sy
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
attr_accessor :mouse_stale
|
|
107
|
+
|
|
108
|
+
def event_queue
|
|
109
|
+
@event_queue
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def layer
|
|
113
|
+
@services.last
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def lower
|
|
117
|
+
nil
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def lower_pad
|
|
121
|
+
nil
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def area_size_x
|
|
125
|
+
window.size[0]
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def area_size_y
|
|
129
|
+
window.size[1]
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def area_size
|
|
133
|
+
window.size
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def clip_size_x
|
|
137
|
+
window.size[0]
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def clip_size_y
|
|
141
|
+
window.size[1]
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def clip_size
|
|
145
|
+
window.size
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def tick ms
|
|
149
|
+
super
|
|
150
|
+
arrange
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
def arrange
|
|
154
|
+
update_mouse_location if @services.count(&:arrange) > 0 || @mouse_stale
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def pad_tree
|
|
158
|
+
@services.map{|it| [it, it.pad_tree] }.to_h
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
def mouse_event event
|
|
162
|
+
arrange
|
|
163
|
+
@services.reverse_each do |layer|
|
|
164
|
+
event.target = nil
|
|
165
|
+
event = layer.mouse_event event
|
|
166
|
+
@event_queue.process
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
def mouse_move_event event
|
|
171
|
+
update_mouse_location event
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
def mouse_enter_event event
|
|
175
|
+
update_mouse_location
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
def mouse_leave_event event
|
|
179
|
+
update_mouse_location
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
def update_mouse_location event = nil
|
|
183
|
+
event ||= PositionEvent.new *window.mouse_xy
|
|
184
|
+
xy = event.xy
|
|
185
|
+
cursor = nil
|
|
186
|
+
@services.reverse_each do |layer|
|
|
187
|
+
if event.closed?
|
|
188
|
+
layer.clear_mouse_location xy
|
|
189
|
+
else
|
|
190
|
+
event = layer.update_mouse_location event
|
|
191
|
+
cursor ||= layer.layer_mouse_cursor
|
|
192
|
+
end
|
|
193
|
+
@event_queue.process
|
|
194
|
+
end
|
|
195
|
+
Kredki.mouse.set_cursor cursor
|
|
196
|
+
@mouse_stale = false
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def keyboard_event event
|
|
200
|
+
@services.reverse_each.find do |layer|
|
|
201
|
+
event.target = nil
|
|
202
|
+
layer.keyboard_event event
|
|
203
|
+
@event_queue.process
|
|
204
|
+
event.closed?
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
def joystick_event event
|
|
209
|
+
@services.reverse_each.find do |layer|
|
|
210
|
+
event.target = nil
|
|
211
|
+
layer.joystick_event event
|
|
212
|
+
@event_queue.process
|
|
213
|
+
event.closed?
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
def put subject, *a, at: nil, **ka, &b
|
|
218
|
+
case subject
|
|
219
|
+
when Class
|
|
220
|
+
put subject.new, *a, at: at, **ka, &b
|
|
221
|
+
else
|
|
222
|
+
layer = subject
|
|
223
|
+
put_layer layer, at if at != false
|
|
224
|
+
layer.set *a, **ka, &b
|
|
225
|
+
layer
|
|
226
|
+
end
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
def put_layer layer, at = nil
|
|
230
|
+
layer.pad_attach self, at
|
|
231
|
+
case at
|
|
232
|
+
when Integer
|
|
233
|
+
paint_state = put_paint layer.scene, false
|
|
234
|
+
@services.insert at, pad
|
|
235
|
+
when Layer
|
|
236
|
+
paint_state = put_paint layer.scene, false, at.scene
|
|
237
|
+
@services.insert @services.index(at), layer
|
|
238
|
+
else
|
|
239
|
+
paint_state = put_paint layer.scene, false
|
|
240
|
+
@services << layer
|
|
241
|
+
end
|
|
242
|
+
layer.sketch_service
|
|
243
|
+
sx, sy = window.size
|
|
244
|
+
layer.update_xy 0, 0
|
|
245
|
+
layer.set_size sx, sy
|
|
246
|
+
layer.update_size sx, sy
|
|
247
|
+
layer&.break_layout
|
|
248
|
+
@mouse_stale = true
|
|
249
|
+
layer
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
def layers
|
|
253
|
+
@services
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
def delete_upper upper
|
|
257
|
+
@services.delete upper
|
|
258
|
+
@mouse_stale = true
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
def delete_pad pad, transfer = false
|
|
262
|
+
@services.delete pad
|
|
263
|
+
@mouse_stale = true
|
|
264
|
+
end
|
|
265
|
+
end
|
|
266
|
+
end
|
|
267
|
+
end
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
module Kredki
|
|
2
|
+
module Pads
|
|
3
|
+
# A layer which translates all mouse pointer events.
|
|
4
|
+
class PortalLayer < Layer
|
|
5
|
+
|
|
6
|
+
# :section: LEVEL 2
|
|
7
|
+
|
|
8
|
+
module PortalMouseEvent
|
|
9
|
+
def x
|
|
10
|
+
@x
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def y
|
|
14
|
+
@y
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def xy
|
|
18
|
+
[@x, @y]
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def param
|
|
22
|
+
xy
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def initialize x, y, ...
|
|
26
|
+
super(nil, ...)
|
|
27
|
+
@x = x
|
|
28
|
+
@y = y
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
class PortalMousePointerMoveEvent < MousePointerMoveEvent
|
|
33
|
+
include PortalMouseEvent
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
module PortalMouseButtonEvent
|
|
37
|
+
include PortalMouseEvent
|
|
38
|
+
|
|
39
|
+
def button
|
|
40
|
+
@source.button
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def code
|
|
44
|
+
@source.code
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def param
|
|
48
|
+
@source.param
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
class PortalMouseButtonPressEvent < MouseButtonPressEvent
|
|
53
|
+
include PortalMouseButtonEvent
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
class PortalMouseButtonReleaseEvent < MouseButtonReleaseEvent
|
|
57
|
+
include PortalMouseButtonEvent
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
attr_accessor :entry
|
|
61
|
+
attr_accessor :exit
|
|
62
|
+
|
|
63
|
+
def mouse_event event
|
|
64
|
+
case event
|
|
65
|
+
when MouseButtonPressEvent
|
|
66
|
+
PortalMouseButtonPressEvent.new *translated_xy(event.xy), event
|
|
67
|
+
when MouseButtonReleaseEvent
|
|
68
|
+
PortalMouseButtonReleaseEvent.new *translated_xy(event.xy), event
|
|
69
|
+
else
|
|
70
|
+
event
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def translated_xy xy
|
|
75
|
+
lx, ly = pane.translate *xy, @entry
|
|
76
|
+
@exit.translate lx * @exit.area_size_x / @entry.area_size_x, ly * @exit.area_size_y / @entry.area_size_y
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def update_mouse_location event
|
|
80
|
+
xy = event.xy
|
|
81
|
+
|
|
82
|
+
@entry.layer.arrange
|
|
83
|
+
@mouse_pads, last_mouse_pads = [], @mouse_pads
|
|
84
|
+
@entry.layer.point_pads *xy, @mouse_pads
|
|
85
|
+
if @mouse_pads.last != @entry
|
|
86
|
+
pad_detach
|
|
87
|
+
return event
|
|
88
|
+
end
|
|
89
|
+
PortalMousePointerMoveEvent.new *translated_xy(event.xy), event
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
require_relative 'item_button'
|
|
2
|
+
require_relative 'item'
|
|
3
|
+
|
|
4
|
+
module Kredki
|
|
5
|
+
module Pads
|
|
6
|
+
module Radio
|
|
7
|
+
# Group of radio items.
|
|
8
|
+
class Group < Service
|
|
9
|
+
|
|
10
|
+
# Add new radio item.
|
|
11
|
+
def item! ...
|
|
12
|
+
put(Item, __method__, ...)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# :section: LEVEL 2
|
|
16
|
+
|
|
17
|
+
def key event, item_button
|
|
18
|
+
case event.key.id
|
|
19
|
+
when :up
|
|
20
|
+
previous_item_button(item_button).keyboard_request
|
|
21
|
+
event.close
|
|
22
|
+
when :down
|
|
23
|
+
next_item_button(item_button).keyboard_request
|
|
24
|
+
event.close
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def previous_item_button item_button
|
|
29
|
+
item_buttons = each_upper(ItemButton).to_a
|
|
30
|
+
item_buttons[item_buttons.index(item_button) - 1]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def next_item_button item_button
|
|
34
|
+
item_buttons = each_upper(ItemButton).to_a
|
|
35
|
+
item_buttons[(item_buttons.index(item_button) + 1) % item_buttons.size]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def update_selected item_button, selected
|
|
39
|
+
each_upper(ItemButton){|it| it.selected }.each{|it| it.update_selected false } if selected
|
|
40
|
+
item_button.update_selected selected
|
|
41
|
+
end
|
|
42
|
+
end#Group
|
|
43
|
+
end#Radio
|
|
44
|
+
end#Pads
|
|
45
|
+
end#Kredki
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
module Kredki
|
|
2
|
+
module Pads
|
|
3
|
+
module Radio
|
|
4
|
+
# Radio item.
|
|
5
|
+
class Item < SpacePad
|
|
6
|
+
|
|
7
|
+
# Set whether is selected.
|
|
8
|
+
def set_selected ...
|
|
9
|
+
@button.set_selected(...)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# See #set_selected.
|
|
13
|
+
def selected= param
|
|
14
|
+
@button.selected = param
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Get whether is selected.
|
|
18
|
+
def selected
|
|
19
|
+
@button.selected
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Set a feature recognized by its class.
|
|
23
|
+
def << feature
|
|
24
|
+
case feature
|
|
25
|
+
when String
|
|
26
|
+
find(Label)&.set feature or default_text feature
|
|
27
|
+
self.subject ||= feature
|
|
28
|
+
else
|
|
29
|
+
super
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# :section: LEVEL 2
|
|
34
|
+
|
|
35
|
+
def initialize
|
|
36
|
+
super
|
|
37
|
+
|
|
38
|
+
@button = default_item_button
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def attach lower, at: nil
|
|
42
|
+
pad_detach
|
|
43
|
+
pad_attach lower, at: at
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def sketch
|
|
47
|
+
super
|
|
48
|
+
|
|
49
|
+
set_size_y Fit
|
|
50
|
+
set_spacer 8
|
|
51
|
+
set_layout :xsc
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def repaint event = nil
|
|
55
|
+
set_opacity in_disabled ? 3/4r : 1r
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def default_item_button
|
|
59
|
+
put ItemButton
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def default_text text
|
|
63
|
+
put Label, text
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
module Kredki
|
|
2
|
+
module Pads
|
|
3
|
+
module Radio
|
|
4
|
+
# Radio item button model.
|
|
5
|
+
class ItemButton < RectanglePad
|
|
6
|
+
|
|
7
|
+
# Set suit.
|
|
8
|
+
def set_suit *suit
|
|
9
|
+
return send_bundle :set_suit, yield(self.suit) if block_given?
|
|
10
|
+
suit = Util.uncover suit
|
|
11
|
+
return if @suit == suit && suit != :random
|
|
12
|
+
@suit = suit
|
|
13
|
+
repaint
|
|
14
|
+
true
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# See #set_suit.
|
|
18
|
+
def suit= param
|
|
19
|
+
send_bundle :set_suit, param
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Get suit.
|
|
23
|
+
def suit
|
|
24
|
+
@suit
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Set whether is selected.
|
|
28
|
+
def set_selected value = true
|
|
29
|
+
return if (c = selected) == (value = block_given? ? yield(c) : value == Not ? !c : value)
|
|
30
|
+
update_group_selected value
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# See #set_selected.
|
|
34
|
+
def selected= param
|
|
35
|
+
send_bundle :set_selected, param
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Get whether is selected.
|
|
39
|
+
def selected
|
|
40
|
+
@selected
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
class SelectEvent < Event
|
|
44
|
+
def initialize value
|
|
45
|
+
@value = value
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
attr :value
|
|
49
|
+
|
|
50
|
+
def param
|
|
51
|
+
@target.subject
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def on_select ...
|
|
56
|
+
on(SelectEvent, ...)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def on_select= param
|
|
60
|
+
on_select do: param
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# :section: LEVEL 2
|
|
64
|
+
|
|
65
|
+
def initialize
|
|
66
|
+
super
|
|
67
|
+
|
|
68
|
+
@check = default_check
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def sketch
|
|
72
|
+
super
|
|
73
|
+
|
|
74
|
+
set_area @scene.new_ellipse
|
|
75
|
+
set_keyboardy true
|
|
76
|
+
set_stroke_width 1
|
|
77
|
+
set_layout :zcc
|
|
78
|
+
set_size 16
|
|
79
|
+
set_margin 3
|
|
80
|
+
set_suit :gray
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def presence
|
|
84
|
+
super
|
|
85
|
+
|
|
86
|
+
Event.each(
|
|
87
|
+
on_focus_enter,
|
|
88
|
+
on_focus_leave,
|
|
89
|
+
on_mouse_press,
|
|
90
|
+
on_mouse_release,
|
|
91
|
+
on_mouse_enter,
|
|
92
|
+
on_mouse_leave,
|
|
93
|
+
do: method(:repaint)
|
|
94
|
+
)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def repaint event = nil
|
|
98
|
+
color = Kredki.color @suit
|
|
99
|
+
if in_disabled
|
|
100
|
+
area.set fill: color
|
|
101
|
+
area.set stroke_fill: color.darken
|
|
102
|
+
else
|
|
103
|
+
area.set fill: pin_top ? color.darken : mouse_in ? color.lighten : color
|
|
104
|
+
area.set stroke_fill: keyboard_in ? :stroke_focus : color.darken
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def behavior
|
|
109
|
+
super
|
|
110
|
+
|
|
111
|
+
Event.each on_mouse_click, on_key(:space, :enter) do |e|
|
|
112
|
+
report SelectEvent.new true if !selected
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
on_select early: true do |e|
|
|
116
|
+
e.close if in_disabled || set_selected(e.value).not
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
on_key_press do |e|
|
|
120
|
+
find_lower(Group).key e, self
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def update_group_selected selected
|
|
125
|
+
find_lower(Group)&.update_selected self, selected or update_selected selected
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def update_selected selected
|
|
129
|
+
@selected = selected
|
|
130
|
+
@check.set_scenic selected
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def default_check
|
|
134
|
+
put ShapePad, mousy: false, keyboardy: false, fill: :text, size: 1r do
|
|
135
|
+
set_area @scene.new_ellipse
|
|
136
|
+
set_scenic false
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
end
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
module Kredki
|
|
2
|
+
# Responsible for the order in which events are reported.
|
|
3
|
+
class EventQueue
|
|
4
|
+
|
|
5
|
+
# :section: LEVEL 2
|
|
6
|
+
|
|
7
|
+
# The maximum number of reported events in one call, before EventQueue switch to loop safe mode.
|
|
8
|
+
EVENT_LOOP_SAFE_THRESHOLD = 500
|
|
9
|
+
|
|
10
|
+
def initialize
|
|
11
|
+
@stops = []
|
|
12
|
+
@stem = false
|
|
13
|
+
@i = -1
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def inspect
|
|
17
|
+
"#{self.class}:#{object_id}"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def push event, stop, early = false, instant = false
|
|
21
|
+
if instant
|
|
22
|
+
@stops[@i += 1] = [stop, event, early]
|
|
23
|
+
else
|
|
24
|
+
@stops << [stop, event, early]
|
|
25
|
+
end
|
|
26
|
+
process if !@stem
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def process
|
|
30
|
+
stem, @stem = @stem, true
|
|
31
|
+
(0..).each do |i|
|
|
32
|
+
@i = i
|
|
33
|
+
if i > EVENT_LOOP_SAFE_THRESHOLD
|
|
34
|
+
begin
|
|
35
|
+
return loop_safe_report i
|
|
36
|
+
ensure
|
|
37
|
+
@stops = []
|
|
38
|
+
@stem = stem
|
|
39
|
+
@i = -1
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
stop = @stops[i]
|
|
43
|
+
unless stop
|
|
44
|
+
@stops = []
|
|
45
|
+
@stem = stem
|
|
46
|
+
@i = -1
|
|
47
|
+
return
|
|
48
|
+
end
|
|
49
|
+
stop, event, early = *stop
|
|
50
|
+
stop.report event, early
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
private
|
|
55
|
+
|
|
56
|
+
class EventLoopError < Exception
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def loop_error range
|
|
60
|
+
raise EventLoopError.new "#{@stops[range]}"
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def loop_safe_report start = 0
|
|
64
|
+
proceed = {}
|
|
65
|
+
(start..).each do |i|
|
|
66
|
+
@i = i
|
|
67
|
+
return unless stop = @stops[i]
|
|
68
|
+
if j = proceed[stop]
|
|
69
|
+
loop_error j..i
|
|
70
|
+
else
|
|
71
|
+
proceed[stop] = i
|
|
72
|
+
end
|
|
73
|
+
stop, event, early = *stop
|
|
74
|
+
stop.report event, early
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
end
|
|
79
|
+
end
|