Module: Bewildr::ControlPatterns::WindowPattern

Defined in:
lib/bewildr/control_patterns/window_pattern.rb

Instance Method Summary collapse

Instance Method Details

#closeObject

Closes the window



7
8
9
# File 'lib/bewildr/control_patterns/window_pattern.rb', line 7

def close
  @automation_element.get_current_pattern(System::Windows::Automation::WindowPattern.pattern).close
end

#maximizeObject

Maximizes the window



17
18
19
# File 'lib/bewildr/control_patterns/window_pattern.rb', line 17

def maximize
  @automation_element.get_current_pattern(System::Windows::Automation::WindowPattern.pattern).set_window_visual_state(System::Windows::Automation::WindowVisualState.maximized)
end

#minimizeObject

Minimizes the window



12
13
14
# File 'lib/bewildr/control_patterns/window_pattern.rb', line 12

def minimize
  @automation_element.get_current_pattern(System::Windows::Automation::WindowPattern.pattern).set_window_visual_state(System::Windows::Automation::WindowVisualState.minimized)
end

#restoreObject

Restores the window



22
23
24
# File 'lib/bewildr/control_patterns/window_pattern.rb', line 22

def restore
  @automation_element.get_current_pattern(System::Windows::Automation::WindowPattern.pattern).set_window_visual_state(System::Windows::Automation::WindowVisualState.normal)
end

#visual_stateObject

Returns the visual state of the window. Available states are:

:maximized
:minimized
:normal


30
31
32
33
34
35
36
# File 'lib/bewildr/control_patterns/window_pattern.rb', line 30

def visual_state
  case @automation_element.get_current_pattern(System::Windows::Automation::WindowPattern.pattern).current.window_visual_state
  when System::Windows::Automation::WindowVisualState.maximized then return :maximized
  when System::Windows::Automation::WindowVisualState.minimized then return :minimized
  when System::Windows::Automation::WindowVisualState.normal    then return :normal
  end
end