btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / apps / webpositive / support / FontSelectionView.h
blob8ee630b4484a98a09fe842313e0e3e5b904cfa3c
1 /*
2 * Copyright 2001-2010, Haiku.
3 * Distributed under the terms of the MIT License.
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 * Stephan Aßmus <superstippi@gmx.de>
12 #ifndef FONT_SELECTION_VIEW_H
13 #define FONT_SELECTION_VIEW_H
16 #include <Font.h>
17 #include <Handler.h>
19 class BLayoutItem;
20 class BBox;
21 class BMenu;
22 class BMenuField;
23 class BPopUpMenu;
24 class BStringView;
25 class BView;
28 class FontSelectionView : public BHandler {
29 public:
30 FontSelectionView(const char* name,
31 const char* label, bool separateStyles,
32 const BFont* font = NULL);
33 virtual ~FontSelectionView();
35 void AttachedToLooper();
36 virtual void MessageReceived(BMessage* message);
38 void SetMessage(BMessage* message);
39 void SetTarget(BHandler* target);
41 void SetFont(const BFont& font, float size);
42 void SetFont(const BFont& font);
43 void SetSize(float size);
44 const BFont& Font() const;
46 void SetDefaults();
47 void Revert();
48 bool IsDefaultable();
49 bool IsRevertable();
51 void UpdateFontsMenu();
53 BLayoutItem* CreateSizesLabelLayoutItem();
54 BLayoutItem* CreateSizesMenuBarLayoutItem();
56 BLayoutItem* CreateFontsLabelLayoutItem();
57 BLayoutItem* CreateFontsMenuBarLayoutItem();
59 BLayoutItem* CreateStylesLabelLayoutItem();
60 BLayoutItem* CreateStylesMenuBarLayoutItem();
62 BView* PreviewBox() const;
64 private:
65 void _Invoke();
67 BFont _DefaultFont() const;
68 void _SelectCurrentFont(bool select);
69 void _SelectCurrentSize(bool select);
70 void _UpdateFontPreview();
71 void _BuildSizesMenu();
72 void _AddStylesToMenu(const BFont& font,
73 BMenu* menu) const;
75 protected:
76 BMenuField* fFontsMenuField;
77 BMenuField* fStylesMenuField;
78 BMenuField* fSizesMenuField;
79 BPopUpMenu* fFontsMenu;
80 BPopUpMenu* fStylesMenu;
81 BPopUpMenu* fSizesMenu;
82 BStringView* fPreviewText;
84 BFont fSavedFont;
85 BFont fCurrentFont;
87 BMessage* fMessage;
88 BHandler* fTarget;
91 #endif // FONT_SELECTION_VIEW_H