#! ruby -Ks
require "Phi" ; include Phi
require "RGUI"

plan = 5

case plan
when 4

form = Form.new
gb = GroupBox.new form, :group_box1, "グループボックス(plan = #{plan})"
gb.align = AL_CLIENT
frame = RGUI::Panel.new gb
frame.align = AL_CLIENT
p frame.top
frame.bevel_inner = BV_NONE
frame.bevel_outer = BV_NONE
frame_item = []
frame_item << Label.new(frame, :lab1, "ラベル1")
frame_item << Label.new(frame, :lab2, "ラベル2")

#    def initialize(homo=false,space=0,fill=true,vdir=:n,hdir=:w)
#hbox = UI::Hbox.new(frame_item, 5)

hbox = RGUI::Hbox.new(false,5)
hbox.add(frame_item)
frame.add hbox
form.on_resize = proc{frame.layout}
form.show
mainloop

when 5

module RGUI
  class GroupBox < Phi::GroupBox
    include PanelLayout
  end
end

form = Form.new
frame = RGUI::GroupBox.new form, :group_box1, "グループボックス(plan = #{plan})"
frame.align = AL_CLIENT
frame_item = []
frame_item << Label.new(frame, :lab1, "ラベル1")
frame_item << Label.new(frame, :lab2, "ラベル2")
hbox = RGUI::Hbox.new(false,5)
hbox.add(frame_item)
frame.add hbox
form.on_resize = proc{frame.layout}
form.show
mainloop

when 6

form = Form.new
frame = GroupBox.new form, :group_box1, "グループボックス(plan = #{plan})"
frame.align = AL_CLIENT
frame.extend RGUI::PanelLayout  ## <----
frame_item = []
frame_item << Label.new(frame, :lab1, "ラベル1")
frame_item << Label.new(frame, :lab2, "ラベル2")
hbox = RGUI::Hbox.new(false,5)
hbox.add(frame_item)
frame.add hbox
form.on_resize = proc{frame.layout}
form.show
mainloop

end
