Mercurial > foo_out_sdl
view 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 |
line wrap: on
line source
#import "NSComboBox+fb2k.h" namespace fb2k { void comboSetupHistory(NSComboBox * box, cfg_dropdown_history & var) { [box removeAllItems]; pfc::string8 temp; var.get_state( temp ); NSString * str = [NSString stringWithUTF8String: temp.c_str()]; if ( str.length == 0 ) return; NSArray * arr = [str componentsSeparatedByCharactersInSet: NSCharacterSet.newlineCharacterSet]; if ( arr.count == 0 ) return; for( NSString * str in arr ) { if ( str.length > 0 ) [box addItemWithObjectValue: str]; } box.stringValue = arr.firstObject; [box.menu addItem: NSMenuItem.separatorItem]; } void comboAddToHistory(NSComboBox * box, cfg_dropdown_history & var) { NSString * str = box.stringValue; if ( str.length > 0 ) var.add_item( str.UTF8String ); } } // namespace fb2k
