Skip to content

Commit 2a58778

Browse files
committed
Introduce SearchableComboListView
This is a better control for picking an item from a long list.
1 parent 0a54f13 commit 2a58778

File tree

45 files changed

+3614
-525
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+3614
-525
lines changed

Interfaces/iTermEditKeyActionWindowController.xib

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<outlet property="_comboViewContainer" destination="rtR-KB-sUm" id="StD-xL-ZEV"/>
1414
<outlet property="_keyboardShortcutLabel" destination="K5J-cS-cKV" id="OHV-3k-HGx"/>
1515
<outlet property="_menuToSelectPopup" destination="Lul-IP-GkH" id="LCb-mY-zgC"/>
16+
<outlet property="_okButton" destination="loN-RU-1Py" id="GFk-gT-zqx"/>
1617
<outlet property="_parameter" destination="7JT-ar-Qef" id="2uA-Zc-mij"/>
1718
<outlet property="_parameterLabel" destination="q03-HA-vno" id="4oO-Om-1Ub"/>
1819
<outlet property="_pasteSpecialViewContainer" destination="6C1-2g-xev" id="Pck-1A-8hb"/>
@@ -110,11 +111,14 @@ Gw
110111
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="oHw-49-aB1" userLabel="Touch Bar Label">
111112
<rect key="frame" x="150" y="119" width="273" height="22"/>
112113
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
113-
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" placeholderString="Label to show in Touch Bar" drawsBackground="YES" id="mYT-YJ-w7Z">
114+
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" continuous="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" placeholderString="Label to show in Touch Bar" drawsBackground="YES" id="mYT-YJ-w7Z">
114115
<font key="font" metaFont="system"/>
115116
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
116117
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
117118
</textFieldCell>
119+
<connections>
120+
<outlet property="delegate" destination="-2" id="oMf-on-bkf"/>
121+
</connections>
118122
</textField>
119123
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="7JT-ar-Qef" userLabel="Parameter">
120124
<rect key="frame" x="149" y="62" width="273" height="22"/>

