removed all compile- and run-time checks for GTK+ < 2.4; don't include the generic files which are now never used in wxGTK in the build

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49660 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-11-05 22:31:24 +00:00
parent 899544330f
commit ff654490b7
41 changed files with 483 additions and 1234 deletions

View File

@@ -25,6 +25,13 @@ class WXDLLIMPEXP_FWD_CORE wxColourPickerEvent;
extern WXDLLEXPORT_DATA(const wxChar) wxColourPickerWidgetNameStr[];
extern WXDLLEXPORT_DATA(const wxChar) wxColourPickerCtrlNameStr[];
// show the colour in HTML form (#AABBCC) as colour button label
#define wxCLRBTN_SHOW_LABEL 100
// the default style
#define wxCLRBTN_DEFAULT_STYLE (wxCLRBTN_SHOW_LABEL)
// ----------------------------------------------------------------------------
// wxColourPickerWidgetBase: a generic abstract interface which must be
@@ -70,7 +77,7 @@ protected:
// same prototype for their contructor (and also explains why we use
// define instead of a typedef)
// since GTK > 2.4, there is GtkColorButton
#if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__)
#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
#include "wx/gtk/clrpicker.h"
#define wxColourPickerWidget wxColourButton
#else

View File

@@ -19,6 +19,8 @@
#include "wx/control.h"
// class name
extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxCollapsiblePaneNameStr[];
// ----------------------------------------------------------------------------
// wxCollapsiblePaneBase: interface for wxCollapsiblePane
@@ -90,7 +92,7 @@ typedef void (wxEvtHandler::*wxCollapsiblePaneEventFunction)(wxCollapsiblePaneEv
wx__DECLARE_EVT1(wxEVT_COMMAND_COLLPANE_CHANGED, id, wxCollapsiblePaneEventHandler(fn))
#if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__)
#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
#include "wx/gtk/collpane.h"
#else
#include "wx/generic/collpaneg.h"

View File

@@ -106,7 +106,7 @@ protected:
#define wxDirDialog wxGenericDirDialog
#elif defined(__WXMSW__)
#include "wx/msw/dirdlg.h" // Native MSW
#elif defined(__WXGTK24__)
#elif defined(__WXGTK20__)
#include "wx/gtk/dirdlg.h" // Native GTK for gtk2.4
#elif defined(__WXGTK__)
#include "wx/generic/dirdlgg.h"

View File

@@ -73,7 +73,7 @@ void GenerateFolderChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd );
void GenerateSelectionChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd );
void GenerateFileActivatedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd, const wxString filename = wxEmptyString );
#if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__)
#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
#define wxFileCtrl wxGtkFileCtrl
#include "wx/gtk/filectrl.h"
#else

View File

