This keyword is not expanded by Git which means it's not replaced with the correct revision value in the releases made using git-based scripts and it's confusing to have lines with unexpanded "$Id$" in the released files. As expanding them with Git is not that simple (it could be done with git archive and export-subst attribute) and there are not many benefits in having them in the first place, just remove all these lines. If nothing else, this will make an eventual transition to Git simpler. Closes #14487. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
119 lines
3.5 KiB
C++
119 lines
3.5 KiB
C++
///////////////////////////////////////////////////////////////////////////////
|
|
// Name: src/generic/fontpickerg.cpp
|
|
// Purpose: wxGenericFontButton class implementation
|
|
// Author: Francesco Montorsi
|
|
// Modified by:
|
|
// Created: 15/04/2006
|
|
// Copyright: (c) Francesco Montorsi
|
|
// Licence: wxWindows licence
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// ============================================================================
|
|
// declarations
|
|
// ============================================================================
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// headers
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// For compilers that support precompilation, includes "wx.h".
|
|
#include "wx/wxprec.h"
|
|
|
|
#ifdef __BORLANDC__
|
|
#pragma hdrstop
|
|
#endif
|
|
|
|
#if wxUSE_FONTPICKERCTRL
|
|
|
|
#include "wx/fontpicker.h"
|
|
|
|
#include "wx/fontdlg.h"
|
|
|
|
|
|
// ============================================================================
|
|
// implementation
|
|
// ============================================================================
|
|
|
|
IMPLEMENT_DYNAMIC_CLASS(wxGenericFontButton, wxButton)
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// wxGenericFontButton
|
|
// ----------------------------------------------------------------------------
|
|
|
|
bool wxGenericFontButton::Create( wxWindow *parent, wxWindowID id,
|
|
const wxFont &initial, const wxPoint &pos,
|
|
const wxSize &size, long style,
|
|
const wxValidator& validator, const wxString &name)
|
|
{
|
|
wxString label = (style & wxFNTP_FONTDESC_AS_LABEL) ?
|
|
wxString() : // label will be updated by UpdateFont
|
|
_("Choose font");
|
|
|
|
// create this button
|
|
if (!wxButton::Create( parent, id, label, pos,
|
|
size, style, validator, name ))
|
|
{
|
|
wxFAIL_MSG( wxT("wxGenericFontButton creation failed") );
|
|
return false;
|
|
}
|
|
|
|
// and handle user clicks on it
|
|
Connect(GetId(), wxEVT_BUTTON,
|
|
wxCommandEventHandler(wxGenericFontButton::OnButtonClick),
|
|
NULL, this);
|
|
|
|
m_selectedFont = initial.IsOk() ? initial : *wxNORMAL_FONT;
|
|
UpdateFont();
|
|
InitFontData();
|
|
|
|
return true;
|
|
}
|
|
|
|
void wxGenericFontButton::InitFontData()
|
|
{
|
|
m_data.SetAllowSymbols(true);
|
|
m_data.SetColour(*wxBLACK);
|
|
m_data.EnableEffects(true);
|
|
}
|
|
|
|
void wxGenericFontButton::OnButtonClick(wxCommandEvent& WXUNUSED(ev))
|
|
{
|
|
// update the wxFontData to be shown in the dialog
|
|
m_data.SetInitialFont(m_selectedFont);
|
|
|
|
// create the font dialog and display it
|
|
wxFontDialog dlg(this, m_data);
|
|
if (dlg.ShowModal() == wxID_OK)
|
|
{
|
|
m_data = dlg.GetFontData();
|
|
SetSelectedFont(m_data.GetChosenFont());
|
|
|
|
// fire an event
|
|
wxFontPickerEvent event(this, GetId(), m_selectedFont);
|
|
GetEventHandler()->ProcessEvent(event);
|
|
}
|
|
}
|
|
|
|
void wxGenericFontButton::UpdateFont()
|
|
{
|
|
if ( !m_selectedFont.IsOk() )
|
|
return;
|
|
|
|
SetForegroundColour(m_data.GetColour());
|
|
|
|
if (HasFlag(wxFNTP_USEFONT_FOR_LABEL))
|
|
{
|
|
// use currently selected font for the label...
|
|
wxButton::SetFont(m_selectedFont);
|
|
}
|
|
|
|
if (HasFlag(wxFNTP_FONTDESC_AS_LABEL))
|
|
{
|
|
SetLabel(wxString::Format(wxT("%s, %d"),
|
|
m_selectedFont.GetFaceName().c_str(),
|
|
m_selectedFont.GetPointSize()));
|
|
}
|
|
}
|
|
|
|
#endif // wxUSE_FONTPICKERCTRL
|