1 /* 2 * Copyright 2019, Andrew Lindesay <apl@lindesay.co.nz>. 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5 #ifndef LANGUAGE_MENU_UTILS_H 6 #define LANGUAGE_MENU_UTILS_H 7 8 9 #include <Menu.h> 10 11 #include "Model.h" 12 #include "PackageInfo.h" 13 14 15 class LanguageMenuUtils { 16 17 public: 18 static void AddLanguagesToMenu( 19 const LanguageModel* languagesModel, 20 BMenu* menu); 21 static void MarkLanguageInMenu( 22 const BString& languageCode, 23 BMenu* menu); 24 25 private: 26 static int32 _IndexOfLanguageInMenu( 27 const BString& languageCode, 28 BMenu* menu); 29 static status_t _GetLanguageAtIndexInMenu(BMenu* menu, 30 int32 index, BString* result); 31 static int32 _AddLanguagesToMenu( 32 const LanguageModel* languagesModel, 33 BMenu* menu, bool isPopular); 34 static void _AddLanguageToMenu( 35 const LanguageRef& language, 36 BMenu* menu); 37 static void _AddLanguageToMenu( 38 const BString& code, 39 const BString& name, BMenu* menu); 40 }; 41 42 43 #endif // LANGUAGE_MENU_UTILS_H 44