@@ -192,7 +192,7 @@ wxSaveFileSelector(const wxString& what,
#include "wx/msw/filedlg.h"
#elif defined(__WXMOTIF__)
#include "wx/motif/filedlg.h"
#elif defined(__WXGTK24__)
#elif defined(__WXGTK20__)
#include "wx/gtk/filedlg.h" // GTK+ > 2.4 has native version
#elif defined(__WXGTK__)
#include "wx/gtk1/filedlg.h"

View File

@@ -66,8 +66,11 @@ protected:
// uses the currently selected font to draw the label of the button
#define wxFNTP_USEFONT_FOR_LABEL 0x0010
// since GTK > 2.4, there is GtkFontButton
#if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__)
#define wxFONTBTN_DEFAULT_STYLE \
(wxFNTP_FONTDESC_AS_LABEL | wxFNTP_USEFONT_FOR_LABEL)
// native version currently only exists in wxGTK2
#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
#include "wx/gtk/fontpicker.h"
#define wxFontPickerWidget wxFontButton
#else

View File

@@ -19,13 +19,6 @@
// wxGenericColourButton: a button which brings up a wxColourDialog
//-----------------------------------------------------------------------------
// show the colour in HTML form (#AABBCC) as colour button label
#define wxCLRBTN_SHOW_LABEL 100
// the default style
#define wxCLRBTN_DEFAULT_STYLE (wxCLRBTN_SHOW_LABEL)
class WXDLLIMPEXP_CORE wxGenericColourButton : public wxButton,
public wxColourPickerWidgetBase
{

View File

@@ -16,9 +16,6 @@
class WXDLLIMPEXP_FWD_CORE wxButton;
class WXDLLIMPEXP_FWD_CORE wxStaticLine;
// class name
extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxCollapsiblePaneNameStr[];
// ----------------------------------------------------------------------------
// wxGenericCollapsiblePane
// ----------------------------------------------------------------------------

View File

@@ -19,9 +19,6 @@
// wxGenericFontButton: a button which brings up a wxColourDialog
//-----------------------------------------------------------------------------
#define wxFONTBTN_DEFAULT_STYLE \
(wxFNTP_FONTDESC_AS_LABEL | wxFNTP_USEFONT_FOR_LABEL)
class WXDLLIMPEXP_CORE wxGenericFontButton : public wxButton,
public wxFontPickerWidgetBase
{

View File

@@ -12,16 +12,12 @@
#ifndef _WX_GTK_CLRPICKER_H_
#define _WX_GTK_CLRPICKER_H_
// since GtkColorButton is available only for GTK+ >= 2.4,
// we need to use generic version if we detect (at runtime)
// that GTK+ < 2.4
#include "wx/generic/clrpickerg.h"
//-----------------------------------------------------------------------------
// wxColourButton
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxColourButton : public wxGenericColourButton
class WXDLLIMPEXP_CORE wxColourButton : public wxButton,
public wxColourPickerWidgetBase
{
public:
wxColourButton() : m_topParent(NULL) {}
@@ -38,11 +34,6 @@ public:
Create(parent, id, initial, pos, size, style, validator, name);
}
virtual ~wxColourButton();
public: // overrides
bool Create(wxWindow *parent,
wxWindowID id,
const wxColour& initial = *wxBLACK,
@@ -52,6 +43,8 @@ public: // overrides
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxColourPickerWidgetNameStr);
virtual ~wxColourButton();
protected:
void UpdateColour();

View File

@@ -12,13 +12,11 @@
#ifndef _WX_COLLAPSABLE_PANEL_H_GTK_
#define _WX_COLLAPSABLE_PANEL_H_GTK_
#include "wx/generic/collpaneg.h"
// ----------------------------------------------------------------------------
// wxCollapsiblePane
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxCollapsiblePane : public wxGenericCollapsiblePane
class WXDLLIMPEXP_CORE wxCollapsiblePane : public wxCollapsiblePaneBase
{
public:
wxCollapsiblePane() { Init(); }
@@ -51,9 +49,12 @@ public:
const wxValidator& val = wxDefaultValidator,
const wxString& name = wxCollapsiblePaneNameStr);
void Collapse(bool collapse = true);
bool IsCollapsed() const;
void SetLabel(const wxString &str);
virtual void Collapse(bool collapse = true);
virtual bool IsCollapsed() const;
virtual void SetLabel(const wxString& str);
virtual wxWindow *GetPane() const { return m_pPane; }
virtual wxString GetLabel() const { return m_strLabel; }
protected:
virtual wxSize DoGetBestSize() const;
@@ -62,6 +63,11 @@ public: // used by GTK callbacks
bool m_bIgnoreNextChange;
wxSize m_szCollapsed;
wxWindow *m_pPane;
// the button label without ">>" or "<<"
wxString m_strLabel;
private:
void OnSize(wxSizeEvent&);

View File

@@ -11,6 +11,8 @@
#ifndef _WX_GTK_COMBOBOX_H_
#define _WX_GTK_COMBOBOX_H_
typedef struct _GtkEntry GtkEntry;
//-----------------------------------------------------------------------------
// wxComboBox
//-----------------------------------------------------------------------------
@@ -94,7 +96,6 @@ public:
virtual void SetFocus();
void OnSize( wxSizeEvent &event );
void OnChar( wxKeyEvent &event );
// Standard event handling
@@ -131,7 +132,6 @@ public:
protected:
// From wxWindowGTK:
virtual void DoApplyWidgetStyle(GtkRcStyle *style);
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
// From wxItemContainer:
@@ -150,6 +150,9 @@ protected:
// override this and return true.
virtual bool UseGTKStyleBase() const { return true; }
// return the GtkEntry part of the combobox
GtkEntry *GetEntry() const;
private:
// From wxTextEntry:
virtual const wxWindow *GetEditableWindow() const { return this; }

View File

@@ -10,13 +10,11 @@
#ifndef __GTKDIRDLGH__
#define __GTKDIRDLGH__
#include "wx/generic/dirdlgg.h"
//-------------------------------------------------------------------------
// wxDirDialog
//-------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDirDialog : public wxGenericDirDialog
class WXDLLIMPEXP_CORE wxDirDialog : public wxDirDialogBase
{
public:
wxDirDialog() { }
@@ -37,9 +35,6 @@ public: // overrides from wxGenericDirDialog
wxString GetPath() const;
void SetPath(const wxString& path);
virtual int ShowModal();
virtual bool Show( bool show = true );
protected:
// override this from wxTLW since the native
@@ -50,9 +45,10 @@ protected:
private:
void OnFakeOk( wxCommandEvent &event );
DECLARE_DYNAMIC_CLASS(wxDirDialog)
DECLARE_EVENT_TABLE()
void OnFakeOk( wxCommandEvent &event );
};
#endif // __GTKDIRDLGH__

View File

@@ -12,16 +12,12 @@
#ifndef _WX_GTK_FONTPICKER_H_
#define _WX_GTK_FONTPICKER_H_
// since GtkFontButton is available only for GTK+ >= 2.4,
// we need to use generic version if we detect (at runtime)
// that GTK+ < 2.4
#include "wx/generic/fontpickerg.h"
//-----------------------------------------------------------------------------
// wxFontButton
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxFontButton : public wxGenericFontButton
class WXDLLIMPEXP_CORE wxFontButton : public wxButton,
public wxFontPickerWidgetBase
{
public:
wxFontButton() {}
@@ -37,11 +33,6 @@ public:
Create(parent, id, initial, pos, size, style, validator, name);
}
virtual ~wxFontButton();
public: // overrides
bool Create(wxWindow *parent,
wxWindowID id,
const wxFont& initial = wxNullFont,
@@ -51,6 +42,8 @@ public: // overrides
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxFontPickerWidgetNameStr);
virtual ~wxFontButton();
protected:
void UpdateFont();

View File

@@ -15,7 +15,7 @@
#pragma hdrstop
#endif //__BORLANDC__
#if wxUSE_ANIMATIONCTRL && (!defined(__WXGTK20__) || defined(__WXUNIVERSAL__))
#if wxUSE_ANIMATIONCTRL
#include "wx/animate.h"

View File

@@ -493,7 +493,7 @@ void wxButtonToolBar::OnCommand(wxCommandEvent& event)
}
// paints a border
void wxButtonToolBar::OnPaint(wxPaintEvent& event)
void wxButtonToolBar::OnPaint(wxPaintEvent& WXUNUSED(event))
{
wxPaintDC dc(this);

View File

@@ -88,7 +88,7 @@ bool wxGenericCollapsiblePane::Create(wxWindow *parent,
// FIXME: at least under wxCE and wxGTK1 the background is black if we don't do
// this, no idea why...
#if defined(__WXWINCE__) || (defined(__WXGTK__) && !defined(__WXGTK20__))
#if defined(__WXWINCE__) || defined(__WXGTK__)
SetBackgroundColour(parent->GetBackgroundColour());
#endif
@@ -259,8 +259,6 @@ int wxGenericCollapsiblePane::GetBorder() const
{
#if defined( __WXMAC__ )
return 6;
#elif defined(__WXGTK20__)
return 3;
#elif defined(__WXMSW__)
wxASSERT(m_pButton);
return m_pButton->ConvertDialogToPixels(wxSize(2, 0)).x;

View File

@@ -16,7 +16,7 @@
#pragma hdrstop
#endif
#if wxUSE_COLOURDLG && (!defined(__WXGTK20__) || defined(__WXUNIVERSAL__))
#if wxUSE_COLOURDLG
#ifndef WX_PRECOMP
#include "wx/utils.h"
@@ -581,4 +581,4 @@ void wxGenericColourDialog::OnBlueSlider(wxCommandEvent& WXUNUSED(event))
#endif // wxUSE_SLIDER
#endif // wxUSE_COLOURDLG && !defined(__WXGTK20__)
#endif // wxUSE_COLOURDLG

View File

@@ -1330,7 +1330,7 @@ void wxDirFilterListCtrl::FillFilterList(const wxString& filter, int defaultFilt
// wxFileIconsTable icons
// ----------------------------------------------------------------------------
#ifndef __WXGTK24__
#ifndef __WXGTK20__
/* Computer (c) Julian Smart */
static const char * file_icons_tbl_computer_xpm[] = {
/* columns rows colors chars-per-pixel */
@@ -1395,7 +1395,7 @@ static const char * file_icons_tbl_computer_xpm[] = {
" dfffffffffffffd",
" "
};
#endif // GTK+ < 2.4
#endif // !GTK+ 2
// ----------------------------------------------------------------------------
// wxFileIconsTable & friends
@@ -1464,7 +1464,7 @@ void wxFileIconsTable::Create()
wxART_CMN_DIALOG,
wxSize(16, 16)));
// computer
#ifdef __WXGTK24__
#ifdef __WXGTK20__
// GTK24 uses this icon in the file open dialog
m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_HARDDISK,
wxART_CMN_DIALOG,

View File

@@ -451,7 +451,8 @@ bool wxGenericDragImage::Hide()
}
// More efficient: erase and redraw simultaneously if possible
bool wxGenericDragImage::RedrawImage(const wxPoint& oldPos, const wxPoint& newPos,
bool wxGenericDragImage::RedrawImage(const wxPoint& WXUNUSED(oldPos),
const wxPoint& newPos,
bool eraseOld, bool drawNew)
{
if (!m_windowDC)

View File

@@ -257,11 +257,8 @@ wxBitmap wxGTK2ArtProvider::CreateBitmap(const wxArtID& id,
stockid = id.ToAscii();
GdkPixbuf *pixbuf = CreateStockIcon(stockid, stocksize);
if (!pixbuf && !gtk_check_version(2,4,0))
{
if (!pixbuf)
pixbuf = CreateThemeIcon(stockid, stocksize, size);
}
if (pixbuf && size != wxDefaultSize &&
(size.x != gdk_pixbuf_get_width(pixbuf) ||

View File

@@ -17,7 +17,7 @@
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#if wxUSE_COLOURPICKERCTRL && defined(__WXGTK24__)
#if wxUSE_COLOURPICKERCTRL
#include "wx/clrpicker.h"
@@ -51,15 +51,13 @@ static void gtk_clrbutton_setcolor_callback(GtkColorButton *widget,
// wxColourButton
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxColourButton, wxGenericColourButton)
IMPLEMENT_DYNAMIC_CLASS(wxColourButton, wxButton)
bool wxColourButton::Create( wxWindow *parent, wxWindowID id,
const wxColour &col,
const wxPoint &pos, const wxSize &size,
long style, const wxValidator& validator,
const wxString &name )
{
if (!gtk_check_version(2,4,0))
{
if (!PreCreation( parent, pos, size ) ||
!wxControl::CreateBase(parent, id, pos, size, style, validator, name))
@@ -81,10 +79,7 @@ bool wxColourButton::Create( wxWindow *parent, wxWindowID id,
PostCreation(size);
SetInitialSize(size);
}
else
return wxGenericColourButton::Create(parent, id, col, pos, size,
style, validator, name);
return true;
}
@@ -94,10 +89,7 @@ wxColourButton::~wxColourButton()
void wxColourButton::UpdateColour()
{
if (!gtk_check_version(2,4,0))
gtk_color_button_set_color(GTK_COLOR_BUTTON(m_widget), m_colour.GetColor());
else
wxGenericColourButton::UpdateColour();
}
#endif // wxUSE_COLOURPICKERCTRL && defined(__WXGTK24__)
#endif // wxUSE_COLOURPICKERCTRL

View File

@@ -17,7 +17,7 @@
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#if wxUSE_COLLPANE && defined(__WXGTK24__) && !defined(__WXUNIVERSAL__)
#if wxUSE_COLLPANE && !defined(__WXUNIVERSAL__)
#include "wx/collpane.h"
#include "wx/toplevel.h"
@@ -26,6 +26,15 @@
#include "wx/gtk/private.h"
// the lines below duplicate the same definitions in collpaneg.cpp, if we have
// another implementation of this class we should extract them to a common file
const wxChar wxCollapsiblePaneNameStr[] = wxT("collapsiblePane");
DEFINE_EVENT_TYPE(wxEVT_COMMAND_COLLPANE_CHANGED)
IMPLEMENT_DYNAMIC_CLASS(wxCollapsiblePaneEvent, wxCommandEvent)
// ============================================================================
// implementation
// ============================================================================
@@ -153,9 +162,9 @@ gtk_collapsiblepane_insert_callback(wxWindowGTK* parent, wxWindowGTK* child)
// wxCollapsiblePane
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxCollapsiblePane, wxGenericCollapsiblePane)
IMPLEMENT_DYNAMIC_CLASS(wxCollapsiblePane, wxControl)
BEGIN_EVENT_TABLE(wxCollapsiblePane, wxGenericCollapsiblePane)
BEGIN_EVENT_TABLE(wxCollapsiblePane, wxCollapsiblePaneBase)
EVT_SIZE(wxCollapsiblePane::OnSize)
END_EVENT_TABLE()
@@ -168,10 +177,6 @@ bool wxCollapsiblePane::Create(wxWindow *parent,
const wxValidator& val,
const wxString& name)
{
if (gtk_check_version(2,4,0))
return wxGenericCollapsiblePane::Create(parent, id, label,
pos, size, style, val, name);
m_bIgnoreNextChange = false;
if ( !PreCreation( parent, pos, size ) ||
@@ -210,8 +215,6 @@ bool wxCollapsiblePane::Create(wxWindow *parent,
}
wxSize wxCollapsiblePane::DoGetBestSize() const
{
if (!gtk_check_version(2,4,0))
{
wxASSERT_MSG( m_widget, wxT("DoGetBestSize called before creation") );
@@ -226,12 +229,7 @@ wxSize wxCollapsiblePane::DoGetBestSize() const
return wxSize(req.width, req.height);
}
return wxGenericCollapsiblePane::DoGetBestSize();
}
void wxCollapsiblePane::Collapse(bool collapse)
{
if (!gtk_check_version(2,4,0))
{
// optimization
if (IsCollapsed() == collapse)
@@ -241,21 +239,13 @@ void wxCollapsiblePane::Collapse(bool collapse)
m_bIgnoreNextChange = true;
gtk_expander_set_expanded(GTK_EXPANDER(m_widget), !collapse);
}
else
wxGenericCollapsiblePane::Collapse(collapse);
}
bool wxCollapsiblePane::IsCollapsed() const
{
if (!gtk_check_version(2,4,0))
return !gtk_expander_get_expanded(GTK_EXPANDER(m_widget));
return wxGenericCollapsiblePane::IsCollapsed();
}
void wxCollapsiblePane::SetLabel(const wxString &str)
{
if (!gtk_check_version(2,4,0))
{
gtk_expander_set_label(GTK_EXPANDER(m_widget), wxGTK_CONV(str));
@@ -263,9 +253,6 @@ void wxCollapsiblePane::SetLabel(const wxString &str)
// we may get the size of the control with the pane size summed up if we are expanded!
//m_szCollapsed.x = GetBestSize().x;
}
else
wxGenericCollapsiblePane::SetLabel(str);
}
void wxCollapsiblePane::OnSize(wxSizeEvent &ev)
{
@@ -287,5 +274,5 @@ void wxCollapsiblePane::OnSize(wxSizeEvent &ev)
m_pPane->Layout();
}
#endif // wxUSE_COLLPANE && defined(__WXGTK24__) && !defined(__WXUNIVERSAL__)
#endif // wxUSE_COLLPANE && !defined(__WXUNIVERSAL__)

View File

@@ -16,7 +16,7 @@
#pragma hdrstop
#endif
#if wxUSE_COLOURDLG && defined(__WXGTK20__)
#if wxUSE_COLOURDLG
#include "wx/colordlg.h"
@@ -140,5 +140,5 @@ void wxColourDialog::DialogToColourData()
g_free(pal);
}
#endif // wxUSE_COLOURDLG && defined(__WXGTK20__)
#endif // wxUSE_COLOURDLG

View File

@@ -21,148 +21,12 @@
#include "wx/arrstr.h"
#endif
// We use GtkCombo which has been deprecated since GTK+ 2.3.0
// in favour of GtkComboBox for <GTK2.4 runtime
// We also use GtkList
#ifdef GTK_DISABLE_DEPRECATED
#undef GTK_DISABLE_DEPRECATED
#endif
#include "wx/gtk/private.h"
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// GTK callbacks
// ----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
static int g_SelectionBeforePopup = wxID_NONE; // this means the popup is hidden
//-----------------------------------------------------------------------------
// "changed" - typing and list item matches get changed, select-child
// if it doesn't match an item then just get a single changed
//-----------------------------------------------------------------------------
extern "C" {
static void
gtkcombo_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
{
if (combo->m_ignoreNextUpdate)
{
combo->m_ignoreNextUpdate = false;
return;
}
if (!combo->m_hasVMT) return;
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
event.SetString( combo->GetValue() );
event.SetEventObject( combo );
combo->GetEventHandler()->ProcessEvent( event );
}
}
extern "C" {
static void
gtkcombo_dummy_callback(GtkEntry *WXUNUSED(entry), GtkCombo *WXUNUSED(combo))
{
}
}
extern "C" {
static void
gtkcombo_popup_hide_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo)
{
// when the popup is hidden, throw a SELECTED event only if the combobox
// selection changed.
const int curSelection = combo->GetCurrentSelection();
const bool hasChanged = curSelection != g_SelectionBeforePopup;
// reset the selection flag to value meaning that it is hidden and do it
// now, before generating the events, so that GetSelection() returns the
// new value from the event handler
g_SelectionBeforePopup = wxID_NONE;
if ( hasChanged )
{
wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, combo->GetId() );
event.SetInt( curSelection );
event.SetString( combo->GetStringSelection() );
event.SetEventObject( combo );
combo->GetEventHandler()->ProcessEvent( event );
// for consistency with the other ports, send TEXT event
wxCommandEvent event2( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
event2.SetString( combo->GetStringSelection() );
event2.SetEventObject( combo );
combo->GetEventHandler()->ProcessEvent( event2 );
}
}
}
extern "C" {
static void
gtkcombo_popup_show_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo)
{
// store the combobox selection value before the popup is shown
g_SelectionBeforePopup = combo->GetCurrentSelection();
}
}
//-----------------------------------------------------------------------------
// "select-child" - click/cursor get select-child, changed, select-child
//-----------------------------------------------------------------------------
extern "C" {
static void
gtkcombo_combo_select_child_callback( GtkList *WXUNUSED(list), GtkWidget *WXUNUSED(widget), wxComboBox *combo )
{
if (!combo->m_hasVMT) return;
if (g_blockEventsOnDrag) return;
int curSelection = combo->GetCurrentSelection();
if (combo->m_prevSelection == curSelection) return;
GtkWidget *list = GTK_COMBO(combo->m_widget)->list;
gtk_list_unselect_item( GTK_LIST(list), combo->m_prevSelection );
combo->m_prevSelection = curSelection;
// Quickly set the value of the combo box
// as GTK+ does that only AFTER the event
// is sent.
GtkWidget* entry = GTK_COMBO(combo->GetHandle())->entry;
g_signal_handlers_block_by_func(
entry, (gpointer)gtkcombo_text_changed_callback, combo);
combo->SetValue( combo->GetStringSelection() );
g_signal_handlers_unblock_by_func(
entry, (gpointer)gtkcombo_text_changed_callback, combo);
// throw a SELECTED event only if the combobox popup is hidden (wxID_NONE)
// because when combobox popup is shown, gtkcombo_combo_select_child_callback is
// called each times the mouse is over an item with a pressed button so a lot
// of SELECTED event could be generated if the user keep the mouse button down
// and select other items ...
if (g_SelectionBeforePopup == wxID_NONE)
{
wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, combo->GetId() );
event.SetInt( curSelection );
event.SetString( combo->GetStringSelection() );
event.SetEventObject( combo );
combo->GetEventHandler()->ProcessEvent( event );
// for consistency with the other ports, don't generate text update
// events while the user is browsing the combobox neither
wxCommandEvent event2( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
event2.SetString( combo->GetValue() );
event2.SetEventObject( combo );
combo->GetEventHandler()->ProcessEvent( event2 );
}
}
}
#ifdef __WXGTK24__
extern "C" {
static void
gtkcombobox_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
@@ -174,9 +38,7 @@ gtkcombobox_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *comb
event.SetEventObject( combo );
combo->GetEventHandler()->ProcessEvent( event );
}
}
extern "C" {
static void
gtkcombobox_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
{
@@ -193,8 +55,6 @@ gtkcombobox_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
}
}
#endif
//-----------------------------------------------------------------------------
// wxComboBox
//-----------------------------------------------------------------------------
@@ -202,7 +62,6 @@ gtkcombobox_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
IMPLEMENT_DYNAMIC_CLASS(wxComboBox,wxControl)
BEGIN_EVENT_TABLE(wxComboBox, wxControl)
EVT_SIZE(wxComboBox::OnSize)
EVT_CHAR(wxComboBox::OnChar)
EVT_MENU(wxID_CUT, wxComboBox::OnCut)
@@ -255,62 +114,22 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
if(HasFlag(wxCB_SORT))
m_strings = new wxSortedArrayString();
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
m_widget = gtk_combo_box_entry_new_text();
gtk_entry_set_editable( GTK_ENTRY( GTK_BIN(m_widget)->child ), TRUE );
}
else
#endif
{
m_widget = gtk_combo_new();
GtkCombo* combo = GTK_COMBO(m_widget);
GtkEntry * const entry = GetEntry();
// Disable GTK's broken events ...
g_signal_handler_disconnect (combo->entry, combo->entry_change_id);
// ... and add surrogate handler.
combo->entry_change_id = g_signal_connect (combo->entry, "changed",
G_CALLBACK (gtkcombo_dummy_callback),
combo);
// make it more useable
gtk_combo_set_use_arrows_always( GTK_COMBO(m_widget), TRUE );
// and case-sensitive
gtk_combo_set_case_sensitive( GTK_COMBO(m_widget), TRUE );
if (style & wxNO_BORDER)
g_object_set (combo->entry, "has-frame", FALSE, NULL );
}
gtk_entry_set_editable( entry, TRUE );
Append(n, choices);
m_parent->DoAddChild( this );
GtkEntry *entry = NULL;
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
entry = GTK_ENTRY( GTK_BIN(m_widget)->child );
else
#endif
entry = GTK_ENTRY( GTK_COMBO(m_widget)->entry );
m_focusWidget = GTK_WIDGET( entry );
PostCreation(size);
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
ConnectWidget( m_widget );
else
#endif
ConnectWidget( GTK_COMBO(m_widget)->button );
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
gtk_entry_set_text( entry, wxGTK_CONV(value) );
if (style & wxCB_READONLY)
@@ -322,44 +141,20 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
g_signal_connect_after (m_widget, "changed",
G_CALLBACK (gtkcombobox_changed_callback), this);
}
else
#endif
{
GtkCombo *combo = GTK_COMBO(m_widget);
// MSW's combo box shows the value and the selection is -1
gtk_entry_set_text( entry, wxGTK_CONV(value) );
gtk_list_unselect_all( GTK_LIST(combo->list) );
if (style & wxCB_READONLY)
gtk_entry_set_editable( entry, FALSE );
// "show" and "hide" events are generated when user click on the combobox button which popups a list
// this list is the "popwin" gtk widget
g_signal_connect (GTK_COMBO(combo)->popwin, "hide",
G_CALLBACK (gtkcombo_popup_hide_callback), this);
g_signal_connect (GTK_COMBO(combo)->popwin, "show",
G_CALLBACK (gtkcombo_popup_show_callback), this);
g_signal_connect_after (combo->list, "select-child",
G_CALLBACK (gtkcombo_combo_select_child_callback),
this);
g_signal_connect_after (entry, "changed",
G_CALLBACK (gtkcombo_text_changed_callback), this);
}
SetInitialSize(size); // need this too because this is a wxControlWithItems
return true;
}
GtkEntry *wxComboBox::GetEntry() const
{
return GTK_ENTRY(GTK_BIN(m_widget)->child);
}
GtkEditable *wxComboBox::GetEditable() const
{
#ifdef __WXGTK24__
if ( !gtk_check_version(2,4,0) )
return GTK_EDITABLE( GTK_BIN(m_widget)->child );
else
#endif
return GTK_EDITABLE( GTK_COMBO(m_widget)->entry );
}
wxComboBox::~wxComboBox()
@@ -393,9 +188,6 @@ int wxComboBox::DoInsertItems(const wxArrayStringsAdapter & items,
int n = wxNOT_FOUND;
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
for( int i = 0; i < count; ++i )
{
@@ -410,44 +202,6 @@ int wxComboBox::DoInsertItems(const wxArrayStringsAdapter & items,
m_clientData.Insert( NULL, n );
AssignNewItemClientData(n, clientData, i, type);
}
}
else
#endif
{
DisableEvents();
GtkWidget *list = GTK_COMBO(m_widget)->list;
for( int i = 0; i < count; ++i )
{
n = pos + i;
// If sorted, use this wxSortedArrayStrings to determine
// the right insertion point
if(m_strings)
n = m_strings->Add(items[i]);
GtkWidget *list_item = gtk_list_item_new_with_label( wxGTK_CONV( items[i] ) );
// TODO construct a list with all items and call gtk_list_insert_items once?
GList *gitem_list = g_list_alloc ();
gitem_list->data = list_item;
gtk_list_insert_items( GTK_LIST (list), gitem_list, n );
m_clientData.Insert( NULL, n );
AssignNewItemClientData(n, clientData, i, type);
if (GTK_WIDGET_REALIZED(m_widget))
{
gtk_widget_realize( list_item );
gtk_widget_realize( GTK_BIN(list_item)->child );
ApplyWidgetStyle();
}
gtk_widget_show( list_item );
}
EnableEvents();
}
InvalidateBestSize();
@@ -470,20 +224,10 @@ void wxComboBox::DoClear()
DisableEvents();
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
const unsigned int count = GetCount();
for (unsigned int i = 0; i < count; i++)
gtk_combo_box_remove_text( combobox, 0 );
}
else // GTK+ < 2.4.0
#endif // __WXGTK24__
{
GtkWidget *list = GTK_COMBO(m_widget)->list;
gtk_list_clear_items( GTK_LIST(list), 0, GetCount() );
}
m_clientData.Clear();
@@ -499,35 +243,10 @@ void wxComboBox::DoDeleteOneItem(unsigned int n)
{
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
wxCHECK_RET( IsValid(n), wxT("invalid index") );
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
gtk_combo_box_remove_text( combobox, n );
}
else
#endif
{
GtkList *listbox = GTK_LIST( GTK_COMBO(m_widget)->list );
GList *child = g_list_nth( listbox->children, n );
if (!child)
{
wxFAIL_MSG(wxT("wrong index"));
return;
}
DisableEvents();
GList *list = g_list_append( (GList*) NULL, child->data );
gtk_list_remove_items( listbox, list );
g_list_free( list );
EnableEvents();
}
m_clientData.RemoveAt( n );
if(m_strings)
@@ -540,9 +259,6 @@ void wxComboBox::SetString(unsigned int n, const wxString &text)
{
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
wxCHECK_RET( IsValid(n), wxT("invalid index") );
@@ -556,24 +272,6 @@ void wxComboBox::SetString(unsigned int n, const wxString &text)
gtk_list_store_set_value( GTK_LIST_STORE(model), &iter, 0, &value );
g_value_unset( &value );
}
}
else
#endif
{
GtkWidget *list = GTK_COMBO(m_widget)->list;
GList *child = g_list_nth( GTK_LIST(list)->children, n );
if (child)
{
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child );
gtk_label_set_text(label, wxGTK_CONV(text));
}
else
{
wxFAIL_MSG( wxT("wxComboBox: wrong index") );
}
}
InvalidateBestSize();
}
@@ -582,9 +280,6 @@ int wxComboBox::FindString( const wxString &item, bool bCase ) const
{
wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid combobox") );
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
GtkTreeModel* model = gtk_combo_box_get_model( combobox );
GtkTreeIter iter;
@@ -603,80 +298,25 @@ int wxComboBox::FindString( const wxString &item, bool bCase ) const
return count;
count++;
} while (gtk_tree_model_iter_next( model, &iter ));
}
else
#endif
{
GtkWidget *list = GTK_COMBO(m_widget)->list;
GList *child = GTK_LIST(list)->children;
int count = 0;
while (child)
{
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child );
wxString str( wxGTK_CONV_BACK( gtk_label_get_text(label) ) );
if (item.IsSameAs( str , bCase ) )
return count;
count++;
child = child->next;
}
}
while ( gtk_tree_model_iter_next(model, &iter) );
return wxNOT_FOUND;
}
int wxComboBox::GetSelection() const
{
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
return gtk_combo_box_get_active( combobox );
}
else
#endif
// if the popup is currently opened, use the selection as it had been
// before it dropped down
return g_SelectionBeforePopup == wxID_NONE ? GetCurrentSelection()
: g_SelectionBeforePopup;
}
int wxComboBox::GetCurrentSelection() const
{
wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid combobox") );
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
return gtk_combo_box_get_active( combobox );
}
else
#endif
{
GtkWidget *list = GTK_COMBO(m_widget)->list;
GList *selection = GTK_LIST(list)->selection;
if (selection)
{
GList *child = GTK_LIST(list)->children;
int count = 0;
while (child)
{
if (child->data == selection->data) return count;
count++;
child = child->next;
}
}
}
return -1;
}
wxString wxComboBox::GetString(unsigned int n) const
{
@@ -684,9 +324,6 @@ wxString wxComboBox::GetString(unsigned int n) const
wxString str;
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
GtkTreeModel *model = gtk_combo_box_get_model( combobox );
GtkTreeIter iter;
@@ -698,24 +335,6 @@ wxString wxComboBox::GetString(unsigned int n) const
g_value_unset( &value );
return tmp;
}
}
else
#endif
{
GtkWidget *list = GTK_COMBO(m_widget)->list;
GList *child = g_list_nth( GTK_LIST(list)->children, n );
if (child)
{
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child );
str = wxGTK_CONV_BACK( gtk_label_get_text(label) );
}
else
{
wxFAIL_MSG( wxT("wxComboBox: wrong index") );
}
}
return str;
}
@@ -724,9 +343,6 @@ unsigned int wxComboBox::GetCount() const
{
wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid combobox") );
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
GtkTreeModel* model = gtk_combo_box_get_model( combobox );
GtkTreeIter iter;
@@ -738,21 +354,6 @@ unsigned int wxComboBox::GetCount() const
ret++;
return ret;
}
else
#endif
{
GtkWidget *list = GTK_COMBO(m_widget)->list;
GList *child = GTK_LIST(list)->children;
unsigned int count = 0;
while (child)
{
count++;
child = child->next;
}
return count;
}
}
void wxComboBox::SetSelection( int n )
{
@@ -760,20 +361,8 @@ void wxComboBox::SetSelection( int n )
DisableEvents();
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
gtk_combo_box_set_active( combobox, n );
}
else
#endif
{
GtkWidget *list = GTK_COMBO(m_widget)->list;
gtk_list_unselect_item( GTK_LIST(list), m_prevSelection );
gtk_list_select_item( GTK_LIST(list), n );
m_prevSelection = n;
}
EnableEvents();
}
@@ -805,9 +394,6 @@ void wxComboBox::OnChar( wxKeyEvent &event )
}
void wxComboBox::DisableEvents()
{
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
g_signal_handlers_block_by_func(GTK_BIN(m_widget)->child,
(gpointer)gtkcombobox_text_changed_callback, this);
@@ -815,21 +401,8 @@ void wxComboBox::DisableEvents()
g_signal_handlers_block_by_func(m_widget,
(gpointer)gtkcombobox_changed_callback, this);
}
else
#endif
{
g_signal_handlers_block_by_func(GTK_COMBO(m_widget)->list,
(gpointer) gtkcombo_combo_select_child_callback, this);
g_signal_handlers_block_by_func(GTK_COMBO(m_widget)->entry,
(gpointer) gtkcombo_text_changed_callback, this);
}
}
void wxComboBox::EnableEvents()
{
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
g_signal_handlers_unblock_by_func(GTK_BIN(m_widget)->child,
(gpointer)gtkcombobox_text_changed_callback, this);
@@ -837,100 +410,17 @@ void wxComboBox::EnableEvents()
g_signal_handlers_unblock_by_func(m_widget,
(gpointer)gtkcombobox_changed_callback, this);
}
else
#endif
{
g_signal_handlers_unblock_by_func(GTK_COMBO(m_widget)->list,
(gpointer) gtkcombo_combo_select_child_callback, this);
g_signal_handlers_unblock_by_func(GTK_COMBO(m_widget)->entry,
(gpointer) gtkcombo_text_changed_callback, this);
}
}
void wxComboBox::OnSize( wxSizeEvent &event )
{
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
// Do nothing
}
else
#endif
{
// NB: In some situations (e.g. on non-first page of a wizard, if the
// size used is default size), GtkCombo widget is resized correctly,
// but it's look is not updated, it's rendered as if it was much wider.
// No other widgets are affected, so it looks like a bug in GTK+.
// Manually requesting resize calculation (as gtk_pizza_set_size does)
// fixes it.
if (GTK_WIDGET_VISIBLE(m_widget))
gtk_widget_queue_resize(m_widget);
}
event.Skip();
}
void wxComboBox::DoApplyWidgetStyle(GtkRcStyle *style)
{
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
// Do nothing
}
else
#endif
{
// gtk_widget_modify_style( GTK_COMBO(m_widget)->button, syle );
gtk_widget_modify_style( GTK_COMBO(m_widget)->entry, style );
gtk_widget_modify_style( GTK_COMBO(m_widget)->list, style );
GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list );
GList *child = list->children;
while (child)
{
gtk_widget_modify_style( GTK_WIDGET(child->data), style );
GtkBin *bin = GTK_BIN(child->data);
gtk_widget_modify_style( bin->child, style );
child = child->next;
}
}
}
GtkWidget* wxComboBox::GetConnectWidget()
{
GtkEntry *entry = NULL;
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
entry = GTK_ENTRY( GTK_BIN(m_widget)->child );
else
#endif
entry = GTK_ENTRY( GTK_COMBO(m_widget)->entry );
return GTK_WIDGET( entry );
return GTK_WIDGET( GetEntry() );
}
GdkWindow *wxComboBox::GTKGetWindow(wxArrayGdkWindows& windows) const
{
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
wxUnusedVar(windows);
return GTK_ENTRY(GTK_BIN(m_widget)->child)->text_area;
}
else
#endif // GTK+ 2.4
{
windows.push_back(GTK_ENTRY(GTK_COMBO(m_widget)->entry)->text_area);
windows.push_back(GTK_COMBO(m_widget)->button->window);
// indicate that we return multiple windows in the windows array
return NULL;
}
return GetEntry()->text_area;
}
wxSize wxComboBox::DoGetBestSize() const
@@ -963,12 +453,7 @@ wxSize wxComboBox::DoGetBestSize() const
wxVisualAttributes
wxComboBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
{
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
return GetDefaultAttributesFromGTKWidget(gtk_combo_box_entry_new, true);
else
#endif
return GetDefaultAttributesFromGTKWidget(gtk_combo_new, true);
}
// ----------------------------------------------------------------------------

