summaryrefslogtreecommitdiff
path: root/widgets.js
diff options
context:
space:
mode:
authorjmoenig <jens@moenig.org>2013-07-04 15:31:05 +0200
committerjmoenig <jens@moenig.org>2013-07-04 15:31:05 +0200
commitb59f7f3e274688a4c70df6e9a16f02d88005a381 (patch)
tree4166e0d642e4c5bcaefafa90ae63a32c3ed8e307 /widgets.js
parent8e0f60fdd68a145d7f2acc5d350d5214c844fd54 (diff)
downloadsnap-byow-b59f7f3e274688a4c70df6e9a16f02d88005a381.tar.gz
snap-byow-b59f7f3e274688a4c70df6e9a16f02d88005a381.zip
Codification (blocks to text) support complete
text code mapping and block header support, both via GUI and primitives, for built-in blocks and for custom ones.
Diffstat (limited to 'widgets.js')
-rw-r--r--widgets.js32
1 files changed, 29 insertions, 3 deletions
diff --git a/widgets.js b/widgets.js
index 7d12549..45ef2d1 100644
--- a/widgets.js
+++ b/widgets.js
@@ -74,7 +74,7 @@ HTMLCanvasElement, fontHeight, SymbolMorph, localize, SpeechBubbleMorph,
ArrowMorph, MenuMorph, isString, isNil, SliderMorph, MorphicPreferences,
ScrollFrameMorph*/
-modules.widgets = '2013-June-25';
+modules.widgets = '2013-July-04';
var PushButtonMorph;
var ToggleButtonMorph;
@@ -1680,16 +1680,33 @@ DialogBoxMorph.prototype.promptCode = function (
title,
defaultString,
world,
- pic
+ pic,
+ instructions
) {
var frame = new ScrollFrameMorph(),
text = new TextMorph(defaultString || ''),
+ bdy = new AlignmentMorph('column', this.padding),
size = pic ? Math.max(pic.width, 400) : 400;
this.getInput = function () {
return text.text;
};
+ function remarkText(string) {
+ return new TextMorph(
+ string,
+ 10,
+ null, // style
+ false, // bold
+ null, // italic
+ null, // alignment
+ null, // width
+ null, // font name
+ MorphicPreferences.isFlat ? null : new Point(1, 1),
+ new Color(255, 255, 255) // shadowColor
+ );
+ }
+
frame.padding = 6;
frame.setWidth(size);
frame.acceptsDrops = false;
@@ -1723,8 +1740,17 @@ DialogBoxMorph.prototype.promptCode = function (
this.key = 'promptCode' + title + defaultString;
}
- this.addBody(frame);
+ bdy.setColor(this.color);
+ bdy.add(frame);
+ if (instructions) {
+ bdy.add(remarkText(instructions));
+ }
+ bdy.fixLayout();
+
+ this.addBody(bdy);
frame.drawNew();
+ bdy.drawNew();
+
this.addButton('ok', 'OK');
this.addButton('cancel', 'Cancel');
this.fixLayout();