xref: /haiku/src/apps/haikudepot/util/LanguageMenuUtils.h (revision 909af08f4328301fbdef1ffb41f566c3b5bec0c7)
1 /*
2  * Copyright 2019-2024, 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 <vector>
10 
11 #include <Menu.h>
12 
13 #include "Model.h"
14 #include "PackageInfo.h"
15 
16 
17 class LanguageMenuUtils {
18 
19 public:
20 	static	void			AddLanguagesToMenu(
21 								const LanguageRepository* repository,
22 								BMenu* menu);
23 	static	void			MarkLanguageInMenu(
24 								const BString& languageId,
25 								BMenu* menu);
26 
27 private:
28 	static	int32			_AddLanguagesToMenu(
29 								const std::vector<LanguageRef>& languages,
30 								BMenu* menu, bool isPopular);
31 	static	void			_AddLanguageToMenu(
32 								const LanguageRef& language,
33 								BMenu* menu);
34 	static	void			_AddLanguageToMenu(
35 								const BString& code,
36 								const BString& name, BMenu* menu);
37 
38 	static	int				_LanguagesPresentationCompareFn(const LanguageRef& l1,
39 								const LanguageRef& l2);
40 	static	bool			_IsLanguagePresentationBefore(const LanguageRef& l1,
41 								const LanguageRef& l2);
42 };
43 
44 
45 #endif // LANGUAGE_MENU_UTILS_H
46