View File

@@ -178,9 +178,6 @@ wxCursor::wxCursor( const wxImage & image )
bool bHasMask = image.HasMask();
int imagebitcount = (w*h)/8;
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
if ( gdk_display_supports_cursor_color(gdk_display_get_default()) )
{
unsigned char rMask = 0,
@@ -227,8 +224,6 @@ wxCursor::wxCursor( const wxImage & image )
g_object_unref (pixbuf);
return;
}
}
#endif // GTK+ 2.4+
unsigned char * bits = new unsigned char [imagebitcount];
unsigned char * maskBits = new unsigned char [imagebitcount];

View File

@@ -204,7 +204,8 @@ bool wxDataObject::IsSupportedFormat(const wxDataFormat& format, Direction dir)
// wxTextDataObject
// ----------------------------------------------------------------------------
#if defined(__WXGTK20__) && wxUSE_UNICODE
#if wxUSE_UNICODE
void
wxTextDataObject::GetAllFormats(wxDataFormat *formats,
wxDataObjectBase::Direction WXUNUSED(dir)) const
@@ -212,7 +213,8 @@ wxTextDataObject::GetAllFormats(wxDataFormat *formats,
*formats++ = GetPreferredFormat();
*formats = g_altTextAtom;
}
#endif
#endif // wxUSE_UNICODE
// ----------------------------------------------------------------------------
// wxFileDataObject

