sketchup-api-stubs 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/SketchUp/Geom/BoundingBox.rb +335 -0
- data/SketchUp/Geom/LatLong.rb +123 -0
- data/SketchUp/Geom/Point3d.rb +643 -0
- data/SketchUp/Geom/PolygonMesh.rb +478 -0
- data/SketchUp/Geom/Transformation.rb +476 -0
- data/SketchUp/Geom/UTM.rb +135 -0
- data/SketchUp/Geom/Vector3d.rb +684 -0
- data/SketchUp/Sketchup/Animation.rb +137 -0
- data/SketchUp/Sketchup/AppObserver.rb +157 -0
- data/SketchUp/Sketchup/ArcCurve.rb +209 -0
- data/SketchUp/Sketchup/AttributeDictionaries.rb +146 -0
- data/SketchUp/Sketchup/AttributeDictionary.rb +280 -0
- data/SketchUp/Sketchup/Axes.rb +149 -0
- data/SketchUp/Sketchup/Behavior.rb +338 -0
- data/SketchUp/Sketchup/Camera.rb +594 -0
- data/SketchUp/Sketchup/ClassificationSchema.rb +63 -0
- data/SketchUp/Sketchup/Classifications.rb +118 -0
- data/SketchUp/Sketchup/Color.rb +291 -0
- data/SketchUp/Sketchup/ComponentDefinition.rb +562 -0
- data/SketchUp/Sketchup/ComponentInstance.rb +597 -0
- data/SketchUp/Sketchup/Console.rb +78 -0
- data/SketchUp/Sketchup/ConstructionLine.rb +257 -0
- data/SketchUp/Sketchup/ConstructionPoint.rb +32 -0
- data/SketchUp/Sketchup/Curve.rb +196 -0
- data/SketchUp/Sketchup/DefinitionList.rb +312 -0
- data/SketchUp/Sketchup/DefinitionObserver.rb +73 -0
- data/SketchUp/Sketchup/DefinitionsObserver.rb +102 -0
- data/SketchUp/Sketchup/Dimension.rb +167 -0
- data/SketchUp/Sketchup/DimensionLinear.rb +232 -0
- data/SketchUp/Sketchup/DimensionObserver.rb +38 -0
- data/SketchUp/Sketchup/DimensionRadial.rb +87 -0
- data/SketchUp/Sketchup/Drawingelement.rb +400 -0
- data/SketchUp/Sketchup/Edge.rb +517 -0
- data/SketchUp/Sketchup/EdgeUse.rb +213 -0
- data/SketchUp/Sketchup/Entities.rb +1011 -0
- data/SketchUp/Sketchup/EntitiesObserver.rb +125 -0
- data/SketchUp/Sketchup/Entity.rb +522 -0
- data/SketchUp/Sketchup/EntityObserver.rb +59 -0
- data/SketchUp/Sketchup/ExtensionsManager.rb +129 -0
- data/SketchUp/Sketchup/Face.rb +737 -0
- data/SketchUp/Sketchup/FrameChangeObserver.rb +104 -0
- data/SketchUp/Sketchup/Group.rb +705 -0
- data/SketchUp/Sketchup/Http.rb +27 -0
- data/SketchUp/Sketchup/Http/Request.rb +285 -0
- data/SketchUp/Sketchup/Http/Response.rb +62 -0
- data/SketchUp/Sketchup/Image.rb +393 -0
- data/SketchUp/Sketchup/Importer.rb +192 -0
- data/SketchUp/Sketchup/InputPoint.rb +393 -0
- data/SketchUp/Sketchup/InstanceObserver.rb +82 -0
- data/SketchUp/Sketchup/InstancePath.rb +297 -0
- data/SketchUp/Sketchup/Layer.rb +240 -0
- data/SketchUp/Sketchup/Layers.rb +235 -0
- data/SketchUp/Sketchup/LayersObserver.rb +136 -0
- data/SketchUp/Sketchup/Licensing.rb +47 -0
- data/SketchUp/Sketchup/Licensing/ExtensionLicense.rb +88 -0
- data/SketchUp/Sketchup/Loop.rb +141 -0
- data/SketchUp/Sketchup/Material.rb +384 -0
- data/SketchUp/Sketchup/Materials.rb +283 -0
- data/SketchUp/Sketchup/MaterialsObserver.rb +141 -0
- data/SketchUp/Sketchup/Menu.rb +97 -0
- data/SketchUp/Sketchup/Model.rb +1459 -0
- data/SketchUp/Sketchup/ModelObserver.rb +356 -0
- data/SketchUp/Sketchup/OptionsManager.rb +135 -0
- data/SketchUp/Sketchup/OptionsProvider.rb +277 -0
- data/SketchUp/Sketchup/OptionsProviderObserver.rb +58 -0
- data/SketchUp/Sketchup/Page.rb +636 -0
- data/SketchUp/Sketchup/Pages.rb +349 -0
- data/SketchUp/Sketchup/PagesObserver.rb +76 -0
- data/SketchUp/Sketchup/PickHelper.rb +457 -0
- data/SketchUp/Sketchup/RegionalSettings.rb +43 -0
- data/SketchUp/Sketchup/RenderingOptions.rb +337 -0
- data/SketchUp/Sketchup/RenderingOptionsObserver.rb +44 -0
- data/SketchUp/Sketchup/SectionPlane.rb +88 -0
- data/SketchUp/Sketchup/Selection.rb +470 -0
- data/SketchUp/Sketchup/SelectionObserver.rb +115 -0
- data/SketchUp/Sketchup/Set.rb +253 -0
- data/SketchUp/Sketchup/ShadowInfo.rb +257 -0
- data/SketchUp/Sketchup/ShadowInfoObserver.rb +57 -0
- data/SketchUp/Sketchup/Style.rb +77 -0
- data/SketchUp/Sketchup/Styles.rb +204 -0
- data/SketchUp/Sketchup/Text.rb +241 -0
- data/SketchUp/Sketchup/Texture.rb +211 -0
- data/SketchUp/Sketchup/TextureWriter.rb +237 -0
- data/SketchUp/Sketchup/Tool.rb +808 -0
- data/SketchUp/Sketchup/Tools.rb +120 -0
- data/SketchUp/Sketchup/ToolsObserver.rb +154 -0
- data/SketchUp/Sketchup/UVHelper.rb +61 -0
- data/SketchUp/Sketchup/Vertex.rb +143 -0
- data/SketchUp/Sketchup/View.rb +965 -0
- data/SketchUp/Sketchup/ViewObserver.rb +40 -0
- data/SketchUp/UI/Command.rb +307 -0
- data/SketchUp/UI/HtmlDialog.rb +346 -0
- data/SketchUp/UI/Notification.rb +229 -0
- data/SketchUp/UI/Toolbar.rb +243 -0
- data/SketchUp/UI/WebDialog.rb +623 -0
- data/SketchUp/_top_level.rb +193 -0
- data/SketchUp/array.rb +593 -0
- data/SketchUp/geom.rb +231 -0
- data/SketchUp/languagehandler.rb +92 -0
- data/SketchUp/length.rb +210 -0
- data/SketchUp/numeric.rb +249 -0
- data/SketchUp/sketchup.rb +1290 -0
- data/SketchUp/sketchupextension.rb +355 -0
- data/SketchUp/string.rb +24 -0
- data/SketchUp/ui.rb +637 -0
- metadata +176 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# This observer interface is implemented to react to view events. To implement
|
5
|
+
# this observer, create a Ruby class of this type, override the desired
|
6
|
+
# methods, and add an instance of the observer to the view object.
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# # This is an example of an observer that watches tool interactions.
|
10
|
+
# class MyViewObserver < Sketchup::ViewObserver
|
11
|
+
# def onViewChanged(view)
|
12
|
+
# puts "onViewChanged: #{view}"
|
13
|
+
# end
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# # Attach the observer.
|
17
|
+
# Sketchup.active_model.active_view.add_observer(MyViewObserver.new)
|
18
|
+
#
|
19
|
+
# @version SketchUp 6.0
|
20
|
+
class Sketchup::ViewObserver
|
21
|
+
|
22
|
+
# Instance Methods
|
23
|
+
|
24
|
+
# The {#onViewChanged} method is called whenever the view is altered, such as
|
25
|
+
# when the user uses the Pan, Orbit, or Zoom tools are used.
|
26
|
+
#
|
27
|
+
# @example
|
28
|
+
# def onViewChanged(view)
|
29
|
+
# pust "onViewChanged: #{view}"
|
30
|
+
# end
|
31
|
+
#
|
32
|
+
# @param [Sketchup::View] view
|
33
|
+
#
|
34
|
+
# @return [nil]
|
35
|
+
#
|
36
|
+
# @version SketchUp 6.0
|
37
|
+
def onViewChanged(view)
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -0,0 +1,307 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The Command class is the preferred class for adding tools to the menus and
|
5
|
+
# Ruby toolbars. For example, you could add a menu item and pass it a code
|
6
|
+
# block directly, or you could first create a Command.
|
7
|
+
#
|
8
|
+
# Using Commands gives you greater control over how the item works in the UI,
|
9
|
+
# and it allows multiple spots in the UI to call the same code. For example,
|
10
|
+
# You might want a toolbar button and a context-click menu item to both point
|
11
|
+
# to the same command, and to control the tooltip and its "graying" from
|
12
|
+
# a single spot in your code.
|
13
|
+
#
|
14
|
+
# @example
|
15
|
+
# # You can add menu items as procedure blocks, as shown here, but
|
16
|
+
# # you have no control over whether it is grayed out, for example.
|
17
|
+
# UI.menu("Draw").add_item("My Procedure") {
|
18
|
+
# UI.messagebox("My Procedure")
|
19
|
+
# }
|
20
|
+
#
|
21
|
+
# # Better to create a command object.
|
22
|
+
# cmd = UI::Command.new("Tester") {
|
23
|
+
# UI.messagebox("My Command")
|
24
|
+
# }
|
25
|
+
# cmd.menu_text = "My Command"
|
26
|
+
# cmd.set_validation_proc {
|
27
|
+
# if Sketchup.active_model.selection.length == 0
|
28
|
+
# MF_GRAYED
|
29
|
+
# else
|
30
|
+
# MF_ENABLED
|
31
|
+
# end
|
32
|
+
# }
|
33
|
+
# UI.menu("Draw").add_item cmd
|
34
|
+
#
|
35
|
+
# @version SketchUp 6.0
|
36
|
+
class UI::Command
|
37
|
+
|
38
|
+
# Class Methods
|
39
|
+
|
40
|
+
# The new method is used to create a new command.
|
41
|
+
#
|
42
|
+
# @example
|
43
|
+
# UI.menu("Draw").add_separator
|
44
|
+
#
|
45
|
+
# # Adds a Test submenu to the Draw menu where the Tester menu item appears
|
46
|
+
# testmenu = UI.menu("Draw").add_submenu("Test")
|
47
|
+
#
|
48
|
+
# # This menu item simply displays Hello World on the screen when clicked.
|
49
|
+
# cmd = UI::Command.new("Tester") { UI.messagebox("Hello World") }
|
50
|
+
# testmenu.add_item cmd
|
51
|
+
#
|
52
|
+
# @param menutext
|
53
|
+
# The text that will appear for this command's menu item
|
54
|
+
# if it appears on a menu.
|
55
|
+
#
|
56
|
+
# @return command - the new Command object
|
57
|
+
#
|
58
|
+
# @version SketchUp 6.0
|
59
|
+
#
|
60
|
+
# @yield Code that executes the command when the menu item or
|
61
|
+
# toolbar item is selected.
|
62
|
+
def self.new(menutext)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Instance Methods
|
66
|
+
|
67
|
+
# The large_icon method returns the icon file for the command's
|
68
|
+
# large icon.
|
69
|
+
#
|
70
|
+
# @example
|
71
|
+
# toolbar = UI::Toolbar.new "Test"
|
72
|
+
# # This command displays Hello World on the screen when clicked
|
73
|
+
# cmd = UI::Command.new("Test") { UI.messagebox("Hello World") }
|
74
|
+
# cmd.small_icon = "ToolPencilSmall.png"
|
75
|
+
# cmd.large_icon = "ToolPencilLarge.png"
|
76
|
+
# toolbar = toolbar.add_item cmd
|
77
|
+
# toolbar.show
|
78
|
+
# puts cmd.large_icon
|
79
|
+
#
|
80
|
+
# @return string - the path to the large icon.
|
81
|
+
#
|
82
|
+
# @version SketchUp 8.0 M1
|
83
|
+
def large_icon
|
84
|
+
end
|
85
|
+
|
86
|
+
# The large_icon= method is used to identify the icon file for the command's
|
87
|
+
# large icon. large icons should be 24x24 pixel images for best display
|
88
|
+
# quality.
|
89
|
+
#
|
90
|
+
# Since SketchUp 2016 it is possible to provide vector images for the cursors.
|
91
|
+
# SVG format for Windows and PDF format for OS X. Since the vector images scale
|
92
|
+
# for both small and large icon sizes, you may choose to use only one vector
|
93
|
+
# image for both variants.
|
94
|
+
#
|
95
|
+
# @example
|
96
|
+
# toolbar = UI::Toolbar.new "Test"
|
97
|
+
# # This command displays Hello World on the screen when clicked
|
98
|
+
# cmd = UI::Command.new("Test") { UI.messagebox("Hello World") }
|
99
|
+
# cmd.small_icon = "ToolPencilSmall.png"
|
100
|
+
# cmd.large_icon = "ToolPencilLarge.png"
|
101
|
+
# toolbar = toolbar.add_item cmd
|
102
|
+
# toolbar.show
|
103
|
+
#
|
104
|
+
# @param path
|
105
|
+
# The path to the large icon.
|
106
|
+
#
|
107
|
+
# @return command - the Command object
|
108
|
+
#
|
109
|
+
# @version SketchUp 6.0
|
110
|
+
def large_icon=(path)
|
111
|
+
end
|
112
|
+
|
113
|
+
# The menu_text method returns the menu item name for the command.
|
114
|
+
#
|
115
|
+
# @example
|
116
|
+
# add_separator_to_menu("Draw")
|
117
|
+
# # Adds a Test submenu to the Draw menu where the Tester menu item appears
|
118
|
+
# testmenu = UI.menu("Draw").add_submenu("Test")
|
119
|
+
# cmd = UI::Command.new("Tester") { UI.messagebox("Hello World") }
|
120
|
+
# cmd.menu_text = "New String"
|
121
|
+
# testmenu.add_item cmd
|
122
|
+
# puts cmd.menu_text
|
123
|
+
#
|
124
|
+
# @return command - a Command object
|
125
|
+
#
|
126
|
+
# @version SketchUp 8.0 M1
|
127
|
+
def menu_text
|
128
|
+
end
|
129
|
+
|
130
|
+
# The menu_text= method is used to set the menu item name for the command.
|
131
|
+
#
|
132
|
+
# @example
|
133
|
+
# add_separator_to_menu("Draw")
|
134
|
+
# # Adds a Test submenu to the Draw menu where the Tester menu item appears
|
135
|
+
# testmenu = UI.menu("Draw").add_submenu("Test")
|
136
|
+
# cmd = UI::Command.new("Tester") { UI.messagebox("Hello World") }
|
137
|
+
# cmd.menu_text = "New String"
|
138
|
+
# testmenu.add_item cmd
|
139
|
+
#
|
140
|
+
# @param menuitem
|
141
|
+
# A string representing the menu item for the command.
|
142
|
+
#
|
143
|
+
# @return command - a Command object
|
144
|
+
#
|
145
|
+
# @version SketchUp 6.0
|
146
|
+
def menu_text=(menuitem)
|
147
|
+
end
|
148
|
+
|
149
|
+
# The {#set_validation_proc} method allows you to change whether the command
|
150
|
+
# is enabled, checked, etc. based on the user state. For example, you might
|
151
|
+
# want your command to be disabled unless the user has a current selection.
|
152
|
+
#
|
153
|
+
# @example
|
154
|
+
# # Create a command object.
|
155
|
+
# cmd = UI::Command.new("Tester") {
|
156
|
+
# UI.messagebox("My Command")
|
157
|
+
# }
|
158
|
+
# cmd.menu_text = "My Command"
|
159
|
+
# cmd.set_validation_proc {
|
160
|
+
# if Sketchup.active_model.selection.length == 0
|
161
|
+
# MF_GRAYED
|
162
|
+
# else
|
163
|
+
# MF_ENABLED
|
164
|
+
# end
|
165
|
+
# }
|
166
|
+
# UI.menu("Draw").add_item(cmd)
|
167
|
+
#
|
168
|
+
# @return [UI::Command]
|
169
|
+
#
|
170
|
+
# @version SketchUp 6.0
|
171
|
+
#
|
172
|
+
# @yield []
|
173
|
+
#
|
174
|
+
# @yieldreturn [Integer] +MF_ENABLED+, +MF_DISABLED+, +MF_CHECKED+,
|
175
|
+
# +MF_UNCHECKED+, or +MF_GRAYED+
|
176
|
+
def set_validation_proc
|
177
|
+
end
|
178
|
+
|
179
|
+
# The small_icon method returns the icon file for the command's
|
180
|
+
# small icon.
|
181
|
+
#
|
182
|
+
# @example
|
183
|
+
# toolbar = UI::Toolbar.new "Test"
|
184
|
+
# # This toolbar command displays Hello World on the screen when clicked.
|
185
|
+
# cmd = UI::Command.new("Tester") { UI.messagebox("Hello World") }
|
186
|
+
# cmd.small_icon = "ToolPencilSmall.png"
|
187
|
+
# cmd.large_icon = "ToolPencilLarge.png"
|
188
|
+
# toolbar = toolbar.add_item cmd
|
189
|
+
# toolbar.show
|
190
|
+
# puts cmd.small_icon
|
191
|
+
#
|
192
|
+
# @return string - the path to the small_icon
|
193
|
+
#
|
194
|
+
# @version SketchUp 8.0 M1
|
195
|
+
def small_icon
|
196
|
+
end
|
197
|
+
|
198
|
+
# The small_icon= method is used to identify the icon file for the command's
|
199
|
+
# small icon. Small icons should be 16x16 pixel images for best display
|
200
|
+
# quality.
|
201
|
+
#
|
202
|
+
# Since SketchUp 2016 it is possible to provide vector images for the cursors.
|
203
|
+
# SVG format for Windows and PDF format for OS X. Since the vector images scale
|
204
|
+
# for both small and large icon sizes, you may choose to use only one vector
|
205
|
+
# image for both variants.
|
206
|
+
#
|
207
|
+
# @example
|
208
|
+
# toolbar = UI::Toolbar.new "Test"
|
209
|
+
# # This toolbar command displays Hello World on the screen when clicked.
|
210
|
+
# cmd = UI::Command.new("Tester") { UI.messagebox("Hello World") }
|
211
|
+
# cmd.small_icon = "ToolPencilSmall.png"
|
212
|
+
# cmd.large_icon = "ToolPencilLarge.png"
|
213
|
+
# toolbar = toolbar.add_item cmd
|
214
|
+
# toolbar.show
|
215
|
+
#
|
216
|
+
# @param path
|
217
|
+
# A path to the small icon.
|
218
|
+
#
|
219
|
+
# @return command - the Command object
|
220
|
+
#
|
221
|
+
# @version SketchUp 6.0
|
222
|
+
def small_icon=(path)
|
223
|
+
end
|
224
|
+
|
225
|
+
# The status_bar_text method returns the status bar text for the
|
226
|
+
# command.
|
227
|
+
#
|
228
|
+
# @example
|
229
|
+
# toolbar = UI::Toolbar.new "Test"
|
230
|
+
# # This toolbar tool simply displays Hello World on the screen
|
231
|
+
# # when clicked
|
232
|
+
# cmd = UI::Command.new("Tester") { UI.messagebox("Hello World") }
|
233
|
+
# cmd.small_icon = "ToolPencilSmall.png"
|
234
|
+
# cmd.large_icon = "ToolPencilLarge.png"
|
235
|
+
# cmd.status_bar_text = $tStrings.GetString("Testing the toolbars class")
|
236
|
+
# toolbar = toolbar.add_item cmd
|
237
|
+
# toolbar.show
|
238
|
+
# puts cmd.status_bar_text
|
239
|
+
#
|
240
|
+
# @return string - the status bar text.
|
241
|
+
#
|
242
|
+
# @version SketchUp 8.0 M1
|
243
|
+
def status_bar_text
|
244
|
+
end
|
245
|
+
|
246
|
+
# The status_bar_text= method is used to set the status bar text for the
|
247
|
+
# command.
|
248
|
+
#
|
249
|
+
# @example
|
250
|
+
# toolbar = UI::Toolbar.new "Test"
|
251
|
+
# # This toolbar tool simply displays Hello World on the screen when clicked
|
252
|
+
# cmd = UI::Command.new("Tester") { UI.messagebox("Hello World") }
|
253
|
+
# cmd.small_icon = "ToolPencilSmall.png"
|
254
|
+
# cmd.large_icon = "ToolPencilLarge.png"
|
255
|
+
# cmd.status_bar_text = $tStrings.GetString("Testing the toolbars class")
|
256
|
+
# toolbar = toolbar.add_item cmd
|
257
|
+
# toolbar.show
|
258
|
+
#
|
259
|
+
# @param text
|
260
|
+
# The text that will appear on the status bar when the
|
261
|
+
# cursor is over the command's menu item.
|
262
|
+
#
|
263
|
+
# @return command - the Command object
|
264
|
+
#
|
265
|
+
# @version SketchUp 6.0
|
266
|
+
def status_bar_text=(text)
|
267
|
+
end
|
268
|
+
|
269
|
+
# The tooltip method returns command item's tooltip text.
|
270
|
+
#
|
271
|
+
# @example
|
272
|
+
# toolbar = UI::Toolbar.new "Test"
|
273
|
+
# # This command displays Hello World on the screen when clicked
|
274
|
+
# cmd = UI::Command.new("Test") { UI.messagebox("Hello World") }
|
275
|
+
# cmd.tooltip = "Hello World Tool"
|
276
|
+
# toolbar = toolbar.add_item cmd
|
277
|
+
# toolbar.show
|
278
|
+
# puts cmd.tooltip
|
279
|
+
#
|
280
|
+
# @return string - the tooltip text
|
281
|
+
#
|
282
|
+
# @version SketchUp 8.0 M1
|
283
|
+
def tooltip
|
284
|
+
end
|
285
|
+
|
286
|
+
# The tooltip= method is used to define a command item's tooltip text. Tooltips
|
287
|
+
# will appear when the command is attached to a tool bar and the user hovers
|
288
|
+
# their cursor over the icon.
|
289
|
+
#
|
290
|
+
# @example
|
291
|
+
# toolbar = UI::Toolbar.new "Test"
|
292
|
+
# # This command displays Hello World on the screen when clicked
|
293
|
+
# cmd = UI::Command.new("Test") { UI.messagebox("Hello World") }
|
294
|
+
# cmd.tooltip = "Hello World Tool"
|
295
|
+
# toolbar = toolbar.add_item cmd
|
296
|
+
# toolbar.show
|
297
|
+
#
|
298
|
+
# @param text
|
299
|
+
# The text of the tooltip.
|
300
|
+
#
|
301
|
+
# @return command - the Command object
|
302
|
+
#
|
303
|
+
# @version SketchUp 6.0
|
304
|
+
def tooltip=(text)
|
305
|
+
end
|
306
|
+
|
307
|
+
end
|
@@ -0,0 +1,346 @@
|
|
1
|
+
# Copyright:: Copyright 2017 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
|
+
# @version SketchUp 2017
|
13
|
+
class UI::HtmlDialog
|
14
|
+
|
15
|
+
# Constants
|
16
|
+
|
17
|
+
STYLE_DIALOG = nil # Stub value.
|
18
|
+
STYLE_UTILITY = nil # Stub value.
|
19
|
+
STYLE_WINDOW = nil # Stub value.
|
20
|
+
|
21
|
+
# Instance Methods
|
22
|
+
|
23
|
+
# The {#add_action_callback} method establishes a Ruby callback method that your
|
24
|
+
# html dialog can call to perform some function.
|
25
|
+
#
|
26
|
+
# Use the +sketchup.callback_method_name+ to invoke the callback method from your
|
27
|
+
# html dialog. Your JavaScript in the html dialog will invoke the callback with
|
28
|
+
# the same number of arguments.
|
29
|
+
#
|
30
|
+
# The call is asynchronous. JavaScript call might return before Ruby callback
|
31
|
+
# even called. Use +onCompleted+ callback to get notified for completion.
|
32
|
+
#
|
33
|
+
# Basic types such as booleans, numbers, strings, arrays and hashes are
|
34
|
+
# automatically converted between Ruby and JavaScript.
|
35
|
+
#
|
36
|
+
# @example JavaScript with callback
|
37
|
+
# sketchup.say('Hello World', 42, {
|
38
|
+
# onCompleted: function() {
|
39
|
+
# console.log('Ruby side done.');
|
40
|
+
# }
|
41
|
+
# });
|
42
|
+
#
|
43
|
+
# @example Ruby Code
|
44
|
+
# dialog.add_action_callback("say") { |action_context, param1, param2|
|
45
|
+
# puts "JavaScript said #{param1} and #{param2}"
|
46
|
+
# }
|
47
|
+
#
|
48
|
+
# @example JavaScript
|
49
|
+
# sketchup.say('Hello World', 42);
|
50
|
+
#
|
51
|
+
# @param [String] callback_name
|
52
|
+
# The name of the callback method to be
|
53
|
+
# invoked from the html dialog.
|
54
|
+
#
|
55
|
+
# @return [Boolean] true if action added successfully, false
|
56
|
+
# otherwise.
|
57
|
+
#
|
58
|
+
# @version SketchUp 2017
|
59
|
+
#
|
60
|
+
# @yield [action_context, ...]
|
61
|
+
#
|
62
|
+
# @yieldparam [Object] action_context
|
63
|
+
# action_context Currently unused.
|
64
|
+
#
|
65
|
+
# @yieldparam [Object] ...
|
66
|
+
# The parameters sent from JavaScript.
|
67
|
+
def add_action_callback(callback_name)
|
68
|
+
end
|
69
|
+
|
70
|
+
# The {#bring_to_front} method is used to bring the window to the front,
|
71
|
+
# putting it on top of other windows even if its minimized.
|
72
|
+
#
|
73
|
+
# @example
|
74
|
+
# dialog.bring_to_front
|
75
|
+
#
|
76
|
+
# @return [nil]
|
77
|
+
#
|
78
|
+
# @version SketchUp 2017
|
79
|
+
def bring_to_front
|
80
|
+
end
|
81
|
+
|
82
|
+
# The {#center} method is used to center the HtmlDialog relative to the active
|
83
|
+
# model window. If there is no active model window, this function doesn't do
|
84
|
+
# anything.
|
85
|
+
#
|
86
|
+
# @example
|
87
|
+
# dialog.center
|
88
|
+
#
|
89
|
+
# @return [true]
|
90
|
+
#
|
91
|
+
# @version SketchUp 2017
|
92
|
+
def center
|
93
|
+
end
|
94
|
+
|
95
|
+
# The {#close} method is used to close a dialog box.
|
96
|
+
#
|
97
|
+
# @example
|
98
|
+
# dialog.close
|
99
|
+
#
|
100
|
+
# @return [nil]
|
101
|
+
#
|
102
|
+
# @version SketchUp 2017
|
103
|
+
def close
|
104
|
+
end
|
105
|
+
|
106
|
+
# The {#execute_script} method is used to execute a JavaScript string on the
|
107
|
+
# html dialog asynchronously.
|
108
|
+
#
|
109
|
+
# @example
|
110
|
+
# js_command = "document.getElementById('id').innerHTML = '<b>Hi!</b>'"
|
111
|
+
# dialog.execute_script(js_command)
|
112
|
+
#
|
113
|
+
# @param [String] script
|
114
|
+
# The JavaScript script to execute on the HtmlDialog.
|
115
|
+
#
|
116
|
+
# @return [nil]
|
117
|
+
#
|
118
|
+
# @version SketchUp 2017
|
119
|
+
def execute_script(script)
|
120
|
+
end
|
121
|
+
|
122
|
+
# The new method is used to create a new HtmlDialog.
|
123
|
+
#
|
124
|
+
# The +properties+ hash accepts an optional key +style+ where the value is
|
125
|
+
# one of:
|
126
|
+
#
|
127
|
+
# [+UI::HtmlDialog::STYLE_DIALOG+] HtmlDialog stays at the top of SketchUp.
|
128
|
+
#
|
129
|
+
# [+UI::HtmlDialog::STYLE_WINDOW+] HtmlDialog can go behind SketchUp and
|
130
|
+
# doesn't disappear when SketchUp looses
|
131
|
+
# focus.
|
132
|
+
#
|
133
|
+
# [+UI::HtmlDialog::STYLE_UTILITY+] HtmlDialog is shown with small titlebar
|
134
|
+
# and stays on top of SketchUp.
|
135
|
+
#
|
136
|
+
# @example
|
137
|
+
# dialog = UI::HtmlDialog.new(
|
138
|
+
# {
|
139
|
+
# :dialog_title => "Dialog Example",
|
140
|
+
# :preferences_key => "com.sample.plugin",
|
141
|
+
# :scrollable => true,
|
142
|
+
# :resizable => true,
|
143
|
+
# :width => 600,
|
144
|
+
# :height => 400,
|
145
|
+
# :left => 100,
|
146
|
+
# :top => 100,
|
147
|
+
# :min_width => 50,
|
148
|
+
# :min_height => 50,
|
149
|
+
# :max_width =>1000,
|
150
|
+
# :max_height => 1000,
|
151
|
+
# :style => UI::HtmlDialog::STYLE_DIALOG
|
152
|
+
# })
|
153
|
+
# dialog.set_url("http://www.sketchup.com")
|
154
|
+
# dialog.show
|
155
|
+
#
|
156
|
+
# @option properties [Integer] :width (250)
|
157
|
+
#
|
158
|
+
# @option properties [Integer] :max_height (-1)
|
159
|
+
#
|
160
|
+
# @option properties [String] :dialog_title
|
161
|
+
#
|
162
|
+
# @option properties [String] :preferences_key
|
163
|
+
#
|
164
|
+
# @option properties [Boolean] :scrollable
|
165
|
+
#
|
166
|
+
# @option properties [Boolean] :resizable (true)
|
167
|
+
#
|
168
|
+
# @option properties [Integer] :height (250)
|
169
|
+
#
|
170
|
+
# @option properties [Integer] :max_width (-1)
|
171
|
+
#
|
172
|
+
# @option properties [Integer] :left (0)
|
173
|
+
#
|
174
|
+
# @option properties [Integer] :top (0)
|
175
|
+
#
|
176
|
+
# @option properties [Integer] :min_width (0)
|
177
|
+
#
|
178
|
+
# @option properties [Integer] :min_height (0)
|
179
|
+
#
|
180
|
+
# @option properties [Integer] :style (UI::HtmlDialog::STYLE_DIALOG)
|
181
|
+
#
|
182
|
+
# @param [Hash] properties
|
183
|
+
# A hash containing the initial properties of
|
184
|
+
# the newly created dialog.
|
185
|
+
#
|
186
|
+
# @return [HtmlDialog]
|
187
|
+
#
|
188
|
+
# @version SketchUp 2017
|
189
|
+
def initialize(properties)
|
190
|
+
end
|
191
|
+
|
192
|
+
# The {#set_can_close} method is used to attach a block that is executed just
|
193
|
+
# before closing, this block has to return a boolean, if the block returns
|
194
|
+
# false the close will be canceled.
|
195
|
+
#
|
196
|
+
# @example
|
197
|
+
# dialog.set_can_close { false }
|
198
|
+
#
|
199
|
+
# @return [Boolean]
|
200
|
+
#
|
201
|
+
# @version SketchUp 2017
|
202
|
+
#
|
203
|
+
# @yieldreturn [Boolean] Return a boolean to indicate if the dialogs should
|
204
|
+
# close.
|
205
|
+
def set_can_close
|
206
|
+
end
|
207
|
+
|
208
|
+
# The {#set_file} method is used to identify a local HTML file to display in the
|
209
|
+
# HtmlDialog.
|
210
|
+
#
|
211
|
+
# @example
|
212
|
+
# dialog.set_file("c:/mypage.html")
|
213
|
+
#
|
214
|
+
# @param [String] filename
|
215
|
+
# The filename for the HtmlDialog file (HTML file)
|
216
|
+
#
|
217
|
+
# @return [nil]
|
218
|
+
#
|
219
|
+
# @version SketchUp 2017
|
220
|
+
def set_file(filename)
|
221
|
+
end
|
222
|
+
|
223
|
+
# The {#set_html} method is used to load a HtmlDialog with a string of provided
|
224
|
+
# HTML.
|
225
|
+
#
|
226
|
+
# @example
|
227
|
+
# html = '<b>Hello world!</b>'
|
228
|
+
# dialog.set_html(html)
|
229
|
+
#
|
230
|
+
# @param [String] html_string
|
231
|
+
# A string of valid html to display in your
|
232
|
+
# HtmlDialog.
|
233
|
+
#
|
234
|
+
# @return [nil]
|
235
|
+
#
|
236
|
+
# @version SketchUp 2017
|
237
|
+
def set_html(html_string)
|
238
|
+
end
|
239
|
+
|
240
|
+
# The {#set_on_closed} method is used to attach a block that will be
|
241
|
+
# executed when a dialog is already in the process of closing, do any last
|
242
|
+
# minute operations within this block such as saving the current state.
|
243
|
+
#
|
244
|
+
# @example
|
245
|
+
# dialog.set_on_closed { save_selection }
|
246
|
+
#
|
247
|
+
# @return [Boolean]
|
248
|
+
#
|
249
|
+
# @version SketchUp 2017
|
250
|
+
def set_on_closed
|
251
|
+
end
|
252
|
+
|
253
|
+
# The {#set_position} method is used to set the position of the HtmlDialog
|
254
|
+
# relative to the screen, in pixels.
|
255
|
+
#
|
256
|
+
# @example
|
257
|
+
# dialog.set_position(100, 50)
|
258
|
+
#
|
259
|
+
# @param [Integer] left
|
260
|
+
# The number of pixels from the left.
|
261
|
+
#
|
262
|
+
# @param [Integer] top
|
263
|
+
# The number of pixels from the top of the screen.
|
264
|
+
#
|
265
|
+
# @return [true]
|
266
|
+
#
|
267
|
+
# @version SketchUp 2017
|
268
|
+
def set_position(left, top)
|
269
|
+
end
|
270
|
+
|
271
|
+
# The {#set_size} method is used to set the size of the HtmlDialog, in pixels.
|
272
|
+
#
|
273
|
+
# @example
|
274
|
+
# dialog.set_size(320, 240)
|
275
|
+
#
|
276
|
+
# @param [Integer] width
|
277
|
+
# Width of the HtmlDialog.
|
278
|
+
#
|
279
|
+
# @param [Integer] height
|
280
|
+
# Height of the HtmlDialog.
|
281
|
+
#
|
282
|
+
# @return [true]
|
283
|
+
#
|
284
|
+
# @version SketchUp 2017
|
285
|
+
def set_size(width, height)
|
286
|
+
end
|
287
|
+
|
288
|
+
# The {#set_url} method is used to load a HtmlDialog with the content at a
|
289
|
+
# specific URL. This method allows you to load web sites in a HtmlDialog.
|
290
|
+
#
|
291
|
+
# @example
|
292
|
+
# dialog.set_url("http://www.sketchup.com")
|
293
|
+
#
|
294
|
+
# @param [String] url
|
295
|
+
# The URL for a specific web site.
|
296
|
+
#
|
297
|
+
# @return [nil]
|
298
|
+
#
|
299
|
+
# @version SketchUp 2017
|
300
|
+
def set_url(url)
|
301
|
+
end
|
302
|
+
|
303
|
+
# The {#show} method is used to display a non-modal dialog box.
|
304
|
+
#
|
305
|
+
# @example
|
306
|
+
# dialog.show
|
307
|
+
#
|
308
|
+
# @return [nil]
|
309
|
+
#
|
310
|
+
# @version SketchUp 2017
|
311
|
+
def show
|
312
|
+
end
|
313
|
+
|
314
|
+
# The {#show_modal} method is used to display a modal dialog box.
|
315
|
+
#
|
316
|
+
# @example
|
317
|
+
# dialog.show_modal
|
318
|
+
#
|
319
|
+
# @return [nil]
|
320
|
+
#
|
321
|
+
# @version SketchUp 2017
|
322
|
+
def show_modal
|
323
|
+
end
|
324
|
+
|
325
|
+
# The {#visible?} method is useful to tell if the dialog is shown and still
|
326
|
+
# alive, if the dialog is minimized or not visible on the screen this will
|
327
|
+
# still return +true+.
|
328
|
+
#
|
329
|
+
# @example
|
330
|
+
# if dialog.visible?
|
331
|
+
# dialog.bring_to_front
|
332
|
+
# else
|
333
|
+
# dialog = UI::HtmlDialog.new
|
334
|
+
# dialog.set_url("http://www.sketchup.com")
|
335
|
+
# dialog.show
|
336
|
+
# end
|
337
|
+
#
|
338
|
+
# @return [Boolean] Returns true if the dialog is open.
|
339
|
+
#
|
340
|
+
# @return [Boolean]
|
341
|
+
#
|
342
|
+
# @version SketchUp 2017
|
343
|
+
def visible?
|
344
|
+
end
|
345
|
+
|
346
|
+
end
|