sketchup-api-stubs 0.7.9 → 0.7.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sketchup-api-stubs/sketchup.rb +157 -151
  3. data/lib/sketchup-api-stubs/stubs/Array.rb +741 -741
  4. data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +322 -322
  5. data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +182 -172
  6. data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +111 -126
  7. data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +102 -102
  8. data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +423 -400
  9. data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +693 -661
  10. data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +535 -509
  11. data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +500 -476
  12. data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +267 -263
  13. data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +133 -141
  14. data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +547 -522
  15. data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +678 -693
  16. data/lib/sketchup-api-stubs/stubs/Geom.rb +351 -351
  17. data/lib/sketchup-api-stubs/stubs/LanguageHandler.rb +93 -93
  18. data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +595 -595
  19. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +751 -747
  20. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +183 -183
  21. data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
  22. data/lib/sketchup-api-stubs/stubs/Layout/Dictionary.rb +234 -0
  23. data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +683 -517
  24. data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
  25. data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +148 -148
  26. data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +464 -353
  27. data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +354 -354
  28. data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +311 -311
  29. data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +261 -261
  30. data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +91 -91
  31. data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +370 -370
  32. data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +218 -218
  33. data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +128 -128
  34. data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +225 -225
  35. data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +614 -567
  36. data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +10 -10
  37. data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +11 -11
  38. data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +282 -183
  39. data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +458 -387
  40. data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +209 -209
  41. data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +346 -344
  42. data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +174 -174
  43. data/lib/sketchup-api-stubs/stubs/Layout/ReferenceEntity.rb +82 -82
  44. data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +714 -692
  45. data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1565 -1519
  46. data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +290 -290
  47. data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +149 -149
  48. data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +139 -139
  49. data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +135 -135
  50. data/lib/sketchup-api-stubs/stubs/Layout.rb +25 -25
  51. data/lib/sketchup-api-stubs/stubs/Length.rb +286 -278
  52. data/lib/sketchup-api-stubs/stubs/Numeric.rb +249 -249
  53. data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +196 -144
  54. data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +169 -169
  55. data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +226 -209
  56. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +145 -150
  57. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +294 -281
  58. data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
  59. data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +296 -302
  60. data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +473 -478
  61. data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
  62. data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +121 -121
  63. data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +294 -294
  64. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +673 -659
  65. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +600 -593
  66. data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +76 -76
  67. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +252 -257
  68. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +32 -32
  69. data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +201 -201
  70. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +443 -449
  71. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +74 -74
  72. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +104 -104
  73. data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +167 -165
  74. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +306 -306
  75. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +42 -42
  76. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
  77. data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +403 -406
  78. data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +397 -397
  79. data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
  80. data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1282 -1239
  81. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +261 -261
  82. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +127 -127
  83. data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +519 -545
  84. data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +60 -60
  85. data/lib/sketchup-api-stubs/stubs/Sketchup/Environment.rb +406 -0
  86. data/lib/sketchup-api-stubs/stubs/Sketchup/Environments.rb +185 -0
  87. data/lib/sketchup-api-stubs/stubs/Sketchup/EnvironmentsObserver.rb +113 -0
  88. data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +122 -125
  89. data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +1006 -937
  90. data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +102 -102
  91. data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +740 -750
  92. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +289 -282
  93. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +64 -62
  94. data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
  95. data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +405 -468
  96. data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +266 -266
  97. data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +189 -189
  98. data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +432 -406
  99. data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +84 -84
  100. data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +307 -306
  101. data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +332 -326
  102. data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +380 -422
  103. data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +409 -427
  104. data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +241 -249
  105. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
  106. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +55 -48
  107. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
  108. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +114 -114
  109. data/lib/sketchup-api-stubs/stubs/Sketchup/LoadHandler.rb +70 -0
  110. data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
  111. data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +1115 -414
  112. data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +330 -317
  113. data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +142 -142
  114. data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +93 -93
  115. data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1714 -1652
  116. data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +372 -357
  117. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +133 -130
  118. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +271 -271
  119. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
  120. data/lib/sketchup-api-stubs/stubs/Sketchup/Overlay.rb +463 -490
  121. data/lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb +104 -116
  122. data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +939 -797
  123. data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +388 -361
  124. data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +77 -77
  125. data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +501 -478
  126. data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
  127. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +385 -361
  128. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +45 -45
  129. data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
  130. data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +451 -458
  131. data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +115 -115
  132. data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +211 -212
  133. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +259 -255
  134. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +59 -59
  135. data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -40
  136. data/lib/sketchup-api-stubs/stubs/Sketchup/Snap.rb +125 -0
  137. data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +88 -69
  138. data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +263 -217
  139. data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +283 -262
  140. data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +199 -217
  141. data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
  142. data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +924 -834
  143. data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
  144. data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +156 -156
  145. data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +75 -75
  146. data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +143 -142
  147. data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1566 -1311
  148. data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +71 -45
  149. data/lib/sketchup-api-stubs/stubs/Sketchup.rb +1429 -1377
  150. data/lib/sketchup-api-stubs/stubs/SketchupExtension.rb +353 -353
  151. data/lib/sketchup-api-stubs/stubs/String.rb +24 -24
  152. data/lib/sketchup-api-stubs/stubs/UI/Command.rb +399 -389
  153. data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +580 -494
  154. data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +280 -269
  155. data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +258 -241
  156. data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +636 -635
  157. data/lib/sketchup-api-stubs/stubs/UI.rb +791 -683
  158. data/lib/sketchup-api-stubs/stubs/_top_level.rb +303 -303
  159. data/lib/sketchup-api-stubs.rb +1 -1
  160. metadata +10 -24