View File

@@ -399,11 +399,7 @@ void wxGTKWindowImplDC::SetUpDC( bool isMemDC )
/* background colour */
m_backgroundBrush = *wxWHITE_BRUSH;
m_backgroundBrush.GetColour().CalcPixel( m_cmap );
#ifdef __WXGTK24__
const GdkColor *bg_col = m_backgroundBrush.GetColour().GetColor();
#else
GdkColor *bg_col = m_backgroundBrush.GetColour().GetColor();
#endif
/* m_textGC */
m_textForegroundColour.CalcPixel( m_cmap );
@@ -1139,13 +1135,6 @@ void wxGTKWindowImplDC::DoDrawBitmap( const wxBitmap &bitmap,
if ((w != ww) || (h != hh))
use_bitmap = use_bitmap.Rescale( 0, 0, ww, hh, ww, hh );
// NB: We can't render pixbufs with GTK+ < 2.2, we need to use pixmaps code.
// Pixbufs-based bitmaps with alpha channel don't have a mask, so we
// have to call GetPixmap() here -- it converts the pixbuf into pixmap
// and also creates the mask as a side-effect:
if (gtk_check_version(2,2,0))
use_bitmap.GetPixmap();
// apply mask if any
GdkBitmap *mask = (GdkBitmap *) NULL;
if (useMask && use_bitmap.GetMask())
@@ -1199,8 +1188,7 @@ void wxGTKWindowImplDC::DoDrawBitmap( const wxBitmap &bitmap,
}
else
{
#if GTK_CHECK_VERSION(2,2,0)
if (!gtk_check_version(2,2,0) && use_bitmap.HasPixbuf())
if (use_bitmap.HasPixbuf())
{
gdk_draw_pixbuf(m_window, use_gc,
use_bitmap.GetPixbuf(),
@@ -1208,7 +1196,6 @@ void wxGTKWindowImplDC::DoDrawBitmap( const wxBitmap &bitmap,
GDK_RGB_DITHER_NORMAL, xx, yy);
}
else
#endif
{
gdk_draw_drawable(m_window, use_gc,
use_bitmap.GetPixmap(),

View File

@@ -20,7 +20,7 @@
#if wxUSE_DIRDLG && defined( __WXGTK24__ )
#if wxUSE_DIRDLG
#include "wx/dirdlg.h"
@@ -83,18 +83,19 @@ static void gtk_dirdialog_response_callback(GtkWidget *w,
// wxDirDialog
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxDirDialog,wxGenericDirDialog)
IMPLEMENT_DYNAMIC_CLASS(wxDirDialog, wxDialog)
BEGIN_EVENT_TABLE(wxDirDialog,wxGenericDirDialog)
BEGIN_EVENT_TABLE(wxDirDialog, wxDirDialogBase)
EVT_BUTTON(wxID_OK, wxDirDialog::OnFakeOk)
END_EVENT_TABLE()
wxDirDialog::wxDirDialog(wxWindow* parent, const wxString& title,
const wxString& defaultPath, long style,
const wxPoint& pos, const wxSize& sz,
const wxString& name)
{
if (!gtk_check_version(2,4,0))
wxDirDialog::wxDirDialog(wxWindow* parent,
const wxString& title,
const wxString& defaultPath,
long style,
const wxPoint& pos,
const wxSize& WXUNUSED(sz),
const wxString& WXUNUSED(name))
{
m_message = title;
@@ -144,45 +145,21 @@ wxDirDialog::wxDirDialog(wxWindow* parent, const wxString& title,
gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(m_widget),
defaultPath.fn_str() );
}
else
wxGenericDirDialog::Create(parent, title, defaultPath, style, pos, sz, name);
}
void wxDirDialog::OnFakeOk( wxCommandEvent &event )
void wxDirDialog::OnFakeOk(wxCommandEvent& WXUNUSED(event))
{
if (!gtk_check_version(2,4,0))
EndDialog(wxID_OK);
else
wxGenericDirDialog::OnOK( event );
}
int wxDirDialog::ShowModal()
{
if (!gtk_check_version(2,4,0))
return wxDialog::ShowModal();
else
return wxGenericDirDialog::ShowModal();
}
bool wxDirDialog::Show( bool show )
{
if (!gtk_check_version(2,4,0))
return wxDialog::Show( show );
else
return wxGenericDirDialog::Show( show );
}
void wxDirDialog::DoSetSize(int x, int y, int width, int height, int sizeFlags)
{
if (!m_wxwindow)
return;
else
wxGenericDirDialog::DoSetSize( x, y, width, height, sizeFlags );
wxDirDialogBase::DoSetSize( x, y, width, height, sizeFlags );
}
void wxDirDialog::SetPath(const wxString& dir)
{
if (!gtk_check_version(2,4,0))
{
if (wxDirExists(dir))
{
@@ -190,19 +167,11 @@ void wxDirDialog::SetPath(const wxString& dir)
dir.fn_str());
}
}
else
wxGenericDirDialog::SetPath( dir );
}
wxString wxDirDialog::GetPath() const
{
if (!gtk_check_version(2,4,0))
{
wxGtkString str(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(m_widget)));
return wxString(str, *wxConvFileName);
}
return wxGenericDirDialog::GetPath();
}
#endif // wxUSE_DIRDLG

View File

@@ -16,7 +16,7 @@
#include "wx/filectrl.h"
#if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__)
#if !defined(__WXUNIVERSAL__)
#ifndef WX_PRECOMP
# include "wx/sizer.h"
@@ -421,8 +421,6 @@ void wxGtkFileCtrl::ShowHidden(bool show)
g_object_set (G_OBJECT (m_fcWidget), "show-hidden", show, NULL);
}
#endif
// wxUSE_FILECTRL
#endif // wxUSE_FILECTRL
#endif
// if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__)
#endif // !defined(__WXUNIVERSAL__)

View File

@@ -276,7 +276,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
}
}
void wxFileDialog::OnFakeOk( wxCommandEvent &event )
void wxFileDialog::OnFakeOk(wxCommandEvent& WXUNUSED(event))
{
EndDialog(wxID_OK);
}

