1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        wx/richtext/richtextfontpage.h
3 // Purpose:     Font page for wxRichTextFormattingDialog
4 // Author:      Julian Smart
5 // Modified by:
6 // Created:     2006-10-02
7 // Copyright:   (c) Julian Smart
8 // Licence:     wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10 
11 #ifndef _RICHTEXTFONTPAGE_H_
12 #define _RICHTEXTFONTPAGE_H_
13 
14 /*!
15  * Includes
16  */
17 
18 #include "wx/richtext/richtextdialogpage.h"
19 
20 ////@begin includes
21 #include "wx/spinbutt.h"
22 ////@end includes
23 
24 /*!
25  * Forward declarations
26  */
27 
28 ////@begin forward declarations
29 class wxSpinButton;
30 class wxBoxSizer;
31 class wxRichTextFontListBox;
32 class wxRichTextColourSwatchCtrl;
33 class wxRichTextFontPreviewCtrl;
34 ////@end forward declarations
35 
36 /*!
37  * Control identifiers
38  */
39 
40 ////@begin control identifiers
41 #define SYMBOL_WXRICHTEXTFONTPAGE_STYLE wxTAB_TRAVERSAL
42 #define SYMBOL_WXRICHTEXTFONTPAGE_TITLE wxEmptyString
43 #define SYMBOL_WXRICHTEXTFONTPAGE_IDNAME ID_RICHTEXTFONTPAGE
44 #define SYMBOL_WXRICHTEXTFONTPAGE_SIZE wxSize(200, 100)
45 #define SYMBOL_WXRICHTEXTFONTPAGE_POSITION wxDefaultPosition
46 ////@end control identifiers
47 
48 /*!
49  * wxRichTextFontPage class declaration
50  */
51 
52 class WXDLLIMPEXP_RICHTEXT wxRichTextFontPage: public wxRichTextDialogPage
53 {
54     DECLARE_DYNAMIC_CLASS( wxRichTextFontPage )
55     DECLARE_EVENT_TABLE()
56     DECLARE_HELP_PROVISION()
57 
58 public:
59     /// Constructors
60     wxRichTextFontPage( );
61     wxRichTextFontPage( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTFONTPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTFONTPAGE_SIZE, long style = SYMBOL_WXRICHTEXTFONTPAGE_STYLE );
62 
63     /// Initialise members
64     void Init();
65 
66     /// Creation
67     bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = SYMBOL_WXRICHTEXTFONTPAGE_POSITION, const wxSize& size = SYMBOL_WXRICHTEXTFONTPAGE_SIZE, long style = SYMBOL_WXRICHTEXTFONTPAGE_STYLE );
68 
69     /// Creates the controls and sizers
70     void CreateControls();
71 
72     /// Transfer data from/to window
73     virtual bool TransferDataFromWindow();
74     virtual bool TransferDataToWindow();
75 
76     /// Updates the font preview
77     void UpdatePreview();
78 
79     void OnFaceListBoxSelected( wxCommandEvent& event );
80     void OnColourClicked( wxCommandEvent& event );
81 
82     /// Gets the attributes associated with the main formatting dialog
83     wxRichTextAttr* GetAttributes();
84 
85 ////@begin wxRichTextFontPage event handler declarations
86 
87     /// wxEVT_IDLE event handler for ID_RICHTEXTFONTPAGE
88     void OnIdle( wxIdleEvent& event );
89 
90     /// wxEVT_TEXT event handler for ID_RICHTEXTFONTPAGE_FACETEXTCTRL
91     void OnFaceTextCtrlUpdated( wxCommandEvent& event );
92 
93     /// wxEVT_TEXT event handler for ID_RICHTEXTFONTPAGE_SIZETEXTCTRL
94     void OnSizeTextCtrlUpdated( wxCommandEvent& event );
95 
96     /// wxEVT_SCROLL_LINEUP event handler for ID_RICHTEXTFONTPAGE_SPINBUTTONS
97     void OnRichtextfontpageSpinbuttonsUp( wxSpinEvent& event );
98 
99     /// wxEVT_SCROLL_LINEDOWN event handler for ID_RICHTEXTFONTPAGE_SPINBUTTONS
100     void OnRichtextfontpageSpinbuttonsDown( wxSpinEvent& event );
101 
102     /// wxEVT_CHOICE event handler for ID_RICHTEXTFONTPAGE_SIZE_UNITS
103     void OnRichtextfontpageSizeUnitsSelected( wxCommandEvent& event );
104 
105     /// wxEVT_LISTBOX event handler for ID_RICHTEXTFONTPAGE_SIZELISTBOX
106     void OnSizeListBoxSelected( wxCommandEvent& event );
107 
108     /// wxEVT_COMBOBOX event handler for ID_RICHTEXTFONTPAGE_STYLECTRL
109     void OnStyleCtrlSelected( wxCommandEvent& event );
110 
111     /// wxEVT_COMBOBOX event handler for ID_RICHTEXTFONTPAGE_WEIGHTCTRL
112     void OnWeightCtrlSelected( wxCommandEvent& event );
113 
114     /// wxEVT_COMBOBOX event handler for ID_RICHTEXTFONTPAGE_UNDERLINING_CTRL
115     void OnUnderliningCtrlSelected( wxCommandEvent& event );
116 
117     /// wxEVT_CHECKBOX event handler for ID_RICHTEXTFONTPAGE_STRIKETHROUGHCTRL
118     void OnStrikethroughctrlClick( wxCommandEvent& event );
119 
120     /// wxEVT_CHECKBOX event handler for ID_RICHTEXTFONTPAGE_CAPSCTRL
121     void OnCapsctrlClick( wxCommandEvent& event );
122 
123     /// wxEVT_CHECKBOX event handler for ID_RICHTEXTFONTPAGE_SUPERSCRIPT
124     void OnRichtextfontpageSuperscriptClick( wxCommandEvent& event );
125 
126     /// wxEVT_CHECKBOX event handler for ID_RICHTEXTFONTPAGE_SUBSCRIPT
127     void OnRichtextfontpageSubscriptClick( wxCommandEvent& event );
128 
129 ////@end wxRichTextFontPage event handler declarations
130 
131 ////@begin wxRichTextFontPage member function declarations
132 
133     /// Retrieves bitmap resources
134     wxBitmap GetBitmapResource( const wxString& name );
135 
136     /// Retrieves icon resources
137     wxIcon GetIconResource( const wxString& name );
138 ////@end wxRichTextFontPage member function declarations
139 
140     /// Should we show tooltips?
141     static bool ShowToolTips();
142 
143 ////@begin wxRichTextFontPage member variables
144     wxTextCtrl* m_faceTextCtrl;
145     wxTextCtrl* m_sizeTextCtrl;
146     wxSpinButton* m_fontSizeSpinButtons;
147     wxChoice* m_sizeUnitsCtrl;
148     wxBoxSizer* m_fontListBoxParent;
149     wxRichTextFontListBox* m_faceListBox;
150     wxListBox* m_sizeListBox;
151     wxComboBox* m_styleCtrl;
152     wxComboBox* m_weightCtrl;
153     wxComboBox* m_underliningCtrl;
154     wxCheckBox* m_textColourLabel;
155     wxRichTextColourSwatchCtrl* m_colourCtrl;
156     wxCheckBox* m_bgColourLabel;
157     wxRichTextColourSwatchCtrl* m_bgColourCtrl;
158     wxCheckBox* m_strikethroughCtrl;
159     wxCheckBox* m_capitalsCtrl;
160     wxCheckBox* m_smallCapitalsCtrl;
161     wxCheckBox* m_superscriptCtrl;
162     wxCheckBox* m_subscriptCtrl;
163     wxRichTextFontPreviewCtrl* m_previewCtrl;
164     /// Control identifiers
165     enum {
166         ID_RICHTEXTFONTPAGE = 10000,
167         ID_RICHTEXTFONTPAGE_FACETEXTCTRL = 10001,
168         ID_RICHTEXTFONTPAGE_SIZETEXTCTRL = 10002,
169         ID_RICHTEXTFONTPAGE_SPINBUTTONS = 10003,
170         ID_RICHTEXTFONTPAGE_SIZE_UNITS = 10004,
171         ID_RICHTEXTFONTPAGE_FACELISTBOX = 10005,
172         ID_RICHTEXTFONTPAGE_SIZELISTBOX = 10006,
173         ID_RICHTEXTFONTPAGE_STYLECTRL = 10007,
174         ID_RICHTEXTFONTPAGE_WEIGHTCTRL = 10008,
175         ID_RICHTEXTFONTPAGE_UNDERLINING_CTRL = 10009,
176         ID_RICHTEXTFONTPAGE_COLOURCTRL_LABEL = 10010,
177         ID_RICHTEXTFONTPAGE_COLOURCTRL = 10011,
178         ID_RICHTEXTFONTPAGE_BGCOLOURCTRL_LABEL = 10012,
179         ID_RICHTEXTFONTPAGE_BGCOLOURCTRL = 10013,
180         ID_RICHTEXTFONTPAGE_STRIKETHROUGHCTRL = 10014,
181         ID_RICHTEXTFONTPAGE_CAPSCTRL = 10015,
182         ID_RICHTEXTFONTPAGE_SMALLCAPSCTRL = 10016,
183         ID_RICHTEXTFONTPAGE_SUPERSCRIPT = 10017,
184         ID_RICHTEXTFONTPAGE_SUBSCRIPT = 10018,
185         ID_RICHTEXTFONTPAGE_PREVIEWCTRL = 10019
186     };
187 ////@end wxRichTextFontPage member variables
188 
189     bool m_dontUpdate;
190     bool m_colourPresent;
191     bool m_bgColourPresent;
192 };
193 
194 #endif
195     // _RICHTEXTFONTPAGE_H_
196