sketchup-api-stubs 0.7.8 → 0.7.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sketchup-api-stubs/sketchup.rb +151 -148
- data/lib/sketchup-api-stubs/stubs/Array.rb +741 -741
- data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +322 -322
- data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +172 -172
- data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +126 -126
- data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +102 -102
- data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +400 -400
- data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +661 -661
- data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +509 -523
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +476 -478
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +263 -263
- data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +141 -141
- data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +522 -522
- data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +693 -693
- data/lib/sketchup-api-stubs/stubs/Geom.rb +351 -351
- data/lib/sketchup-api-stubs/stubs/LanguageHandler.rb +93 -93
- data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +595 -595
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +747 -698
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +183 -183
- data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
- data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +517 -516
- data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
- data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +148 -148
- data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +353 -353
- data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +354 -354
- data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +311 -311
- data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +261 -261
- data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +91 -91
- data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +370 -370
- data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +218 -218
- data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +128 -128
- data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +225 -225
- data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +567 -567
- data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +10 -10
- data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +11 -11
- data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +183 -183
- data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +387 -387
- data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +209 -209
- data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +344 -344
- data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +174 -174
- data/lib/sketchup-api-stubs/stubs/Layout/ReferenceEntity.rb +82 -0
- data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +692 -692
- data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1519 -1519
- data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +290 -290
- data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +139 -139
- data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +135 -135
- data/lib/sketchup-api-stubs/stubs/Layout.rb +25 -25
- data/lib/sketchup-api-stubs/stubs/Length.rb +278 -278
- data/lib/sketchup-api-stubs/stubs/Numeric.rb +249 -249
- data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +144 -144
- data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +169 -169
- data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +209 -209
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +150 -152
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +281 -286
- data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +302 -302
- data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +478 -478
- data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
- data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +121 -122
- data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +294 -294
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +659 -619
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +593 -593
- data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +76 -76
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +257 -257
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +32 -32
- data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +201 -201
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +449 -426
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +74 -74
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +104 -104
- data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +165 -165
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +306 -306
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +42 -42
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
- data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +406 -396
- data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +397 -502
- data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1239 -1205
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +261 -272
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +127 -127
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +545 -545
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +60 -60
- data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +125 -126
- data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +937 -937
- data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +102 -104
- data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +750 -750
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +282 -292
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +62 -62
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
- data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +468 -468
- data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +266 -266
- data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +189 -189
- data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +406 -407
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +84 -84
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +306 -306
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +326 -326
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +422 -422
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +427 -427
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +249 -249
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +48 -48
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +114 -112
- data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
- data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +414 -414
- data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +317 -318
- data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +142 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +93 -93
- data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1652 -1651
- data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +357 -357
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +130 -131
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +271 -284
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
- data/lib/sketchup-api-stubs/stubs/Sketchup/Overlay.rb +490 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb +116 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +797 -797
- data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +361 -363
- data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +77 -77
- data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +478 -477
- data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +361 -364
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +45 -45
- data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
- data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +458 -459
- data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +115 -115
- data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +212 -212
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +255 -260
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +59 -59
- data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -40
- data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +69 -69
- data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +217 -217
- data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +262 -262
- data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +217 -217
- data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +834 -837
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
- data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +156 -156
- data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +75 -75
- data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +142 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1311 -1317
- data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +45 -45
- data/lib/sketchup-api-stubs/stubs/Sketchup.rb +1377 -1360
- data/lib/sketchup-api-stubs/stubs/SketchupExtension.rb +353 -353
- data/lib/sketchup-api-stubs/stubs/String.rb +24 -24
- data/lib/sketchup-api-stubs/stubs/UI/Command.rb +389 -389
- data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +494 -496
- data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +269 -269
- data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +241 -240
- data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +635 -635
- data/lib/sketchup-api-stubs/stubs/UI.rb +683 -683
- data/lib/sketchup-api-stubs/stubs/_top_level.rb +303 -311
- data/lib/sketchup-api-stubs.rb +1 -1
- metadata +10 -7
@@ -1,635 +1,635 @@
|
|
1
|
-
# Copyright:: Copyright
|
2
|
-
# License:: The MIT License (MIT)
|
3
|
-
|
4
|
-
# The Ruby WebDialog class allows you to create and interact with DHTML dialog
|
5
|
-
# boxes from Ruby.
|
6
|
-
#
|
7
|
-
# If your goal is to simply display a website to your users, consider using
|
8
|
-
# {UI.openURL}, which will show them a web page in their default browser rather
|
9
|
-
# than inside a dialog in SketchUp.
|
10
|
-
#
|
11
|
-
# See this blog post for a detailed, step-by-step example:
|
12
|
-
# http://sketchupapi.blogspot.com/2008/02/sharing-data-between-sketchup-ruby-and.html
|
13
|
-
#
|
14
|
-
# Under Windows the IE render mode is different in webdialogs than from what
|
15
|
-
# you see in the normal browser. It will by default pick an older render mode
|
16
|
-
# and different versions of SketchUp will use different modes. In order to
|
17
|
-
# reliably control the render mode of your webdialogs under Windows you need to
|
18
|
-
# insert a special META compatibility tag:
|
19
|
-
#
|
20
|
-
# // To always force the latest version available:
|
21
|
-
# <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
22
|
-
#
|
23
|
-
# // To lock to a specific IE version:
|
24
|
-
# <meta http-equiv="X-UA-Compatible" content="IE=8"/>
|
25
|
-
#
|
26
|
-
# Starting with SketchUp 2013, you can embed a special HTML link in your dialog
|
27
|
-
# that will launch Extension Warehouse and show a specified extension's page.
|
28
|
-
# This can be useful if your extension has a dependency on another one and you
|
29
|
-
# would like to direct the user to install that extension.
|
30
|
-
#
|
31
|
-
# For example, to launch an extension's page whose URL is:
|
32
|
-
# http://extensions.sketchup.com/en/content/advanced-camera-tools
|
33
|
-
# The link would be:
|
34
|
-
#
|
35
|
-
# @deprecated Please use {UI::HtmlDialog} that was introduced in
|
36
|
-
# SketchUp 2017.
|
37
|
-
#
|
38
|
-
# @example
|
39
|
-
# <a href="skp:launchEW@advanced-camera-tools">Get Advanced Camera Tools</a>
|
40
|
-
#
|
41
|
-
# @version SketchUp 6.0
|
42
|
-
class UI::WebDialog
|
43
|
-
|
44
|
-
# Instance Methods
|
45
|
-
|
46
|
-
# The add_action_callback method establishes a Ruby callback method that your
|
47
|
-
# web dialog can call to perform some function.
|
48
|
-
#
|
49
|
-
# Use the skp:callback_method_name to invoke the callback method from your
|
50
|
-
# webdialog. Your JavaScript in the webdialog will invoke the callback method
|
51
|
-
# with a string representing arguments to the callback method.
|
52
|
-
#
|
53
|
-
# Note that you're sending data down to Ruby as a single string that's
|
54
|
-
# passed via the window.location bar. In Internet Explorer on PC, there is
|
55
|
-
# a length limit of 2038 characters for this bar, so if you're
|
56
|
-
# needing to pass large data down you might consider using get_element_value
|
57
|
-
# to pull in a longer string from a hidden input field in the HTML.
|
58
|
-
#
|
59
|
-
# @example
|
60
|
-
# # In Ruby code...
|
61
|
-
# dlg.add_action_callback("ruby_messagebox") {|dialog, params|
|
62
|
-
# UI.messagebox("You called ruby_messagebox with: " + params.to_s)
|
63
|
-
# }
|
64
|
-
#
|
65
|
-
# # JavaScript inside the page loaded into the WebDialog:
|
66
|
-
# # window.location = 'skp:ruby_messagebox@Hello World';
|
67
|
-
#
|
68
|
-
# @param callback_name
|
69
|
-
# The name of the callback method to be invoked from the
|
70
|
-
# webdialog.
|
71
|
-
#
|
72
|
-
# @return nil
|
73
|
-
#
|
74
|
-
# @version SketchUp 6.0
|
75
|
-
#
|
76
|
-
# @yield [dialog, params]
|
77
|
-
#
|
78
|
-
# @yieldparam dialog
|
79
|
-
# The dialog.
|
80
|
-
#
|
81
|
-
# @yieldparam params
|
82
|
-
# Any parameters passed to the dialog from HTML.
|
83
|
-
# This is passed as a single string.
|
84
|
-
def add_action_callback(callback_name)
|
85
|
-
end
|
86
|
-
|
87
|
-
# By default, actions are only allowed on the host where the webdialog is
|
88
|
-
# displayed. The allow_actions_from_host method is used to selectively allow
|
89
|
-
# actions to take place on a host remote from the host where the webdialog
|
90
|
-
# exists. If the webdialog is local, no remote host is allowed unless you use
|
91
|
-
# this method.
|
92
|
-
#
|
93
|
-
# @example
|
94
|
-
# dialog.allow_actions_from_host("sketchup.com")
|
95
|
-
#
|
96
|
-
# @param [String] hostname
|
97
|
-
# The name (domain) of the host that your webdialog can
|
98
|
-
# access safely.
|
99
|
-
#
|
100
|
-
# @return [Boolean]
|
101
|
-
#
|
102
|
-
# @version SketchUp 6.0
|
103
|
-
def allow_actions_from_host(hostname)
|
104
|
-
end
|
105
|
-
|
106
|
-
# The bring_to_front method is used to bring the webdialog to the front of all
|
107
|
-
# the windows on the desktop. See show_modal for how to ensure that your
|
108
|
-
# WedDialogs are on top.
|
109
|
-
#
|
110
|
-
# @example
|
111
|
-
# dialog.bring_to_front
|
112
|
-
#
|
113
|
-
# @return [UI::WebDialog]
|
114
|
-
#
|
115
|
-
# @version SketchUp 6.0
|
116
|
-
def bring_to_front
|
117
|
-
end
|
118
|
-
|
119
|
-
# The close method is used to close the webdialog.
|
120
|
-
#
|
121
|
-
# @example
|
122
|
-
# dialog.close
|
123
|
-
#
|
124
|
-
# @return [nil]
|
125
|
-
#
|
126
|
-
# @version SketchUp 6.0
|
127
|
-
def close
|
128
|
-
end
|
129
|
-
|
130
|
-
# The execute_script method is used to execute a JavaScript string on the web
|
131
|
-
# dialog.
|
132
|
-
#
|
133
|
-
# @example
|
134
|
-
# js_command = "document.getElementById('id').innerHTML = '<b>Hi!</b>'"
|
135
|
-
# dialog.execute_script(js_command)
|
136
|
-
#
|
137
|
-
# @param [String] script
|
138
|
-
# The JavaScript script to execute on the webdialog.
|
139
|
-
#
|
140
|
-
# @return [Boolean]
|
141
|
-
#
|
142
|
-
# @version SketchUp 6.0
|
143
|
-
def execute_script(script)
|
144
|
-
end
|
145
|
-
|
146
|
-
# The get_default_dialog_color method is used to get the default dialog color
|
147
|
-
# for the web dialog.
|
148
|
-
#
|
149
|
-
# @example
|
150
|
-
# dialog.get_default_dialog_color
|
151
|
-
# #ece9d8
|
152
|
-
#
|
153
|
-
# @return [String] a six digit hexidecimal number representing the color
|
154
|
-
#
|
155
|
-
# @version SketchUp 6.0
|
156
|
-
def get_default_dialog_color
|
157
|
-
end
|
158
|
-
|
159
|
-
# The get_element_value method is used to get a value, with a given
|
160
|
-
# element_id, from the web dialog's DOM.
|
161
|
-
#
|
162
|
-
# @example
|
163
|
-
# # In Ruby code:
|
164
|
-
# dialog.get_element_value("myTextInput")
|
165
|
-
#
|
166
|
-
# # In webdialog's HTML:
|
167
|
-
# <input type="text" id="myTextInput" value="hello">
|
168
|
-
#
|
169
|
-
# @param [String] element_id
|
170
|
-
# The name of the element in your HTML code.
|
171
|
-
#
|
172
|
-
# @return [String] a string containing the retrieved value.
|
173
|
-
#
|
174
|
-
# @version SketchUp 6.0
|
175
|
-
def get_element_value(element_id)
|
176
|
-
end
|
177
|
-
|
178
|
-
# The +new+ method is used to create a new webdialog.
|
179
|
-
#
|
180
|
-
# 250, left = 0, top = 0, resizable = true)
|
181
|
-
# @param [String] dialog_title The title to be displayed in the webdialog.
|
182
|
-
# @param [Boolean] scrollable true if you want to allow scrollbars, false
|
183
|
-
# if you do not want to allow scrollbars.
|
184
|
-
# @param [String, nil] pref_key The registry entry where the location and
|
185
|
-
# size of the dialog will be saved.
|
186
|
-
# If preferences_key is not included, the
|
187
|
-
# location and size will not be stored.
|
188
|
-
# @param [Integer] width The width of the webdialog.
|
189
|
-
# @param [Integer] height The height of the webdialog.
|
190
|
-
# @param [Integer] left The number of pixels from the left.
|
191
|
-
# @param [Integer] top The number of pixels from the top.
|
192
|
-
# @param [Integer] resizable true if you want the webdialog to be resizable,
|
193
|
-
# false if not.
|
194
|
-
# @return [UI::WebDialog]
|
195
|
-
#
|
196
|
-
# @example
|
197
|
-
# dlg = UI::WebDialog.new("Show sketchup.com", true,
|
198
|
-
# "ShowSketchupDotCom", 739, 641, 150, 150, true);
|
199
|
-
# dlg.set_url "http://www.sketchup.com"
|
200
|
-
# dlg.show
|
201
|
-
#
|
202
|
-
# @note Since SU2017 the position and size of the dialog is DPI aware - it will
|
203
|
-
# scale to the DPI of the monitor automatically. Specify units as they would
|
204
|
-
# be on a traditional low-DPI monitor.
|
205
|
-
#
|
206
|
-
# @note The browser which is embedded inside the dialog depends on the
|
207
|
-
# user's OS. On Mac, Safari is embedded, while on the PC whatever version of
|
208
|
-
# Internet Explorer is installed will be embedded.
|
209
|
-
#
|
210
|
-
# @overload initialize(dialog_title = "", scrollable = true, pref_key = nil, width = 250, height =
|
211
|
-
#
|
212
|
-
#
|
213
|
-
# @overload initialize(properties)
|
214
|
-
#
|
215
|
-
# @version SketchUp 7.0
|
216
|
-
# @param [Hash] properties A hash containing the initial properties of
|
217
|
-
# the newly created dialog.
|
218
|
-
# @option properties [String] :dialog_title
|
219
|
-
# @option properties [String] :preferences_key
|
220
|
-
# @option properties [Boolean] :scrollable
|
221
|
-
# @option properties [Boolean] :resizable (true)
|
222
|
-
# @option properties [Integer] :width (250)
|
223
|
-
# @option properties [Integer] :height (250)
|
224
|
-
# @option properties [Integer] :left (0)
|
225
|
-
# @option properties [Integer] :top (0)
|
226
|
-
# @option properties [Integer] :min_width (0)
|
227
|
-
# @option properties [Integer] :min_height (0)
|
228
|
-
# @option properties [Integer] :max_width (-1)
|
229
|
-
# @option properties [Integer] :max_height (-1)
|
230
|
-
# @option properties [Integer] :full_security (false)
|
231
|
-
# @option properties [Integer] :mac_only_use_nswindow (false)
|
232
|
-
# @return [UI::WebDialog]
|
233
|
-
#
|
234
|
-
# @version SketchUp 6.0
|
235
|
-
def initialize(*args)
|
236
|
-
end
|
237
|
-
|
238
|
-
# The max_height method is used to get the maximum height that the user is
|
239
|
-
# allowed to resize the dialog to.
|
240
|
-
#
|
241
|
-
# @example
|
242
|
-
# max = dialog.max_height
|
243
|
-
#
|
244
|
-
# @return [Integer] the maximum height in pixels
|
245
|
-
#
|
246
|
-
# @version SketchUp 7.0
|
247
|
-
def max_height
|
248
|
-
end
|
249
|
-
|
250
|
-
# The max_height= method is used to set the maximum height that the user is
|
251
|
-
# allowed to resize the dialog to.
|
252
|
-
#
|
253
|
-
# @example
|
254
|
-
# dialog.max_height = 400
|
255
|
-
#
|
256
|
-
# @note As of SU2017 this will automatically scale the height by the same
|
257
|
-
# factor as {UI.scale_factor}.
|
258
|
-
#
|
259
|
-
# @param [Integer] height
|
260
|
-
# The maximum height in pixels
|
261
|
-
#
|
262
|
-
# @return [Integer]
|
263
|
-
#
|
264
|
-
# @version SketchUp 7.0
|
265
|
-
def max_height=(height)
|
266
|
-
end
|
267
|
-
|
268
|
-
# The max_width method is used to get the maximum width that the user is
|
269
|
-
# allowed to resize the dialog to.
|
270
|
-
#
|
271
|
-
# @example
|
272
|
-
# max = dialog.max_width
|
273
|
-
#
|
274
|
-
# @return [Integer] the maximum width in pixels
|
275
|
-
#
|
276
|
-
# @version SketchUp 7.0
|
277
|
-
def max_width
|
278
|
-
end
|
279
|
-
|
280
|
-
# The max_width= method is used to set the maximum width that the user is
|
281
|
-
# allowed to resize the dialog to.
|
282
|
-
#
|
283
|
-
# @example
|
284
|
-
# dialog.max_width = 500
|
285
|
-
#
|
286
|
-
# @note As of SU2017 this will automatically scale the width by the same factor
|
287
|
-
# as {UI.scale_factor}.
|
288
|
-
#
|
289
|
-
# @param [Integer] width
|
290
|
-
# The maximum width in pixels
|
291
|
-
#
|
292
|
-
# @return [Integer]
|
293
|
-
#
|
294
|
-
# @version SketchUp 7.0
|
295
|
-
def max_width=(width)
|
296
|
-
end
|
297
|
-
|
298
|
-
# The min_width method is used to get the minimum height that the user is
|
299
|
-
# allowed to resize the dialog to.
|
300
|
-
#
|
301
|
-
# @example
|
302
|
-
# min = dialog.min_height
|
303
|
-
#
|
304
|
-
# @return [Integer] the minimum height in pixels
|
305
|
-
#
|
306
|
-
# @version SketchUp 7.0
|
307
|
-
def min_height
|
308
|
-
end
|
309
|
-
|
310
|
-
# The min_height= method is used to set the minimum height that the user is
|
311
|
-
# allowed to resize the dialog to.
|
312
|
-
#
|
313
|
-
# @example
|
314
|
-
# dialog.min_height = 100
|
315
|
-
#
|
316
|
-
# @note As of SU2017 this will automatically scale the height by the same
|
317
|
-
# factor as {UI.scale_factor}.
|
318
|
-
#
|
319
|
-
# @param [Integer] height
|
320
|
-
# The minimum height in pixels
|
321
|
-
#
|
322
|
-
# @return [Integer]
|
323
|
-
#
|
324
|
-
# @version SketchUp 7.0
|
325
|
-
def min_height=(height)
|
326
|
-
end
|
327
|
-
|
328
|
-
# The min_width method is used to get the minimum width that the user is
|
329
|
-
# allowed to resize the dialog to.
|
330
|
-
#
|
331
|
-
# @example
|
332
|
-
# min = dialog.min_width
|
333
|
-
#
|
334
|
-
# @return [Integer] the minimum width in pixels
|
335
|
-
#
|
336
|
-
# @version SketchUp 7.0
|
337
|
-
def min_width
|
338
|
-
end
|
339
|
-
|
340
|
-
# The min_width= method is used to set the minimum width that the user is
|
341
|
-
# allowed to resize the dialog to.
|
342
|
-
#
|
343
|
-
# @example
|
344
|
-
# dialog.min_width = 200
|
345
|
-
#
|
346
|
-
# @note As of SU2017 this will automatically scale the width by the same factor
|
347
|
-
# as {UI.scale_factor}.
|
348
|
-
#
|
349
|
-
# @param [Integer] width
|
350
|
-
# The minimum width in pixels
|
351
|
-
#
|
352
|
-
# @return [Integer]
|
353
|
-
#
|
354
|
-
# @version SketchUp 7.0
|
355
|
-
def min_width=(width)
|
356
|
-
end
|
357
|
-
|
358
|
-
# The navigation_buttons_enabled= method is used to set whether the home, next,
|
359
|
-
# and back buttons are visible at the top of the WebDialog on the mac. This
|
360
|
-
# method has no use on the PC, as these buttons are never displayed.
|
361
|
-
#
|
362
|
-
# @example
|
363
|
-
# dialog.navigation_buttons_enabled = false
|
364
|
-
#
|
365
|
-
# @return [Boolean]
|
366
|
-
#
|
367
|
-
# @version SketchUp 7.0
|
368
|
-
def navigation_buttons_enabled=(nav_buttons)
|
369
|
-
end
|
370
|
-
|
371
|
-
# The navigation_buttons_enabled? method is used to get whether the home, next,
|
372
|
-
# and back buttons are visible at the top of the WebDialog on the mac. This
|
373
|
-
# method has no use on the PC, as these buttons are never displayed.
|
374
|
-
#
|
375
|
-
# On the mac, this defaults to true for new WebDialogs.
|
376
|
-
#
|
377
|
-
# @example
|
378
|
-
# nav_buttons = dialog.navigation_buttons_enabled?
|
379
|
-
#
|
380
|
-
# @return [Boolean]
|
381
|
-
#
|
382
|
-
# @version SketchUp 7.0
|
383
|
-
def navigation_buttons_enabled?
|
384
|
-
end
|
385
|
-
|
386
|
-
# The post_url method is used to send the data to a url using the HTTP POST
|
387
|
-
# method.
|
388
|
-
#
|
389
|
-
# @example
|
390
|
-
# data = dialog.post_url("http://www.mydomain.com/formchecker.cgi",data)
|
391
|
-
#
|
392
|
-
# @param [String] url
|
393
|
-
# The url to send the data.
|
394
|
-
#
|
395
|
-
# @param [String] data
|
396
|
-
# The data to be sent.
|
397
|
-
#
|
398
|
-
# @return [nil]
|
399
|
-
#
|
400
|
-
# @version SketchUp 6.0
|
401
|
-
def post_url(url, data)
|
402
|
-
end
|
403
|
-
|
404
|
-
# The screen_scale_factor method returns the ratio of screen pixels to logical
|
405
|
-
# window units (called 'points' on Mac) for the screen this WebDialog is
|
406
|
-
# currently in. On a retina screen Mac, this ratio will be greater than 1.0.
|
407
|
-
# On Windows this always return 1.0.
|
408
|
-
#
|
409
|
-
# @example
|
410
|
-
# factor = dialog.screen_scale_factor
|
411
|
-
#
|
412
|
-
# @return [Float] screen scale factor
|
413
|
-
#
|
414
|
-
# @version SketchUp 2014
|
415
|
-
def screen_scale_factor
|
416
|
-
end
|
417
|
-
|
418
|
-
# The set_background_color method is used to set the background color for the
|
419
|
-
# webdialog.
|
420
|
-
#
|
421
|
-
# @example
|
422
|
-
# dlg.set_background_color("f3f0f0")
|
423
|
-
#
|
424
|
-
# @param [String] color
|
425
|
-
# A six digit hexidecimal color.
|
426
|
-
#
|
427
|
-
# @return [nil]
|
428
|
-
#
|
429
|
-
# @version SketchUp 6.0
|
430
|
-
def set_background_color(color)
|
431
|
-
end
|
432
|
-
|
433
|
-
# The {#set_file} method is used to identify a local HTML file to display in
|
434
|
-
# the webdialog.
|
435
|
-
#
|
436
|
-
# @example
|
437
|
-
# file = File.join(__dir__, 'mypage.html')
|
438
|
-
# dialog.set_file(file)
|
439
|
-
#
|
440
|
-
# @param [String] filename
|
441
|
-
# The filename for the webdialog file (HTML file).
|
442
|
-
#
|
443
|
-
# @param [String] path
|
444
|
-
# A path that filename is relative to.
|
445
|
-
#
|
446
|
-
# @return [nil]
|
447
|
-
#
|
448
|
-
# @version SketchUp 6.0
|
449
|
-
def set_file(filename, path = nil)
|
450
|
-
end
|
451
|
-
|
452
|
-
# The set_full_security method is used to place the WebDialog into a higher
|
453
|
-
# security mode where remote URLs and plugins (such as Flash) are not allowed
|
454
|
-
# inside the browser. This defaults to false when a new WebDialog is created.
|
455
|
-
#
|
456
|
-
# @example
|
457
|
-
# dialog.set_full_security
|
458
|
-
#
|
459
|
-
# @return [UI::WebDialog] the updated WebDialog
|
460
|
-
#
|
461
|
-
# @version SketchUp 7.0
|
462
|
-
def set_full_security
|
463
|
-
end
|
464
|
-
|
465
|
-
# The set_html method is used to load a webdialog with a string of provided
|
466
|
-
# HTML.
|
467
|
-
#
|
468
|
-
# @example
|
469
|
-
# html= '<b>Hello world!</b>'
|
470
|
-
# dialog.set_html(html)
|
471
|
-
#
|
472
|
-
# @param [String] html_string
|
473
|
-
# A string of valid html to display in your webdialog.
|
474
|
-
#
|
475
|
-
# @return [nil]
|
476
|
-
#
|
477
|
-
# @version SketchUp 6.0
|
478
|
-
def set_html(html_string)
|
479
|
-
end
|
480
|
-
|
481
|
-
# The set_on_close method is used to establish one or more activities to
|
482
|
-
# perform when the dialog closes (such as saving values stored in the dialog).
|
483
|
-
#
|
484
|
-
# @example
|
485
|
-
# dialog.set_on_close{ UI.messagebox("Closing the webDialog") }
|
486
|
-
#
|
487
|
-
# @return [nil]
|
488
|
-
#
|
489
|
-
# @version SketchUp 6.0
|
490
|
-
#
|
491
|
-
# @yield Ruby block to perform when the dialog closes.
|
492
|
-
def set_on_close
|
493
|
-
end
|
494
|
-
|
495
|
-
# The set_position method is used to set the position of the webdialog
|
496
|
-
# relative to the screen, in pixels.
|
497
|
-
#
|
498
|
-
# @example
|
499
|
-
# dialog.set_position(100,50)
|
500
|
-
#
|
501
|
-
# @note As of SU2017 this will automatically scale the x and y by the same
|
502
|
-
# factor as {UI.scale_factor}.
|
503
|
-
#
|
504
|
-
# @param [Integer] left
|
505
|
-
# The number of pixels from the left.
|
506
|
-
#
|
507
|
-
# @param [Integer] top
|
508
|
-
# The number of pixels from the top of the screen.
|
509
|
-
#
|
510
|
-
# @return [nil]
|
511
|
-
#
|
512
|
-
# @version SketchUp 6.0
|
513
|
-
def set_position(left, top)
|
514
|
-
end
|
515
|
-
|
516
|
-
# The set_size method is used to set the size of the webdialog, in pixels.
|
517
|
-
#
|
518
|
-
# @example
|
519
|
-
# dialog.set_size(320,240)
|
520
|
-
#
|
521
|
-
# @note As of SU2017 this will automatically scale the width and height by the
|
522
|
-
# same factor as {UI.scale_factor}.
|
523
|
-
#
|
524
|
-
# @param [Integer] w
|
525
|
-
# Width of the webdialog.
|
526
|
-
#
|
527
|
-
# @param [Integer] h
|
528
|
-
# Height of the webdialog.
|
529
|
-
#
|
530
|
-
# @return [nil]
|
531
|
-
#
|
532
|
-
# @version SketchUp 6.0
|
533
|
-
def set_size(w, h)
|
534
|
-
end
|
535
|
-
|
536
|
-
# The set_url method is used to load a webdialog with the content at a
|
537
|
-
# specific URL. This method allows you to load web sites in a webdialog.
|
538
|
-
#
|
539
|
-
# @example
|
540
|
-
# dialog.set_url "http://www.sketchup.com"
|
541
|
-
#
|
542
|
-
# @param [String] url
|
543
|
-
# The URL for a specific web site.
|
544
|
-
#
|
545
|
-
# @return [nil]
|
546
|
-
#
|
547
|
-
# @version SketchUp 6.0
|
548
|
-
def set_url(url)
|
549
|
-
end
|
550
|
-
|
551
|
-
# The show method is used to display a non-modal dialog box.
|
552
|
-
#
|
553
|
-
# @example
|
554
|
-
# dialog.show {
|
555
|
-
# dialog.execute_script("alert(10)");
|
556
|
-
# }
|
557
|
-
#
|
558
|
-
# @return [nil]
|
559
|
-
#
|
560
|
-
# @version SketchUp 6.0
|
561
|
-
#
|
562
|
-
# @yield [dialog] (optional) Ruby code to perform when the dialog is first
|
563
|
-
# displayed.
|
564
|
-
def show
|
565
|
-
end
|
566
|
-
|
567
|
-
# The show_modal method is used to display a modal dialog box. In SketchUp 6
|
568
|
-
# and 7, this behaves differently on Mac vs. PC. On the PC, it shows a truly
|
569
|
-
# modal dialog, meaning so long as the WebDialog is visible, no input can be
|
570
|
-
# performed elsewhere inside SketchUp. On the Mac, "modal" WebDialogs do not
|
571
|
-
# behave this way, but instead are "always on top" of other windows.
|
572
|
-
#
|
573
|
-
# @example
|
574
|
-
# dialog.show_modal {
|
575
|
-
# dialog.execute_script("alert(10)");
|
576
|
-
# }
|
577
|
-
#
|
578
|
-
# @return [nil]
|
579
|
-
#
|
580
|
-
# @version SketchUp 6.0
|
581
|
-
#
|
582
|
-
# @yield [dialog] (optional) Ruby code to perform when the dialog is first
|
583
|
-
# displayed.
|
584
|
-
def show_modal
|
585
|
-
end
|
586
|
-
|
587
|
-
# The visible? method is used to tell if the webdialog is currently shown.
|
588
|
-
#
|
589
|
-
# @example
|
590
|
-
# vis = dialog.visible?
|
591
|
-
#
|
592
|
-
# @return [Boolean]
|
593
|
-
#
|
594
|
-
# @version SketchUp 6.0
|
595
|
-
def visible?
|
596
|
-
end
|
597
|
-
|
598
|
-
# The write_image method is used to grab a portion of the web dialog screen and
|
599
|
-
# save the image to the given file path.
|
600
|
-
#
|
601
|
-
# @example
|
602
|
-
# dialog.write_image('c:/grab.jpg', 70, 0, 0, 100, 100)
|
603
|
-
# dialog.write_image('c:/grab.png', 4, 0, 0, 100, 100)
|
604
|
-
#
|
605
|
-
# @param [String] image_path
|
606
|
-
# The destination path of the saved image.
|
607
|
-
#
|
608
|
-
# @param [Integer] option
|
609
|
-
# Specifies what method to use when saving the image. For
|
610
|
-
# JPG/JPEG images, this specifies the image quality and
|
611
|
-
# can range from 1 to 100. For PNG images this specifies
|
612
|
-
# the compression algorithm: <4 (best speed), 4-8
|
613
|
-
# (default), or >=9 (best compression).
|
614
|
-
#
|
615
|
-
# @param [Integer] top_left_x
|
616
|
-
# The x coordinate of the upper left corner of the
|
617
|
-
# region to grab.
|
618
|
-
#
|
619
|
-
# @param [Integer] top_left_y
|
620
|
-
# The x coordinate of the upper left corner of the
|
621
|
-
# region to grab.
|
622
|
-
#
|
623
|
-
# @param [Integer] bottom_right_x
|
624
|
-
# The x coordinate of the lower right corner of the
|
625
|
-
# region to grab.
|
626
|
-
#
|
627
|
-
# @param [Integer] bottom_right_y
|
628
|
-
# The x coordinate of the lower right corner of the
|
629
|
-
# region to grab.
|
630
|
-
#
|
631
|
-
# @version SketchUp 7.1
|
632
|
-
def write_image(image_path, option, top_left_x, top_left_y, bottom_right_x, bottom_right_y)
|
633
|
-
end
|
634
|
-
|
635
|
-
end
|
1
|
+
# Copyright:: Copyright 2023 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The Ruby WebDialog class allows you to create and interact with DHTML dialog
|
5
|
+
# boxes from Ruby.
|
6
|
+
#
|
7
|
+
# If your goal is to simply display a website to your users, consider using
|
8
|
+
# {UI.openURL}, which will show them a web page in their default browser rather
|
9
|
+
# than inside a dialog in SketchUp.
|
10
|
+
#
|
11
|
+
# See this blog post for a detailed, step-by-step example:
|
12
|
+
# http://sketchupapi.blogspot.com/2008/02/sharing-data-between-sketchup-ruby-and.html
|
13
|
+
#
|
14
|
+
# Under Windows the IE render mode is different in webdialogs than from what
|
15
|
+
# you see in the normal browser. It will by default pick an older render mode
|
16
|
+
# and different versions of SketchUp will use different modes. In order to
|
17
|
+
# reliably control the render mode of your webdialogs under Windows you need to
|
18
|
+
# insert a special META compatibility tag:
|
19
|
+
#
|
20
|
+
# // To always force the latest version available:
|
21
|
+
# <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
22
|
+
#
|
23
|
+
# // To lock to a specific IE version:
|
24
|
+
# <meta http-equiv="X-UA-Compatible" content="IE=8"/>
|
25
|
+
#
|
26
|
+
# Starting with SketchUp 2013, you can embed a special HTML link in your dialog
|
27
|
+
# that will launch Extension Warehouse and show a specified extension's page.
|
28
|
+
# This can be useful if your extension has a dependency on another one and you
|
29
|
+
# would like to direct the user to install that extension.
|
30
|
+
#
|
31
|
+
# For example, to launch an extension's page whose URL is:
|
32
|
+
# http://extensions.sketchup.com/en/content/advanced-camera-tools
|
33
|
+
# The link would be:
|
34
|
+
#
|
35
|
+
# @deprecated Please use {UI::HtmlDialog} that was introduced in
|
36
|
+
# SketchUp 2017.
|
37
|
+
#
|
38
|
+
# @example
|
39
|
+
# <a href="skp:launchEW@advanced-camera-tools">Get Advanced Camera Tools</a>
|
40
|
+
#
|
41
|
+
# @version SketchUp 6.0
|
42
|
+
class UI::WebDialog
|
43
|
+
|
44
|
+
# Instance Methods
|
45
|
+
|
46
|
+
# The add_action_callback method establishes a Ruby callback method that your
|
47
|
+
# web dialog can call to perform some function.
|
48
|
+
#
|
49
|
+
# Use the skp:callback_method_name to invoke the callback method from your
|
50
|
+
# webdialog. Your JavaScript in the webdialog will invoke the callback method
|
51
|
+
# with a string representing arguments to the callback method.
|
52
|
+
#
|
53
|
+
# Note that you're sending data down to Ruby as a single string that's
|
54
|
+
# passed via the window.location bar. In Internet Explorer on PC, there is
|
55
|
+
# a length limit of 2038 characters for this bar, so if you're
|
56
|
+
# needing to pass large data down you might consider using get_element_value
|
57
|
+
# to pull in a longer string from a hidden input field in the HTML.
|
58
|
+
#
|
59
|
+
# @example
|
60
|
+
# # In Ruby code...
|
61
|
+
# dlg.add_action_callback("ruby_messagebox") {|dialog, params|
|
62
|
+
# UI.messagebox("You called ruby_messagebox with: " + params.to_s)
|
63
|
+
# }
|
64
|
+
#
|
65
|
+
# # JavaScript inside the page loaded into the WebDialog:
|
66
|
+
# # window.location = 'skp:ruby_messagebox@Hello World';
|
67
|
+
#
|
68
|
+
# @param callback_name
|
69
|
+
# The name of the callback method to be invoked from the
|
70
|
+
# webdialog.
|
71
|
+
#
|
72
|
+
# @return nil
|
73
|
+
#
|
74
|
+
# @version SketchUp 6.0
|
75
|
+
#
|
76
|
+
# @yield [dialog, params]
|
77
|
+
#
|
78
|
+
# @yieldparam dialog
|
79
|
+
# The dialog.
|
80
|
+
#
|
81
|
+
# @yieldparam params
|
82
|
+
# Any parameters passed to the dialog from HTML.
|
83
|
+
# This is passed as a single string.
|
84
|
+
def add_action_callback(callback_name)
|
85
|
+
end
|
86
|
+
|
87
|
+
# By default, actions are only allowed on the host where the webdialog is
|
88
|
+
# displayed. The allow_actions_from_host method is used to selectively allow
|
89
|
+
# actions to take place on a host remote from the host where the webdialog
|
90
|
+
# exists. If the webdialog is local, no remote host is allowed unless you use
|
91
|
+
# this method.
|
92
|
+
#
|
93
|
+
# @example
|
94
|
+
# dialog.allow_actions_from_host("sketchup.com")
|
95
|
+
#
|
96
|
+
# @param [String] hostname
|
97
|
+
# The name (domain) of the host that your webdialog can
|
98
|
+
# access safely.
|
99
|
+
#
|
100
|
+
# @return [Boolean]
|
101
|
+
#
|
102
|
+
# @version SketchUp 6.0
|
103
|
+
def allow_actions_from_host(hostname)
|
104
|
+
end
|
105
|
+
|
106
|
+
# The bring_to_front method is used to bring the webdialog to the front of all
|
107
|
+
# the windows on the desktop. See show_modal for how to ensure that your
|
108
|
+
# WedDialogs are on top.
|
109
|
+
#
|
110
|
+
# @example
|
111
|
+
# dialog.bring_to_front
|
112
|
+
#
|
113
|
+
# @return [UI::WebDialog]
|
114
|
+
#
|
115
|
+
# @version SketchUp 6.0
|
116
|
+
def bring_to_front
|
117
|
+
end
|
118
|
+
|
119
|
+
# The close method is used to close the webdialog.
|
120
|
+
#
|
121
|
+
# @example
|
122
|
+
# dialog.close
|
123
|
+
#
|
124
|
+
# @return [nil]
|
125
|
+
#
|
126
|
+
# @version SketchUp 6.0
|
127
|
+
def close
|
128
|
+
end
|
129
|
+
|
130
|
+
# The execute_script method is used to execute a JavaScript string on the web
|
131
|
+
# dialog.
|
132
|
+
#
|
133
|
+
# @example
|
134
|
+
# js_command = "document.getElementById('id').innerHTML = '<b>Hi!</b>'"
|
135
|
+
# dialog.execute_script(js_command)
|
136
|
+
#
|
137
|
+
# @param [String] script
|
138
|
+
# The JavaScript script to execute on the webdialog.
|
139
|
+
#
|
140
|
+
# @return [Boolean]
|
141
|
+
#
|
142
|
+
# @version SketchUp 6.0
|
143
|
+
def execute_script(script)
|
144
|
+
end
|
145
|
+
|
146
|
+
# The get_default_dialog_color method is used to get the default dialog color
|
147
|
+
# for the web dialog.
|
148
|
+
#
|
149
|
+
# @example
|
150
|
+
# dialog.get_default_dialog_color
|
151
|
+
# #ece9d8
|
152
|
+
#
|
153
|
+
# @return [String] a six digit hexidecimal number representing the color
|
154
|
+
#
|
155
|
+
# @version SketchUp 6.0
|
156
|
+
def get_default_dialog_color
|
157
|
+
end
|
158
|
+
|
159
|
+
# The get_element_value method is used to get a value, with a given
|
160
|
+
# element_id, from the web dialog's DOM.
|
161
|
+
#
|
162
|
+
# @example
|
163
|
+
# # In Ruby code:
|
164
|
+
# dialog.get_element_value("myTextInput")
|
165
|
+
#
|
166
|
+
# # In webdialog's HTML:
|
167
|
+
# <input type="text" id="myTextInput" value="hello">
|
168
|
+
#
|
169
|
+
# @param [String] element_id
|
170
|
+
# The name of the element in your HTML code.
|
171
|
+
#
|
172
|
+
# @return [String] a string containing the retrieved value.
|
173
|
+
#
|
174
|
+
# @version SketchUp 6.0
|
175
|
+
def get_element_value(element_id)
|
176
|
+
end
|
177
|
+
|
178
|
+
# The +new+ method is used to create a new webdialog.
|
179
|
+
#
|
180
|
+
# 250, left = 0, top = 0, resizable = true)
|
181
|
+
# @param [String] dialog_title The title to be displayed in the webdialog.
|
182
|
+
# @param [Boolean] scrollable true if you want to allow scrollbars, false
|
183
|
+
# if you do not want to allow scrollbars.
|
184
|
+
# @param [String, nil] pref_key The registry entry where the location and
|
185
|
+
# size of the dialog will be saved.
|
186
|
+
# If preferences_key is not included, the
|
187
|
+
# location and size will not be stored.
|
188
|
+
# @param [Integer] width The width of the webdialog.
|
189
|
+
# @param [Integer] height The height of the webdialog.
|
190
|
+
# @param [Integer] left The number of pixels from the left.
|
191
|
+
# @param [Integer] top The number of pixels from the top.
|
192
|
+
# @param [Integer] resizable true if you want the webdialog to be resizable,
|
193
|
+
# false if not.
|
194
|
+
# @return [UI::WebDialog]
|
195
|
+
#
|
196
|
+
# @example
|
197
|
+
# dlg = UI::WebDialog.new("Show sketchup.com", true,
|
198
|
+
# "ShowSketchupDotCom", 739, 641, 150, 150, true);
|
199
|
+
# dlg.set_url "http://www.sketchup.com"
|
200
|
+
# dlg.show
|
201
|
+
#
|
202
|
+
# @note Since SU2017 the position and size of the dialog is DPI aware - it will
|
203
|
+
# scale to the DPI of the monitor automatically. Specify units as they would
|
204
|
+
# be on a traditional low-DPI monitor.
|
205
|
+
#
|
206
|
+
# @note The browser which is embedded inside the dialog depends on the
|
207
|
+
# user's OS. On Mac, Safari is embedded, while on the PC whatever version of
|
208
|
+
# Internet Explorer is installed will be embedded.
|
209
|
+
#
|
210
|
+
# @overload initialize(dialog_title = "", scrollable = true, pref_key = nil, width = 250, height =
|
211
|
+
#
|
212
|
+
#
|
213
|
+
# @overload initialize(properties)
|
214
|
+
#
|
215
|
+
# @version SketchUp 7.0
|
216
|
+
# @param [Hash] properties A hash containing the initial properties of
|
217
|
+
# the newly created dialog.
|
218
|
+
# @option properties [String] :dialog_title
|
219
|
+
# @option properties [String] :preferences_key
|
220
|
+
# @option properties [Boolean] :scrollable
|
221
|
+
# @option properties [Boolean] :resizable (true)
|
222
|
+
# @option properties [Integer] :width (250)
|
223
|
+
# @option properties [Integer] :height (250)
|
224
|
+
# @option properties [Integer] :left (0)
|
225
|
+
# @option properties [Integer] :top (0)
|
226
|
+
# @option properties [Integer] :min_width (0)
|
227
|
+
# @option properties [Integer] :min_height (0)
|
228
|
+
# @option properties [Integer] :max_width (-1)
|
229
|
+
# @option properties [Integer] :max_height (-1)
|
230
|
+
# @option properties [Integer] :full_security (false)
|
231
|
+
# @option properties [Integer] :mac_only_use_nswindow (false)
|
232
|
+
# @return [UI::WebDialog]
|
233
|
+
#
|
234
|
+
# @version SketchUp 6.0
|
235
|
+
def initialize(*args)
|
236
|
+
end
|
237
|
+
|
238
|
+
# The max_height method is used to get the maximum height that the user is
|
239
|
+
# allowed to resize the dialog to.
|
240
|
+
#
|
241
|
+
# @example
|
242
|
+
# max = dialog.max_height
|
243
|
+
#
|
244
|
+
# @return [Integer] the maximum height in pixels
|
245
|
+
#
|
246
|
+
# @version SketchUp 7.0
|
247
|
+
def max_height
|
248
|
+
end
|
249
|
+
|
250
|
+
# The max_height= method is used to set the maximum height that the user is
|
251
|
+
# allowed to resize the dialog to.
|
252
|
+
#
|
253
|
+
# @example
|
254
|
+
# dialog.max_height = 400
|
255
|
+
#
|
256
|
+
# @note As of SU2017 this will automatically scale the height by the same
|
257
|
+
# factor as {UI.scale_factor}.
|
258
|
+
#
|
259
|
+
# @param [Integer] height
|
260
|
+
# The maximum height in pixels
|
261
|
+
#
|
262
|
+
# @return [Integer]
|
263
|
+
#
|
264
|
+
# @version SketchUp 7.0
|
265
|
+
def max_height=(height)
|
266
|
+
end
|
267
|
+
|
268
|
+
# The max_width method is used to get the maximum width that the user is
|
269
|
+
# allowed to resize the dialog to.
|
270
|
+
#
|
271
|
+
# @example
|
272
|
+
# max = dialog.max_width
|
273
|
+
#
|
274
|
+
# @return [Integer] the maximum width in pixels
|
275
|
+
#
|
276
|
+
# @version SketchUp 7.0
|
277
|
+
def max_width
|
278
|
+
end
|
279
|
+
|
280
|
+
# The max_width= method is used to set the maximum width that the user is
|
281
|
+
# allowed to resize the dialog to.
|
282
|
+
#
|
283
|
+
# @example
|
284
|
+
# dialog.max_width = 500
|
285
|
+
#
|
286
|
+
# @note As of SU2017 this will automatically scale the width by the same factor
|
287
|
+
# as {UI.scale_factor}.
|
288
|
+
#
|
289
|
+
# @param [Integer] width
|
290
|
+
# The maximum width in pixels
|
291
|
+
#
|
292
|
+
# @return [Integer]
|
293
|
+
#
|
294
|
+
# @version SketchUp 7.0
|
295
|
+
def max_width=(width)
|
296
|
+
end
|
297
|
+
|
298
|
+
# The min_width method is used to get the minimum height that the user is
|
299
|
+
# allowed to resize the dialog to.
|
300
|
+
#
|
301
|
+
# @example
|
302
|
+
# min = dialog.min_height
|
303
|
+
#
|
304
|
+
# @return [Integer] the minimum height in pixels
|
305
|
+
#
|
306
|
+
# @version SketchUp 7.0
|
307
|
+
def min_height
|
308
|
+
end
|
309
|
+
|
310
|
+
# The min_height= method is used to set the minimum height that the user is
|
311
|
+
# allowed to resize the dialog to.
|
312
|
+
#
|
313
|
+
# @example
|
314
|
+
# dialog.min_height = 100
|
315
|
+
#
|
316
|
+
# @note As of SU2017 this will automatically scale the height by the same
|
317
|
+
# factor as {UI.scale_factor}.
|
318
|
+
#
|
319
|
+
# @param [Integer] height
|
320
|
+
# The minimum height in pixels
|
321
|
+
#
|
322
|
+
# @return [Integer]
|
323
|
+
#
|
324
|
+
# @version SketchUp 7.0
|
325
|
+
def min_height=(height)
|
326
|
+
end
|
327
|
+
|
328
|
+
# The min_width method is used to get the minimum width that the user is
|
329
|
+
# allowed to resize the dialog to.
|
330
|
+
#
|
331
|
+
# @example
|
332
|
+
# min = dialog.min_width
|
333
|
+
#
|
334
|
+
# @return [Integer] the minimum width in pixels
|
335
|
+
#
|
336
|
+
# @version SketchUp 7.0
|
337
|
+
def min_width
|
338
|
+
end
|
339
|
+
|
340
|
+
# The min_width= method is used to set the minimum width that the user is
|
341
|
+
# allowed to resize the dialog to.
|
342
|
+
#
|
343
|
+
# @example
|
344
|
+
# dialog.min_width = 200
|
345
|
+
#
|
346
|
+
# @note As of SU2017 this will automatically scale the width by the same factor
|
347
|
+
# as {UI.scale_factor}.
|
348
|
+
#
|
349
|
+
# @param [Integer] width
|
350
|
+
# The minimum width in pixels
|
351
|
+
#
|
352
|
+
# @return [Integer]
|
353
|
+
#
|
354
|
+
# @version SketchUp 7.0
|
355
|
+
def min_width=(width)
|
356
|
+
end
|
357
|
+
|
358
|
+
# The navigation_buttons_enabled= method is used to set whether the home, next,
|
359
|
+
# and back buttons are visible at the top of the WebDialog on the mac. This
|
360
|
+
# method has no use on the PC, as these buttons are never displayed.
|
361
|
+
#
|
362
|
+
# @example
|
363
|
+
# dialog.navigation_buttons_enabled = false
|
364
|
+
#
|
365
|
+
# @return [Boolean]
|
366
|
+
#
|
367
|
+
# @version SketchUp 7.0
|
368
|
+
def navigation_buttons_enabled=(nav_buttons)
|
369
|
+
end
|
370
|
+
|
371
|
+
# The navigation_buttons_enabled? method is used to get whether the home, next,
|
372
|
+
# and back buttons are visible at the top of the WebDialog on the mac. This
|
373
|
+
# method has no use on the PC, as these buttons are never displayed.
|
374
|
+
#
|
375
|
+
# On the mac, this defaults to true for new WebDialogs.
|
376
|
+
#
|
377
|
+
# @example
|
378
|
+
# nav_buttons = dialog.navigation_buttons_enabled?
|
379
|
+
#
|
380
|
+
# @return [Boolean]
|
381
|
+
#
|
382
|
+
# @version SketchUp 7.0
|
383
|
+
def navigation_buttons_enabled?
|
384
|
+
end
|
385
|
+
|
386
|
+
# The post_url method is used to send the data to a url using the HTTP POST
|
387
|
+
# method.
|
388
|
+
#
|
389
|
+
# @example
|
390
|
+
# data = dialog.post_url("http://www.mydomain.com/formchecker.cgi",data)
|
391
|
+
#
|
392
|
+
# @param [String] url
|
393
|
+
# The url to send the data.
|
394
|
+
#
|
395
|
+
# @param [String] data
|
396
|
+
# The data to be sent.
|
397
|
+
#
|
398
|
+
# @return [nil]
|
399
|
+
#
|
400
|
+
# @version SketchUp 6.0
|
401
|
+
def post_url(url, data)
|
402
|
+
end
|
403
|
+
|
404
|
+
# The screen_scale_factor method returns the ratio of screen pixels to logical
|
405
|
+
# window units (called 'points' on Mac) for the screen this WebDialog is
|
406
|
+
# currently in. On a retina screen Mac, this ratio will be greater than 1.0.
|
407
|
+
# On Windows this always return 1.0.
|
408
|
+
#
|
409
|
+
# @example
|
410
|
+
# factor = dialog.screen_scale_factor
|
411
|
+
#
|
412
|
+
# @return [Float] screen scale factor
|
413
|
+
#
|
414
|
+
# @version SketchUp 2014
|
415
|
+
def screen_scale_factor
|
416
|
+
end
|
417
|
+
|
418
|
+
# The set_background_color method is used to set the background color for the
|
419
|
+
# webdialog.
|
420
|
+
#
|
421
|
+
# @example
|
422
|
+
# dlg.set_background_color("f3f0f0")
|
423
|
+
#
|
424
|
+
# @param [String] color
|
425
|
+
# A six digit hexidecimal color.
|
426
|
+
#
|
427
|
+
# @return [nil]
|
428
|
+
#
|
429
|
+
# @version SketchUp 6.0
|
430
|
+
def set_background_color(color)
|
431
|
+
end
|
432
|
+
|
433
|
+
# The {#set_file} method is used to identify a local HTML file to display in
|
434
|
+
# the webdialog.
|
435
|
+
#
|
436
|
+
# @example
|
437
|
+
# file = File.join(__dir__, 'mypage.html')
|
438
|
+
# dialog.set_file(file)
|
439
|
+
#
|
440
|
+
# @param [String] filename
|
441
|
+
# The filename for the webdialog file (HTML file).
|
442
|
+
#
|
443
|
+
# @param [String] path
|
444
|
+
# A path that filename is relative to.
|
445
|
+
#
|
446
|
+
# @return [nil]
|
447
|
+
#
|
448
|
+
# @version SketchUp 6.0
|
449
|
+
def set_file(filename, path = nil)
|
450
|
+
end
|
451
|
+
|
452
|
+
# The set_full_security method is used to place the WebDialog into a higher
|
453
|
+
# security mode where remote URLs and plugins (such as Flash) are not allowed
|
454
|
+
# inside the browser. This defaults to false when a new WebDialog is created.
|
455
|
+
#
|
456
|
+
# @example
|
457
|
+
# dialog.set_full_security
|
458
|
+
#
|
459
|
+
# @return [UI::WebDialog] the updated WebDialog
|
460
|
+
#
|
461
|
+
# @version SketchUp 7.0
|
462
|
+
def set_full_security
|
463
|
+
end
|
464
|
+
|
465
|
+
# The set_html method is used to load a webdialog with a string of provided
|
466
|
+
# HTML.
|
467
|
+
#
|
468
|
+
# @example
|
469
|
+
# html= '<b>Hello world!</b>'
|
470
|
+
# dialog.set_html(html)
|
471
|
+
#
|
472
|
+
# @param [String] html_string
|
473
|
+
# A string of valid html to display in your webdialog.
|
474
|
+
#
|
475
|
+
# @return [nil]
|
476
|
+
#
|
477
|
+
# @version SketchUp 6.0
|
478
|
+
def set_html(html_string)
|
479
|
+
end
|
480
|
+
|
481
|
+
# The set_on_close method is used to establish one or more activities to
|
482
|
+
# perform when the dialog closes (such as saving values stored in the dialog).
|
483
|
+
#
|
484
|
+
# @example
|
485
|
+
# dialog.set_on_close{ UI.messagebox("Closing the webDialog") }
|
486
|
+
#
|
487
|
+
# @return [nil]
|
488
|
+
#
|
489
|
+
# @version SketchUp 6.0
|
490
|
+
#
|
491
|
+
# @yield Ruby block to perform when the dialog closes.
|
492
|
+
def set_on_close
|
493
|
+
end
|
494
|
+
|
495
|
+
# The set_position method is used to set the position of the webdialog
|
496
|
+
# relative to the screen, in pixels.
|
497
|
+
#
|
498
|
+
# @example
|
499
|
+
# dialog.set_position(100,50)
|
500
|
+
#
|
501
|
+
# @note As of SU2017 this will automatically scale the x and y by the same
|
502
|
+
# factor as {UI.scale_factor}.
|
503
|
+
#
|
504
|
+
# @param [Integer] left
|
505
|
+
# The number of pixels from the left.
|
506
|
+
#
|
507
|
+
# @param [Integer] top
|
508
|
+
# The number of pixels from the top of the screen.
|
509
|
+
#
|
510
|
+
# @return [nil]
|
511
|
+
#
|
512
|
+
# @version SketchUp 6.0
|
513
|
+
def set_position(left, top)
|
514
|
+
end
|
515
|
+
|
516
|
+
# The set_size method is used to set the size of the webdialog, in pixels.
|
517
|
+
#
|
518
|
+
# @example
|
519
|
+
# dialog.set_size(320,240)
|
520
|
+
#
|
521
|
+
# @note As of SU2017 this will automatically scale the width and height by the
|
522
|
+
# same factor as {UI.scale_factor}.
|
523
|
+
#
|
524
|
+
# @param [Integer] w
|
525
|
+
# Width of the webdialog.
|
526
|
+
#
|
527
|
+
# @param [Integer] h
|
528
|
+
# Height of the webdialog.
|
529
|
+
#
|
530
|
+
# @return [nil]
|
531
|
+
#
|
532
|
+
# @version SketchUp 6.0
|
533
|
+
def set_size(w, h)
|
534
|
+
end
|
535
|
+
|
536
|
+
# The set_url method is used to load a webdialog with the content at a
|
537
|
+
# specific URL. This method allows you to load web sites in a webdialog.
|
538
|
+
#
|
539
|
+
# @example
|
540
|
+
# dialog.set_url "http://www.sketchup.com"
|
541
|
+
#
|
542
|
+
# @param [String] url
|
543
|
+
# The URL for a specific web site.
|
544
|
+
#
|
545
|
+
# @return [nil]
|
546
|
+
#
|
547
|
+
# @version SketchUp 6.0
|
548
|
+
def set_url(url)
|
549
|
+
end
|
550
|
+
|
551
|
+
# The show method is used to display a non-modal dialog box.
|
552
|
+
#
|
553
|
+
# @example
|
554
|
+
# dialog.show {
|
555
|
+
# dialog.execute_script("alert(10)");
|
556
|
+
# }
|
557
|
+
#
|
558
|
+
# @return [nil]
|
559
|
+
#
|
560
|
+
# @version SketchUp 6.0
|
561
|
+
#
|
562
|
+
# @yield [dialog] (optional) Ruby code to perform when the dialog is first
|
563
|
+
# displayed.
|
564
|
+
def show
|
565
|
+
end
|
566
|
+
|
567
|
+
# The show_modal method is used to display a modal dialog box. In SketchUp 6
|
568
|
+
# and 7, this behaves differently on Mac vs. PC. On the PC, it shows a truly
|
569
|
+
# modal dialog, meaning so long as the WebDialog is visible, no input can be
|
570
|
+
# performed elsewhere inside SketchUp. On the Mac, "modal" WebDialogs do not
|
571
|
+
# behave this way, but instead are "always on top" of other windows.
|
572
|
+
#
|
573
|
+
# @example
|
574
|
+
# dialog.show_modal {
|
575
|
+
# dialog.execute_script("alert(10)");
|
576
|
+
# }
|
577
|
+
#
|
578
|
+
# @return [nil]
|
579
|
+
#
|
580
|
+
# @version SketchUp 6.0
|
581
|
+
#
|
582
|
+
# @yield [dialog] (optional) Ruby code to perform when the dialog is first
|
583
|
+
# displayed.
|
584
|
+
def show_modal
|
585
|
+
end
|
586
|
+
|
587
|
+
# The visible? method is used to tell if the webdialog is currently shown.
|
588
|
+
#
|
589
|
+
# @example
|
590
|
+
# vis = dialog.visible?
|
591
|
+
#
|
592
|
+
# @return [Boolean]
|
593
|
+
#
|
594
|
+
# @version SketchUp 6.0
|
595
|
+
def visible?
|
596
|
+
end
|
597
|
+
|
598
|
+
# The write_image method is used to grab a portion of the web dialog screen and
|
599
|
+
# save the image to the given file path.
|
600
|
+
#
|
601
|
+
# @example
|
602
|
+
# dialog.write_image('c:/grab.jpg', 70, 0, 0, 100, 100)
|
603
|
+
# dialog.write_image('c:/grab.png', 4, 0, 0, 100, 100)
|
604
|
+
#
|
605
|
+
# @param [String] image_path
|
606
|
+
# The destination path of the saved image.
|
607
|
+
#
|
608
|
+
# @param [Integer] option
|
609
|
+
# Specifies what method to use when saving the image. For
|
610
|
+
# JPG/JPEG images, this specifies the image quality and
|
611
|
+
# can range from 1 to 100. For PNG images this specifies
|
612
|
+
# the compression algorithm: <4 (best speed), 4-8
|
613
|
+
# (default), or >=9 (best compression).
|
614
|
+
#
|
615
|
+
# @param [Integer] top_left_x
|
616
|
+
# The x coordinate of the upper left corner of the
|
617
|
+
# region to grab.
|
618
|
+
#
|
619
|
+
# @param [Integer] top_left_y
|
620
|
+
# The x coordinate of the upper left corner of the
|
621
|
+
# region to grab.
|
622
|
+
#
|
623
|
+
# @param [Integer] bottom_right_x
|
624
|
+
# The x coordinate of the lower right corner of the
|
625
|
+
# region to grab.
|
626
|
+
#
|
627
|
+
# @param [Integer] bottom_right_y
|
628
|
+
# The x coordinate of the lower right corner of the
|
629
|
+
# region to grab.
|
630
|
+
#
|
631
|
+
# @version SketchUp 7.1
|
632
|
+
def write_image(image_path, option, top_left_x, top_left_y, bottom_right_x, bottom_right_y)
|
633
|
+
end
|
634
|
+
|
635
|
+
end
|