comparison foosdk/sdk/foobar2000/helpers-mac/NSComboBox+fb2k.mm @ 1:20d02a178406 default tip

*: check in everything else yay
author Paper <paper@tflc.us>
date Mon, 05 Jan 2026 02:15:46 -0500
parents
children
comparison
equal deleted inserted replaced
0:e9bb126753e7 1:20d02a178406
1 #import "NSComboBox+fb2k.h"
2
3 namespace fb2k {
4 void comboSetupHistory(NSComboBox * box, cfg_dropdown_history & var) {
5 [box removeAllItems];
6 pfc::string8 temp; var.get_state( temp );
7 NSString * str = [NSString stringWithUTF8String: temp.c_str()];
8 if ( str.length == 0 ) return;
9 NSArray * arr = [str componentsSeparatedByCharactersInSet: NSCharacterSet.newlineCharacterSet];
10 if ( arr.count == 0 ) return;
11 for( NSString * str in arr ) {
12 if ( str.length > 0 ) [box addItemWithObjectValue: str];
13 }
14 box.stringValue = arr.firstObject;
15
16 [box.menu addItem: NSMenuItem.separatorItem];
17 }
18
19 void comboAddToHistory(NSComboBox * box, cfg_dropdown_history & var) {
20 NSString * str = box.stringValue;
21 if ( str.length > 0 ) var.add_item( str.UTF8String );
22 }
23 } // namespace fb2k