Class: Exerb::Resource::GroupIcon

Inherits:
Base
  • Object
show all
Defined in:
lib/exerb/resource/group_icon.rb

Overview

#

Defined Under Namespace

Classes: Entry

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#size

Constructor Details

#initializeGroupIcon

Returns a new instance of GroupIcon.



22
23
24
25
# File 'lib/exerb/resource/group_icon.rb', line 22

def initialize
  super()
  @entries = []
end

Instance Attribute Details

#entriesObject (readonly)

Returns the value of attribute entries.



27
28
29
# File 'lib/exerb/resource/group_icon.rb', line 27

def entries
  @entries
end

Instance Method Details

#add(id, icon) ⇒ Object



29
30
31
32
# File 'lib/exerb/resource/group_icon.rb', line 29

def add(id, icon)
  @entries << Entry.new(id, icon.width, icon.height, icon.bit_count, icon.size)
  return self
end

#packObject



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/exerb/resource/group_icon.rb', line 34

def pack
  header = Exerb::Win32::Struct::IconHeader.new
  header.reserved = 0
  header.type     = 1
  header.count    = @entries.size

  packed_header  = header.pack
  packed_entries = @entries.collect { |entry| entry.pack }.join

  return packed_header + packed_entries
end