|
@@ -379,6 +379,14 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @objc private func _alignmentAction(sender: NSMenuItem) {
|
|
|
+ if let data = self._currentItemView {
|
|
|
+ self.delegate?.toolbarViewController?(self, menuItemDidClick: data, index: sender.tag, info: nil)
|
|
|
+ } else {
|
|
|
+ self.delegate?.toolbarViewController?(self, menuItemDidClick: self.toolbarItemFindItemIdentifiers(value: KMToolbarToolFormAlignIdentifier), index: sender.tag, info: nil)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// Form 更多操作
|
|
|
@IBAction func formsMoreOperationAction(sender:KMToolbarClickButton) {
|
|
|
|
|
@@ -1388,9 +1396,23 @@ extension KMToolbarViewController {
|
|
|
item?.toolTip = NSLocalizedString("Alignment", comment: "")
|
|
|
item?.titleName = NSLocalizedString("Alignment", comment: "")
|
|
|
item?.boxImagePosition = .imageExpandLeft
|
|
|
+ item?.needExpandAction = true
|
|
|
item?.btnAction = #selector(formsAlignmentAction)
|
|
|
|
|
|
let menuItem = NSMenuItem.init(title: "Alignment", action: #selector(formsAlignmentAction), target: self)
|
|
|
+ let subMenu = NSMenu()
|
|
|
+ subMenu.addItem(title: NSLocalizedString("Align Left", comment: ""), imageNamed: "KMImageNameUXIconPropertybarAlignLeftNor", action: #selector(_alignmentAction), target: self, tag: 0)
|
|
|
+ subMenu.addItem(title: NSLocalizedString("Align Vertically", comment: ""), imageNamed: "KMImageNameUXIconPropertybarAlignVercenterNor", action: #selector(_alignmentAction), target: self, tag: 1)
|
|
|
+ subMenu.addItem(title: NSLocalizedString("Align Right", comment: ""), imageNamed: "KMImageNameUXIconPropertybarAlignRightNor", action: #selector(_alignmentAction), target: self, tag: 2)
|
|
|
+ subMenu.addItem(NSMenuItem.separator())
|
|
|
+ subMenu.addItem(title: NSLocalizedString("Align Top", comment: ""), imageNamed: "KMImageNameUXIconPropertybarAlignUpNor", action: #selector(_alignmentAction), target: self, tag: 3)
|
|
|
+ subMenu.addItem(title: NSLocalizedString("Align Horizontally", comment: ""), imageNamed: "KMImageNameUXIconPropertybarAlignHorcenterNor", action: #selector(_alignmentAction), target: self, tag: 4)
|
|
|
+ subMenu.addItem(title: NSLocalizedString("Align Bottom", comment: ""), imageNamed: "KMImageNameUXIconPropertybarAlignDownNor", action: #selector(_alignmentAction), target: self, tag: 5)
|
|
|
+ subMenu.addItem(NSMenuItem.separator())
|
|
|
+ subMenu.addItem(title: NSLocalizedString("Distribute Horizontally", comment: ""), imageNamed: "KMImageNameUXIconPropertybarAlignHorsplitNor", action: #selector(_alignmentAction), target: self, tag: 6)
|
|
|
+ subMenu.addItem(title: NSLocalizedString("Distribute Vertically", comment: ""), imageNamed: "KMImageNameUXIconPropertybarAlignVersplitNor", action: #selector(_alignmentAction), target: self, tag: 7)
|
|
|
+
|
|
|
+ menuItem.submenu = subMenu
|
|
|
menuItem.tag = item!.btnTag
|
|
|
item?.menuFormRepresentation = menuItem
|
|
|
} else if identifier == KMToolbarToolFormMoreIdentifier {
|