Class: Fzeet::UIRibbon::GalleryItem

Inherits:
Windows::UISimplePropertySetCallback
  • Object
show all
Defined in:
lib/fzeet/windows/uiribbon.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label, categoryId = 0, image = nil) ⇒ GalleryItem

Returns a new instance of GalleryItem.



525
526
527
528
529
# File 'lib/fzeet/windows/uiribbon.rb', line 525

def initialize(label, categoryId = 0, image = nil)
	@label, @categoryId, @image = label, categoryId, image

	super()
end

Instance Attribute Details

#categoryIdObject (readonly)

Returns the value of attribute categoryId.



531
532
533
# File 'lib/fzeet/windows/uiribbon.rb', line 531

def categoryId
  @categoryId
end

#imageObject (readonly)

Returns the value of attribute image.



531
532
533
# File 'lib/fzeet/windows/uiribbon.rb', line 531

def image
  @image
end

#labelObject (readonly)

Returns the value of attribute label.



531
532
533
# File 'lib/fzeet/windows/uiribbon.rb', line 531

def label
  @label
end

Instance Method Details

#GetValue(pkey, pvalue) ⇒ Object



533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
# File 'lib/fzeet/windows/uiribbon.rb', line 533

def GetValue(pkey, pvalue)
	key, value = Windows::PROPERTYKEY.new(pkey), Windows::PROPVARIANT.new(pvalue)

	case key
	when Windows::UI_PKEY_CategoryId
		value.uint = @categoryId; Windows::S_OK
	when Windows::UI_PKEY_Label
		value.wstring = @label; Windows::S_OK
	when Windows::UI_PKEY_ItemImage
		FFI::MemoryPointer.new(:pointer) { |punk|
			Windows::UIImageFromBitmap.new.CreateImage(PARGB32.new(@image).handle, Windows::UI_OWNERSHIP_TRANSFER, punk)

			unk = Windows::Unknown.new(punk.read_pointer)
			value.unknown = unk
			unk.Release
		}

		Windows::S_OK
	else
		Windows::E_NOTIMPL
	end
end