From 38301ebf1549042587ba3ce72bdb0963db04c0bc Mon Sep 17 00:00:00 2001 From: rubyFeedback <46686565+rubyFeedback@users.noreply.github.com> Date: Fri, 24 Jan 2025 19:03:55 +0000 Subject: [PATCH] Create font_button.rb First standalone addition of font_button - currently misses 3 components. --- examples2/font_button.rb | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 examples2/font_button.rb diff --git a/examples2/font_button.rb b/examples2/font_button.rb new file mode 100644 index 0000000..4b44c9c --- /dev/null +++ b/examples2/font_button.rb @@ -0,0 +1,37 @@ +# ============================================================================ # +# This example (font_button.rb) shall demonstrate the following +# functionality (5 components), as well as their implementation-status +# in regards to this file: +# +# :new_font_button # [DONE] +# :font_button_font # [NOT YET ADDED] +# :font_button_on_changed # [DONE] +# :free_font_button_font # [NOT YET ADDED] +# :free_font_descriptor #[NOT YET ADDED] +# +# Unsure what ":load_control_ font" is. +# ============================================================================ # +require 'libui' +LibUI.init # Initialize LibUI. + +main_window = LibUI.new_window('font_button.rb', 640, 240, 1) + +vbox = LibUI.new_vertical_box +LibUI.box_set_padded(vbox, 1) +_ = LibUI.new_font_button # Create a new font-button here. +LibUI.box_append(vbox, _, 0) # Add the font-button here. + +LibUI.font_button_on_changed(_) {|entry| + puts 'The font was changed. (class '+entry.class.to_s+')' +} + +LibUI.window_set_child(main_window, vbox) +LibUI.control_show(main_window) + +LibUI.window_on_closing(main_window) { + LibUI.quit + 1 +} + +LibUI.main +LibUI.uninit