diff --git a/README.md b/README.md index db4dde9..4894b3f 100644 --- a/README.md +++ b/README.md @@ -35,9 +35,14 @@ app_options = { can_resize: true }.freeze + MittensUi::Application.Window(app_options) do - add_contact_button = MittensUi::Button.new(title: "Add") - remove_contact_button = MittensUi::Button.new(title: "Remove") + file_menus = { "File": { sub_menus: ["Exit"] } }.freeze + + fm = MittensUi::FileMenu.new(file_menus).render + + add_contact_button = MittensUi::Button.new(title: "Add", icon: :add_green) + remove_contact_button = MittensUi::Button.new(title: "Remove", icon: :remove_red) buttons = [ add_contact_button, remove_contact_button ] @@ -68,7 +73,6 @@ MittensUi::Application.Window(app_options) do MittensUi::HBox.new(tb_list, spacing: 10).render # ACTONS - add_contact_button.click do |_b| if tb_list.map { |tb| tb.text.length > 0 }.all? contacts_table.add(tb_list.map {|tb| tb.text }) @@ -80,7 +84,7 @@ MittensUi::Application.Window(app_options) do removed = contacts_table.remove_selected if removed.size > 0 - MittensUi::Alert.new("#{removed[0]} was removed.").render + MittensUi::Notify.new("#{removed[0]} was removed.", type: :info).render end end @@ -95,8 +99,12 @@ MittensUi::Application.Window(app_options) do MittensUi::Alert.new(msg).render end -end + fm.exit do |fm| + MittensUi::Application.exit { print "Exiting App!"} + end + +end ``` ## Development diff --git a/examples/contacts.rb b/examples/contacts.rb index cc2c192..f9a92fe 100644 --- a/examples/contacts.rb +++ b/examples/contacts.rb @@ -10,9 +10,7 @@ MittensUi::Application.Window(app_options) do - file_menus = { - "File": { sub_menus: ["Exit"] } - }.freeze + file_menus = { "File": { sub_menus: ["Exit"] } }.freeze fm = MittensUi::FileMenu.new(file_menus).render diff --git a/lib/mittens_ui/version.rb b/lib/mittens_ui/version.rb index 6ec1fb7..6216138 100644 --- a/lib/mittens_ui/version.rb +++ b/lib/mittens_ui/version.rb @@ -1,3 +1,3 @@ module MittensUi - VERSION = "0.0.10" + VERSION = "0.0.11" end