Class: WindowState::WindowInfo
- Inherits:
-
Object
- Object
- WindowState::WindowInfo
- Includes:
- Windows::Window
- Defined in:
- lib/windowstate.rb
Constant Summary collapse
- WS_CAPTION =
0x00C00000
- WS_CHILD =
0x40000000
- WS_CLIPSIBLINGS =
0x04000000
- WS_DISABLED =
0x08000000
- WS_DLGFRAME =
0x00400000
- WS_POPUP =
0x80000000
- WS_SIZEBOX =
0x00040000
- WS_SYSMENU =
0x00080000
- WS_VISIBLE =
0x10000000
Instance Attribute Summary collapse
-
#data_encoded ⇒ Object
readonly
Returns the value of attribute data_encoded.
-
#handle ⇒ Object
readonly
Returns the value of attribute handle.
Class Method Summary collapse
Instance Method Summary collapse
- #application_window? ⇒ Boolean
- #data ⇒ Object
- #data=(array) ⇒ Object
- #get ⇒ Object
- #ignorable? ⇒ Boolean
-
#initialize(handle) ⇒ WindowInfo
constructor
A new instance of WindowInfo.
- #inspect ⇒ Object
- #style ⇒ Object
- #to_json(*a) ⇒ Object
Constructor Details
#initialize(handle) ⇒ WindowInfo
Returns a new instance of WindowInfo.
100 101 102 |
# File 'lib/windowstate.rb', line 100 def initialize(handle) @handle = handle end |
Instance Attribute Details
#data_encoded ⇒ Object (readonly)
Returns the value of attribute data_encoded.
92 93 94 |
# File 'lib/windowstate.rb', line 92 def data_encoded @data_encoded end |
#handle ⇒ Object (readonly)
Returns the value of attribute handle.
92 93 94 |
# File 'lib/windowstate.rb', line 92 def handle @handle end |
Class Method Details
.get(handle) ⇒ Object
94 95 96 97 98 |
# File 'lib/windowstate.rb', line 94 def self.get(handle) wp = new(handle) wp.get wp end |
Instance Method Details
#application_window? ⇒ Boolean
122 123 124 125 |
# File 'lib/windowstate.rb', line 122 def application_window? mask = (WS_SYSMENU | WS_VISIBLE) (style & mask == mask) && !ignorable? end |
#data ⇒ Object
110 111 112 |
# File 'lib/windowstate.rb', line 110 def data data_encoded.unpack("L14S2") end |
#data=(array) ⇒ Object
127 128 129 |
# File 'lib/windowstate.rb', line 127 def data=(array) @data_encoded = array.pack("L14S2") end |
#get ⇒ Object
104 105 106 107 108 |
# File 'lib/windowstate.rb', line 104 def get buffer = [60].pack("L") + '\0' * 56 GetWindowInfo(handle, buffer) @data_encoded = buffer end |
#ignorable? ⇒ Boolean
118 119 120 |
# File 'lib/windowstate.rb', line 118 def ignorable? style & (WS_DISABLED | WS_CHILD) > 0 end |
#inspect ⇒ Object
138 139 140 |
# File 'lib/windowstate.rb', line 138 def inspect "#<WindowState::WindowInfo:0x%08x @handle=%i, data=%s>" % [object_id, handle, data] end |
#style ⇒ Object
114 115 116 |
# File 'lib/windowstate.rb', line 114 def style data[9] end |
#to_json(*a) ⇒ Object
131 132 133 134 135 136 |
# File 'lib/windowstate.rb', line 131 def to_json(*a) { 'json_class' => self.class.name, 'data' => [handle, data] }.to_json(*a) end |