|
@@ -12,6 +12,8 @@ import AppKit
|
|
|
|
|
|
@objc optional func componentDropdownToolDidShowPopupView(_ view: ComponentDropdownTool)
|
|
|
|
|
|
+ @objc optional func componentDropdownToolDidDismissPopupView(_ view: ComponentDropdownTool)
|
|
|
+
|
|
|
@objc optional func componentDropdownToolDidClicked(_ view: ComponentDropdownTool, menuItem: ComponentMenuitemProperty?)
|
|
|
|
|
|
}
|
|
@@ -24,6 +26,7 @@ public class ComponentDropdownTool: ComponentBaseXibView {
|
|
|
@IBOutlet var titleLabel: NSTextField!
|
|
|
|
|
|
@IBOutlet var imageLeftConst: NSLayoutConstraint!
|
|
|
+ @IBOutlet var imageWidthConst: NSLayoutConstraint!
|
|
|
@IBOutlet var labelLeftConst: NSLayoutConstraint!
|
|
|
|
|
|
private var _properties : ComponentDropdownToolProperty = ComponentDropdownToolProperty()
|
|
@@ -94,6 +97,8 @@ public class ComponentDropdownTool: ComponentBaseXibView {
|
|
|
dropImage.isHidden = true
|
|
|
}
|
|
|
|
|
|
+ imageWidthConst.constant = 20
|
|
|
+
|
|
|
if let text = properties.text {
|
|
|
titleLabel.stringValue = text
|
|
|
titleLabel.isHidden = false
|
|
@@ -107,6 +112,10 @@ public class ComponentDropdownTool: ComponentBaseXibView {
|
|
|
titleLabel.isHidden = true
|
|
|
|
|
|
imageLeftConst.constant = 4
|
|
|
+
|
|
|
+ if properties.showDropdown == false {
|
|
|
+ imageWidthConst.constant = CGRectGetWidth(self.frame) - 8
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -256,6 +265,8 @@ extension ComponentDropdownTool: ComponentGroupDelegate {
|
|
|
properties.state = .normal
|
|
|
|
|
|
refreshUI()
|
|
|
+
|
|
|
+ delegate?.componentDropdownToolDidDismissPopupView?(self)
|
|
|
}
|
|
|
|
|
|
public func componentGroupDidSelect(group: ComponentGroup?, menuItemProperty: ComponentMenuitemProperty?) {
|