Implemented run-time checks for the GTK version
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30870 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -202,7 +202,7 @@ static GdkPixbuf *CreateStockIcon(const char *stockid, GtkIconSize size)
|
|||||||
GTK_STATE_NORMAL, size, NULL, NULL);
|
GTK_STATE_NORMAL, size, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTK_CHECK_VERSION(2,4,0)
|
#ifdef __WXGTK24__
|
||||||
static GdkPixbuf *CreateThemeIcon(const char *iconname,
|
static GdkPixbuf *CreateThemeIcon(const char *iconname,
|
||||||
GtkIconSize iconsize, const wxSize& sz)
|
GtkIconSize iconsize, const wxSize& sz)
|
||||||
{
|
{
|
||||||
@@ -218,7 +218,7 @@ static GdkPixbuf *CreateThemeIcon(const char *iconname,
|
|||||||
size.x,
|
size.x,
|
||||||
(GtkIconLookupFlags)0, NULL);
|
(GtkIconLookupFlags)0, NULL);
|
||||||
}
|
}
|
||||||
#endif // GTK+ >= 2.4.0
|
#endif
|
||||||
|
|
||||||
wxBitmap wxGTK2ArtProvider::CreateBitmap(const wxArtID& id,
|
wxBitmap wxGTK2ArtProvider::CreateBitmap(const wxArtID& id,
|
||||||
const wxArtClient& client,
|
const wxArtClient& client,
|
||||||
@@ -235,9 +235,12 @@ wxBitmap wxGTK2ArtProvider::CreateBitmap(const wxArtID& id,
|
|||||||
|
|
||||||
GdkPixbuf *pixbuf = CreateStockIcon(stockid, stocksize);
|
GdkPixbuf *pixbuf = CreateStockIcon(stockid, stocksize);
|
||||||
|
|
||||||
#if GTK_CHECK_VERSION(2,4,0)
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
|
{
|
||||||
if (!pixbuf)
|
if (!pixbuf)
|
||||||
pixbuf = CreateThemeIcon(stockid, stocksize, size);
|
pixbuf = CreateThemeIcon(stockid, stocksize, size);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (pixbuf && size != wxDefaultSize &&
|
if (pixbuf && size != wxDefaultSize &&
|
||||||
|
@@ -127,13 +127,18 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
|
|||||||
else if (HasFlag(wxBU_BOTTOM))
|
else if (HasFlag(wxBU_BOTTOM))
|
||||||
y_alignment = 1.0;
|
y_alignment = 1.0;
|
||||||
|
|
||||||
#if GTK_CHECK_VERSION(2,4,0)
|
#if __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
|
{
|
||||||
gtk_button_set_alignment(GTK_BUTTON(m_widget), x_alignment, y_alignment);
|
gtk_button_set_alignment(GTK_BUTTON(m_widget), x_alignment, y_alignment);
|
||||||
#else
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
if (GTK_IS_MISC(BUTTON_CHILD(m_widget)))
|
if (GTK_IS_MISC(BUTTON_CHILD(m_widget)))
|
||||||
gtk_misc_set_alignment (GTK_MISC (BUTTON_CHILD (m_widget)),
|
gtk_misc_set_alignment (GTK_MISC (BUTTON_CHILD (m_widget)),
|
||||||
x_alignment, y_alignment);
|
x_alignment, y_alignment);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
SetLabel(label);
|
SetLabel(label);
|
||||||
|
|
||||||
|
@@ -141,6 +141,8 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
|||||||
wildCard, style, pos, true )
|
wildCard, style, pos, true )
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
|
{
|
||||||
m_needParent = FALSE;
|
m_needParent = FALSE;
|
||||||
m_destroyed_by_delete = FALSE;
|
m_destroyed_by_delete = FALSE;
|
||||||
|
|
||||||
@@ -192,49 +194,58 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
|||||||
|
|
||||||
SetWildcard(wildCard);
|
SetWildcard(wildCard);
|
||||||
SetFilterIndex(0);
|
SetFilterIndex(0);
|
||||||
#else
|
}
|
||||||
wxGenericFileDialog::Create( parent, message, defaultDir, defaultFileName, wildCard, style, pos );
|
else
|
||||||
#endif
|
#endif
|
||||||
|
wxGenericFileDialog::Create( parent, message, defaultDir, defaultFileName, wildCard, style, pos );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFileDialog::~wxFileDialog()
|
wxFileDialog::~wxFileDialog()
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
|
{
|
||||||
if (m_destroyed_by_delete)
|
if (m_destroyed_by_delete)
|
||||||
m_widget = NULL;
|
m_widget = NULL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::OnFakeOk( wxCommandEvent &event )
|
void wxFileDialog::OnFakeOk( wxCommandEvent &event )
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
wxDialog::OnOK( event );
|
wxDialog::OnOK( event );
|
||||||
#else
|
else
|
||||||
wxGenericFileDialog::OnListOk( event );
|
|
||||||
#endif
|
#endif
|
||||||
|
wxGenericFileDialog::OnListOk( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxFileDialog::ShowModal()
|
int wxFileDialog::ShowModal()
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
return wxDialog::ShowModal();
|
return wxDialog::ShowModal();
|
||||||
#else
|
else
|
||||||
return wxGenericFileDialog::ShowModal();
|
|
||||||
#endif
|
#endif
|
||||||
|
return wxGenericFileDialog::ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFileDialog::Show( bool show )
|
bool wxFileDialog::Show( bool show )
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
return wxDialog::Show( show );
|
return wxDialog::Show( show );
|
||||||
#else
|
else
|
||||||
return wxGenericFileDialog::Show( show );
|
|
||||||
#endif
|
#endif
|
||||||
|
return wxGenericFileDialog::Show( show );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::GetFilenames(wxArrayString& files) const
|
void wxFileDialog::GetFilenames(wxArrayString& files) const
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
|
{
|
||||||
GetPaths(files);
|
GetPaths(files);
|
||||||
for (size_t n = 0; n < files.GetCount(); n++ )
|
for (size_t n = 0; n < files.GetCount(); n++ )
|
||||||
{
|
{
|
||||||
@@ -247,14 +258,17 @@ void wxFileDialog::GetFilenames(wxArrayString& files) const
|
|||||||
}
|
}
|
||||||
files[n] = name;
|
files[n] = name;
|
||||||
}
|
}
|
||||||
#else
|
}
|
||||||
wxGenericFileDialog::GetFilenames( files );
|
else
|
||||||
#endif
|
#endif
|
||||||
|
wxGenericFileDialog::GetFilenames( files );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::GetPaths(wxArrayString& paths) const
|
void wxFileDialog::GetPaths(wxArrayString& paths) const
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
|
{
|
||||||
paths.Empty();
|
paths.Empty();
|
||||||
if (GetWindowStyle() & wxMULTIPLE)
|
if (GetWindowStyle() & wxMULTIPLE)
|
||||||
{
|
{
|
||||||
@@ -275,24 +289,30 @@ void wxFileDialog::GetPaths(wxArrayString& paths) const
|
|||||||
{
|
{
|
||||||
paths.Add(m_fileName);
|
paths.Add(m_fileName);
|
||||||
}
|
}
|
||||||
#else
|
}
|
||||||
wxGenericFileDialog::GetPaths( paths );
|
else
|
||||||
#endif
|
#endif
|
||||||
|
wxGenericFileDialog::GetPaths( paths );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::SetMessage(const wxString& message)
|
void wxFileDialog::SetMessage(const wxString& message)
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
|
{
|
||||||
m_message = message;
|
m_message = message;
|
||||||
SetTitle(message);
|
SetTitle(message);
|
||||||
#else
|
}
|
||||||
wxGenericFileDialog::SetMessage( message );
|
else
|
||||||
#endif
|
#endif
|
||||||
|
wxGenericFileDialog::SetMessage( message );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::SetPath(const wxString& path)
|
void wxFileDialog::SetPath(const wxString& path)
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
|
{
|
||||||
if (path.empty()) return;
|
if (path.empty()) return;
|
||||||
|
|
||||||
wxFileName fn(path);
|
wxFileName fn(path);
|
||||||
@@ -300,41 +320,49 @@ void wxFileDialog::SetPath(const wxString& path)
|
|||||||
m_dir = fn.GetPath();
|
m_dir = fn.GetPath();
|
||||||
m_fileName = fn.GetFullName();
|
m_fileName = fn.GetFullName();
|
||||||
UpdateDialog();
|
UpdateDialog();
|
||||||
#else
|
}
|
||||||
wxGenericFileDialog::SetPath( path );
|
else
|
||||||
#endif
|
#endif
|
||||||
|
wxGenericFileDialog::SetPath( path );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::SetDirectory(const wxString& dir)
|
void wxFileDialog::SetDirectory(const wxString& dir)
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
|
{
|
||||||
if (wxDirExists(dir))
|
if (wxDirExists(dir))
|
||||||
{
|
{
|
||||||
m_dir = dir;
|
m_dir = dir;
|
||||||
m_path = wxFileName(m_dir, m_fileName).GetFullPath();
|
m_path = wxFileName(m_dir, m_fileName).GetFullPath();
|
||||||
UpdateDialog();
|
UpdateDialog();
|
||||||
}
|
}
|
||||||
#else
|
}
|
||||||
wxGenericFileDialog::SetDirectory( dir );
|
else
|
||||||
#endif
|
#endif
|
||||||
|
wxGenericFileDialog::SetDirectory( dir );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::SetFilename(const wxString& name)
|
void wxFileDialog::SetFilename(const wxString& name)
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
|
{
|
||||||
m_fileName = name;
|
m_fileName = name;
|
||||||
m_path = wxFileName(m_dir, m_fileName).GetFullPath();
|
m_path = wxFileName(m_dir, m_fileName).GetFullPath();
|
||||||
UpdateDialog();
|
UpdateDialog();
|
||||||
#else
|
}
|
||||||
wxGenericFileDialog::SetFilename( name );
|
else
|
||||||
#endif
|
#endif
|
||||||
|
wxGenericFileDialog::SetFilename( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::SetWildcard(const wxString& wildCard)
|
void wxFileDialog::SetWildcard(const wxString& wildCard)
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
|
{
|
||||||
m_wildCard = wildCard;
|
m_wildCard = wildCard;
|
||||||
|
|
||||||
GtkFileChooser* chooser = GTK_FILE_CHOOSER(m_widget);
|
GtkFileChooser* chooser = GTK_FILE_CHOOSER(m_widget);
|
||||||
|
|
||||||
// empty current filter list:
|
// empty current filter list:
|
||||||
@@ -374,14 +402,17 @@ void wxFileDialog::SetWildcard(const wxString& wildCard)
|
|||||||
gtk_file_chooser_add_filter(chooser, filter);
|
gtk_file_chooser_add_filter(chooser, filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
}
|
||||||
wxGenericFileDialog::SetWildcard( wildCard );
|
else
|
||||||
#endif
|
#endif
|
||||||
|
wxGenericFileDialog::SetWildcard( wildCard );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::SetFilterIndex(int filterIndex)
|
void wxFileDialog::SetFilterIndex(int filterIndex)
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
|
{
|
||||||
m_filterIndex = filterIndex;
|
m_filterIndex = filterIndex;
|
||||||
|
|
||||||
GtkFileChooser *chooser = GTK_FILE_CHOOSER(m_widget);
|
GtkFileChooser *chooser = GTK_FILE_CHOOSER(m_widget);
|
||||||
@@ -400,9 +431,10 @@ void wxFileDialog::SetFilterIndex(int filterIndex)
|
|||||||
fnode = fnode->next;
|
fnode = fnode->next;
|
||||||
}
|
}
|
||||||
g_slist_free(filters);
|
g_slist_free(filters);
|
||||||
#else
|
}
|
||||||
wxGenericFileDialog::SetFilterIndex( filterIndex );
|
else
|
||||||
#endif
|
#endif
|
||||||
|
wxGenericFileDialog::SetFilterIndex( filterIndex );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::UpdateDialog()
|
void wxFileDialog::UpdateDialog()
|
||||||
|
@@ -487,16 +487,19 @@ bool wxTextCtrl::Create( wxWindow *parent,
|
|||||||
gtk_text_view_set_justification( GTK_TEXT_VIEW(m_text), GTK_JUSTIFY_CENTER );
|
gtk_text_view_set_justification( GTK_TEXT_VIEW(m_text), GTK_JUSTIFY_CENTER );
|
||||||
// Left justify (alignment) is the default and we don't need to apply GTK_JUSTIFY_LEFT
|
// Left justify (alignment) is the default and we don't need to apply GTK_JUSTIFY_LEFT
|
||||||
}
|
}
|
||||||
// gtk_entry_set_alignment was introduced in gtk+-2.3.5
|
|
||||||
#if GTK_CHECK_VERSION(2, 3, 5)
|
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
#ifdef __WXGTK24__
|
||||||
|
// gtk_entry_set_alignment was introduced in gtk+-2.3.5
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
{
|
{
|
||||||
if (style & wxTE_RIGHT)
|
if (style & wxTE_RIGHT)
|
||||||
gtk_entry_set_alignment( GTK_ENTRY(m_text), 1.0 );
|
gtk_entry_set_alignment( GTK_ENTRY(m_text), 1.0 );
|
||||||
else if (style & wxTE_CENTRE)
|
else if (style & wxTE_CENTRE)
|
||||||
gtk_entry_set_alignment( GTK_ENTRY(m_text), 0.5 );
|
gtk_entry_set_alignment( GTK_ENTRY(m_text), 0.5 );
|
||||||
}
|
}
|
||||||
#endif // gtk+-2.3.5
|
#endif
|
||||||
|
}
|
||||||
#endif // __WXGTK20__
|
#endif // __WXGTK20__
|
||||||
|
|
||||||
// We want to be notified about text changes.
|
// We want to be notified about text changes.
|
||||||
|
@@ -202,7 +202,7 @@ static GdkPixbuf *CreateStockIcon(const char *stockid, GtkIconSize size)
|
|||||||
GTK_STATE_NORMAL, size, NULL, NULL);
|
GTK_STATE_NORMAL, size, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTK_CHECK_VERSION(2,4,0)
|
#ifdef __WXGTK24__
|
||||||
static GdkPixbuf *CreateThemeIcon(const char *iconname,
|
static GdkPixbuf *CreateThemeIcon(const char *iconname,
|
||||||
GtkIconSize iconsize, const wxSize& sz)
|
GtkIconSize iconsize, const wxSize& sz)
|
||||||
{
|
{
|
||||||
@@ -218,7 +218,7 @@ static GdkPixbuf *CreateThemeIcon(const char *iconname,
|
|||||||
size.x,
|
size.x,
|
||||||
(GtkIconLookupFlags)0, NULL);
|
(GtkIconLookupFlags)0, NULL);
|
||||||
}
|
}
|
||||||
#endif // GTK+ >= 2.4.0
|
#endif
|
||||||
|
|
||||||
wxBitmap wxGTK2ArtProvider::CreateBitmap(const wxArtID& id,
|
wxBitmap wxGTK2ArtProvider::CreateBitmap(const wxArtID& id,
|
||||||
const wxArtClient& client,
|
const wxArtClient& client,
|
||||||
@@ -235,9 +235,12 @@ wxBitmap wxGTK2ArtProvider::CreateBitmap(const wxArtID& id,
|
|||||||
|
|
||||||
GdkPixbuf *pixbuf = CreateStockIcon(stockid, stocksize);
|
GdkPixbuf *pixbuf = CreateStockIcon(stockid, stocksize);
|
||||||
|
|
||||||
#if GTK_CHECK_VERSION(2,4,0)
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
|
{
|
||||||
if (!pixbuf)
|
if (!pixbuf)
|
||||||
pixbuf = CreateThemeIcon(stockid, stocksize, size);
|
pixbuf = CreateThemeIcon(stockid, stocksize, size);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (pixbuf && size != wxDefaultSize &&
|
if (pixbuf && size != wxDefaultSize &&
|
||||||
|
@@ -127,13 +127,18 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
|
|||||||
else if (HasFlag(wxBU_BOTTOM))
|
else if (HasFlag(wxBU_BOTTOM))
|
||||||
y_alignment = 1.0;
|
y_alignment = 1.0;
|
||||||
|
|
||||||
#if GTK_CHECK_VERSION(2,4,0)
|
#if __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
|
{
|
||||||
gtk_button_set_alignment(GTK_BUTTON(m_widget), x_alignment, y_alignment);
|
gtk_button_set_alignment(GTK_BUTTON(m_widget), x_alignment, y_alignment);
|
||||||
#else
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
if (GTK_IS_MISC(BUTTON_CHILD(m_widget)))
|
if (GTK_IS_MISC(BUTTON_CHILD(m_widget)))
|
||||||
gtk_misc_set_alignment (GTK_MISC (BUTTON_CHILD (m_widget)),
|
gtk_misc_set_alignment (GTK_MISC (BUTTON_CHILD (m_widget)),
|
||||||
x_alignment, y_alignment);
|
x_alignment, y_alignment);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
SetLabel(label);
|
SetLabel(label);
|
||||||
|
|
||||||
|
@@ -141,6 +141,8 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
|||||||
wildCard, style, pos, true )
|
wildCard, style, pos, true )
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
|
{
|
||||||
m_needParent = FALSE;
|
m_needParent = FALSE;
|
||||||
m_destroyed_by_delete = FALSE;
|
m_destroyed_by_delete = FALSE;
|
||||||
|
|
||||||
@@ -192,49 +194,58 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
|||||||
|
|
||||||
SetWildcard(wildCard);
|
SetWildcard(wildCard);
|
||||||
SetFilterIndex(0);
|
SetFilterIndex(0);
|
||||||
#else
|
}
|
||||||
wxGenericFileDialog::Create( parent, message, defaultDir, defaultFileName, wildCard, style, pos );
|
else
|
||||||
#endif
|
#endif
|
||||||
|
wxGenericFileDialog::Create( parent, message, defaultDir, defaultFileName, wildCard, style, pos );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFileDialog::~wxFileDialog()
|
wxFileDialog::~wxFileDialog()
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
|
{
|
||||||
if (m_destroyed_by_delete)
|
if (m_destroyed_by_delete)
|
||||||
m_widget = NULL;
|
m_widget = NULL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::OnFakeOk( wxCommandEvent &event )
|
void wxFileDialog::OnFakeOk( wxCommandEvent &event )
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
wxDialog::OnOK( event );
|
wxDialog::OnOK( event );
|
||||||
#else
|
else
|
||||||
wxGenericFileDialog::OnListOk( event );
|
|
||||||
#endif
|
#endif
|
||||||
|
wxGenericFileDialog::OnListOk( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxFileDialog::ShowModal()
|
int wxFileDialog::ShowModal()
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
return wxDialog::ShowModal();
|
return wxDialog::ShowModal();
|
||||||
#else
|
else
|
||||||
return wxGenericFileDialog::ShowModal();
|
|
||||||
#endif
|
#endif
|
||||||
|
return wxGenericFileDialog::ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFileDialog::Show( bool show )
|
bool wxFileDialog::Show( bool show )
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
return wxDialog::Show( show );
|
return wxDialog::Show( show );
|
||||||
#else
|
else
|
||||||
return wxGenericFileDialog::Show( show );
|
|
||||||
#endif
|
#endif
|
||||||
|
return wxGenericFileDialog::Show( show );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::GetFilenames(wxArrayString& files) const
|
void wxFileDialog::GetFilenames(wxArrayString& files) const
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
|
{
|
||||||
GetPaths(files);
|
GetPaths(files);
|
||||||
for (size_t n = 0; n < files.GetCount(); n++ )
|
for (size_t n = 0; n < files.GetCount(); n++ )
|
||||||
{
|
{
|
||||||
@@ -247,14 +258,17 @@ void wxFileDialog::GetFilenames(wxArrayString& files) const
|
|||||||
}
|
}
|
||||||
files[n] = name;
|
files[n] = name;
|
||||||
}
|
}
|
||||||
#else
|
}
|
||||||
wxGenericFileDialog::GetFilenames( files );
|
else
|
||||||
#endif
|
#endif
|
||||||
|
wxGenericFileDialog::GetFilenames( files );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::GetPaths(wxArrayString& paths) const
|
void wxFileDialog::GetPaths(wxArrayString& paths) const
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
|
{
|
||||||
paths.Empty();
|
paths.Empty();
|
||||||
if (GetWindowStyle() & wxMULTIPLE)
|
if (GetWindowStyle() & wxMULTIPLE)
|
||||||
{
|
{
|
||||||
@@ -275,24 +289,30 @@ void wxFileDialog::GetPaths(wxArrayString& paths) const
|
|||||||
{
|
{
|
||||||
paths.Add(m_fileName);
|
paths.Add(m_fileName);
|
||||||
}
|
}
|
||||||
#else
|
}
|
||||||
wxGenericFileDialog::GetPaths( paths );
|
else
|
||||||
#endif
|
#endif
|
||||||
|
wxGenericFileDialog::GetPaths( paths );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::SetMessage(const wxString& message)
|
void wxFileDialog::SetMessage(const wxString& message)
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
|
{
|
||||||
m_message = message;
|
m_message = message;
|
||||||
SetTitle(message);
|
SetTitle(message);
|
||||||
#else
|
}
|
||||||
wxGenericFileDialog::SetMessage( message );
|
else
|
||||||
#endif
|
#endif
|
||||||
|
wxGenericFileDialog::SetMessage( message );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::SetPath(const wxString& path)
|
void wxFileDialog::SetPath(const wxString& path)
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
|
{
|
||||||
if (path.empty()) return;
|
if (path.empty()) return;
|
||||||
|
|
||||||
wxFileName fn(path);
|
wxFileName fn(path);
|
||||||
@@ -300,41 +320,49 @@ void wxFileDialog::SetPath(const wxString& path)
|
|||||||
m_dir = fn.GetPath();
|
m_dir = fn.GetPath();
|
||||||
m_fileName = fn.GetFullName();
|
m_fileName = fn.GetFullName();
|
||||||
UpdateDialog();
|
UpdateDialog();
|
||||||
#else
|
}
|
||||||
wxGenericFileDialog::SetPath( path );
|
else
|
||||||
#endif
|
#endif
|
||||||
|
wxGenericFileDialog::SetPath( path );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::SetDirectory(const wxString& dir)
|
void wxFileDialog::SetDirectory(const wxString& dir)
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
|
{
|
||||||
if (wxDirExists(dir))
|
if (wxDirExists(dir))
|
||||||
{
|
{
|
||||||
m_dir = dir;
|
m_dir = dir;
|
||||||
m_path = wxFileName(m_dir, m_fileName).GetFullPath();
|
m_path = wxFileName(m_dir, m_fileName).GetFullPath();
|
||||||
UpdateDialog();
|
UpdateDialog();
|
||||||
}
|
}
|
||||||
#else
|
}
|
||||||
wxGenericFileDialog::SetDirectory( dir );
|
else
|
||||||
#endif
|
#endif
|
||||||
|
wxGenericFileDialog::SetDirectory( dir );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::SetFilename(const wxString& name)
|
void wxFileDialog::SetFilename(const wxString& name)
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
|
{
|
||||||
m_fileName = name;
|
m_fileName = name;
|
||||||
m_path = wxFileName(m_dir, m_fileName).GetFullPath();
|
m_path = wxFileName(m_dir, m_fileName).GetFullPath();
|
||||||
UpdateDialog();
|
UpdateDialog();
|
||||||
#else
|
}
|
||||||
wxGenericFileDialog::SetFilename( name );
|
else
|
||||||
#endif
|
#endif
|
||||||
|
wxGenericFileDialog::SetFilename( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::SetWildcard(const wxString& wildCard)
|
void wxFileDialog::SetWildcard(const wxString& wildCard)
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
|
{
|
||||||
m_wildCard = wildCard;
|
m_wildCard = wildCard;
|
||||||
|
|
||||||
GtkFileChooser* chooser = GTK_FILE_CHOOSER(m_widget);
|
GtkFileChooser* chooser = GTK_FILE_CHOOSER(m_widget);
|
||||||
|
|
||||||
// empty current filter list:
|
// empty current filter list:
|
||||||
@@ -374,14 +402,17 @@ void wxFileDialog::SetWildcard(const wxString& wildCard)
|
|||||||
gtk_file_chooser_add_filter(chooser, filter);
|
gtk_file_chooser_add_filter(chooser, filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
}
|
||||||
wxGenericFileDialog::SetWildcard( wildCard );
|
else
|
||||||
#endif
|
#endif
|
||||||
|
wxGenericFileDialog::SetWildcard( wildCard );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::SetFilterIndex(int filterIndex)
|
void wxFileDialog::SetFilterIndex(int filterIndex)
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK24__
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
|
{
|
||||||
m_filterIndex = filterIndex;
|
m_filterIndex = filterIndex;
|
||||||
|
|
||||||
GtkFileChooser *chooser = GTK_FILE_CHOOSER(m_widget);
|
GtkFileChooser *chooser = GTK_FILE_CHOOSER(m_widget);
|
||||||
@@ -400,9 +431,10 @@ void wxFileDialog::SetFilterIndex(int filterIndex)
|
|||||||
fnode = fnode->next;
|
fnode = fnode->next;
|
||||||
}
|
}
|
||||||
g_slist_free(filters);
|
g_slist_free(filters);
|
||||||
#else
|
}
|
||||||
wxGenericFileDialog::SetFilterIndex( filterIndex );
|
else
|
||||||
#endif
|
#endif
|
||||||
|
wxGenericFileDialog::SetFilterIndex( filterIndex );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDialog::UpdateDialog()
|
void wxFileDialog::UpdateDialog()
|
||||||
|
@@ -487,16 +487,19 @@ bool wxTextCtrl::Create( wxWindow *parent,
|
|||||||
gtk_text_view_set_justification( GTK_TEXT_VIEW(m_text), GTK_JUSTIFY_CENTER );
|
gtk_text_view_set_justification( GTK_TEXT_VIEW(m_text), GTK_JUSTIFY_CENTER );
|
||||||
// Left justify (alignment) is the default and we don't need to apply GTK_JUSTIFY_LEFT
|
// Left justify (alignment) is the default and we don't need to apply GTK_JUSTIFY_LEFT
|
||||||
}
|
}
|
||||||
// gtk_entry_set_alignment was introduced in gtk+-2.3.5
|
|
||||||
#if GTK_CHECK_VERSION(2, 3, 5)
|
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
#ifdef __WXGTK24__
|
||||||
|
// gtk_entry_set_alignment was introduced in gtk+-2.3.5
|
||||||
|
if (!gtk_check_version(2,4,0))
|
||||||
{
|
{
|
||||||
if (style & wxTE_RIGHT)
|
if (style & wxTE_RIGHT)
|
||||||
gtk_entry_set_alignment( GTK_ENTRY(m_text), 1.0 );
|
gtk_entry_set_alignment( GTK_ENTRY(m_text), 1.0 );
|
||||||
else if (style & wxTE_CENTRE)
|
else if (style & wxTE_CENTRE)
|
||||||
gtk_entry_set_alignment( GTK_ENTRY(m_text), 0.5 );
|
gtk_entry_set_alignment( GTK_ENTRY(m_text), 0.5 );
|
||||||
}
|
}
|
||||||
#endif // gtk+-2.3.5
|
#endif
|
||||||
|
}
|
||||||
#endif // __WXGTK20__
|
#endif // __WXGTK20__
|
||||||
|
|
||||||
// We want to be notified about text changes.
|
// We want to be notified about text changes.
|
||||||
|
Reference in New Issue
Block a user