ModraUp Ruby API Documentation Ruby API Reference

Class: UI::Notification

Inherits:
Object
  • Object
show all

Overview

Extend the notification bar. It will not dismiss if the timeout expires without calling the dismiss block.

Examples:

ext = SketchupExtension.new("Demo", "demo.rb")
n = UI::Notification.new(ext, "Loaded")
n.on_accept("OK") { }
n.show

Class Method Summary # collapse

Instance Method Summary # collapse

Class Method Details

Notification.new(extension, message = nil, icon_name = nil, icon_tooltip = nil) ⇒ notification

Parameters:

  • extension (SketchupExtension)
  • message (String)
  • icon_name (String)
  • icon_tooltip (String)

Returns:

  • (UI::Notification)

Examples:

UI::Notification.new(SketchupExtension.new("Demo", "demo.rb"), "hi")

Instance Method Details

notification.message ⇒ String

Body.

Returns:

  • (String)

Examples:

UI::Notification.new(SketchupExtension.new("D", "d.rb"), "hi").message

notification.message = text ⇒ text

Set the summary.

Parameters:

  • text (String)

Returns:

  • (String)

Examples:

n = UI::Notification.new(SketchupExtension.new("D", "d.rb"))
n.message = "Ready"

notification.icon_name ⇒ String

Icon path.

Returns:

  • (String)

Examples:

UI::Notification.new(SketchupExtension.new("D", "d.rb")).icon_name

notification.icon_name = path ⇒ path

Set the icon path.

Parameters:

  • path (String)

Returns:

  • (String)

Examples:

n = UI::Notification.new(SketchupExtension.new("D", "d.rb"))
n.icon_name = File.join(__dir__, "icon.png")

notification.icon_tooltip ⇒ String

Icon tooltip.

Returns:

  • (String)

Examples:

UI::Notification.new(SketchupExtension.new("D", "d.rb")).icon_tooltip

notification.icon_tooltip = text ⇒ text

Set the icon tooltip.

Parameters:

  • text (String)

Returns:

  • (String)

Examples:

n = UI::Notification.new(SketchupExtension.new("D", "d.rb"))
n.icon_tooltip = "Demo"

notification.on_accept(title) { } ⇒ truenotification.on_accept(title, proc) ⇒ true

Title of the Accept button and its callback.

Parameters:

  • title (String)
  • proc (Proc)

Returns:

  • (true)

Examples:

n = UI::Notification.new(SketchupExtension.new("D", "d.rb"), "hi")
n.on_accept("OK") { }

notification.on_dismiss(title) { } ⇒ truenotification.on_dismiss(title, proc) ⇒ true

Title of the close button and callback. Dismisses without calling the callback after a timeout.

Parameters:

  • title (String)
  • proc (Proc)

Returns:

  • (true)

Examples:

n = UI::Notification.new(SketchupExtension.new("D", "d.rb"), "hi")
n.on_dismiss("Close") { }

notification.on_accept_title ⇒ String

The current title of the accept button.

Returns:

  • (String)

Examples:

UI::Notification.new(SketchupExtension.new("D", "d.rb")).on_accept_title

notification.on_dismiss_title ⇒ String

Title of the close button.

Returns:

  • (String)

Examples:

UI::Notification.new(SketchupExtension.new("D", "d.rb")).on_dismiss_title

notification.show ⇒ Boolean

Display the notification. Return false if no host is available.

Returns:

  • (Boolean)

Examples:

UI::Notification.new(SketchupExtension.new("D", "d.rb"), "hi").show