1/* 2 * Copyright 2001-2009, Haiku. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Mark Hogben 7 * DarkWyrm <bpmagic@columbus.rr.com> 8 * Axel Dörfler, axeld@pinc-software.de 9 * Philippe Saint-Pierre, stpere@gmail.com 10 */ 11#ifndef FONT_SELECTION_VIEW_H 12#define FONT_SELECTION_VIEW_H 13 14 15#include <View.h> 16 17class BLayoutItem; 18class BBox; 19class BMenuField; 20class BPopUpMenu; 21class BStringView; 22 23static const int32 kMsgSetFamily = 'fmly'; 24static const int32 kMsgSetStyle = 'styl'; 25static const int32 kMsgSetSize = 'size'; 26 27 28class FontSelectionView : public BView { 29public: 30 FontSelectionView(const char* name, 31 const char* label, 32 const BFont* font = NULL); 33 virtual ~FontSelectionView(); 34 35 36 virtual void MessageReceived(BMessage* message); 37 38 void SetDefaults(); 39 void Revert(); 40 bool IsDefaultable(); 41 bool IsRevertable(); 42 43 void UpdateFontsMenu(); 44 45 BLayoutItem* CreateSizesLabelLayoutItem(); 46 BLayoutItem* CreateSizesMenuBarLayoutItem(); 47 48 BLayoutItem* CreateFontsLabelLayoutItem(); 49 BLayoutItem* CreateFontsMenuBarLayoutItem(); 50 51 BView* GetPreviewBox(); 52 53private: 54 void _SelectCurrentFont(bool select); 55 void _SelectCurrentSize(bool select); 56 void _UpdateFontPreview(); 57 void _UpdateSystemFont(); 58 void _BuildSizesMenu(); 59 60protected: 61 BMenuField* fFontsMenuField; 62 BMenuField* fSizesMenuField; 63 BPopUpMenu* fFontsMenu; 64 BPopUpMenu* fSizesMenu; 65 66 BBox* fPreviewBox; 67 BStringView* fPreviewText; 68 69 BFont fSavedFont; 70 BFont fCurrentFont; 71 float fMaxFontNameWidth; 72}; 73 74#endif // FONT_SELECTION_VIEW_H 75