///////////////////////////////////////////////////////////////////////////////////
// BUTTON
///////////////////////////////////////////////////////////////////////////////////
556155
func drawButton(out *command.Buffer, bounds rect.Rect, state nstyle.WidgetStates, style *nstyle.Button) *nstyle.Item {
	var background *nstyle.Item
	if state&nstyle.WidgetStateHovered != 0 {
		background = &style.Hover
	} else if state&nstyle.WidgetStateActive != 0 {
		background = &style.Active
	} else {
		background = &style.Normal
	}

	if background.Type == nstyle.ItemImage {
		out.DrawImage(bounds, background.Data.Image)
	} else {
		out.FillRect(bounds, style.Rounding, style.BorderColor)
		out.FillRect(shrinkRect(bounds, style.Border), style.Rounding, background.Data.Color)
	}

	return background
}
261634
public function buttonClicked()
    {
        $actions = $this->getAllActions();
        foreach ($actions as $action) {
            if ($this->buttonClickedFunc === $action->actionName()) {
                return $action;
            }
        }
        return null;
    }
960575
function (btnName) { // btnName is name of the button
            var t = this,
                prefix = t.o.prefix,
                btn = t.btnsDef[btnName],
                isDropdown = btn.dropdown,
                hasIcon = btn.hasIcon != null ? btn.hasIcon : true,
                textDef = t.lang[btnName] || btnName,

                $btn = $('<button/>', {
                    type: 'button',
                    class: prefix + btnName + '-button ' + (btn.class || '') + (!hasIcon ? ' ' + prefix + 'textual-button' : ''),
                    html: t.hasSvg && hasIcon ?
                        '<svg><use xlink:href="' + t.svgPath + '#' + prefix + (btn.ico || btnName).replace(/([A-Z]+)/g, '-$1').toLowerCase() + '"/></svg>' :
                        t.hideButtonTexts ? '' : (btn.text || btn.title || t.lang[btnName] || btnName),
                    title: (btn.title || btn.text || textDef) + (btn.key ? ' (' + (t.isMac ? 'Cmd' : 'Ctrl') + ' + ' + btn.key + ')' : ''),
                    tabindex: -1,
                    mousedown: function () {
                        if (!isDropdown || $('.' + btnName + '-' + prefix + 'dropdown', t.$box).is(':hidden')) {
                            $('body', t.doc).trigger('mousedown');
                        }

                        if ((t.$btnPane.hasClass(prefix + 'disable') || t.$box.hasClass(prefix + 'disabled')) &&
                            !$(this).hasClass(prefix + 'active') &&
                            !$(this).hasClass(prefix + 'not-disable')) {
                            return false;
                        }

                        t.execCmd((isDropdown ? 'dropdown' : false) || btn.fn || btnName, btn.param || btnName, btn.forceCss);

                        return false;
                    }
                });

            if (isDropdown) {
                $btn.addClass(prefix + 'open-dropdown');
                var dropdownPrefix = prefix + 'dropdown',
                    dropdownOptions = { // the dropdown
                        class: dropdownPrefix + '-' + btnName + ' ' + dropdownPrefix + ' ' + prefix + 'fixed-top ' + (btn.dropdownClass || '')
                    };
                dropdownOptions['data-' + dropdownPrefix] = btnName;
                var $dropdown = $('<div/>', dropdownOptions);
                $.each(isDropdown, function (i, def) {
                    if (t.btnsDef[def] && t.isSupportedBtn(def)) {
                        $dropdown.append(t.buildSubBtn(def));
                    }
                });
                t.$box.append($dropdown.hide());
            } else if (btn.key) {
                t.keys[btn.key] = {
                    fn: btn.fn || btnName,
                    param: btn.param || btnName
                };
            }

            if (!isDropdown) {
                t.tagToButton[(btn.tag || btnName).toLowerCase()] = btnName;
            }

            return $btn;
        }
640283
def press(button, scope={})
      in_scope(scope) do
        begin
          click_button(button)
        rescue Capybara::ElementNotFound
          raise Kelp::MissingButton,
            "No button with value, id or text '#{button}' found"
        end
      end
    end
89100
@Override
    public void buttonClick(final ClickEvent event) {
        if (window.getParent() != null) {
            isImplicitClose = true;
            UI.getCurrent().removeWindow(window);
        }
        callback.response(event.getSource().equals(okButton));
    }
