Class: WinFFI::User32::WindowPos

Inherits:
FFIStruct
  • Object
show all
Defined in:
lib/win-ffi/structs/user32/window/window_pos.rb

Constant Summary collapse

FLAGS_INV =
SetWindowPosFlags.to_hash.reduce(Hash.new{|h,k| h[k] = []}){|h,(k,v)| h[v] << k; h}.freeze

Instance Method Summary collapse

Methods inherited from FFIStruct

layout

Instance Method Details

#bottomObject



33
34
35
# File 'lib/win-ffi/structs/user32/window/window_pos.rb', line 33

def bottom
  height + top
end

#bottom=(v) ⇒ Object



37
38
39
# File 'lib/win-ffi/structs/user32/window/window_pos.rb', line 37

def bottom=(v)
  self.height = v - top
end

#flagsObject



16
17
18
19
# File 'lib/win-ffi/structs/user32/window/window_pos.rb', line 16

def flags
  val = self[:flags]
  Set.new(FLAGS_INV.select { |k,_| val & k != 0 }.reduce([]) { |a,(_,v)| a << v }.flatten)
end

#flags=(flags) ⇒ Object



21
22
23
# File 'lib/win-ffi/structs/user32/window/window_pos.rb', line 21

def flags=(flags)
  self[:flags] = [*flags].reduce(0) { |a,f| a | SetWindowPosFlags[f].to_i }
end

#rightObject



25
26
27
# File 'lib/win-ffi/structs/user32/window/window_pos.rb', line 25

def right
  width + left
end

#right=(v) ⇒ Object



29
30
31
# File 'lib/win-ffi/structs/user32/window/window_pos.rb', line 29

def right=(v)
  self.width = v - left
end

#to_sObject



41
42
43
# File 'lib/win-ffi/structs/user32/window/window_pos.rb', line 41

def to_s
  "left = #{left}, top = #{top}, width = #{width}, height = #{height}, flags = #{flags.to_a.inspect}"
end