Module: Tgui::WidgetOwner

Extended by:
BangDef
Included in:
Container, ToolTip
Defined in:
lib/white_gold/convention/container_widgets.rb

Constant Summary collapse

@@auto_button_name =
"Button0"

Instance Method Summary collapse

Methods included from BangDef

def!

Instance Method Details

#child_methodsObject



78
79
80
81
# File 'lib/white_gold/convention/container_widgets.rb', line 78

def child_methods
  ## TO OPTIMIZE

  methods.filter{ _1.start_with? ApiChild::API_CHILD_PREFIX }
end

#common_widget_nest(widget, *keys, id: nil, **na, &b) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/white_gold/convention/container_widgets.rb', line 50

def common_widget_nest widget, *keys, id: nil, **na, &b
  club_params = {}
  Enumerator.new do |e|
    cl = widget.class
    while cl != Object
      e << cl
      cl = cl.superclass
    end
    e << Object
  end.to_a.reverse!.each do |key|
    if key == widget.class
      club = page.club key
      club.join id if id
    else
      club = page.club key, create_on_missing: false
    end
    club_params.merge! club.params if club
  end
  
  keys.each do |key|
    club = page.club key
    club.join id if id
    club_params.merge! club.params
  end
  
  upon! widget, **club_params, **na, &b
end

#equip_child_widget(widget) ⇒ Object



83
84
85
86
87
88
89
90
91
92
# File 'lib/white_gold/convention/container_widgets.rb', line 83

def equip_child_widget widget
  widget.page = page
  parent = self
  child_methods.each do |method|
    widget.define_singleton_method method[ApiChild::API_CHILD_PREFIX.length..] do |*a|
      parent.send(method, self, *a)
    end
  end
  widget
end