501711
function createButton(opts) {
    opts = _.defaults(opts || {}, {
        // Aria label for the button
        label: '',

        // Icon to show
        icon: '',

        // Inner text
        text: '',

        // Right or left position
        position: 'left',

        // Other class name to add to the button
        className: '',

        // Triggered when user click on the button
        onClick: defaultOnClick,

        // Button is a dropdown
        dropdown: null,

        // Position in the toolbar
        index: null
    });

    buttons.push(opts);
    updateButton(opts);
}
399224
function() {

        var events;
        var button;

        if (window.kelmu.data[id].settings.step && !stepButtonInitialized) {
          button = element.find(window.kelmu.data[id].settings.step);
          if (button.length > 0) {
            events = $._data(button[0], 'events');
            stepButtonInitialized = true;

            if (events && events.click && events.click.length > 0) {
              originalStep = events.click[0].handler;
              events.click[0].handler = forwardAndSkip;
            } else {
              button.click(forwardAndSkip);
            }
          }
        }

        if (window.kelmu.data[id].settings.redo && !redoButtonInitialized) {
          button = element.find(window.kelmu.data[id].settings.redo);
          if (button.length > 0) {
            events = $._data(button[0], 'events');
            redoButtonInitialized = true;

            if (events && events.click && events.click.length > 0) {
              originalRedo = events.click[0].handler;
              events.click[0].handler = redo;
            } else {
              button.click(redo);
            }
          }
        }

        if (window.kelmu.data[id].settings.undo && !undoButtonInitialized) {
          button = element.find(window.kelmu.data[id].settings.undo);
          if (button.length > 0) {
            events = $._data(button[0], 'events');
            undoButtonInitialized = true;

            if (events && events.click && events.click.length > 0) {
              originalUndo = events.click[0].handler;
              events.click[0].handler = undo;
            } else {
              button.click(undo);
            }
          }
        }

        if (window.kelmu.data[id].settings.begin && !beginButtonInitialized) {
          button = element.find(window.kelmu.data[id].settings.begin);
          if (button.length > 0) {
            events = $._data(button[0], 'events');
            beginButtonInitialized = true;

            if (events && events.click && events.click.length > 0) {
              originalBegin = events.click[0].handler;
              events.click[0].handler = begin;
            } else {
              button.click(begin);
            }
          }
        }

      }
1050915
@SuppressWarnings("serial")
    private Button createSaveButton() {

        Button saveBtn = CmsToolBar.createButton(FontOpenCms.SAVE, m_messages.key(Messages.GUI_BUTTON_SAVE_0));
        saveBtn.addClickListener(new ClickListener() {

            public void buttonClick(ClickEvent event) {

                saveAction();
            }

        });
        saveBtn.setEnabled(false);
        return saveBtn;
    }
1209125
private void initializeButtons()
	{
		initializeButton(button1 = new Button("1"), Color.black, Color.lightGray);
		initializeButton(button2 = new Button("2"), Color.black, Color.lightGray);
		initializeButton(button3 = new Button("3"), Color.black, Color.lightGray);
		initializeButton(button4 = new Button("4"), Color.black, Color.lightGray);
		initializeButton(button5 = new Button("5"), Color.black, Color.lightGray);
		initializeButton(button6 = new Button("6"), Color.black, Color.lightGray);
		initializeButton(button7 = new Button("7"), Color.black, Color.lightGray);
		initializeButton(button8 = new Button("8"), Color.black, Color.lightGray);
		initializeButton(button9 = new Button("9"), Color.black, Color.lightGray);
		initializeButton(button0 = new Button("0"), Color.black, Color.lightGray);
		initializeButton(buttonCancel = new Button("A"), Color.black, Color.lightGray);
		initializeButton(buttonTable = new Button("T"), Color.black, Color.lightGray);
		initializeButton(buttonEnter = new Button("E"), Color.black, Color.lightGray);
		initializeButton(buttonMinus = new Button("-"), Color.black, Color.lightGray);
		initializeButton(buttonPlus = new Button("+"), Color.black, Color.lightGray);
		initializeButton(buttonStorno = new Button("ST"), Color.black, Color.lightGray);
	}
1374608
function refreshButtons(editor) {

    // Webkit requires focus before queryCommandEnabled will return anything but false
    if (!iOS && $.browser.webkit && !editor.focused) {
      editor.$frame[0].contentWindow.focus();
      window.focus();
      editor.focused = true;
    }

    // Get the object used for checking queryCommandEnabled
    var queryObj = editor.doc;
    if (ie) queryObj = getRange(editor);

    // Loop through each button
    var inSourceMode = sourceMode(editor);
    $.each(editor.$toolbar.find("." + BUTTON_CLASS), function(idx, elem) {

      var $elem = $(elem),
        button = $.cleditor.buttons[$.data(elem, BUTTON_NAME)],
        command = button.command,
        enabled = true;

      // Determine the state
      if (editor.disabled)
        enabled = false;
      else if (button.getEnabled) {
        var data = {
          editor: editor,
          button: elem,
          buttonName: button.name,
          popup: popups[button.popupName],
          popupName: button.popupName,
          command: button.command,
          useCSS: editor.options.useCSS
        };
        enabled = button.getEnabled(data);
        if (enabled === undefined)
          enabled = true;
      }
      else if (((inSourceMode || iOS) && button.name != "source") ||
      (ie && (command == "undo" || command == "redo")))
        enabled = false;
      else if (command && command != "print") {
        if (ie && command == "hilitecolor")
          command = "backcolor";
        // IE does not support inserthtml, so it's always enabled
        if (!ie || command != "inserthtml") {
          try {enabled = queryObj.queryCommandEnabled(command);}
          catch (err) {enabled = false;}
        }
      }

      // Enable or disable the button
      if (enabled) {
        $elem.removeClass(DISABLED_CLASS);
        $elem.removeAttr(DISABLED);
      }
      else {
        $elem.addClass(DISABLED_CLASS);
        $elem.attr(DISABLED, DISABLED);
      }

    });
  }
