Commit 5aed33b6 authored by Neil Fraser's avatar Neil Fraser

Add separators to toolbox.

parent 1235c1e8
This diff is collapsed.
...@@ -346,6 +346,12 @@ Blockly.Css.CONTENT = [ ...@@ -346,6 +346,12 @@ Blockly.Css.CONTENT = [
' background-color: #e4e4e4;', ' background-color: #e4e4e4;',
'}', '}',
'.blocklyTreeSeparator {',
' height: 0px;',
' border-bottom: solid #e5e5e5 1px;',
' margin: 5px 0;',
'}',
'.blocklyTreeIcon {', '.blocklyTreeIcon {',
' height: 16px;', ' height: 16px;',
' width: 16px;', ' width: 16px;',
......
...@@ -172,6 +172,8 @@ Blockly.Toolbox.populate_ = function() { ...@@ -172,6 +172,8 @@ Blockly.Toolbox.populate_ = function() {
} else { } else {
syncTrees(childIn, childOut); syncTrees(childIn, childOut);
} }
} else if (name == 'HR') {
treeOut.add(new Blockly.Toolbox.TreeSeparator());
} else if (name == 'BLOCK') { } else if (name == 'BLOCK') {
treeOut.blocks.push(childIn); treeOut.blocks.push(childIn);
} }
...@@ -273,7 +275,7 @@ Blockly.Toolbox.TreeControl.prototype.setSelectedItem = function(node) { ...@@ -273,7 +275,7 @@ Blockly.Toolbox.TreeControl.prototype.setSelectedItem = function(node) {
}; };
/** /**
* An single node in the tree, customized for Blockly's UI. * A single node in the tree, customized for Blockly's UI.
* @param {!goog.html.SafeHtml} html The HTML content of the node label. * @param {!goog.html.SafeHtml} html The HTML content of the node label.
* @param {Object=} opt_config The configuration for the tree. See * @param {Object=} opt_config The configuration for the tree. See
* goog.ui.tree.TreeControl.DefaultConfig. If not specified, a default config * goog.ui.tree.TreeControl.DefaultConfig. If not specified, a default config
...@@ -331,3 +333,24 @@ Blockly.Toolbox.TreeNode.prototype.onMouseDown = function(e) { ...@@ -331,3 +333,24 @@ Blockly.Toolbox.TreeNode.prototype.onMouseDown = function(e) {
Blockly.Toolbox.TreeNode.prototype.onDoubleClick_ = function(e) { Blockly.Toolbox.TreeNode.prototype.onDoubleClick_ = function(e) {
// NOP. // NOP.
}; };
/**
* A blank separator node in the tree.
* @constructor
* @extends {Blockly.Toolbox.TreeNode}
*/
Blockly.Toolbox.TreeSeparator = function() {
Blockly.Toolbox.TreeNode.call(this, '',
Blockly.Toolbox.TreeSeparator.CONFIG_);
};
goog.inherits(Blockly.Toolbox.TreeSeparator, Blockly.Toolbox.TreeNode);
/**
* Configuration constants for tree separator.
* @type {Object.<string,*>}
* @const
* @private
*/
Blockly.Toolbox.TreeSeparator.CONFIG_ = {
cssTreeRow: 'blocklyTreeSeparator'
};
...@@ -138,6 +138,7 @@ ...@@ -138,6 +138,7 @@
</category> </category>
<category name="Variables" custom="VARIABLE"></category> <category name="Variables" custom="VARIABLE"></category>
<category name="Functions" custom="PROCEDURE"></category> <category name="Functions" custom="PROCEDURE"></category>
<hr>
<category name="Library"> <category name="Library">
<category name="Randomize"> <category name="Randomize">
<block type="procedures_defnoreturn"> <block type="procedures_defnoreturn">
......
...@@ -352,6 +352,7 @@ h1 { ...@@ -352,6 +352,7 @@ h1 {
</value> </value>
</block> </block>
</category> </category>
<hr>
<category name="Variables" custom="VARIABLE"></category> <category name="Variables" custom="VARIABLE"></category>
<category name="Functions" custom="PROCEDURE"></category> <category name="Functions" custom="PROCEDURE"></category>
</xml> </xml>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment