Class: SKUI::Base

Inherits:
Object
  • Object
show all
Extended by:
Properties
Includes:
Events
Defined in:
src/SKUI/base.rb

Overview

Since:

  • 1.0.0

Direct Known Subclasses

Control, Window

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Events

#add_event_handler, included, #release_events, #trigger_event

Constructor Details

#initializeBase

Returns a new instance of Base.

Since:

  • 1.0.0



48
49
50
51
52
53
54
55
# File 'src/SKUI/base.rb', line 48

def initialize
  super()
  # @properties contains all the data that must be shared with the webdialog
  # in order to sync everything on both ends.
  @properties = JSON.new
  @properties[ :ui_id ] = "UI_#{object_id()}"
  @properties[ :type ] = typename()
end

Instance Attribute Details

#propertiesJSON

Returns:

Since:

  • 1.0.0



41
42
43
# File 'src/SKUI/base.rb', line 41

def properties
  @properties
end

#windowWindow|Nil

Returns:

Since:

  • 1.0.0



45
46
47
# File 'src/SKUI/base.rb', line 45

def window
  @window
end

Instance Method Details

#background_colorSketchup::Color, SystemColor

Returns:

Since:

  • 1.0.0



37
# File 'src/SKUI/base.rb', line 37

prop( :background_color, &TypeCheck::COLOR )

#fontFont, SystemFont

Returns:

Since:

  • 1.0.0



29
# File 'src/SKUI/base.rb', line 29

prop( :font, &TypeCheck::FONT )

#foreground_colorSketchup::Color, SystemColor

Returns:

Since:

  • 1.0.0



33
# File 'src/SKUI/base.rb', line 33

prop( :foreground_color, &TypeCheck::COLOR )

#inspectString

Returns:

  • (String)

Since:

  • 1.0.0



59
60
61
# File 'src/SKUI/base.rb', line 59

def inspect
  "<#{self.class}:#{object_id_hex}>"
end

#parentControlManager, Nil

Returns:

Since:

  • 1.0.0



25
# File 'src/SKUI/base.rb', line 25

prop( :parent, &TypeCheck::CONTAINER )

#releaseNil

Release all references to other objects. Setting them to nil. So that the GC can collect them.

Returns:

  • (Nil)

Since:

  • 1.0.0



74
75
76
77
78
79
80
# File 'src/SKUI/base.rb', line 74

def release
  release_events()
  @properties.clear
  @properties = nil
  @parent = nil
  nil
end

#to_jsString

Returns:

  • (String)

Since:

  • 1.0.0



65
66
67
# File 'src/SKUI/base.rb', line 65

def to_js
  ui_id.inspect
end

#typenameString

Returns:

  • (String)

Since:

  • 1.0.0



84
85
86
# File 'src/SKUI/base.rb', line 84

def typename
  self.class.to_s.split( '::' ).last
end

#ui_idString

ID string used by both Ruby and the WebDialog to keep each control in sync with each other when passing properties and events.

Returns:

  • (String)

Since:

  • 1.0.0



21
# File 'src/SKUI/base.rb', line 21

prop_reader( :ui_id )