1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/gtk/aboutdlg.cpp
3 // Purpose: native GTK+ wxAboutBox() implementation
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 // ============================================================================
13 // ============================================================================
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 // for compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
22 #if wxUSE_ABOUTDLG && defined(__WXGTK26__)
27 #include "wx/aboutdlg.h"
28 #include "wx/generic/aboutdlgg.h"
30 #include "wx/gtk/private.h"
32 // ----------------------------------------------------------------------------
33 // GtkArray: temporary array of GTK strings
34 // ----------------------------------------------------------------------------
39 GtkArray(const wxArrayString
& a
)
42 m_strings
= new const gchar
*[m_count
+ 1];
43 for ( size_t n
= 0; n
< m_count
; n
++ )
44 m_strings
[n
] = wxGTK_CONV_SYS(a
[n
]).release();
46 // array must be NULL-terminated
47 m_strings
[m_count
] = NULL
;
50 operator const gchar
**() const { return m_strings
; }
54 for ( size_t n
= 0; n
< m_count
; n
++ )
55 free(wx_const_cast(gchar
*, m_strings
[n
]));
61 const gchar
**m_strings
;
64 DECLARE_NO_COPY_CLASS(GtkArray
)
67 // ============================================================================
69 // ============================================================================
71 void wxAboutBox(const wxAboutDialogInfo
& info
)
73 if ( !gtk_check_version(2,6,0) )
75 GtkAboutDialog
* const dlg
= GTK_ABOUT_DIALOG(gtk_about_dialog_new());
76 gtk_about_dialog_set_name(dlg
, info
.GetName());
77 if ( info
.HasVersion() )
78 gtk_about_dialog_set_version(dlg
, info
.GetVersion());
79 if ( info
.HasCopyright() )
80 gtk_about_dialog_set_copyright(dlg
, info
.GetCopyright());
81 if ( info
.HasDescription() )
82 gtk_about_dialog_set_comments(dlg
, info
.GetDescription());
83 if ( info
.HasLicence() )
84 gtk_about_dialog_set_license(dlg
, info
.GetLicence());
86 wxIcon icon
= info
.GetIcon();
88 gtk_about_dialog_set_logo(dlg
, info
.GetIcon().GetPixbuf());
90 if ( info
.HasWebSite() )
92 gtk_about_dialog_set_website(dlg
, info
.GetWebSiteURL());
93 gtk_about_dialog_set_website_label(dlg
, info
.GetWebSiteDescription());
96 if ( info
.HasDevelopers() )
97 gtk_about_dialog_set_authors(dlg
, GtkArray(info
.GetDevelopers()));
98 if ( info
.HasDocWriters() )
99 gtk_about_dialog_set_documenters(dlg
, GtkArray(info
.GetDocWriters()));
100 if ( info
.HasArtists() )
101 gtk_about_dialog_set_artists(dlg
, GtkArray(info
.GetArtists()));
102 if ( info
.HasTranslators() )
103 gtk_about_dialog_set_translator_credits(dlg
, _("translator-credits"));
105 gtk_widget_show(GTK_WIDGET(dlg
));
109 // native about dialog not available, fall back to the generic one
110 wxGenericAboutBox(info
);
113 #endif // wxUSE_ABOUTDLG && GTK+ 2.6+