View File

@@ -50,15 +50,13 @@ static void gtk_fontbutton_setfont_callback(GtkFontButton *widget,
// wxFontButton
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxFontButton, wxGenericFontButton)
IMPLEMENT_DYNAMIC_CLASS(wxFontButton, wxButton)
bool wxFontButton::Create( wxWindow *parent, wxWindowID id,
const wxFont &initial,
const wxPoint &pos, const wxSize &size,
long style, const wxValidator& validator,
const wxString &name )
{
if (!gtk_check_version(2,4,0))
{
if (!PreCreation( parent, pos, size ) ||
!wxControl::CreateBase(parent, id, pos, size, style, validator, name))
@@ -93,10 +91,7 @@ bool wxFontButton::Create( wxWindow *parent, wxWindowID id,
PostCreation(size);
SetInitialSize(size);
}
else
return wxGenericFontButton::Create(parent, id, initial, pos, size,
style, validator, name);
return true;
}
@@ -105,8 +100,6 @@ wxFontButton::~wxFontButton()
}
void wxFontButton::UpdateFont()
{
if (!gtk_check_version(2,4,0))
{
const wxNativeFontInfo *info = m_selectedFont.GetNativeFontInfo();
wxASSERT_MSG( info, wxT("The fontbutton's internal font is not valid ?") );
@@ -114,8 +107,5 @@ void wxFontButton::UpdateFont()
const wxString& fontname = info->ToString();
gtk_font_button_set_font_name(GTK_FONT_BUTTON(m_widget), wxGTK_CONV(fontname));
}
else
wxGenericFontButton::UpdateFont();
}
#endif // wxUSE_FONTPICKERCTRL

