Module: Teek::UI

Defined in:
lib/teek/ui.rb,
lib/teek/ui/var.rb,
lib/teek/ui/node.rb,
lib/teek/ui/image.rb,
lib/teek/ui/scope.rb,
lib/teek/ui/errors.rb,
lib/teek/ui/handle.rb,
lib/teek/ui/keysyms.rb,
lib/teek/ui/screens.rb,
lib/teek/ui/session.rb,
lib/teek/ui/version.rb,
lib/teek/ui/document.rb,
lib/teek/ui/realizer.rb,
lib/teek/ui/event_bus.rb,
lib/teek/ui/validator.rb,
lib/teek/ui/widget_dsl.rb,
lib/teek/ui/canvas_item.rb,
lib/teek/ui/modal_stack.rb,
lib/teek/ui/widget_type.rb,
lib/teek/ui/menu_builder.rb,
lib/teek/ui/mouse_events.rb,
lib/teek/ui/text_content.rb,
lib/teek/ui/widget_types.rb,
lib/teek/ui/event_binding.rb,
lib/teek/ui/realized_node.rb,
lib/teek/ui/tab_validator.rb,
lib/teek/ui/grid_validator.rb,
lib/teek/ui/pane_validator.rb,
lib/teek/ui/tree_inspector.rb,
lib/teek/ui/overlay_anchors.rb,
lib/teek/ui/component_handle.rb,
lib/teek/ui/widget_types/tab.rb,
lib/teek/ui/overlay_validator.rb,
lib/teek/ui/widget_addressing.rb,
lib/teek/ui/widget_types/pane.rb,
lib/teek/ui/widget_validators.rb,
lib/teek/ui/option_dump_parsing.rb,
lib/teek/ui/widget_types/window.rb,
lib/teek/ui/menu_entry_addressing.rb

Overview

A DSL for building teek (Tk) apps - sugar over teek, not a wall around it. Everything here compiles down to plain teek calls, and every handle keeps an escape hatch back to the underlying App.

Defined Under Namespace

Modules: GridValidator, Keysyms, MouseEvents, OptionDumpParsing, OverlayAnchors, OverlayValidator, PaneRealize, PaneValidator, TabRealize, TabValidator, WidgetDSL, WindowRealize Classes: CanvasItem, ClosedBuilderError, ComponentHandle, Document, EventBinding, EventBus, Handle, Image, MenuBuilder, MenuEntryAddressing, ModalStack, Node, NotRealizedError, RealizedNode, Realizer, Scope, Screens, Session, TextContent, TreeInspector, ValidationError, Validator, Var, WidgetAddressing, WidgetType, WidgetTypes, WidgetValidators

Constant Summary collapse

VERSION =
"0.1.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.auto_scrollBoolean

Returns whether a bare list/text_area/table/tree auto-attaches a scrollbar with no ui.scrollable wrapper needed - true by default. Three levels can override it, most specific wins: a widget's own scroll: option, then Teek::UI.app's own scroll:, then this global default.

Returns:

  • (Boolean)

    whether a bare list/text_area/table/tree auto-attaches a scrollbar with no ui.scrollable wrapper needed - true by default. Three levels can override it, most specific wins: a widget's own scroll: option, then Teek::UI.app's own scroll:, then this global default.



20
21
22
# File 'lib/teek/ui.rb', line 20

def auto_scroll
  @auto_scroll
end

.auto_scroll_canvasBoolean

Returns the same default, but for canvas specifically - false by default, since a canvas is as often fixed drawing as scrollable content, unlike the other native types.

Returns:

  • (Boolean)

    the same default, but for canvas specifically - false by default, since a canvas is as often fixed drawing as scrollable content, unlike the other native types.



25
26
27
# File 'lib/teek/ui.rb', line 25

def auto_scroll_canvas
  @auto_scroll_canvas
end

Class Method Details

.app(title: nil, scroll: nil, **app_opts) {|ui| ... } ⇒ Session

Build an app. Constructs a Session (Tk-free - no App exists yet), yields it to the block, and returns that same session so .run/.run_async can be chained directly off the call. The underlying app is created lazily, at realize (see Teek::UI::Session#realize).

Examples:

Teek::UI.app(title: "Hello") do |ui|
  # widget/layout DSL calls go here
end.run

Parameters:

  • title (String, nil) (defaults to: nil)

    window title

  • scroll (Boolean, nil) (defaults to: nil)

    app-wide override for whether native scrollable widgets auto-attach a scrollbar - between a widget's own scroll: (most specific) and auto_scroll/auto_scroll_canvas (global default). nil (the default) defers straight to the global.

  • app_opts (Hash)

    forwarded to App.new at realize (e.g. debug:, track_widgets:)

Yield Parameters:

Returns:



48
49
50
51
52
# File 'lib/teek/ui.rb', line 48

def self.app(title: nil, scroll: nil, **app_opts, &block)
  session = Session.new(title: title, scroll: scroll, app_opts: app_opts)
  block.call(session) if block
  session
end