ASPiK SDK
cfontchooser.h
1 // This file is part of VSTGUI. It is subject to the license terms
2 // in the LICENSE file found in the top-level directory of this
3 // distribution and at http://github.com/steinbergmedia/vstgui/LICENSE
4 
5 #ifndef __cfontchooser__
6 #define __cfontchooser__
7 
8 #include "../vstguifwd.h"
9 #include "../cviewcontainer.h"
10 #include "../cfont.h"
11 #include "../cdatabrowser.h"
12 #include "icontrollistener.h"
13 
14 namespace VSTGUI {
15 
17 //-----------------------------------------------------------------------------
19 {
20 public:
21  virtual void fontChanged (CFontChooser* chooser, CFontRef newFont) = 0;
22 };
23 
25 //-----------------------------------------------------------------------------
27 {
28  CFontRef font;
29  int32_t rowHeight;
30  CColor fontColor;
31  CColor selectionColor;
32  CColor rowlineColor;
33  CColor rowBackColor;
34  CColor rowAlternateBackColor;
35  CColor previewTextColor;
36  CColor previewBackgroundColor;
37  CColor scrollbarScrollerColor;
38  CColor scrollbarFrameColor;
39  CColor scrollbarBackgroundColor;
40  CCoord scrollbarWidth;
41 
42  CFontChooserUIDefinition (CFontRef font = kSystemFont,
43  const CColor& fontColor = kWhiteCColor,
44  const CColor& selectionColor = kBlueCColor,
45  const CColor& rowlineColor = kGreyCColor,
46  const CColor& rowBackColor = kTransparentCColor,
47  const CColor& rowAlternateBackColor = kTransparentCColor,
48  const CColor& previewTextColor = kBlackCColor,
49  const CColor& previewBackgroundColor = kWhiteCColor,
50  const CColor& scrollbarScrollerColor = kBlueCColor,
51  const CColor& scrollbarFrameColor = kBlackCColor,
52  const CColor& scrollbarBackgroundColor = kGreyCColor,
53  int32_t rowHeight = -1,
54  CCoord scrollbarWidth = 16)
55  : font (font), rowHeight (rowHeight), fontColor (fontColor), selectionColor (selectionColor), rowlineColor (rowlineColor)
56  , rowBackColor (rowBackColor), rowAlternateBackColor (rowAlternateBackColor), previewTextColor (previewTextColor), previewBackgroundColor (previewBackgroundColor)
57  , scrollbarScrollerColor (scrollbarScrollerColor), scrollbarFrameColor (scrollbarFrameColor)
58  , scrollbarBackgroundColor (scrollbarBackgroundColor), scrollbarWidth (scrollbarWidth)
59  {}
60 };
61 
63 //-----------------------------------------------------------------------------
65 {
66 public:
67  CFontChooser (IFontChooserDelegate* delegate, CFontRef initialFont = nullptr, const CFontChooserUIDefinition& uiDef = CFontChooserUIDefinition ());
68  ~CFontChooser () noexcept override;
69 
70  void setFont (CFontRef font);
71 
72 protected:
73  void dbSelectionChanged (int32_t selectedRow, GenericStringListDataBrowserSource* source) override;
74  void valueChanged (CControl* pControl) override;
75  bool attached (CView* parent) override;
76  int32_t onKeyDown (VstKeyCode& keyCode) override;
77 
78  IFontChooserDelegate* delegate;
79  CDataBrowser* fontBrowser;
80  CTextEdit* sizeEdit;
81  CCheckBox* boldBox;
82  CCheckBox* italicBox;
83  CCheckBox* underlineBox;
84  CCheckBox* strikeoutBox;
85  CView* fontPreviewView;
86  GenericStringListDataBrowserSource::StringVector fontNames;
87 
88  CFontRef selFont;
89 };
90 
91 } // namespace
92 
93 #endif
Definition: cfontchooser.h:18
Definition: cfontchooser.h:64
Container Class of CView objects.
Definition: cviewcontainer.h:52
font class
Definition: cfont.h:31
Definition: vstkeycode.h:12
Definition: cfontchooser.h:26
RGBA Color structure.
Definition: ccolor.h:15
DataBrowser view.
Definition: cdatabrowser.h:91
Generic string list data browser source.
Definition: cdatabrowser.h:192
Definition: customcontrols.cpp:8
base class of all VSTGUI controls
Definition: ccontrol.h:76
Base Class of all view objects.
Definition: cview.h:44
int32_t onKeyDown(VstKeyCode &keyCode) override
called if a key down event occurs and this view has focus
Definition: cfontchooser.cpp:292
bool attached(CView *parent) override
view is attached to a parent view
Definition: cfontchooser.cpp:281
a check box control with a title and 3 states
Definition: cbuttons.h:59
a text edit control
Definition: ctextedit.h:21
Definition: icontrollistener.h:14