summaryrefslogtreecommitdiffstats
path: root/test/test_button.rb
blob: 9908a0a8f7c319d21ce837a33bb54fb5db77f0f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#! /usr/bin/env ruby
# -*- coding: UTF-8 -*-
#
require 'efl/elm/elm_win'
require 'efl/elm/elm_bg'
require 'efl/elm/elm_button'
#
include Efl
#
class MyWin < Elm::ElmWin
  #
  def initialize
    super(nil, "Greetings") do
      title_set "Hello, World!"
      autodel_set true
      resize 240, 60
      show
    end
    @bg = Elm::ElmBg.new(self) do
      size_hint_weight_expand
      show
    end
    resize_object_add @bg
    @btn = Elm::ElmButton.new(self) do
      part_text_set(nil, "Good-Bye, World!")
      smart_callback_add("clicked", ->(*_) { Elm.exit }, nil)
      resize 120, 30
      move 60, 15
      show
    end
  end
end
#
Elm.init
#
MyWin.new
Elm.elm_policy_set(0, 1)
#
Elm.run
Elm.shutdown
#
# EOF