Module: Fzeet::HeaderMethods

Included in:
Header
Defined in:
lib/fzeet/windows/comctl/Header.rb

Constant Summary collapse

Prefix =
{
	xstyle: [:ws_ex_],
	style: [:hds_, :ws_],
	message: [:hdm_, :ccm_, :wm_],
	notification: [:hdn_, :nm_]
}

Instance Method Summary collapse

Instance Method Details

#countObject



137
# File 'lib/fzeet/windows/comctl/Header.rb', line 137

def count; sendmsg(:getitemcount) end

#insertItem(i, text, width) ⇒ Object



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/fzeet/windows/comctl/Header.rb', line 139

def insertItem(i, text, width)
	hdi = Windows::HDITEM.new

	hdi[:mask] = Fzeet.flags([:width, :text, :format, :order], :hdi_)
	hdi[:cxy] = width
	hdi[:pszText] = ptext = FFI::MemoryPointer.from_string(text)
	hdi[:fmt] = Fzeet.flags([:left, :string], :hdf_)
	hdi[:iOrder] = i

	sendmsg(:insertitem, 0, hdi.pointer)

	self
ensure
	ptext.free
end

#modifyItem(i, text, style = 0) ⇒ Object



155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/fzeet/windows/comctl/Header.rb', line 155

def modifyItem(i, text, style = 0)
	hdi = Windows::HDITEM.new

	hdi[:mask] = Fzeet.flags([:text, :format], :hdi_)
	hdi[:pszText] = ptext = FFI::MemoryPointer.from_string(text)
	hdi[:fmt] = Fzeet.flags([:left, :string], :hdf_)
	hdi[:fmt] |= Fzeet.flags([*style].compact, :hdf_)

	sendmsg(:setitem, i, hdi.pointer)

	self
ensure
	ptext.free
end