Class: Teek::Wm

Inherits:
Object
  • Object
show all
Defined in:
lib/teek/wm.rb

Overview

Note:

Prefer app.window(path) for new code - the same calls, without repeating window: on every one when you're working with one window repeatedly.

Thin, typed wrapper around Tk's wm (window manager) command family - one method per subcommand, coerced to the right Ruby type, reached via App#wm. Kept for callers already using app.wm.title(window: ...) - every method here is a one-line delegate to Window, which is where the actual wm/grab work now lives (see Window's own doc comment for why - the same window-scoped operations kept growing as more and more +window:+-kwarg methods flattened onto App).

See Also:

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Wm

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Wm.



18
19
20
# File 'lib/teek/wm.rb', line 18

def initialize(app)
  @app = app
end

Instance Method Details

#deiconify(window: '.') ⇒ void

This method returns an undefined value.

Show a window (map it if withdrawn/iconified).

Parameters:

  • window (String, Widget) (defaults to: '.')

    (default: the root window)



65
66
67
# File 'lib/teek/wm.rb', line 65

def deiconify(window: '.')
  @app.window(window).deiconify
end

#geometry(window: '.') ⇒ String

Returns geometry string (e.g. +"400x300+0+0"+).

Parameters:

  • window (String, Widget) (defaults to: '.')

    (default: the root window)

Returns:

  • (String)

    geometry string (e.g. +"400x300+0+0"+)



37
38
39
# File 'lib/teek/wm.rb', line 37

def geometry(window: '.')
  @app.window(window).geometry
end

#resizable(window: '.') ⇒ Array(Boolean, Boolean)

Returns [width_resizable, height_resizable].

Parameters:

  • window (String, Widget) (defaults to: '.')

    (default: the root window)

Returns:

  • (Array(Boolean, Boolean))

    [width_resizable, height_resizable]



50
51
52
# File 'lib/teek/wm.rb', line 50

def resizable(window: '.')
  @app.window(window).resizable
end

#set_geometry(value, window: '.') ⇒ String

Returns the geometry.

Parameters:

  • value (String)

    new geometry (e.g. "400x300", +"400x300+100+50"+)

  • window (String, Widget) (defaults to: '.')

    (default: the root window)

Returns:

  • (String)

    the geometry



44
45
46
# File 'lib/teek/wm.rb', line 44

def set_geometry(value, window: '.')
  @app.window(window).set_geometry(value)
end

#set_resizable(width, height, window: '.') ⇒ void

This method returns an undefined value.

Parameters:

  • width (Boolean)

    allow horizontal resize

  • height (Boolean)

    allow vertical resize

  • window (String, Widget) (defaults to: '.')

    (default: the root window)



58
59
60
# File 'lib/teek/wm.rb', line 58

def set_resizable(width, height, window: '.')
  @app.window(window).set_resizable(width, height)
end

#set_title(value, window: '.') ⇒ String

Returns the title.

Parameters:

  • value (String)

    new title

  • window (String, Widget) (defaults to: '.')

    (default: the root window)

Returns:

  • (String)

    the title



31
32
33
# File 'lib/teek/wm.rb', line 31

def set_title(value, window: '.')
  @app.window(window).set_title(value)
end

#title(window: '.') ⇒ String

Returns the window's current title.

Parameters:

  • window (String, Widget) (defaults to: '.')

    (default: the root window)

Returns:

  • (String)

    the window's current title



24
25
26
# File 'lib/teek/wm.rb', line 24

def title(window: '.')
  @app.window(window).title
end

#withdraw(window: '.') ⇒ void

This method returns an undefined value.

Hide a window without destroying it.

Parameters:

  • window (String, Widget) (defaults to: '.')

    (default: the root window)



72
73
74
# File 'lib/teek/wm.rb', line 72

def withdraw(window: '.')
  @app.window(window).withdraw
end