File: fontdlg.h

package info (click to toggle)
wxpython3.0 3.0.2.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 482,760 kB
  • ctags: 518,293
  • sloc: cpp: 2,127,226; python: 294,045; makefile: 51,942; ansic: 19,033; sh: 3,013; xml: 1,629; perl: 17
file content (173 lines) | stat: -rw-r--r-- 4,407 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/////////////////////////////////////////////////////////////////////////////
// Name:        wx/osx/fontdlg.h
// Purpose:     wxFontDialog class using fonts window services (10.2+).
// Author:      Ryan Norton
// Modified by:
// Created:     2004-09-25
// Copyright:   (c) Ryan Norton
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

#ifndef _WX_FONTDLG_H_
#define _WX_FONTDLG_H_

#include "wx/dialog.h"

/*
 * Font dialog
 */

/*
 * support old notation
 */
#ifdef wxMAC_USE_EXPERIMENTAL_FONTDIALOG
#define wxOSX_USE_EXPERIMENTAL_FONTDIALOG wxMAC_USE_EXPERIMENTAL_FONTDIALOG
#endif

#ifndef wxOSX_USE_EXPERIMENTAL_FONTDIALOG
#define wxOSX_USE_EXPERIMENTAL_FONTDIALOG 1
#endif

#if wxOSX_USE_EXPERIMENTAL_FONTDIALOG

class WXDLLIMPEXP_CORE wxFontDialog : public wxDialog
{
public:
    wxFontDialog();
    wxFontDialog(wxWindow *parent);
    wxFontDialog(wxWindow *parent, const wxFontData& data);
    virtual ~wxFontDialog();

    bool Create(wxWindow *parent);
    bool Create(wxWindow *parent, const wxFontData& data);

    int ShowModal();
    wxFontData& GetFontData() { return m_fontData; }

protected:
    wxFontData m_fontData;

    DECLARE_DYNAMIC_CLASS_NO_COPY(wxFontDialog)
};

extern "C" int RunMixedFontDialog(wxFontDialog* dialog) ;

#else // wxOSX_USE_EXPERIMENTAL_FONTDIALOG

#if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX

/*!
 * Forward declarations
 */

class wxFontColourSwatchCtrl;
class wxFontPreviewCtrl;
class WXDLLIMPEXP_FWD_CORE wxSpinCtrl;
class WXDLLIMPEXP_FWD_CORE wxSpinEvent;
class WXDLLIMPEXP_FWD_CORE wxListBox;
class WXDLLIMPEXP_FWD_CORE wxChoice;
class WXDLLIMPEXP_FWD_CORE wxButton;
class WXDLLIMPEXP_FWD_CORE wxStaticText;
class WXDLLIMPEXP_FWD_CORE wxCheckBox;

/*!
 * Control identifiers
 */

#define wxID_FONTDIALOG_FACENAME 20001
#define wxID_FONTDIALOG_FONTSIZE 20002
#define wxID_FONTDIALOG_BOLD 20003
#define wxID_FONTDIALOG_ITALIC 20004
#define wxID_FONTDIALOG_UNDERLINED 20005
#define wxID_FONTDIALOG_COLOUR 20006
#define wxID_FONTDIALOG_PREVIEW 20007

#endif
    // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX

class WXDLLIMPEXP_CORE wxFontDialog: public wxDialog
{
DECLARE_DYNAMIC_CLASS(wxFontDialog)

#if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
DECLARE_EVENT_TABLE()
#endif

public:
    wxFontDialog();
    wxFontDialog(wxWindow *parent, const wxFontData& data);
    virtual ~wxFontDialog();

    bool Create(wxWindow *parent, const wxFontData& data);

    int ShowModal();
    wxFontData& GetFontData() { return m_fontData; }
    bool IsShown() const;
    void OnPanelClose();
    void SetData(const wxFontData& data);

#if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX

    /// Creates the controls and sizers
    void CreateControls();

    /// Initialize font
    void InitializeFont();

    /// Set controls according to current font
    void InitializeControls();

    /// Respond to font change
    void ChangeFont();

    /// Respond to colour change
    void OnColourChanged(wxCommandEvent& event);

    /// wxEVT_LISTBOX event handler for wxID_FONTDIALOG_FACENAME
    void OnFontdialogFacenameSelected( wxCommandEvent& event );

    /// wxEVT_SPINCTRL event handler for wxID_FONTDIALOG_FONTSIZE
    void OnFontdialogFontsizeUpdated( wxSpinEvent& event );

    /// wxEVT_TEXT event handler for wxID_FONTDIALOG_FONTSIZE
    void OnFontdialogFontsizeTextUpdated( wxCommandEvent& event );

    /// wxEVT_CHECKBOX event handler for wxID_FONTDIALOG_BOLD
    void OnFontdialogBoldClick( wxCommandEvent& event );

    /// wxEVT_CHECKBOX event handler for wxID_FONTDIALOG_ITALIC
    void OnFontdialogItalicClick( wxCommandEvent& event );

    /// wxEVT_CHECKBOX event handler for wxID_FONTDIALOG_UNDERLINED
    void OnFontdialogUnderlinedClick( wxCommandEvent& event );

    /// wxEVT_BUTTON event handler for wxID_OK
    void OnOkClick( wxCommandEvent& event );

    /// Should we show tooltips?
    static bool ShowToolTips();

    wxListBox* m_facenameCtrl;
    wxSpinCtrl* m_sizeCtrl;
    wxCheckBox* m_boldCtrl;
    wxCheckBox* m_italicCtrl;
    wxCheckBox* m_underlinedCtrl;
    wxFontColourSwatchCtrl* m_colourCtrl;
    wxFontPreviewCtrl* m_previewCtrl;

    wxFont      m_dialogFont;
    bool        m_suppressUpdates;

#endif
    // !USE_NATIVE_FONT_DIALOG_FOR_MACOSX

protected:
    wxWindow*   m_dialogParent;
    wxFontData  m_fontData;
    void*       m_pEventHandlerRef;
};

#endif

#endif
    // _WX_FONTDLG_H_