Stroika Library 3.0d18
 
Loading...
Searching...
No Matches
LedLineIt/Sources/FontMenu.cpp
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4
5#include "Stroika/Foundation/StroikaPreComp.h"
6
7#include <afxwin.h>
8
9#include <algorithm>
10
11#include "Stroika/Frameworks/Led/GDI.h"
12
13#include "Resource.h"
14
15#include "FontMenu.h"
16
17using namespace Stroika::Foundation;
18using namespace Stroika::Frameworks::Led;
19
20static InstalledFonts sInstalledFonts; // Keep a static copy for speed, and so font#s are static throughout the life of the applet
21
22/*
23 ********************************************************************************
24 *********************************** FixupFontMenu ******************************
25 ********************************************************************************
26 */
27void FixupFontMenu (CMenu* fontMenu)
28{
29 AssertMember (fontMenu, CMenu);
30
31 // delete all menu items
32 while (fontMenu->DeleteMenu (0, MF_BYPOSITION) != 0) {
33 ;
34 }
35
36 vector<SDKString> fontNames = sInstalledFonts.GetUsableFontNames ();
37 for (UINT i = 0; i < fontNames.size (); ++i) {
38 int cmdNum = cmdFontMenuFirst + i;
39 fontMenu->AppendMenu (MF_STRING, cmdNum, fontNames[i].c_str ());
40 }
41}
42
43SDKString CmdNumToFontName (UINT cmdNum)
44{
45 vector<SDKString> fontNames = sInstalledFonts.GetUsableFontNames ();
46 return (fontNames[cmdNum - cmdFontMenuFirst]);
47}
#define AssertMember(p, c)
Definition Assertions.h:312
basic_string< SDKChar > SDKString
Definition SDKString.h:38