View File

@@ -193,10 +193,6 @@ bool wxGLCanvas::Create(wxWindow *parent,
GdkVisual *visual;
GdkColormap *colormap;
// MR: This needs a fix for lower gtk+ versions too. Might need to rethink logic (FIXME)
#if defined(__WXGTK20__) && GTK_CHECK_VERSION(2,2,0)
if (!gtk_check_version(2,2,0))
{
wxWindow::Create( parent, id, pos, size, style, name );
m_glWidget = m_wxwindow;
@@ -212,18 +208,6 @@ bool wxGLCanvas::Create(wxWindow *parent,
}
gtk_widget_set_colormap( m_glWidget, colormap );
}
else
#endif // GTK+ >= 2.2
{
visual = gdkx_visual_get( xvi->visualid );
colormap = gdk_colormap_new( visual, TRUE );
gtk_widget_push_colormap( colormap );
wxWindow::Create( parent, id, pos, size, style, name );
m_glWidget = m_wxwindow;
}
gtk_widget_set_double_buffered( m_glWidget, FALSE );
@@ -234,11 +218,6 @@ bool wxGLCanvas::Create(wxWindow *parent,
g_signal_connect(m_wxwindow, "expose_event", G_CALLBACK(gtk_glwindow_expose_callback), this);
g_signal_connect(m_widget, "size_allocate", G_CALLBACK(gtk_glcanvas_size_callback), this);
if (gtk_check_version(2,2,0) != NULL)
{
gtk_widget_pop_colormap();
}
#if WXWIN_COMPATIBILITY_2_8
// if our parent window is already visible, we had been realized before we
// connected to the "realize" signal and hence our m_glContext hasn't been

View File

@@ -1695,8 +1695,6 @@ bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y )
#endif // wxUSE_MENUS_NATIVE
#ifdef __WXGTK20__
#include <gtk/gtk.h>
const char *wxGetStockGtkID(wxWindowID id)
@@ -1815,6 +1813,4 @@ bool wxGetStockGtkAccelerator(const char *id, GdkModifierType *mod, guint *key)
return false;
}
#endif // __WXGTK20__
#endif // wxUSE_MENUS

