Module: MittensUi::Helpers

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

Instance Method Summary collapse

Instance Method Details

#icon_mapObject



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

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

#list_system_iconsObject



14
15
16
17
# File 'lib/mittens_ui/helpers.rb', line 14

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

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



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/mittens_ui/helpers.rb', line 19

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]

  widget.set_margin_top(margin_top)       unless margin_top.nil?
  widget.set_margin_bottom(margin_bottom) unless margin_bottom.nil?
  widget.set_margin_start(margin_left)    unless margin_left.nil?
  widget.set_margin_end(margin_right)     unless margin_right.nil?
end