@@ -1,494 +1,580 @@
1
- # Copyright:: Copyright 2023 Trimble Inc.
2
- # License:: The MIT License (MIT)
3
-
4
- # The Ruby HtmlDialog class allows you to create and interact with HTML dialog
5
- # boxes from Ruby. This is the best way to generate complex, embedded UIs
6
- # inside SketchUp, but it does generally require HTML and JavaScript expertise.
7
- #
8
- # If your goal is to simple display a website to your users, consider using
9
- # {UI#openURL}, which will show them a web page in their default browser rather
10
- # than inside a dialog in SketchUp.
11
- #
12
- # The left, top, width, height etc. dimensions of the dialog are in logical
13
- # units. This means you provide the units as if they where on a monitor with
14
- # "normal" DPI. The units given will be multiplied by the same factor as
15
- # returned by {UI.scale_factor}.
16
- #
17
- # For usage examples, including how to migrate from the old WebDialog class,
18
- # see https://github.com/SketchUp/htmldialog-examples.
19
- # You may use the {https://sketchup.github.io/modus-for-sketchup-extensions Trimble Modus}
20
- # framework for a look and feel of your dialog that matches that of SketchUp's dialogs.
21
- #
22
- # HtmlDialog uses the following versions of CEF (Chromium Embedded Framework):
23
- #
24
- # [SketchUp 2021.1]
25
- # CEF 88
26
- # [SketchUp 2019.0]
27
- # CEF 64
28
- # [SketchUp 2018.0]
29
- # CEF 56
30
- # [SketchUp 2017.0]
31
- # CEF 52
32
- #
33
- # @version SketchUp 2017
34
- class UI::HtmlDialog
35
-
36
- # Constants
37
-
38
- CEF_VERSION = nil # Stub value.
39
-
40
- CHROME_VERSION = nil # Stub value.
41
-
42
- STYLE_DIALOG = nil # Stub value.
43
- STYLE_UTILITY = nil # Stub value.
44
- STYLE_WINDOW = nil # Stub value.
45
-
46
- # Instance Methods
47
-
48
- # The {#add_action_callback} method establishes a Ruby callback method that your
49
- # html dialog can call to perform some function.
50
- #
51
- # Use the +sketchup.callback_method_name+ to invoke the callback method from your
52
- # html dialog. Your JavaScript in the html dialog will invoke the callback with
53
- # the same number of arguments.
54
- #
55
- # The call is asynchronous. JavaScript call might return before Ruby callback
56
- # even called. Use +onCompleted+ callback to get notified for completion.
57
- #
58
- # Basic types such as booleans, numbers, strings, arrays and hashes are
59
- # automatically converted between Ruby and JavaScript.
60
- #
61
- # @example Ruby Code
62
- # dialog.add_action_callback("say") { |action_context, param1, param2|
63
- # puts "JavaScript said #{param1} and #{param2}"
64
- # }
65
- #
66
- # @example JavaScript
67
- # sketchup.say('Hello World', 42);
68
- #
69
- # @example JavaScript with callback
70
- # sketchup.say('Hello World', 42, {
71
- # onCompleted: function() {
72
- # console.log('Ruby side done.');
73
- # }
74
- # });
75
- #
76
- # @note When an HtmlDialog is closed, all callbacks to that instance are
77
- # cleared. Re-attach them if you need to open the dialog again.
78
- #
79
- # @param [String] callback_name
80
- # The name of the callback method to be invoked from the html dialog.
81
- #
82
- # @return [Boolean] +true+ if action added successfully, +false+ otherwise.
83
- #
84
- # @version SketchUp 2017
85
- #
86
- # @yield [action_context, *args]
87
- #
88
- # @yieldparam [Object] action_context
89
- # Currently unused.
90
- #
91
- # @yieldparam [Array<Object>] args
92
- # The parameters sent from JavaScript.
93
- def add_action_callback(callback_name)
94
- end
95
-
96
- # The {#bring_to_front} method is used to bring the window to the front,
97
- # putting it on top of other windows even if its minimized.
98
- #
99
- # @bug Prior to SketchUp 2021.1, on Mac, the focus the was not being set
100
- # on the {UI::HtmlDialog}.
101
- #
102
- # @example
103
- # dialog.bring_to_front
104
- #
105
- # @return [nil]
106
- #
107
- # @see Sketchup.focus
108
- #
109
- # @version SketchUp 2017
110
- def bring_to_front
111
- end
112
-
113
- # The {#center} method is used to center the HtmlDialog relative to the active
114
- # model window. If there is no active model window, this function doesn't do
115
- # anything.
116
- #
117
- # @example
118
- # dialog.center
119
- #
120
- # @return [true] This always return true, never false.
121
- #
122
- # @version SketchUp 2017
123
- def center
124
- end
125
-
126
- # The {#close} method is used to close a dialog box.
127
- #
128
- # @example
129
- # dialog.close
130
- #
131
- # @return [nil]
132
- #
133
- # @version SketchUp 2017
134
- def close
135
- end
136
-
137
- # The {#execute_script} method is used to execute a JavaScript string on the
138
- # html dialog asynchronously.
139
- #
140
- # @example
141
- # js_command = "document.getElementById('id').innerHTML = '<b>Hi!</b>'"
142
- # dialog.execute_script(js_command)
143
- #
144
- # @param [String] script
145
- # The JavaScript script to execute on the HtmlDialog.
146
- #
147
- # @return [nil]
148
- #
149
- # @version SketchUp 2017
150
- def execute_script(script)
151
- end
152
-
153
- # The {#get_content_size} method is used to get the content size of the HtmlDialog, in logical
154
- # pixels.
155
- #
156
- # @example
157
- # width, height = dialog.get_content_size
158
- #
159
- # @return [Array(Integer, Integer), nil] Content width and height of the HtmlDialog.
160
- # A nil value is returned if the HtmlDialog
161
- # is not visible.
162
- #
163
- # @version SketchUp 2021.1
164
- def get_content_size
165
- end
166
-
167
- # The {#get_position} method is used to get the position of the HtmlDialog
168
- # relative to the screen, in logical pixels.
169
- #
170
- # @example
171
- # left, top = dialog.get_position
172
- #
173
- # @return [Array(Integer, Integer), nil] Left and top position of the dialog.
174
- # A nil value is returned if the HtmlDialog
175
- # is not visible.
176
- #
177
- # @version SketchUp 2021.1
178
- def get_position
179
- end
180
-
181
- # The {#get_size} method is used to get the outer frame size of the HtmlDialog, in logical pixels.
182
- #
183
- # @example
184
- # width, height = dialog.get_size
185
- #
186
- # @return [Array(Integer, Integer), nil] Outer frame width and height of the HtmlDialog.
187
- # A nil value is returned if the HtmlDialog
188
- # is not visible.
189
- #
190
- # @version SketchUp 2021.1
191
- def get_size
192
- end
193
-
194
- # The new method is used to create a new HtmlDialog.
195
- #
196
- # In SketchUp 2021.1 +use_content_size+ was added.
197
- # When set to +true+, +width+, +height+, +min_width+,
198
- # +max width+, +min_height+, +max_height+ will represent the size of the
199
- # content area of the window. This excludes the titlebar and the window frame.
200
- # When +use_content_size+ is set to +false+ (the default value),
201
- # the size dimensions will represent the outer frame size.
202
- #
203
- # The +properties+ hash accepts an optional key +style+ where the value is
204
- # one of:
205
- #
206
- # [+UI::HtmlDialog::STYLE_DIALOG+] HtmlDialog stays at the top of SketchUp.
207
- #
208
- # [+UI::HtmlDialog::STYLE_WINDOW+] HtmlDialog can go behind SketchUp and
209
- # doesn't disappear when SketchUp looses
210
- # focus.
211
- #
212
- # [+UI::HtmlDialog::STYLE_UTILITY+] HtmlDialog is shown with small titlebar
213
- # and stays on top of SketchUp.
214
- #
215
- # @bug Prior to SketchUp 2019 the +:width+ and +:height+ provided is ignored
216
- # if a +:preference_key+ is also present. To work around this bug on older
217
- # versions use {#set_size} after you initialize the dialog.
218
- #
219
- # @bug SketchUp 2022.0 fixed a bug where position was set incorrectly when
220
- # +use_content_size+ was set to +true+.
221
- #
222
- # @bug SketchUp 2022.0 fixed a bug where +max_height+ and +max_width+ were swapped
223
- # when +use_content_size+ was set to +true+.
224
- #
225
- # @bug SketchUp 2022.0 fixed a bug where +use_content_size+ was not persisted (when
226
- # +preferences_key+ is set).
227
- #
228
- # @bug SketchUp 2022.0 fixed a bug on Mac where size and position of the
229
- # HtmlDialog were not persisted when SketchUp was closed without first
230
- # closing the HtmlDialog window.
231
- #
232
- # @example With options Hash
233
- # dialog = UI::HtmlDialog.new(
234
- # {
235
- # :dialog_title => "Dialog Example",
236
- # :preferences_key => "com.sample.plugin",
237
- # :scrollable => true,
238
- # :resizable => true,
239
- # :width => 600,
240
- # :height => 400,
241
- # :left => 100,
242
- # :top => 100,
243
- # :min_width => 50,
244
- # :min_height => 50,
245
- # :max_width =>1000,
246
- # :max_height => 1000,
247
- # :style => UI::HtmlDialog::STYLE_DIALOG
248
- # })
249
- # dialog.set_url("http://www.sketchup.com")
250
- # dialog.show
251
- #
252
- # @example With keyword style argument
253
- # dialog = UI::HtmlDialog.new(
254
- # dialog_title: "Dialog Example",
255
- # preferences_key: "my_name_my_extension_my_dialog",
256
- # scrollable: true,
257
- # resizable: true,
258
- # width: 600,
259
- # height: 400,
260
- # left: 100,
261
- # top: 100,
262
- # min_width: 50,
263
- # min_height: 50,
264
- # max_width: 1000,
265
- # max_height: 1000,
266
- # style: UI::HtmlDialog::STYLE_DIALOG
267
- # )
268
- # dialog.set_url("https://www.sketchup.com")
269
- # dialog.show
270
- #
271
- # @note Prefix +preference_key+ with something unique to your extension.
272
- #
273
- # @note If there is no reference kept to the HtmlDialog object, the window
274
- # will close once the garbage collection runs. This behavior can be confusing
275
- # in trivial test code but is usually not a concern in real life scenarios.
276
- # Typically a persistent reference, e.g. an instance variable, should be kept
277
- # to bring the dialog to front, rather than creating a duplicate, if the user
278
- # should request it a second time.
279
- #
280
- # @option properties [String] :dialog_title
281
- #
282
- # @option properties [String] :preferences_key
283
- #
284
- # @option properties [Boolean] :scrollable
285
- #
286
- # @option properties [Boolean] :resizable (true)
287
- #
288
- # @option properties [Boolean] :use_content_size (false)
289
- #
290
- # @option properties [Integer] :width (250)
291
- #
292
- # @option properties [Integer] :height (250)
293
- #
294
- # @option properties [Integer] :left (0)
295
- #
296
- # @option properties [Integer] :top (0)
297
- #
298
- # @option properties [Integer] :min_width (0)
299
- #
300
- # @option properties [Integer] :min_height (0)
301
- #
302
- # @option properties [Integer] :max_width (-1)
303
- #
304
- # @option properties [Integer] :max_height (-1)
305
- #
306
- # @option properties [Integer] :style (UI::HtmlDialog::STYLE_DIALOG)
307
- #
308
- # @param [Hash] properties
309
- # A hash containing the initial properties of
310
- # the newly created dialog.
311
- #
312
- # @return [UI::HtmlDialog]
313
- #
314
- # @version SketchUp 2017
315
- def initialize(properties)
316
- end
317
-
318
- # The {#set_can_close} method is used to attach a block that is executed just
319
- # before closing, this block has to return a boolean, if the block returns
320
- # false the close will be canceled.
321
- #
322
- # @example
323
- # dialog.set_can_close { false }
324
- #
325
- # @return [Boolean]
326
- #
327
- # @version SketchUp 2017
328
- #
329
- # @yieldreturn [Boolean] Return a boolean to indicate if the dialogs should
330
- # close.
331
- def set_can_close
332
- end
333
-
334
- # The {#set_content_size} method is used to set the content size of the HtmlDialog, in logical
335
- # pixels.
336
- #
337
- # @example
338
- # dialog.set_content_size(600, 400)
339
- #
340
- # @param [Integer] width
341
- # Content width of the HtmlDialog.
342
- #
343
- # @param [Integer] height
344
- # Content height of the HtmlDialog.
345
- #
346
- # @return [nil]
347
- #
348
- # @version SketchUp 2021.1
349
- def set_content_size(width, height)
350
- end
351
-
352
- # The {#set_file} method is used to identify a local HTML file to display in the
353
- # HtmlDialog.
354
- #
355
- # @example
356
- # dialog.set_file("c:/mypage.html")
357
- #
358
- # @param [String] filename
359
- # The filename for the HtmlDialog file (HTML file)
360
- #
361
- # @return [nil]
362
- #
363
- # @version SketchUp 2017
364
- def set_file(filename)
365
- end
366
-
367
- # The {#set_html} method is used to load a HtmlDialog with a string of provided
368
- # HTML.
369
- #
370
- # @example
371
- # html = '<b>Hello world!</b>'
372
- # dialog.set_html(html)
373
- #
374
- # @param [String] html_string
375
- # A string of valid html to display in your
376
- # HtmlDialog.
377
- #
378
- # @return [nil]
379
- #
380
- # @version SketchUp 2017
381
- def set_html(html_string)
382
- end
383
-
384
- # The {#set_on_closed} method is used to attach a block that will be
385
- # executed when a dialog is already in the process of closing, do any last
386
- # minute operations within this block such as saving the current state.
387
- #
388
- # @example
389
- # dialog.set_on_closed { save_selection }
390
- #
391
- # @return [Boolean]
392
- #
393
- # @version SketchUp 2017
394
- def set_on_closed
395
- end
396
-
397
- # The {#set_position} method is used to set the position of the HtmlDialog
398
- # relative to the screen, in pixels.
399
- #
400
- # @bug Prior to SketchUp 2021.1, on Windows, calling this method incorrectly
401
- # set the focus on the {UI::HtmlDialog}.
402
- #
403
- # @example
404
- # dialog.set_position(100, 50)
405
- #
406
- # @param [Integer] left
407
- # The number of pixels from the left.
408
- #
409
- # @param [Integer] top
410
- # The number of pixels from the top of the screen.
411
- #
412
- # @return [true] This always return true, never false.
413
- #
414
- # @version SketchUp 2017
415
- def set_position(left, top)
416
- end
417
-
418
- # The {#set_size} method is used to set the outer frame size of the HtmlDialog, in pixels.
419
- #
420
- # @bug Prior to SketchUp 2021.1, on Windows, calling this method incorrectly
421
- # set the focus on the {UI::HtmlDialog}.
422
- #
423
- # @example
424
- # dialog.set_size(320, 240)
425
- #
426
- # @param [Integer] width
427
- # Outer frame width of the HtmlDialog.
428
- #
429
- # @param [Integer] height
430
- # Outer frame height of the HtmlDialog.
431
- #
432
- # @return [true] This always return true, never false.
433
- #
434
- # @version SketchUp 2017
435
- def set_size(width, height)
436
- end
437
-
438
- # The {#set_url} method is used to load a HtmlDialog with the content at a
439
- # specific URL. This method allows you to load web sites in a HtmlDialog.
440
- #
441
- # @example
442
- # dialog.set_url("https://www.sketchup.com")
443
- #
444
- # @param [String] url
445
- # The URL for a specific web site.
446
- #
447
- # @return [nil]
448
- #
449
- # @version SketchUp 2017
450
- def set_url(url)
451
- end
452
-
453
- # The {#show} method is used to display a non-modal dialog box.
454
- #
455
- # @example
456
- # dialog.show
457
- #
458
- # @return [nil]
459
- #
460
- # @version SketchUp 2017
461
- def show
462
- end
463
-
464
- # The {#show_modal} method is used to display a modal dialog box.
465
- #
466
- # @example
467
- # dialog.show_modal
468
- #
469
- # @return [nil]
470
- #
471
- # @version SketchUp 2017
472
- def show_modal
473
- end
474
-
475
- # The {#visible?} method is useful to tell if the dialog is shown and still
476
- # alive, if the dialog is minimized or not visible on the screen this will
477
- # still return +true+.
478
- #
479
- # @example
480
- # if dialog.visible?
481
- # dialog.bring_to_front
482
- # else
483
- # dialog = UI::HtmlDialog.new
484
- # dialog.set_url("https://www.sketchup.com")
485
- # dialog.show
486
- # end
487
- #
488
- # @return [Boolean] Returns true if the dialog is open.
489
- #
490
- # @version SketchUp 2017
491
- def visible?
492
- end
493
-
494
- end
1
+ # Copyright:: Copyright 2026 Trimble Inc.
2
+ # License:: The MIT License (MIT)
3
+
4
+ # The Ruby HtmlDialog class allows you to create and interact with HTML dialog
5
+ # boxes from Ruby. This is the best way to generate complex, embedded UIs
6
+ # inside SketchUp, but it does generally require HTML and JavaScript expertise.
7
+ #
8
+ # If your goal is to simple display a website to your users, consider using
9
+ # {UI#openURL}, which will show them a web page in their default browser rather
10
+ # than inside a dialog in SketchUp.
11
+ #
12
+ # The left, top, width, height etc. dimensions of the dialog are in logical
13
+ # units. This means you provide the units as if they where on a monitor with
14
+ # "normal" DPI. The units given will be multiplied by the same factor as
15
+ # returned by {UI.scale_factor}.
16
+ #
17
+ # For usage examples, including how to migrate from the old WebDialog class,
18
+ # see https://github.com/SketchUp/htmldialog-examples.
19
+ # You may use the {https://sketchup.github.io/modus-for-sketchup-extensions Trimble Modus}
20
+ # framework for a look and feel of your dialog that matches that of SketchUp's dialogs.
21
+ #
22
+ # HtmlDialog uses the following versions of CEF (Chromium Embedded Framework):
23
+ #
24
+ # [SketchUp 2025.0]
25
+ # CEF 128
26
+ # [SketchUp 2024.0]
27
+ # CEF 112
28
+ # [SketchUp 2021.1]
29
+ # CEF 88
30
+ # [SketchUp 2019.0]
31
+ # CEF 64
32
+ # [SketchUp 2018.0]
33
+ # CEF 56
34
+ # [SketchUp 2017.0]
35
+ # CEF 52
36
+ #
37
+ # Starting with SketchUp 2026.1, HtmlDialog exposes a small set of built-in callbacks (mirroring
38
+ # the legacy +skp:+ protocol used by {UI::WebDialog}).
39
+ #
40
+ # * +sketchup.launchEW(id)+ Opens the Extension Warehouse dialog and show a specified
41
+ # extension's page.
42
+ # * +sketchup.installRBZ(url)+ Downloads and installs a Ruby extension
43
+ # from the given +.rbz+ URL. (User will be prompted just like using the
44
+ # Extension Manager.)
45
+ #
46
+ # @example
47
+ # html = <<-HTML
48
+ # <button onclick="sketchup.launchEW('b5825acd-ba7c-4544-b255-e9935ddfd63b')">
49
+ # Open Advanced Camera Tools in EW
50
+ # </button>
51
+ # <button onclick="sketchup.installRBZ('https://example.com/my_extension.rbz')">
52
+ # Install My Extension
53
+ # </button>
54
+ # HTML
55
+ # dlg = UI::HtmlDialog.new(dialog_title: 'EW Example')
56
+ # dlg.set_html(html)
57
+ # dlg.show
58
+ #
59
+ # @note The window size is not guaranteed to be pixel perfect in all SketchUp
60
+ # versions and operating systems. Prefer responsive designs that can take
61
+ # up some fluctuations in size.
62
+ #
63
+ # @version SketchUp 2017
64
+ class UI::HtmlDialog
65
+
66
+ # Constants
67
+
68
+ CEF_VERSION = nil # Stub value.
69
+
70
+ CHROME_VERSION = nil # Stub value.
71
+
72
+ STYLE_DIALOG = nil # Stub value.
73
+ STYLE_UTILITY = nil # Stub value.
74
+ STYLE_WINDOW = nil # Stub value.
75
+
76
+ # Instance Methods
77
+
78
+ # The {#add_action_callback} method establishes a Ruby callback method that your
79
+ # html dialog can call to perform some function.
80
+ #
81
+ # Use the +sketchup.callback_method_name+ to invoke the callback method from your
82
+ # html dialog. Your JavaScript in the html dialog will invoke the callback with
83
+ # the same number of arguments.
84
+ #
85
+ # The call is asynchronous. JavaScript call might return before Ruby callback
86
+ # even called. Use +onCompleted+ callback to get notified for completion.
87
+ #
88
+ # Basic types such as booleans, numbers, strings, arrays and hashes are
89
+ # automatically converted between Ruby and JavaScript.
90
+ #
91
+ # @example Ruby Code
92
+ # dialog.add_action_callback("say") { |action_context, param1, param2|
93
+ # puts "JavaScript said #{param1} and #{param2}"
94
+ # }
95
+ # dialog.show # should be called directly after binding callbacks
96
+ #
97
+ # @example JavaScript
98
+ # sketchup.say('Hello World', 42);
99
+ #
100
+ # @example JavaScript with callback
101
+ # sketchup.say('Hello World', 42, {
102
+ # onCompleted: function() {
103
+ # console.log('Ruby side done.');
104
+ # }
105
+ # });
106
+ #
107
+ # @example A complete example containing both Ruby and JavaScript
108
+ # html = <<-HTML
109
+ # <h1>Hello World</h1>
110
+ # <p><button onclick="sketchup.say('Hello World', 42)">Say Hello</button></p>
111
+ # <p><button onclick="sketchup.say('Hello World', 66, { onCompleted: function() {
112
+ # console.log('Ruby side done.'); } })">Say Hello with Callback</button></p>
113
+ # HTML
114
+ #
115
+ # options = {
116
+ # :dialog_title => "Example Dialog",
117
+ # :preferences_key => "example.htmldialog",
118
+ # :style => UI::HtmlDialog::STYLE_DIALOG
119
+ # }
120
+ #
121
+ # dialog = UI::HtmlDialog.new(options)
122
+ # dialog.set_html(html)
123
+ # dialog.center
124
+ #
125
+ # dialog.add_action_callback("say") { |action_context, param1, param2|
126
+ # puts "JavaScript said #{param1} and #{param2}"
127
+ # }
128
+ #
129
+ # dialog.show # should be called directly after binding callbacks
130
+ #
131
+ # @note When an HtmlDialog is closed, all callbacks to that instance are
132
+ # cleared. Attach or re-attach them before you show the dialog.
133
+ #
134
+ # @param [String] callback_name
135
+ # The name of the callback method to be invoked from the html dialog.
136
+ #
137
+ # @return [Boolean] +true+ if action added successfully, +false+ otherwise.
138
+ #
139
+ # @version SketchUp 2017
140
+ #
141
+ # @yield [action_context, *args]
142
+ #
143
+ # @yieldparam [Object] action_context
144
+ # Currently unused.
145
+ #
146
+ # @yieldparam [Array<Object>] args
147
+ # The parameters sent from JavaScript.
148
+ def add_action_callback(callback_name)
149
+ end
150
+
151
+ # The {#bring_to_front} method is used to bring the window to the front,
152
+ # putting it on top of other windows even if its minimized.
153
+ #
154
+ # @bug Prior to SketchUp 2021.1, on Mac, the focus the was not being set
155
+ # on the {UI::HtmlDialog}.
156
+ #
157
+ # @example
158
+ # dialog.bring_to_front
159
+ #
160
+ # @return [nil]
161
+ #
162
+ # @see Sketchup.focus
163
+ #
164
+ # @version SketchUp 2017
165
+ def bring_to_front
166
+ end
167
+
168
+ # The {#center} method is used to center the HtmlDialog relative to the active
169
+ # model window. If there is no active model window, this function doesn't do
170
+ # anything.
171
+ #
172
+ # @example
173
+ # dialog.center
174
+ #
175
+ # @return [true] This always return true, never false.
176
+ #
177
+ # @version SketchUp 2017
178
+ def center
179
+ end
180
+
181
+ # The {#close} method is used to close a dialog box.
182
+ #
183
+ # @example
184
+ # dialog.close
185
+ #
186
+ # @return [nil]
187
+ #
188
+ # @version SketchUp 2017
189
+ def close
190
+ end
191
+
192
+ # The {#execute_script} method is used to execute a JavaScript string on the
193
+ # html dialog asynchronously.
194
+ #
195
+ # @example
196
+ # js_command = "document.getElementById('id').innerHTML = '<b>Hi!</b>'"
197
+ # dialog.execute_script(js_command)
198
+ #
199
+ # @param [String] script
200
+ # The JavaScript script to execute on the HtmlDialog.
201
+ #
202
+ # @return [nil]
203
+ #
204
+ # @version SketchUp 2017
205
+ def execute_script(script)
206
+ end
207
+
208
+ # The {#get_content_size} method is used to get the content size of the HtmlDialog, in logical
209
+ # pixels.
210
+ #
211
+ # @example
212
+ # width, height = dialog.get_content_size
213
+ #
214
+ # @return [Array(Integer, Integer), nil] Content width and height of the HtmlDialog.
215
+ # A nil value is returned if the HtmlDialog
216
+ # is not visible.
217
+ #
218
+ # @version SketchUp 2021.1
219
+ def get_content_size
220
+ end
221
+
222
+ # The {#get_position} method is used to get the position of the HtmlDialog
223
+ # relative to the screen, in logical pixels.
224
+ #
225
+ # @example
226
+ # left, top = dialog.get_position
227
+ #
228
+ # @return [Array(Integer, Integer), nil] Left and top position of the dialog.
229
+ # A nil value is returned if the HtmlDialog
230
+ # is not visible.
231
+ #
232
+ # @version SketchUp 2021.1
233
+ def get_position
234
+ end
235
+
236
+ # The {#get_size} method is used to get the outer frame size of the HtmlDialog, in logical pixels.
237
+ #
238
+ # @example
239
+ # width, height = dialog.get_size
240
+ #
241
+ # @return [Array(Integer, Integer), nil] Outer frame width and height of the HtmlDialog.
242
+ # A nil value is returned if the HtmlDialog
243
+ # is not visible.
244
+ #
245
+ # @version SketchUp 2021.1
246
+ def get_size
247
+ end
248
+
249
+ # The {#hide} method is used to hide a dialog box without closing it.
250
+ # This preserves the dialog's state and allows it to be shown again later
251
+ # without recreating the dialog.
252
+ #
253
+ # @example
254
+ # dialog.hide
255
+ #
256
+ # @note Modal dialogs cannot be hidden. Attempting to hide a modal dialog
257
+ # will raise an ArgumentError.
258
+ #
259
+ # @raise [ArgumentError] if the dialog is modal
260
+ #
261
+ # @return [nil]
262
+ #
263
+ # @version SketchUp 2026.1
264
+ def hide
265
+ end
266
+
267
+ # The new method is used to create a new HtmlDialog.
268
+ #
269
+ # In SketchUp 2021.1 +use_content_size+ was added.
270
+ # When set to +true+, +width+, +height+, +min_width+,
271
+ # +max width+, +min_height+, +max_height+ will represent the size of the
272
+ # content area of the window. This excludes the titlebar and the window frame.
273
+ # When +use_content_size+ is set to +false+ (the default value),
274
+ # the size dimensions will represent the outer frame size.
275
+ #
276
+ # The +properties+ hash accepts an optional key +style+ where the value is
277
+ # one of:
278
+ #
279
+ # [+UI::HtmlDialog::STYLE_DIALOG+] HtmlDialog stays at the top of SketchUp.
280
+ #
281
+ # [+UI::HtmlDialog::STYLE_WINDOW+] HtmlDialog can go behind SketchUp and
282
+ # doesn't disappear when SketchUp looses
283
+ # focus.
284
+ #
285
+ # [+UI::HtmlDialog::STYLE_UTILITY+] HtmlDialog is shown with small titlebar
286
+ # and stays on top of SketchUp.
287
+ #
288
+ # @bug Prior to SketchUp 2019 the +:width+ and +:height+ provided is ignored
289
+ # if a +:preference_key+ is also present. To work around this bug on older
290
+ # versions use {#set_size} after you initialize the dialog.
291
+ #
292
+ # @bug SketchUp 2022.0 fixed a bug where position was set incorrectly when
293
+ # +use_content_size+ was set to +true+.
294
+ #
295
+ # @bug SketchUp 2022.0 fixed a bug where +max_height+ and +max_width+ were swapped
296
+ # when +use_content_size+ was set to +true+.
297
+ #
298
+ # @bug SketchUp 2022.0 fixed a bug where +use_content_size+ was not persisted (when
299
+ # +preferences_key+ is set).
300
+ #
301
+ # @bug SketchUp 2022.0 fixed a bug on Mac where size and position of the
302
+ # HtmlDialog were not persisted when SketchUp was closed without first
303
+ # closing the HtmlDialog window.
304
+ #
305
+ # @bug SketchUp 2023.0 introduced a bug where the position given in {#initialize}
306
+ # is set relative to the SketchUp main window. If you rely on the position to be
307
+ # absolute to the screen then you can use {#set_position} after creating the
308
+ # dialog.
309
+ #
310
+ # @example With options Hash
311
+ # dialog = UI::HtmlDialog.new(
312
+ # {
313
+ # :dialog_title => "Dialog Example",
314
+ # :preferences_key => "com.sample.plugin",
315
+ # :scrollable => true,
316
+ # :resizable => true,
317
+ # :width => 600,
318
+ # :height => 400,
319
+ # :left => 100,
320
+ # :top => 100,
321
+ # :min_width => 50,
322
+ # :min_height => 50,
323
+ # :max_width =>1000,
324
+ # :max_height => 1000,
325
+ # :style => UI::HtmlDialog::STYLE_DIALOG
326
+ # })
327
+ # dialog.set_url("https://www.sketchup.com")
328
+ # dialog.show
329
+ #
330
+ # @example With keyword style argument
331
+ # dialog = UI::HtmlDialog.new(
332
+ # dialog_title: "Dialog Example",
333
+ # preferences_key: "my_name_my_extension_my_dialog",
334
+ # scrollable: true,
335
+ # resizable: true,
336
+ # width: 600,
337
+ # height: 400,
338
+ # left: 100,
339
+ # top: 100,
340
+ # min_width: 50,
341
+ # min_height: 50,
342
+ # max_width: 1000,
343
+ # max_height: 1000,
344
+ # style: UI::HtmlDialog::STYLE_DIALOG
345
+ # )
346
+ # dialog.set_url("https://www.sketchup.com")
347
+ # dialog.show
348
+ #
349
+ # @note Prefix +preference_key+ with something unique to your extension.
350
+ #
351
+ # @note If there is no reference kept to the HtmlDialog object, the window
352
+ # will close once the garbage collection runs. This behavior can be confusing
353
+ # in trivial test code but is usually not a concern in real life scenarios.
354
+ # Typically a persistent reference, e.g. an instance variable, should be kept
355
+ # to bring the dialog to front, rather than creating a duplicate, if the user
356
+ # should request it a second time.
357
+ #
358
+ # @option properties [String] :dialog_title
359
+ #
360
+ # @option properties [String] :preferences_key
361
+ #
362
+ # @option properties [Boolean] :scrollable
363
+ #
364
+ # @option properties [Boolean] :resizable (true)
365
+ #
366
+ # @option properties [Boolean] :use_content_size (false)
367
+ #
368
+ # @option properties [Integer] :width (250)
369
+ #
370
+ # @option properties [Integer] :height (250)
371
+ #
372
+ # @option properties [Integer] :left (0)
373
+ #
374
+ # @option properties [Integer] :top (0)
375
+ #
376
+ # @option properties [Integer] :min_width (0)
377
+ #
378
+ # @option properties [Integer] :min_height (0)
379
+ #
380
+ # @option properties [Integer] :max_width (-1)
381
+ #
382
+ # @option properties [Integer] :max_height (-1)
383
+ #
384
+ # @option properties [Integer] :style (UI::HtmlDialog::STYLE_DIALOG)
385
+ #
386
+ # @param [Hash] properties
387
+ # A hash containing the initial properties of
388
+ # the newly created dialog.
389
+ #
390
+ # @return [UI::HtmlDialog]
391
+ #
392
+ # @version SketchUp 2017
393
+ def initialize(properties)
394
+ end
395
+
396
+ # The {#set_can_close} method is used to attach a block that is executed just
397
+ # before closing, this block has to return a boolean, if the block returns
398
+ # false the close will be canceled.
399
+ #
400
+ # @example
401
+ # dialog.set_can_close { false }
402
+ #
403
+ # @return [Boolean]
404
+ #
405
+ # @see #set_on_closed
406
+ #
407
+ # @version SketchUp 2017
408
+ #
409
+ # @yieldreturn [Boolean] Return a boolean to indicate if the dialogs should
410
+ # close.
411
+ def set_can_close
412
+ end
413
+
414
+ # The {#set_content_size} method is used to set the content size of the HtmlDialog, in logical
415
+ # pixels.
416
+ #
417
+ # @example
418
+ # dialog.set_content_size(600, 400)
419
+ #
420
+ # @param [Integer] width
421
+ # Content width of the HtmlDialog.
422
+ #
423
+ # @param [Integer] height
424
+ # Content height of the HtmlDialog.
425
+ #
426
+ # @return [nil]
427
+ #
428
+ # @version SketchUp 2021.1
429
+ def set_content_size(width, height)
430
+ end
431
+
432
+ # The {#set_file} method is used to identify a local HTML file to display in the
433
+ # HtmlDialog.
434
+ #
435
+ # @example
436
+ # dialog.set_file("c:/mypage.html")
437
+ #
438
+ # @param [String] filename
439
+ # The filename for the HtmlDialog file (HTML file)
440
+ #
441
+ # @return [nil]
442
+ #
443
+ # @version SketchUp 2017
444
+ def set_file(filename)
445
+ end
446
+
447
+ # The {#set_html} method is used to load a HtmlDialog with a string of provided
448
+ # HTML.
449
+ #
450
+ # @example
451
+ # html = '<b>Hello world!</b>'
452
+ # dialog.set_html(html)
453
+ #
454
+ # @param [String] html_string
455
+ # A string of valid html to display in your
456
+ # HtmlDialog.
457
+ #
458
+ # @return [nil]
459
+ #
460
+ # @version SketchUp 2017
461
+ def set_html(html_string)
462
+ end
463
+
464
+ # The {#set_on_closed} method is used to attach a block that will be
465
+ # executed when a dialog is already in the process of closing, do any last
466
+ # minute operations within this block such as releasing resources or performing cleanup tasks.
467
+ #
468
+ # @example
469
+ # dialog.set_on_closed do
470
+ # File.delete('temp_file.txt') if File.exist?('temp_file.txt')
471
+ # end
472
+ #
473
+ # @note For saving state before window closes use {#set_can_close} instead.
474
+ #
475
+ # @return [Boolean]
476
+ #
477
+ # @see #set_can_close
478
+ #
479
+ # @version SketchUp 2017
480
+ def set_on_closed
481
+ end
482
+
483
+ # The {#set_position} method is used to set the position of the HtmlDialog
484
+ # relative to the screen, in pixels.
485
+ #
486
+ # @bug Prior to SketchUp 2021.1, on Windows, calling this method incorrectly
487
+ # set the focus on the {UI::HtmlDialog}.
488
+ #
489
+ # @example
490
+ # dialog.set_position(100, 50)
491
+ #
492
+ # @param [Integer] left
493
+ # The number of pixels from the left.
494
+ #
495
+ # @param [Integer] top
496
+ # The number of pixels from the top of the screen.
497
+ #
498
+ # @return [true] This always return true, never false.
499
+ #
500
+ # @version SketchUp 2017
501
+ def set_position(left, top)
502
+ end
503
+
504
+ # The {#set_size} method is used to set the outer frame size of the HtmlDialog, in pixels.
505
+ #
506
+ # @bug Prior to SketchUp 2021.1, on Windows, calling this method incorrectly
507
+ # set the focus on the {UI::HtmlDialog}.
508
+ #
509
+ # @example
510
+ # dialog.set_size(320, 240)
511
+ #
512
+ # @param [Integer] width
513
+ # Outer frame width of the HtmlDialog.
514
+ #
515
+ # @param [Integer] height
516
+ # Outer frame height of the HtmlDialog.
517
+ #
518
+ # @return [true] This always return true, never false.
519
+ #
520
+ # @version SketchUp 2017
521
+ def set_size(width, height)
522
+ end
523
+
524
+ # The {#set_url} method is used to load a HtmlDialog with the content at a
525
+ # specific URL. This method allows you to load web sites in a HtmlDialog.
526
+ #
527
+ # @example
528
+ # dialog.set_url("https://www.sketchup.com")
529
+ #
530
+ # @param [String] url
531
+ # The URL for a specific web site.
532
+ #
533
+ # @return [nil]
534
+ #
535
+ # @version SketchUp 2017
536
+ def set_url(url)
537
+ end
538
+
539
+ # The {#show} method is used to display a non-modal dialog box.
540
+ #
541
+ # @example
542
+ # dialog.show
543
+ #
544
+ # @return [nil]
545
+ #
546
+ # @version SketchUp 2017
547
+ def show
548
+ end
549
+
550
+ # The {#show_modal} method is used to display a modal dialog box.
551
+ #
552
+ # @example
553
+ # dialog.show_modal
554
+ #
555
+ # @return [nil]
556
+ #
557
+ # @version SketchUp 2017
558
+ def show_modal
559
+ end
560
+
561
+ # The {#visible?} method is useful to tell if the dialog is shown and still
562
+ # alive, if the dialog is minimized or not visible on the screen this will
563
+ # still return +true+.
564
+ #
565
+ # @example
566
+ # if dialog.visible?
567
+ # dialog.bring_to_front
568
+ # else
569
+ # dialog = UI::HtmlDialog.new
570
+ # dialog.set_url("https://www.sketchup.com")
571
+ # dialog.show
572
+ # end
573
+ #
574
+ # @return [Boolean] Returns true if the dialog is open.
575
+ #
576
+ # @version SketchUp 2017
577
+ def visible?
578
+ end
579
+
580
+ end