// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
-#include "wx/gtk/private.h"
+#if wxUSE_FONTPICKERCTRL && defined(__WXGTK24__)
+
#include "wx/fontpicker.h"
#include "wx/fontutil.h" // for wxNativeFontInfo
#include "wx/gtk/private.h"
-#include <gdk/gdk.h>
-#include <gtk/gtk.h>
-
-
-
// ============================================================================
// implementation
// ============================================================================
-#if wxUSE_FONTPICKERCTRL && defined(__WXGTK24__)
-
//-----------------------------------------------------------------------------
// "font-set"
//-----------------------------------------------------------------------------
{
if (!gtk_check_version(2,4,0))
{
- m_needParent = true;
-
if (!PreCreation( parent, pos, size ) ||
!wxControl::CreateBase(parent, id, pos, size, style, validator, name))
{
m_widget = gtk_font_button_new();
// set initial font
- m_selectedFont = initial;
+ m_selectedFont = initial.IsOk() ? initial : *wxNORMAL_FONT;
UpdateFont();
// honour the fontbutton styles
gtk_font_button_set_use_size(GTK_FONT_BUTTON(m_widget), usefont);
gtk_font_button_set_use_font(GTK_FONT_BUTTON(m_widget), usefont);
- gtk_widget_show( GTK_WIDGET(m_widget) );
+ gtk_widget_show(m_widget);
// GtkFontButton signals
g_signal_connect(m_widget, "font-set",
m_parent->DoAddChild( this );
PostCreation(size);
- SetBestSize(size);
+ SetInitialSize(size);
}
else
return wxGenericFontButton::Create(parent, id, initial, pos, size,
wxGenericFontButton::UpdateFont();
}
-#endif // wxUSE_FONTPICKERCTRL
+#endif // wxUSE_FONTPICKERCTRL && defined(__WXGTK24__)