446240
public function &createButton($button_class='Bootstrap\Button\Button')
    {
        $button = $this->factory->create($button_class);

        $this->addButton($button);

        return $button;
    }
361490
function tapButton(val) {  // {{{2
  var name = val.wrap.attr('label');

  switch (val.wrap.val()) {
  case '':
  case null:
  case undefined:
  case 'off':  // Button is "off", change it to "auto".
    val.wrap.val('auto');

    break;
  case 'on':  // Button is "on", change it to "off" and send "keyup".
    val.wrap.val('off');

    switch (name) {
    case 'shift':  // When "shift" is released, release mouse button "1".
      if (this.entry.sval.mods[1]) this.sendButton(1, false);
      // NO BREAK
    case 'control':
    case 'alt':
    case 'super':
      if (name in this.entry.sval.mods && this.entry.sval.mods[name]) this.sendKey('up', name);
      break;
    }

    break;
  case 'auto':  // Button is "auto", change it to "on" and send "keydown".
    val.wrap.val('on');

    if (name in this.entry.sval.mods && ! this.entry.sval.mods[name]) this.sendKey('down', name);

    break;
  default:
    throw new Error('Invalid button state: ' + val.wrap.val());
  }

  return false;
}
328762
function (settings) {
          var buttons, callback = settings.callback || function () { };

          function createButton(text, status, primary) {
            return {
              type: "button",
              text: text,
              subtype: primary ? 'primary' : '',
              onClick: function (e) {
                e.control.parents()[1].close();
                callback(status);
              }
            };
          }

          switch (settings.buttons) {
            case MessageBox.OK_CANCEL:
              buttons = [
                createButton('Ok', true, true),
                createButton('Cancel', false)
              ];
              break;

            case MessageBox.YES_NO:
            case MessageBox.YES_NO_CANCEL:
              buttons = [
                createButton('Yes', 1, true),
                createButton('No', 0)
              ];

              if (settings.buttons == MessageBox.YES_NO_CANCEL) {
                buttons.push(createButton('Cancel', -1));
              }
              break;

            default:
              buttons = [
                createButton('Ok', true, true)
              ];
              break;
          }

          return new Window({
            padding: 20,
            x: settings.x,
            y: settings.y,
            minWidth: 300,
            minHeight: 100,
            layout: "flex",
            pack: "center",
            align: "center",
            buttons: buttons,
            title: settings.title,
            role: 'alertdialog',
            items: {
              type: "label",
              multiline: true,
              maxWidth: 500,
              maxHeight: 200,
              text: settings.text
            },
            onPostRender: function () {
              this.aria('describedby', this.items()[0]._id);
            },
            onClose: settings.onClose,
            onCancel: function () {
              callback(false);
            }
          }).renderTo(document.body).reflow();
        }
1278062
public void addActionButton(final ToolbarAction action) {
		final IButton button = new IButton();
		button.setWidth(buttonSize);
		button.setHeight(buttonSize);
		button.setIconSize(buttonSize - WidgetLayout.toolbarStripHeight);
		button.setIcon(action.getIcon());
		button.setActionType(SelectionType.BUTTON);
		button.addClickHandler(action);
		button.setShowRollOver(false);
		button.setShowFocused(false);
		button.setTooltip(action.getTooltip());
		button.setDisabled(action.isDisabled());

		if (getMembers() != null && getMembers().length > 0) {
			LayoutSpacer spacer = new LayoutSpacer();
			spacer.setWidth(2);
			super.addMember(spacer);
		}
		action.addToolbarActionHandler(new ToolbarActionHandler() {

			public void onToolbarActionDisabled(ToolbarActionDisabledEvent event) {
				button.setDisabled(true);
			}

			public void onToolbarActionEnabled(ToolbarActionEnabledEvent event) {
				button.setDisabled(false);
			}
		});
		super.addMember(button);
	}
941069
function ( Class, Label, Container ) {
			var Button = L.DomUtil.create( 'button', Class, Container );
			Button.setAttribute( 'type' , 'button' );
			Button.innerHTML = Label;
			
			return Button;
		}
259828
public boolean onButtonPress(MouseButton button)
	{
		if (!isEnabled())
			return false;

		return parent != null ? parent.onButtonPress(button) : false;
	}
1021441
@FXML
    void okButtonOnAction(ActionEvent event) {
        UpdateAvailableDialog t = this;

        okButton.setDisable(true);
        cancelButton.setText(bundle.getString("button.cancel.cancelDownload"));

        downloadThread = new Thread(() -> {
            try {
                boolean res = UpdateChecker.downloadAndInstallUpdate(updateInfo, t);
                if (res) {
                    t.hide();
                }
            } catch (IllegalStateException | IOException e) {
                showErrorMessage(e.getLocalizedMessage());
                e.printStackTrace();
            }
        });
        downloadThread.start();
    }