5#ifndef __FormatToolbar_h__
6#define __FormatToolbar_h__ 1
8#include "Stroika/Foundation/StroikaPreComp.h"
10#if qStroika_Foundation_Common_Platform_Windows
14#include "Stroika/Frameworks/Led/GDI.h"
16#include "LedItConfig.h"
18#if qStroika_Foundation_Common_Platform_Windows
20class FormatToolbarOwner {
22 virtual IncrementalFontSpecification GetCurFont ()
const = 0;
23 virtual void SetCurFont (
const IncrementalFontSpecification& fsp) = 0;
26class FormatToolbar :
public CToolBar {
28 FormatToolbar (FormatToolbarOwner& owner);
31 FormatToolbarOwner& fOwner;
34 nonvirtual
void PositionCombos ();
35 nonvirtual
void SyncToView ();
38 class LocalComboBox :
public CComboBox {
40 static int m_nFontHeight;
42 nonvirtual BOOL HasFocus ()
44 HWND hWnd = ::GetFocus ();
45 return (hWnd == m_hWnd || ::IsChild (m_hWnd, hWnd));
47 nonvirtual
void GetTheText (CString& str);
48 nonvirtual
void SetTheText (LPCTSTR lpszText, BOOL bMatchExact = FALSE);
50 nonvirtual BOOL LimitText (
int nMaxChars);
53 virtual BOOL PreTranslateMessage (MSG* pMsg);
54 afx_msg
int OnCreate (LPCREATESTRUCT lpCreateStruct);
55 DECLARE_MESSAGE_MAP ()
58 class FontComboBox :
public LocalComboBox {
64 nonvirtual
void EnumFontFamiliesEx ();
65 nonvirtual
void MatchFont (LPCTSTR lpszName);
67 static BOOL CALLBACK AFX_EXPORT CheckIsTrueTypeEnumFamCallback (ENUMLOGFONTEX* pelf, NEWTEXTMETRICEX* ,
int FontType, LPVOID pThis);
69 virtual void DrawItem (LPDRAWITEMSTRUCT lpDIS)
override;
70 virtual void MeasureItem (LPMEASUREITEMSTRUCT lpMIS)
override;
71 virtual int CompareItem (LPCOMPAREITEMSTRUCT lpCIS)
override;
72 DECLARE_MESSAGE_MAP ()
75 class SizeComboBox :
public LocalComboBox {
82 nonvirtual
void EnumFontSizes (CDC& dc, LPCTSTR pFontName);
83 static BOOL FAR PASCAL EnumSizeCallBack (LOGFONT FAR* lplf, LPNEWTEXTMETRIC lpntm,
int FontType, LPVOID lpv);
84 nonvirtual
void TwipsToPointString (LPTSTR lpszBuf,
int nTwips);
85 nonvirtual
void SetTwipSize (
int nSize);
86 nonvirtual
int GetTwipSize ();
87 nonvirtual
void InsertSize (
int nSize);
92 FontComboBox m_comboFontName;
93 SizeComboBox m_comboFontSize;
96 void NotifyOwner (UINT nCode);
99 virtual void OnUpdateCmdUI (CFrameWnd* pTarget, BOOL bDisableIfNoHndler)
override;
101 afx_msg
int OnCreate (LPCREATESTRUCT lpCreateStruct);
102 afx_msg
void OnFontNameKillFocus ();
103 afx_msg
void OnFontSizeKillFocus ();
104 afx_msg
void OnFontSizeDropDown ();
105 afx_msg
void OnComboCloseUp ();
106 afx_msg
void OnComboSetFocus ();
107 DECLARE_MESSAGE_MAP ()