Module: MittensUi::Helpers

Included in:
Button, Core, HBox
Defined in:
lib/mittens_ui/helpers.rb

Instance Method Summary collapse

Instance Method Details

#icon_mapObject



3
4
5
6
7
8
9
10
# File 'lib/mittens_ui/helpers.rb', line 3

def icon_map
  {
    add:    "list-add-symbolic",
    remove: "list-remove-symbolic",
    add_green: 'add',
    remove_red: 'remove'
  }.freeze
end

#list_system_iconsObject



12
13
14
15
# File 'lib/mittens_ui/helpers.rb', line 12

def list_system_icons
  @theme = Gtk::IconTheme.default
  puts @theme.icons
end

#set_margin_from_opts_for(widget, options = {}) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/mittens_ui/helpers.rb', line 17

def set_margin_from_opts_for(widget, options={})
  margin_top    = options[:top].nil?    ? nil : options[:top]
  margin_bottom = options[:bottom].nil? ? nil : options[:bottom]
  margin_right  = options[:right].nil?  ? nil : options[:right]
  margin_left   = options[:left].nil?   ? nil : options[:left]

  unless margin_top.nil?
    widget.set_margin_top(margin_top)
  end

  unless margin_bottom.nil?
    widget.set_margin_bottom(margin_bottom)
  end

  unless margin_left.nil?
    widget.set_margin_left(margin_left)
  end

  unless margin_right.nil?
    widget.set_margin_right(margin_right)
  end
end