View File

@@ -16,7 +16,7 @@
#pragma hdrstop
#endif
#if wxUSE_MSGDLG && defined(__WXGTK20__) && !defined(__WXGPE__)
#if wxUSE_MSGDLG && !defined(__WXGPE__)
#include "wx/msgdlg.h"
@@ -179,4 +179,4 @@ int wxMessageDialog::ShowModal()
}
#endif // wxUSE_MSGDLG && defined(__WXGTK20__) && !defined(__WXGPE__)
#endif // wxUSE_MSGDLG && !defined(__WXGPE__)

View File

@@ -399,9 +399,6 @@ static bool GetFrameExtents(GdkWindow* window, int* left, int* right, int* top,
{
bool success = false;
Atom property = 0;
#if GTK_CHECK_VERSION(2, 2, 0)
if (gtk_check_version(2, 2, 0) == NULL)
{
if (gdk_x11_screen_supports_net_wm_hint(
gdk_drawable_get_screen(window),
gdk_atom_intern("_NET_FRAME_EXTENTS", false)))
@@ -411,16 +408,7 @@ static bool GetFrameExtents(GdkWindow* window, int* left, int* right, int* top,
gdk_drawable_get_display(window),
"_NET_FRAME_EXTENTS");
}
}
else
#endif
{
if (gdk_net_wm_supports(gdk_atom_intern("_NET_FRAME_EXTENTS", false)))
{
success = true;
property = gdk_x11_get_xatom_by_name("_NET_FRAME_EXTENTS");
}
}
if (success)
{
Atom type;
@@ -453,6 +441,14 @@ static bool GetFrameExtents(GdkWindow* window, int* left, int* right, int* top,
return success;
}
// helper: return the GtkSettings either for the screen the current window is
// on or for the default screen if window is NULL
static GtkSettings *GetSettingsForWindowScreen(GdkWindow *window)
{
return window ? gtk_settings_get_for_screen(gdk_drawable_get_screen(window))
: gtk_settings_get_default();
}
int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win )
{
GdkWindow *window = NULL;
@@ -499,55 +495,29 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win )
case wxSYS_CURSOR_X:
case wxSYS_CURSOR_Y:
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
if (window)
return gdk_display_get_default_cursor_size(gdk_drawable_get_display(window));
else
return gdk_display_get_default_cursor_size(gdk_display_get_default());
}
else
#endif
return 16;
return gdk_display_get_default_cursor_size(
window ? gdk_drawable_get_display(window)
: gdk_display_get_default());
case wxSYS_DCLICK_X:
case wxSYS_DCLICK_Y:
gint dclick_distance;
#if GTK_CHECK_VERSION(2,2,0)
if (window && !gtk_check_version(2,2,0))
g_object_get(gtk_settings_get_for_screen(gdk_drawable_get_screen(window)),
"gtk-double-click-distance", &dclick_distance, NULL);
else
#endif
g_object_get(gtk_settings_get_default(),
g_object_get(GetSettingsForWindowScreen(window),
"gtk-double-click-distance", &dclick_distance, NULL);
return dclick_distance * 2;
case wxSYS_DCLICK_MSEC:
gint dclick;
g_object_get(gtk_settings_get_default(),
g_object_get(GetSettingsForWindowScreen(window),
"gtk-double-click-time", &dclick, NULL);
return dclick;
case wxSYS_DRAG_X:
case wxSYS_DRAG_Y:
gint drag_threshold;
#if GTK_CHECK_VERSION(2,2,0)
if (window && !gtk_check_version(2,2,0))
{
g_object_get(
gtk_settings_get_for_screen(gdk_drawable_get_screen(window)),
"gtk-dnd-drag-threshold",
&drag_threshold, NULL);
}
else
#endif
{
g_object_get(gtk_settings_get_default(),
g_object_get(GetSettingsForWindowScreen(window),
"gtk-dnd-drag-threshold", &drag_threshold, NULL);
}
// The correct thing here would be to double the value
// since that is what the API wants. But the values
@@ -557,28 +527,25 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win )
return drag_threshold;
// MBN: ditto for icons
case wxSYS_ICON_X: return 32;
case wxSYS_ICON_Y: return 32;
case wxSYS_ICON_X:
case wxSYS_ICON_Y:
return 32;
case wxSYS_SCREEN_X:
#if GTK_CHECK_VERSION(2,2,0)
if (window && !gtk_check_version(2,2,0))
if (window)
return gdk_screen_get_width(gdk_drawable_get_screen(window));
else
#endif
return gdk_screen_width();
case wxSYS_SCREEN_Y:
#if GTK_CHECK_VERSION(2,2,0)
if (window && !gtk_check_version(2,2,0))
if (window)
return gdk_screen_get_height(gdk_drawable_get_screen(window));
else
#endif
return gdk_screen_height();
case wxSYS_HSCROLL_Y: return 15;
case wxSYS_VSCROLL_X: return 15;
case wxSYS_HSCROLL_Y:
case wxSYS_VSCROLL_X:
return 15;
case wxSYS_CAPTION_Y:
if (!window)

View File

@@ -198,14 +198,9 @@ static void wxGtkTextApplyTagsFromAttr(GtkWidget *text,
wxGtkTextRemoveTagsWithPrefix(text_buffer, "WXINDENT", start, end);
// Convert indent from 1/10th of a mm into pixels
float factor;
#if GTK_CHECK_VERSION(2,2,0)
if (!gtk_check_version(2,2,0))
factor = (float)gdk_screen_get_width(gtk_widget_get_screen(text)) /
float factor =
(float)gdk_screen_get_width(gtk_widget_get_screen(text)) /
gdk_screen_get_width_mm(gtk_widget_get_screen(text)) / 10;
else
#endif
factor = (float)gdk_screen_width() / gdk_screen_width_mm() / 10;
const int indent = (int)(factor * attr.GetLeftIndent());
const int subIndent = (int)(factor * attr.GetLeftSubIndent());
@@ -260,14 +255,9 @@ static void wxGtkTextApplyTagsFromAttr(GtkWidget *text,
if (!tag)
{
// Factor to convert from 1/10th of a mm into pixels
float factor;
#if GTK_CHECK_VERSION(2,2,0)
if (!gtk_check_version(2,2,0))
factor = (float)gdk_screen_get_width(gtk_widget_get_screen(text)) /
float factor =
(float)gdk_screen_get_width(gtk_widget_get_screen(text)) /
gdk_screen_get_width_mm(gtk_widget_get_screen(text)) / 10;
else
#endif
factor = (float)gdk_screen_width() / gdk_screen_width_mm() / 10;
PangoTabArray* tabArray = pango_tab_array_new(tabs.GetCount(), TRUE);
for (size_t i = 0; i < tabs.GetCount(); i++)
@@ -857,17 +847,7 @@ void wxTextCtrl::GTKSetWrapMode()
else if ( HasFlag( wxTE_WORDWRAP ) )
wrap = GTK_WRAP_WORD;
else // HasFlag(wxTE_BESTWRAP) always true as wxTE_BESTWRAP == 0
{
// GTK_WRAP_WORD_CHAR seems to be new in GTK+ 2.4
#ifdef __WXGTK24__
if ( !gtk_check_version(2,4,0) )
{
wrap = GTK_WRAP_WORD_CHAR;
}
else
#endif // __WXGTK24__
wrap = GTK_WRAP_WORD;
}
gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( m_text ), wrap );
}
@@ -887,10 +867,6 @@ void wxTextCtrl::GTKSetJustification()
gtk_text_view_set_justification(GTK_TEXT_VIEW(m_text), just);
}
else // single line
{
#ifdef __WXGTK24__
// gtk_entry_set_alignment was introduced in gtk+-2.3.5
if (!gtk_check_version(2,4,0))
{
gfloat align;
if ( HasFlag(wxTE_RIGHT) )
@@ -902,9 +878,6 @@ void wxTextCtrl::GTKSetJustification()
gtk_entry_set_alignment(GTK_ENTRY(m_text), align);
}
#endif // __WXGTK24__
}
}
void wxTextCtrl::SetWindowStyleFlag(long style)

View File

@@ -405,18 +405,8 @@ static gboolean property_notify_event(
if (event->state == GDK_PROPERTY_NEW_VALUE && event->atom == property &&
win->IsDecorCacheable() && !win->IsFullScreen())
{
Atom xproperty;
#if GTK_CHECK_VERSION(2, 2, 0)
if (gtk_check_version(2, 2, 0) == NULL)
{
xproperty = gdk_x11_atom_to_xatom_for_display(
Atom xproperty = gdk_x11_atom_to_xatom_for_display(
gdk_drawable_get_display(event->window), property);
}
else
#endif
{
xproperty = gdk_x11_atom_to_xatom(property);
}
Atom type;
int format;
gulong nitems, bytes_after;
@@ -514,9 +504,6 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
}
else
{
#if GTK_CHECK_VERSION(2,1,0)
if (!gtk_check_version(2,1,0))
{
if (style & wxFRAME_TOOL_WINDOW)
{
gtk_window_set_type_hint(GTK_WINDOW(m_widget),
@@ -531,8 +518,6 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
style |= wxFRAME_NO_TASKBAR;
}
}
#endif
}
}
wxWindow *topParent = wxGetTopLevelParent(m_parent);
@@ -544,25 +529,15 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
GTK_WINDOW(topParent->m_widget) );
}
#if GTK_CHECK_VERSION(2,2,0)
if (!gtk_check_version(2,2,0))
{
if (style & wxFRAME_NO_TASKBAR)
{
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(m_widget), TRUE);
}
}
#endif
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
if (style & wxSTAY_ON_TOP)
{
gtk_window_set_keep_above(GTK_WINDOW(m_widget), TRUE);
}
}
#endif
#if 0
if (!name.empty())
@@ -723,12 +698,11 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long)
wxGetFullScreenMethodX11((WXDisplay*)GDK_DISPLAY(),
(WXWindow)GDK_ROOT_WINDOW());
#if GTK_CHECK_VERSION(2,2,0)
// NB: gtk_window_fullscreen() uses freedesktop.org's WMspec extensions
// to switch to fullscreen, which is not always available. We must
// check if WM supports the spec and use legacy methods if it
// doesn't.
if ( (method == wxX11_FS_WMSPEC) && !gtk_check_version(2,2,0) )
if ( method == wxX11_FS_WMSPEC )
{
if (show)
gtk_window_fullscreen( GTK_WINDOW( m_widget ) );
@@ -736,7 +710,6 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long)
gtk_window_unfullscreen( GTK_WINDOW( m_widget ) );
}
else
#endif // GTK+ >= 2.2.0
{
GdkWindow *window = m_widget->window;
@@ -751,15 +724,11 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long)
gint client_x, client_y, root_x, root_y;
gint width, height;
if (method != wxX11_FS_WMSPEC)
{
// don't do it always, Metacity hates it
m_fsSaveGdkFunc = m_gdkFunc;
m_fsSaveGdkDecor = m_gdkDecor;
m_gdkFunc = m_gdkDecor = 0;
gdk_window_set_decorations(window, (GdkWMDecoration)0);
gdk_window_set_functions(window, (GdkWMFunction)0);
}
gdk_window_get_origin (m_widget->window, &root_x, &root_y);
gdk_window_get_geometry (m_widget->window, &client_x, &client_y,
@@ -775,14 +744,10 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long)
}
else // hide
{
if (method != wxX11_FS_WMSPEC)
{
// don't do it always, Metacity hates it
m_gdkFunc = m_fsSaveGdkFunc;
m_gdkDecor = m_fsSaveGdkDecor;
gdk_window_set_decorations(window, (GdkWMDecoration)m_gdkDecor);
gdk_window_set_functions(window, (GdkWMFunction)m_gdkFunc);
}
wxSetFullScreenStateX11((WXDisplay*)GDK_DISPLAY(),
(WXWindow)GDK_ROOT_WINDOW(),
@@ -1189,10 +1154,8 @@ void wxTopLevelWindowGTK::RequestUserAttention(int flags)
void wxTopLevelWindowGTK::SetWindowStyleFlag( long style )
{
#if defined(__WXGTK24__) || GTK_CHECK_VERSION(2,2,0)
// Store which styles were changed
long styleChanges = style ^ m_windowStyle;
#endif
// Process wxWindow styles. This also updates the internal variable
// Therefore m_windowStyle bits carry now the _new_ style values
@@ -1202,16 +1165,17 @@ void wxTopLevelWindowGTK::SetWindowStyleFlag( long style )
if (!m_widget)
return;
#ifdef __WXGTK24__
if ( (styleChanges & wxSTAY_ON_TOP) && !gtk_check_version(2,4,0) )
gtk_window_set_keep_above(GTK_WINDOW(m_widget), m_windowStyle & wxSTAY_ON_TOP);
#endif // GTK+ 2.4
#if GTK_CHECK_VERSION(2,2,0)
if ( (styleChanges & wxFRAME_NO_TASKBAR) && !gtk_check_version(2,2,0) )
if ( styleChanges & wxSTAY_ON_TOP )
{
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(m_widget), m_windowStyle & wxFRAME_NO_TASKBAR);
gtk_window_set_keep_above(GTK_WINDOW(m_widget),
m_windowStyle & wxSTAY_ON_TOP);
}
if ( styleChanges & wxFRAME_NO_TASKBAR )
{
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(m_widget),
m_windowStyle & wxFRAME_NO_TASKBAR);
}
#endif // GTK+ 2.2
}
/* Get the X Window between child and the root window.

View File

@@ -1453,10 +1453,7 @@ gtk_window_button_press_callback( GtkWidget *widget,
wxEventType event_type = wxEVT_NULL;
// GdkDisplay is a GTK+ 2.2.0 thing
#if defined(__WXGTK20__) && GTK_CHECK_VERSION(2, 2, 0)
if ( gdk_event->type == GDK_2BUTTON_PRESS &&
!gtk_check_version(2,2,0) &&
gdk_event->button >= 1 && gdk_event->button <= 3 )
{
// Reset GDK internal timestamp variables in order to disable GDK
@@ -1466,7 +1463,6 @@ gtk_window_button_press_callback( GtkWidget *widget,
display->button_click_time[1] = 0;
display->button_click_time[0] = 0;
}
#endif // GTK 2+
if (gdk_event->button == 1)
{

View File

@@ -68,18 +68,6 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
return false;
}
#if defined(__WXGTK20__) || !defined(HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE)
if ( fixedWidthOnly
#if defined(__WXGTK24__)
&& (gtk_check_version(2,4,0) != NULL)
#endif
)
{
OnFacename( wxT("monospace") );
}
else // !fixedWidthOnly
#endif // __WXGTK20__ || !HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE
{
PangoFontFamily **families = NULL;
gint n_families = 0;
pango_context_list_families (
@@ -93,13 +81,9 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
for ( int i = 0; i < n_families; i++ )
{
#if defined(__WXGTK24__) || defined(HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE)
if (!fixedWidthOnly || (
#ifdef __WXGTK24__
!gtk_check_version(2,4,0) &&
#endif
pango_font_family_is_monospace(families[i])
) )
#if defined(__WXGTK20__) || defined(HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE)
if ( !fixedWidthOnly ||
pango_font_family_is_monospace(families[i]) )
#endif
{
const gchar *name = pango_font_family_get_name(families[i]);
@@ -107,7 +91,6 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
}
}
g_free(families);
}
return true;
}

View File

@@ -158,9 +158,9 @@ wxFontFamily wxNativeFontInfo::GetFamily() const
ret = wxFONTFAMILY_TELETYPE; // begins with "Monospace"
else if (strncmp( family_text, "courier", 7 ) == 0)
ret = wxFONTFAMILY_TELETYPE; // begins with "Courier"
#if defined(__WXGTK24__) || defined(HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE)
#if defined(__WXGTK20__) || defined(HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE)
else
#ifdef __WXGTK24__
#ifdef __WXGTK20__
if (!gtk_check_version(2,4,0))
#endif
{
@@ -196,7 +196,7 @@ wxFontFamily wxNativeFontInfo::GetFamily() const
if (family != NULL && pango_font_family_is_monospace( family ))
ret = wxFONTFAMILY_TELETYPE; // is deemed a monospace font by pango
}
#endif // gtk24 || HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE
#endif // GTK+ 2 || HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE
if (ret == wxFONTFAMILY_DEFAULT)
{