//////////////////////////////////////////////////////////////////////////////// // BlueMatrix Excel Addin // Copyright (c) 2005, // // File : FontCombobox.h // // Contents : Combo box for a choice of a font // // Implementation details: // // Author : BlueMatrix // // TODO : // //////////////////////////////////////////////////////////////////////////////// #pragma once #define CX_TTBITMAP 11 #define CY_TTBITMAP 11 #define CY_FONT 16 // typedef std::vector FONTVECTOR; typedef std::vector FONTVECTOR; class CFontCompare { private: ATL::CString m_strFont; // The value to compare by public: // Constructor initializes the value to compare by CFontCompare(LPCTSTR pszFont) : m_strFont(pszFont) {} // The function call for the elemnt to be compared BOOL operator()(ENUMLOGFONTEX& eLogFont) const { return !_tcscmp( (LPCTSTR)m_strFont, eLogFont.elfLogFont.lfFaceName); } }; class CFontCombobox : public CWindowImpl { public: // "Combobox" is the name of the standard Window class. // "CColorCombobox" is the name of the new Windows class // that will be based on the ComboBox class. DECLARE_WND_SUPERCLASS("CFontCombobox", WC_COMBOBOX) BEGIN_MSG_MAP(CFontCombobox) // MESSAGE_HANDLER(WM_COMMAND, OnCommand) END_MSG_MAP() // Message handlers // LRESULT OnCommand(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled) // { // bHandled = FALSE; // // if (HIWORD(lParam) == CBN_SELCHANGE) // { // ATLTRACE(_T("CBN_SELCHANGE\n")); // } // // return 0; // } static void MeasureItem(LPMEASUREITEMSTRUCT pmis); static void DrawItem(LPDRAWITEMSTRUCT pdis); static int CALLBACK EnumFontFamiliesExProc( ENUMLOGFONTEX* lpelfe, NEWTEXTMETRICEX* lpntme, int FontType, LPARAM lParam); static bool UDgreater(ENUMLOGFONTEX elf, ENUMLOGFONTEX elf2); /* static */ void InitFont(); static void EnumAllFonts(); // Attributes public: // HFONT s_hFont; static FONTVECTOR s_aFonts; static HBITMAP s_hBitmap; };