示例#1
0
        public ColorPicker(goog.dom.DomHelper opt_domHelper = null, goog.ui.ColorPalette opt_colorPalette = null)
            : base(opt_domHelper)
        {
            this.colorPalette_ = opt_colorPalette;

            this.getHandler().listen(
                this, goog.ui.Component.EventType.ACTION, new Action <events.Event>(this.onColorPaletteAction_));
        }
示例#2
0
        /// <summary>
        /// Create a color palette for the color picker.
        /// </summary>
        /// <param name="colors">Array of colors.</param>
        private void createColorPalette_(JsArray <string> colors)
        {
            // TODO(user): The color picker should eventually just contain a number of
            // palettes and manage the interactions between them.  This will go away then.
            var cp = new goog.ui.ColorPalette(colors, null, this.getDomHelper());

            cp.setSize(goog.ui.ColorPicker.DEFAULT_NUM_COLS);
            cp.setSupportedState(goog.ui.Component.State.FOCUSED, this.focusable_);
            // TODO(user): Use addChild(cp, true) and remove calls to render.
            this.addChild(cp);
            this.colorPalette_ = cp;
            if (this.isInDocument())
            {
                this.colorPalette_.render(this.getElement());
            }
        }