SearchableComboListView/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SearchableComboListView.xcodeproj/xcuserdata
2+
SearchableComboListView.xcodeproj/project.xcworkspace/xcuserdata
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/Headers
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/Modules
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/Resources
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/SearchableComboListView
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
// Generated by Apple Swift version 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)
2+
#pragma clang diagnostic push
3+
#pragma clang diagnostic ignored "-Wgcc-compat"
4+
5+
#if !defined(__has_include)
6+
# define __has_include(x) 0
7+
#endif
8+
#if !defined(__has_attribute)
9+
# define __has_attribute(x) 0
10+
#endif
11+
#if !defined(__has_feature)
12+
# define __has_feature(x) 0
13+
#endif
14+
#if !defined(__has_warning)
15+
# define __has_warning(x) 0
16+
#endif
17+
18+
#if __has_include(<swift/objc-prologue.h>)
19+
# include <swift/objc-prologue.h>
20+
#endif
21+
22+
#pragma clang diagnostic ignored "-Wauto-import"
23+
#include <Foundation/Foundation.h>
24+
#include <stdint.h>
25+
#include <stddef.h>
26+
#include <stdbool.h>
27+
28+
#if !defined(SWIFT_TYPEDEFS)
29+
# define SWIFT_TYPEDEFS 1
30+
# if __has_include(<uchar.h>)
31+
# include <uchar.h>
32+
# elif !defined(__cplusplus)
33+
typedef uint_least16_t char16_t;
34+
typedef uint_least32_t char32_t;
35+
# endif
36+
typedef float swift_float2 __attribute__((__ext_vector_type__(2)));
37+
typedef float swift_float3 __attribute__((__ext_vector_type__(3)));
38+
typedef float swift_float4 __attribute__((__ext_vector_type__(4)));
39+
typedef double swift_double2 __attribute__((__ext_vector_type__(2)));
40+
typedef double swift_double3 __attribute__((__ext_vector_type__(3)));
41+
typedef double swift_double4 __attribute__((__ext_vector_type__(4)));
42+
typedef int swift_int2 __attribute__((__ext_vector_type__(2)));
43+
typedef int swift_int3 __attribute__((__ext_vector_type__(3)));
44+
typedef int swift_int4 __attribute__((__ext_vector_type__(4)));
45+
typedef unsigned int swift_uint2 __attribute__((__ext_vector_type__(2)));
46+
typedef unsigned int swift_uint3 __attribute__((__ext_vector_type__(3)));
47+
typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
48+
#endif
49+
50+
#if !defined(SWIFT_PASTE)
51+
# define SWIFT_PASTE_HELPER(x, y) x##y
52+
# define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y)
53+
#endif
54+
#if !defined(SWIFT_METATYPE)
55+
# define SWIFT_METATYPE(X) Class
56+
#endif
57+
#if !defined(SWIFT_CLASS_PROPERTY)
58+
# if __has_feature(objc_class_property)
59+
# define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__
60+
# else
61+
# define SWIFT_CLASS_PROPERTY(...)
62+
# endif
63+
#endif
64+
65+
#if __has_attribute(objc_runtime_name)
66+
# define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X)))
67+
#else
68+
# define SWIFT_RUNTIME_NAME(X)
69+
#endif
70+
#if __has_attribute(swift_name)
71+
# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X)))
72+
#else
73+
# define SWIFT_COMPILE_NAME(X)
74+
#endif
75+
#if __has_attribute(objc_method_family)
76+
# define SWIFT_METHOD_FAMILY(X) __attribute__((objc_method_family(X)))
77+
#else
78+
# define SWIFT_METHOD_FAMILY(X)
79+
#endif
80+
#if __has_attribute(noescape)
81+
# define SWIFT_NOESCAPE __attribute__((noescape))
82+
#else
83+
# define SWIFT_NOESCAPE
84+
#endif
85+
#if __has_attribute(warn_unused_result)
86+
# define SWIFT_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
87+
#else
88+
# define SWIFT_WARN_UNUSED_RESULT
89+
#endif
90+
#if __has_attribute(noreturn)
91+
# define SWIFT_NORETURN __attribute__((noreturn))
92+
#else
93+
# define SWIFT_NORETURN
94+
#endif
95+
#if !defined(SWIFT_CLASS_EXTRA)
96+
# define SWIFT_CLASS_EXTRA
97+
#endif
98+
#if !defined(SWIFT_PROTOCOL_EXTRA)
99+
# define SWIFT_PROTOCOL_EXTRA
100+
#endif
101+
#if !defined(SWIFT_ENUM_EXTRA)
102+
# define SWIFT_ENUM_EXTRA
103+
#endif
104+
#if !defined(SWIFT_CLASS)
105+
# if __has_attribute(objc_subclassing_restricted)
106+
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA
107+
# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
108+
# else
109+
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
110+
# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
111+
# endif
112+
#endif
113+
#if !defined(SWIFT_RESILIENT_CLASS)
114+
# if __has_attribute(objc_class_stub)
115+
# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME) __attribute__((objc_class_stub))
116+
# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_class_stub)) SWIFT_CLASS_NAMED(SWIFT_NAME)
117+
# else
118+
# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME)
119+
# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) SWIFT_CLASS_NAMED(SWIFT_NAME)
120+
# endif
121+
#endif
122+
123+
#if !defined(SWIFT_PROTOCOL)
124+
# define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
125+
# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
126+
#endif
127+
128+
#if !defined(SWIFT_EXTENSION)
129+
# define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__)
130+
#endif
131+
132+
#if !defined(OBJC_DESIGNATED_INITIALIZER)
133+
# if __has_attribute(objc_designated_initializer)
134+
# define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
135+
# else
136+
# define OBJC_DESIGNATED_INITIALIZER
137+
# endif
138+
#endif
139+
#if !defined(SWIFT_ENUM_ATTR)
140+
# if defined(__has_attribute) && __has_attribute(enum_extensibility)
141+
# define SWIFT_ENUM_ATTR(_extensibility) __attribute__((enum_extensibility(_extensibility)))
142+
# else
143+
# define SWIFT_ENUM_ATTR(_extensibility)
144+
# endif
145+
#endif
146+
#if !defined(SWIFT_ENUM)
147+
# define SWIFT_ENUM(_type, _name, _extensibility) enum _name : _type _name; enum SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
148+
# if __has_feature(generalized_swift_name)
149+
# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
150+
# else
151+
# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) SWIFT_ENUM(_type, _name, _extensibility)
152+
# endif
153+
#endif
154+
#if !defined(SWIFT_UNAVAILABLE)
155+
# define SWIFT_UNAVAILABLE __attribute__((unavailable))
156+
#endif
157+
#if !defined(SWIFT_UNAVAILABLE_MSG)
158+
# define SWIFT_UNAVAILABLE_MSG(msg) __attribute__((unavailable(msg)))
159+
#endif
160+
#if !defined(SWIFT_AVAILABILITY)
161+
# define SWIFT_AVAILABILITY(plat, ...) __attribute__((availability(plat, __VA_ARGS__)))
162+
#endif
163+
#if !defined(SWIFT_WEAK_IMPORT)
164+
# define SWIFT_WEAK_IMPORT __attribute__((weak_import))
165+
#endif
166+
#if !defined(SWIFT_DEPRECATED)
167+
# define SWIFT_DEPRECATED __attribute__((deprecated))
168+
#endif
169+
#if !defined(SWIFT_DEPRECATED_MSG)
170+
# define SWIFT_DEPRECATED_MSG(...) __attribute__((deprecated(__VA_ARGS__)))
171+
#endif
172+
#if __has_feature(attribute_diagnose_if_objc)
173+
# define SWIFT_DEPRECATED_OBJC(Msg) __attribute__((diagnose_if(1, Msg, "warning")))
174+
#else
175+
# define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg)
176+
#endif
177+
#if !defined(IBSegueAction)
178+
# define IBSegueAction
179+
#endif
180+
#if __has_feature(modules)
181+
#if __has_warning("-Watimport-in-framework-header")
182+
#pragma clang diagnostic ignored "-Watimport-in-framework-header"
183+
#endif
184+
@import AppKit;
185+
@import Foundation;
186+
@import ObjectiveC;
187+
#endif
188+
189+
#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
190+
#pragma clang diagnostic ignored "-Wduplicate-method-arg"
191+
#if __has_warning("-Wpragma-clang-attribute")
192+
# pragma clang diagnostic ignored "-Wpragma-clang-attribute"
193+
#endif
194+
#pragma clang diagnostic ignored "-Wunknown-pragmas"
195+
#pragma clang diagnostic ignored "-Wnullability"
196+
197+
#if __has_attribute(external_source_symbol)
198+
# pragma push_macro("any")
199+
# undef any
200+
# pragma clang attribute push(__attribute__((external_source_symbol(language="Swift", defined_in="SearchableComboListView",generated_declaration))), apply_to=any(function,enum,objc_interface,objc_category,objc_protocol))
201+
# pragma pop_macro("any")
202+
#endif
203+
204+
@protocol iTermSearchableComboViewDelegate;
205+
@class NSCoder;
206+
@class iTermSearchableComboViewGroup;
207+
@class NSMenu;
208+
@class NSEvent;
209+
210+
SWIFT_CLASS_NAMED("SearchableComboView")
211+
@interface iTermSearchableComboView : NSPopUpButton
212+
@property (nonatomic, weak) id <iTermSearchableComboViewDelegate> _Nullable delegate;
213+
- (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder SWIFT_UNAVAILABLE;
214+
- (nonnull instancetype)initWithGroups:(NSArray<iTermSearchableComboViewGroup *> * _Nonnull)groups OBJC_DESIGNATED_INITIALIZER;
215+
- (BOOL)selectItemWithTag:(NSInteger)tag SWIFT_WARN_UNUSED_RESULT;
216+
- (NSInteger)selectedTag SWIFT_WARN_UNUSED_RESULT;
217+
- (void)willOpenMenu:(NSMenu * _Nonnull)menu withEvent:(NSEvent * _Nonnull)event;
218+
- (nonnull instancetype)initWithFrame:(NSRect)buttonFrame pullsDown:(BOOL)flag SWIFT_UNAVAILABLE;
219+
- (nonnull instancetype)initWithFrame:(NSRect)frameRect SWIFT_UNAVAILABLE;
220+
@end
221+
222+
223+
224+
@class iTermSearchableComboViewItem;
225+
226+
SWIFT_PROTOCOL_NAMED("SearchableComboViewDelegate")
227+
@protocol iTermSearchableComboViewDelegate
228+
- (void)searchableComboView:(iTermSearchableComboView * _Nonnull)view didSelectItem:(iTermSearchableComboViewItem * _Nullable)didSelectItem;
229+
@end
230+
231+
232+
SWIFT_CLASS_NAMED("SearchableComboViewGroup")
233+
@interface iTermSearchableComboViewGroup : NSObject
234+
- (nonnull instancetype)initWithLabel:(NSString * _Nonnull)label items:(NSArray<iTermSearchableComboViewItem *> * _Nonnull)items OBJC_DESIGNATED_INITIALIZER;
235+
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
236+
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
237+
@end
238+
239+
240+
SWIFT_CLASS_NAMED("SearchableComboViewItem")
241+
@interface iTermSearchableComboViewItem : NSObject
242+
- (nonnull instancetype)initWithLabel:(NSString * _Nonnull)label tag:(NSInteger)tag OBJC_DESIGNATED_INITIALIZER;
243+
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
244+
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
245+
@end
246+
247+
#if __has_attribute(external_source_symbol)
248+
# pragma clang attribute pop
249+
#endif
250+
#pragma clang diagnostic pop
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// SearchableComboListView.h
3+
// SearchableComboListView
4+
//
5+
// Created by George Nachman on 1/20/20.
6+
//
7+
8+
#import <Foundation/Foundation.h>
9+
10+
//! Project version number for SearchableComboListView.
11+
FOUNDATION_EXPORT double SearchableComboListViewVersionNumber;
12+
13+
//! Project version string for SearchableComboListView.
14+
FOUNDATION_EXPORT const unsigned char SearchableComboListViewVersionString[];
15+
16+
// In this header, you should import all the public headers of your framework using statements like #import <SearchableComboListView/PublicHeader.h>
17+
//#import "SearchableComboListView-Swift.h"
18+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
framework module SearchableComboListView {
2+
umbrella header "SearchableComboListView.h"
3+
4+
export *
5+
module * { export * }
6+
}
7+
8+
module SearchableComboListView.Swift {
9+
header "SearchableComboListView-Swift.h"
10+
requires objc
11+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>BuildMachineOSBuild</key>
6+
<string>19C57</string>
7+
<key>CFBundleDevelopmentRegion</key>
8+
<string>en</string>
9+
<key>CFBundleExecutable</key>
10+
<string>SearchableComboListView</string>
11+
<key>CFBundleIdentifier</key>
12+
<string>com.iterm2.SearchableComboListView</string>
13+
<key>CFBundleInfoDictionaryVersion</key>
14+
<string>6.0</string>
15+
<key>CFBundleName</key>
16+
<string>SearchableComboListView</string>
17+
<key>CFBundlePackageType</key>
18+
<string>FMWK</string>
19+
<key>CFBundleShortVersionString</key>
20+
<string>1.0</string>
21+
<key>CFBundleSupportedPlatforms</key>
22+
<array>
23+
<string>MacOSX</string>
24+
</array>
25+
<key>CFBundleVersion</key>
26+
<string>1</string>
27+
<key>DTCompiler</key>
28+
<string>com.apple.compilers.llvm.clang.1_0</string>
29+
<key>DTPlatformBuild</key>
30+
<string>11C29</string>
31+
<key>DTPlatformVersion</key>
32+
<string>GM</string>
33+
<key>DTSDKBuild</key>
34+
<string>19B90</string>
35+
<key>DTSDKName</key>
36+
<string>macosx10.15</string>
37+
<key>DTXcode</key>
38+
<string>1130</string>
39+
<key>DTXcodeBuild</key>
40+
<string>11C29</string>
41+
<key>LSMinimumSystemVersion</key>
42+
<string>10.12</string>
43+
</dict>
44+
</plist>

0 commit comments

Comments
 (0)