Class: Fzeet::Windows::PropertyStore
- Inherits:
-
Object
- Object
- Fzeet::Windows::PropertyStore
- Includes:
- Enumerable
- Defined in:
- lib/fzeet/windows/propsys.rb,
lib/fzeet/windows/uiribbon.rb
Instance Method Summary collapse
- #commit ⇒ Object
- #count ⇒ Object (also: #size, #length)
- #each ⇒ Object
-
#get(k) ⇒ Object
superclass.superclass is FFI::Struct, so do NOT touch [] and []=.
- #key(i) ⇒ Object
- #prop(*args) ⇒ Object
- #set(k, v) ⇒ Object
- #uiprop(*args) ⇒ Object
- #update(from) ⇒ Object
Instance Method Details
#commit ⇒ Object
41 |
# File 'lib/fzeet/windows/propsys.rb', line 41 def commit; Commit(); self end |
#count ⇒ Object Also known as: size, length
23 |
# File 'lib/fzeet/windows/propsys.rb', line 23 def count; FFI::MemoryPointer.new(:ulong) { |pc| GetCount(pc); return pc.get_ulong(0) } end |
#each ⇒ Object
43 |
# File 'lib/fzeet/windows/propsys.rb', line 43 def each; length.times { |i| v = get(k = key(i)); yield k, v }; self end |
#get(k) ⇒ Object
superclass.superclass is FFI::Struct, so do NOT touch [] and []=
30 |
# File 'lib/fzeet/windows/propsys.rb', line 30 def get(k) PROPVARIANT.new.tap { |v| GetValue(k, v) } end |
#key(i) ⇒ Object
27 |
# File 'lib/fzeet/windows/propsys.rb', line 27 def key(i) PROPERTYKEY.new.tap { |k| GetAt(i, k) } end |
#prop(*args) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/fzeet/windows/propsys.rb', line 33 def prop(*args) case args.length when 1; get(*args) when 2; set(*args) else raise ArgumentError end end |
#set(k, v) ⇒ Object
31 |
# File 'lib/fzeet/windows/propsys.rb', line 31 def set(k, v) SetValue(k, v); self end |
#uiprop(*args) ⇒ Object
392 393 394 395 396 |
# File 'lib/fzeet/windows/uiribbon.rb', line 392 def uiprop(*args) args[0] = Windows.const_get("UI_PKEY_#{args[0]}") prop(*args) end |
#update(from) ⇒ Object
398 399 400 401 402 403 404 405 406 407 408 409 410 411 |
# File 'lib/fzeet/windows/uiribbon.rb', line 398 def update(from) case from when Windows::LOGFONT uiprop(:FontProperties_Family, Windows::PROPVARIANT[:wstring, from.face]) uiprop(:FontProperties_Size, Windows::PROPVARIANT[:decimal, from.size.round]) uiprop(:FontProperties_Bold, Windows::PROPVARIANT[:uint, (from.bold?) ? 2 : 1]) uiprop(:FontProperties_Italic, Windows::PROPVARIANT[:uint, (from.italic?) ? 2 : 1]) uiprop(:FontProperties_Underline, Windows::PROPVARIANT[:uint, (from.underline?) ? 2 : 1]) uiprop(:FontProperties_Strikethrough, Windows::PROPVARIANT[:uint, (from.strikeout?) ? 2 : 1]) else raise ArgumentError end self end |