Ejemplo n.º 1
0
bool wxFontPickerCtrl::Create( wxWindow *parent, wxWindowID id,
                               const wxFont &initial,
                               const wxPoint &pos, const wxSize &size,
                               long style, const wxValidator& validator,
                               const wxString &name )
{
    if (!wxPickerBase::CreateBase(parent, id,
                                  Font2String(initial.IsOk() ? initial
                                          : *wxNORMAL_FONT),
                                  pos, size, style, validator, name))
        return false;

    // the picker of a wxFontPickerCtrl is a wxFontPickerWidget
    m_picker = new wxFontPickerWidget(this, wxID_ANY, initial,
                                      wxDefaultPosition, wxDefaultSize,
                                      GetPickerStyle(style));
    // complete sizer creation
    wxPickerBase::PostCreation();

    m_picker->Connect(wxEVT_COMMAND_FONTPICKER_CHANGED,
                      wxFontPickerEventHandler(wxFontPickerCtrl::OnFontChange),
                      NULL, this);

    return true;
}
Ejemplo n.º 2
0
void wxFontPickerCtrl::UpdateTextCtrlFromPicker()
{
    if (!m_text)
        return;     // no textctrl to update

    // Take care to use ChangeValue() here and not SetValue() to avoid
    // infinite recursion.
    m_text->ChangeValue(Font2String(GetPickerWidget()->GetSelectedFont()));
}
Ejemplo n.º 3
0
void wxFontPickerCtrl::UpdateTextCtrlFromPicker()
{
    if (!m_text)
        return;     // no textctrl to update

    // NOTE: this SetValue() will generate an unwanted wxEVT_COMMAND_TEXT_UPDATED
    //       which will trigger a unneeded UpdateFromTextCtrl(); thus before using
    //       SetValue() we set the m_bIgnoreNextTextCtrlUpdate flag...
    m_bIgnoreNextTextCtrlUpdate = true;
    m_text->SetValue(Font2String(M_PICKER->GetSelectedFont()));
}