summaryrefslogtreecommitdiffstats
path: root/test/test_naviframe.rb
blob: 9350d065b715c7904e135625ed75de386eab2b9e (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#! /usr/bin/env ruby
# -*- coding: UTF-8 -*-
#
require 'efl/elm/elm_win'
require 'efl/elm/elm_bg'
require 'efl/elm/elm_button'
require 'efl/elm/elm_naviframe'
#
include Efl
#
class MyWin < Elm::ElmWin
  #
  attr_reader :frames
  def initialize
    super(nil, "Greetings") do
      title_set "Hello, World!"
      resize 240, 400
      show
    end
    @bg = Elm::ElmBg.new(self) do
      size_hint_weight_expand
      show
    end
    resize_object_add @bg
    #
    @naviframe = Elm::ElmNaviFrame.new(self) do
      size_hint_weight_expand
      size_hint_align_fill
      show
    end
    resize_object_add @naviframe
    #
    @frames = 0
    add_frame
  end
  #
  def add_frame *a
    @frames += 1
    _self = self
    @content = Elm::ElmButton.new(self) do
      text_set "content #{_self.frames}"
      size_hint_weight_expand
      size_hint_align_fill
      smart_callback_add "clicked", _self.method(:add_frame)
      show
    end
    @naviframe.item_push("test #{@frames}", nil, nil, @content, nil)
  end
end
#
Elm.init
#
MyWin.new
#
Elm.run
Elm.shutdown
#
# EOF