]> git.saurik.com Git - wxWidgets.git/commitdiff
removed all compile- and run-time checks for GTK+ < 2.4; don't include the generic...
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 5 Nov 2007 22:31:24 +0000 (22:31 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 5 Nov 2007 22:31:24 +0000 (22:31 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49660 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

41 files changed:
include/wx/clrpicker.h
include/wx/collpane.h
include/wx/dirdlg.h
include/wx/filectrl.h
include/wx/filedlg.h
include/wx/fontpicker.h
include/wx/generic/clrpickerg.h
include/wx/generic/collpaneg.h
include/wx/generic/fontpickerg.h
include/wx/gtk/clrpicker.h
include/wx/gtk/collpane.h
include/wx/gtk/combobox.h
include/wx/gtk/dirdlg.h
include/wx/gtk/fontpicker.h
src/generic/animateg.cpp
src/generic/buttonbar.cpp
src/generic/collpaneg.cpp
src/generic/colrdlgg.cpp
src/generic/dirctrlg.cpp
src/generic/dragimgg.cpp
src/gtk/artgtk.cpp
src/gtk/clrpicker.cpp
src/gtk/collpane.cpp
src/gtk/colordlg.cpp
src/gtk/combobox.cpp
src/gtk/cursor.cpp
src/gtk/dataobj.cpp
src/gtk/dcclient.cpp
src/gtk/dirdlg.cpp
src/gtk/filectrl.cpp
src/gtk/filedlg.cpp
src/gtk/fontpicker.cpp
src/gtk/glcanvas.cpp
src/gtk/menu.cpp
src/gtk/msgdlg.cpp
src/gtk/settings.cpp
src/gtk/textctrl.cpp
src/gtk/toplevel.cpp
src/gtk/window.cpp
src/unix/fontenum.cpp
src/unix/fontutil.cpp

index e2d52184e6fa02fe1e25e346b07039714f6d17a4..151693bc070d7a7764e4e15ba7871320a41b777e 100644 (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
index 8ff545d3bcda9be57ee2dc287c3f461ea7f2782c..2d26191c24502f08ce425b644977cef395cef481 100644 (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"
index a5b0cba0217c5323409ba648374c4c3f3dc3910c..04edeebdc8ad558057966db974af7b7bdc6aaf09 100644 (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"
index 8e9f6f49a5c8a6a143ddfbc33e06f8edc16a8348..a44a1305e2a4cbeb459d403729550f5d471f2217 100644 (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
index 394a93c87db7bce215ad8d6493e4138c1bb6447c..86415900cf1f356fc77810f5902ebe03b60366c0 100644 (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"
index 2f12112fc3b9e85b3aafd96f72e6408a23043456..14da2fffc29f1321ea49655b0fdd2a04760d8eeb 100644 (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
index 17dc568551bf8a55723ff0d920ec88aa4ddac46a..758e51619ffb3e9dd9eab3affca52012bfba177c 100644 (file)
 // 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
 {
index 9249aec213f67b788f9f0f1ec2cd5f5ec58f65df..a12b6f1fc4bccbdf888a46305fd4d6aa6d95d2f0 100644 (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
 // ----------------------------------------------------------------------------
index a3c27f432183d7ff2f8d843303fc62b4e9189cb7..ce4f6adb3b746f82327f00748c62e6c5517f42c4 100644 (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
 {
index 3998ca027dd4ff50fc7d3e2c431c7be01ac9f04e..1ddbfe3b1818fb5e41879d067c75f26a7e1bb5a1 100644 (file)
 #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();
 
index 563ad8f3df4739f3efa34b8305d91ba124a4478f..ecc8f9bd3acfe301cf9d538e7a620e4c96b788c1 100644 (file)
 #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&);
 
index 9cb4f9f1854f22d39c959a56b54bbabec31fdd6b..d2df032aaebd02d71fc52571131f2a8c0fc37816 100644 (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; }
index 35d6085c211fa32334954002cf2353c85aad683a..74a105dcd7cd5561429434605a6d020d0a26a1c9 100644 (file)
 #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__
index cef2cd16652abf903ff5ef65870fea8800c712d8..2bb9c8e1037328cba6e4ca0ec3981b9c0a01d8ef 100644 (file)
 #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();
 
index dc7062fc07eb9393efc66d23a2ddba54e7423041..17605f1af85d68d8e04118313ac94c87dcdf6515 100644 (file)
@@ -15,7 +15,7 @@
   #pragma hdrstop
 #endif  //__BORLANDC__
 
-#if wxUSE_ANIMATIONCTRL && (!defined(__WXGTK20__) || defined(__WXUNIVERSAL__))
+#if wxUSE_ANIMATIONCTRL
 
 #include "wx/animate.h"
 
@@ -687,5 +687,5 @@ void wxAnimationCtrl::OnSize(wxSizeEvent &WXUNUSED(event))
     }
 }
 
-#endif      // wxUSE_ANIMATIONCTRL
+#endif // wxUSE_ANIMATIONCTRL
 
index 512352bf79414e16c7161902bf1ec0a910f386e7..c05ef6385b4184e27b16fe21e2753bb02cf7edd7 100644 (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);
 
index ae5f0cde3c20ac7a50e541ce5ed98ff2802c0d6c..40dd98609afb32cf3f04431758c147647ce1650c 100644 (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;
index 0f4bfd6bab9c5c1ab43226172f525daf58e763f8..a8dec5b490f2f6ca4d67388efe1e03a7382a140b 100644 (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
index 8e0994cf03e55e16dc07bfc7e5b251dba5fd7f02..c4bd8118b1d2953c826d22228afd6b18851c316b 100644 (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,
index 36bd745ccc2671c3a5245238d5d2ddd16c32bccc..56ee35e91ddd494ef0dab5fc395ecefa6c20dacf 100644 (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)
index a888e389bf1154b7f75ed8e2679f00c23d8c9757..6153868e5c0834e93917839e1933b3cbaafdb07a 100644 (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) ||
index 9184ed70257df6e7589ee722434c3963cc583470..57272a0e88f8d20259fbdebcda22041db9d47925 100644 (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,7 +51,7 @@ 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,
@@ -59,32 +59,27 @@ bool wxColourButton::Create( wxWindow *parent, wxWindowID id,
                         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))
     {
-        if (!PreCreation( parent, pos, size ) ||
-            !wxControl::CreateBase(parent, id, pos, size, style, validator, name))
-        {
-            wxFAIL_MSG( wxT("wxColourButton creation failed") );
-            return false;
-        }
+        wxFAIL_MSG( wxT("wxColourButton creation failed") );
+        return false;
+    }
 
-        m_colour = col;
-        m_widget = gtk_color_button_new_with_color( m_colour.GetColor() );
-        gtk_widget_show(m_widget);
+    m_colour = col;
+    m_widget = gtk_color_button_new_with_color( m_colour.GetColor() );
+    gtk_widget_show(m_widget);
 
-        // GtkColourButton signals
-        g_signal_connect(m_widget, "color-set",
-                        G_CALLBACK(gtk_clrbutton_setcolor_callback), this);
+    // GtkColourButton signals
+    g_signal_connect(m_widget, "color-set",
+                    G_CALLBACK(gtk_clrbutton_setcolor_callback), this);
 
 
-        m_parent->DoAddChild( this );
+    m_parent->DoAddChild( this );
+
+    PostCreation(size);
+    SetInitialSize(size);
 
-        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();
+    gtk_color_button_set_color(GTK_COLOR_BUTTON(m_widget), m_colour.GetColor());
 }
 
-#endif      // wxUSE_COLOURPICKERCTRL && defined(__WXGTK24__)
+#endif // wxUSE_COLOURPICKERCTRL
index 1239855006fc3aac6c8c095f3996837eac3c9ba6..2702156f34e826a0a38fbbf129c0df8640ced6a7 100644 (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"
 
 #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 ) ||
@@ -211,60 +216,42 @@ 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") );
-
-        GtkRequisition req;
-        req.width = 2;
-        req.height = 2;
-        (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_widget) )->size_request )
-                (m_widget, &req );
+    wxASSERT_MSG( m_widget, wxT("DoGetBestSize called before creation") );
 
-        // notice that we do not cache our best size here as it changes
-        // all times the user expands/hide our pane
-        return wxSize(req.width, req.height);
-    }
+    GtkRequisition req;
+    req.width = 2;
+    req.height = 2;
+    (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_widget) )->size_request )
+            (m_widget, &req );
 
-    return wxGenericCollapsiblePane::DoGetBestSize();
+    // notice that we do not cache our best size here as it changes
+    // all times the user expands/hide our pane
+    return wxSize(req.width, req.height);
 }
 
 void wxCollapsiblePane::Collapse(bool collapse)
 {
-    if (!gtk_check_version(2,4,0))
-    {
-        // optimization
-        if (IsCollapsed() == collapse)
-            return;
+    // optimization
+    if (IsCollapsed() == collapse)
+        return;
 
-        // do not send event in next signal handler call
-        m_bIgnoreNextChange = true;
-        gtk_expander_set_expanded(GTK_EXPANDER(m_widget), !collapse);
-    }
-    else
-        wxGenericCollapsiblePane::Collapse(collapse);
+    // do not send event in next signal handler call
+    m_bIgnoreNextChange = true;
+    gtk_expander_set_expanded(GTK_EXPANDER(m_widget), !collapse);
 }
 
 bool wxCollapsiblePane::IsCollapsed() const
 {
-    if (!gtk_check_version(2,4,0))
-        return !gtk_expander_get_expanded(GTK_EXPANDER(m_widget));
-
-    return wxGenericCollapsiblePane::IsCollapsed();
+    return !gtk_expander_get_expanded(GTK_EXPANDER(m_widget));
 }
 
 void wxCollapsiblePane::SetLabel(const wxString &str)
 {
-    if (!gtk_check_version(2,4,0))
-    {
-        gtk_expander_set_label(GTK_EXPANDER(m_widget), wxGTK_CONV(str));
+    gtk_expander_set_label(GTK_EXPANDER(m_widget), wxGTK_CONV(str));
 
-        // FIXME: we need to update our collapsed width in some way but using GetBestSize()
-        // 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);
+    // FIXME: we need to update our collapsed width in some way but using GetBestSize()
+    // we may get the size of the control with the pane size summed up if we are expanded!
+    //m_szCollapsed.x = GetBestSize().x;
 }
 
 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__)
 
index 20bacbb9e29e9658261ac3b1bf63122f060a5856..ccb80aadc14b43dca1f26ed07f82dfa3e3011982 100644 (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
 
index 63a370d1cb1b6e81418d06a20bcb07cca8d8a965..1fdea4fd204e689369d8d7270c62aca6ba3e1617 100644 (file)
     #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
-//-----------------------------------------------------------------------------
-
-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 );
-    }
-}
-}
+// ----------------------------------------------------------------------------
+// GTK callbacks
+// ----------------------------------------------------------------------------
 
-#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,111 +114,47 @@ 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);
-
-        // 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 );
+    m_widget = gtk_combo_box_entry_new_text();
 
-        // and case-sensitive
-        gtk_combo_set_case_sensitive( GTK_COMBO(m_widget), TRUE );
+    GtkEntry * const entry = GetEntry();
 
-        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 );
+    ConnectWidget( m_widget );
 
-#ifdef __WXGTK24__
-    if (!gtk_check_version(2,4,0))
-    {
-        gtk_entry_set_text( entry, wxGTK_CONV(value) );
+    gtk_entry_set_text( entry, wxGTK_CONV(value) );
 
-        if (style & wxCB_READONLY)
-            gtk_entry_set_editable( entry, FALSE );
+    if (style & wxCB_READONLY)
+        gtk_entry_set_editable( entry, FALSE );
 
-        g_signal_connect_after (entry, "changed",
-                            G_CALLBACK (gtkcombobox_text_changed_callback), this);
+    g_signal_connect_after (entry, "changed",
+                        G_CALLBACK (gtkcombobox_text_changed_callback), this);
 
-        g_signal_connect_after (m_widget, "changed",
-                            G_CALLBACK (gtkcombobox_changed_callback), this);
+    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 );
+    return GTK_EDITABLE( GTK_BIN(m_widget)->child );
 }
 
 wxComboBox::~wxComboBox()
@@ -393,60 +188,19 @@ 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 )
-        {
-            n = pos + i;
-            // If sorted, use this wxSortedArrayStrings to determine
-            // the right insertion point
-            if(m_strings)
-                n = m_strings->Add(items[i]);
-
-            gtk_combo_box_insert_text( combobox, n, wxGTK_CONV( items[i] ) );
-
-            m_clientData.Insert( NULL, n );
-            AssignNewItemClientData(n, clientData, i, type);
-        }
-    }
-    else
-#endif
+    GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
+    for( int i = 0; i < count; ++i )
     {
-        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();
-            }
+        n = pos + i;
+        // If sorted, use this wxSortedArrayStrings to determine
+        // the right insertion point
+        if(m_strings)
+            n = m_strings->Add(items[i]);
 
-            gtk_widget_show( list_item );
-        }
+        gtk_combo_box_insert_text( combobox, n, wxGTK_CONV( items[i] ) );
 
-        EnableEvents();
+        m_clientData.Insert( NULL, n );
+        AssignNewItemClientData(n, clientData, i, type);
     }
 
     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() );
-    }
+    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 );
 
     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;
-        }
+    wxCHECK_RET( IsValid(n), wxT("invalid index") );
 
-        DisableEvents();
-
-        GList *list = g_list_append( (GList*) NULL, child->data );
-        gtk_list_remove_items( listbox, list );
-        g_list_free( list );
-
-        EnableEvents();
-    }
+    GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
+    gtk_combo_box_remove_text( combobox, n );
 
     m_clientData.RemoveAt( n );
     if(m_strings)
@@ -540,39 +259,18 @@ 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") );
+    GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
+    wxCHECK_RET( IsValid(n), wxT("invalid index") );
 
-        GtkTreeModel *model = gtk_combo_box_get_model( combobox );
-        GtkTreeIter iter;
-        if (gtk_tree_model_iter_nth_child (model, &iter, NULL, n))
-        {
-            GValue value = { 0, };
-            g_value_init( &value, G_TYPE_STRING );
-            g_value_set_string( &value, wxGTK_CONV( text ) );
-            gtk_list_store_set_value( GTK_LIST_STORE(model), &iter, 0, &value );
-            g_value_unset( &value );
-        }
-    }
-    else
-#endif
+    GtkTreeModel *model = gtk_combo_box_get_model( combobox );
+    GtkTreeIter iter;
+    if (gtk_tree_model_iter_nth_child (model, &iter, NULL, n))
     {
-        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") );
-        }
+        GValue value = { 0, };
+        g_value_init( &value, G_TYPE_STRING );
+        g_value_set_string( &value, wxGTK_CONV( text ) );
+        gtk_list_store_set_value( GTK_LIST_STORE(model), &iter, 0, &value );
+        g_value_unset( &value );
     }
 
     InvalidateBestSize();
@@ -582,100 +280,42 @@ 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;
+    gtk_tree_model_get_iter_first( model, &iter );
+    if (!gtk_list_store_iter_is_valid(GTK_LIST_STORE(model), &iter ))
+        return -1;
+    int count = 0;
+    do
     {
-        GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
-        GtkTreeModel* model = gtk_combo_box_get_model( combobox );
-        GtkTreeIter iter;
-        gtk_tree_model_get_iter_first( model, &iter );
-        if (!gtk_list_store_iter_is_valid(GTK_LIST_STORE(model), &iter ))
-            return -1;
-        int count = 0;
-        do
-        {
-            GValue value = { 0, };
-            gtk_tree_model_get_value( model, &iter, 0, &value );
-            wxString str = wxGTK_CONV_BACK( g_value_get_string( &value ) );
-            g_value_unset( &value );
+        GValue value = { 0, };
+        gtk_tree_model_get_value( model, &iter, 0, &value );
+        wxString str = wxGTK_CONV_BACK( g_value_get_string( &value ) );
+        g_value_unset( &value );
 
-            if (item.IsSameAs( str, bCase ) )
-                return count;
+        if (item.IsSameAs( str, bCase ) )
+            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;
-        }
+        count++;
     }
+    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;
+    GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
+    return gtk_combo_box_get_active( combobox );
 }
 
 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;
+    GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
+    return gtk_combo_box_get_active( combobox );
 }
 
 wxString wxComboBox::GetString(unsigned int n) const
@@ -684,37 +324,16 @@ 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;
-        if (gtk_tree_model_iter_nth_child (model, &iter, NULL, n))
-        {
-            GValue value = { 0, };
-            gtk_tree_model_get_value( model, &iter, 0, &value );
-            wxString tmp = wxGTK_CONV_BACK( g_value_get_string( &value ) );
-            g_value_unset( &value );
-            return tmp;
-        }
-    }
-    else
-#endif
+    GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
+    GtkTreeModel *model = gtk_combo_box_get_model( combobox );
+    GtkTreeIter iter;
+    if (gtk_tree_model_iter_nth_child (model, &iter, NULL, n))
     {
-        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") );
-        }
+        GValue value = { 0, };
+        gtk_tree_model_get_value( model, &iter, 0, &value );
+        wxString tmp = wxGTK_CONV_BACK( g_value_get_string( &value ) );
+        g_value_unset( &value );
+        return tmp;
     }
 
     return str;
@@ -724,34 +343,16 @@ 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;
-        gtk_tree_model_get_iter_first( model, &iter );
-        if (!gtk_list_store_iter_is_valid(GTK_LIST_STORE(model), &iter ))
-            return 0;
-        unsigned int ret = 1;
-        while (gtk_tree_model_iter_next( model, &iter ))
-            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;
-    }
+    GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
+    GtkTreeModel* model = gtk_combo_box_get_model( combobox );
+    GtkTreeIter iter;
+    gtk_tree_model_get_iter_first( model, &iter );
+    if (!gtk_list_store_iter_is_valid(GTK_LIST_STORE(model), &iter ))
+        return 0;
+    unsigned int ret = 1;
+    while (gtk_tree_model_iter_next( model, &iter ))
+        ret++;
+    return ret;
 }
 
 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;
-    }
+    GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
+    gtk_combo_box_set_active( combobox, n );
 
     EnableEvents();
 }
@@ -806,131 +395,32 @@ 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);
-
-        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_BIN(m_widget)->child,
+        (gpointer)gtkcombobox_text_changed_callback, this);
 
-        g_signal_handlers_block_by_func(GTK_COMBO(m_widget)->entry,
-            (gpointer) gtkcombo_text_changed_callback, this);
-    }
+    g_signal_handlers_block_by_func(m_widget,
+        (gpointer)gtkcombobox_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);
-
-        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 );
+    g_signal_handlers_unblock_by_func(GTK_BIN(m_widget)->child,
+        (gpointer)gtkcombobox_text_changed_callback, this);
 
-        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;
-        }
-    }
+    g_signal_handlers_unblock_by_func(m_widget,
+        (gpointer)gtkcombobox_changed_callback, this);
 }
 
 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);
+    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);
+    return GetDefaultAttributesFromGTKWidget(gtk_combo_box_entry_new, true);
 }
 
 // ----------------------------------------------------------------------------
index a323e44d694a37aa597b9b6607a154190d9030eb..b8d86c20370667a7e555270098927c682a7cc79e 100644 (file)
@@ -178,57 +178,52 @@ 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()) )
     {
-        if ( gdk_display_supports_cursor_color(gdk_display_get_default()) )
+        unsigned char rMask = 0,
+                      gMask = 0,
+                      bMask = 0;
+        if (bHasMask)
         {
-            unsigned char rMask = 0,
-                          gMask = 0,
-                          bMask = 0;
-            if (bHasMask)
-            {
-                rMask = image.GetMaskRed();
-                gMask = image.GetMaskGreen();
-                bMask = image.GetMaskBlue();
-            }
+            rMask = image.GetMaskRed();
+            gMask = image.GetMaskGreen();
+            bMask = image.GetMaskBlue();
+        }
 
-            GdkPixbuf *pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, w, h);
-            unsigned char *alpha = image.HasAlpha() ? image.GetAlpha() : NULL;
-            unsigned char *out = gdk_pixbuf_get_pixels(pixbuf);
-            int rowpad = gdk_pixbuf_get_rowstride(pixbuf) - 4 * w;
-            for ( int y = 0; y < h; y++, out += rowpad )
+        GdkPixbuf *pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, w, h);
+        unsigned char *alpha = image.HasAlpha() ? image.GetAlpha() : NULL;
+        unsigned char *out = gdk_pixbuf_get_pixels(pixbuf);
+        int rowpad = gdk_pixbuf_get_rowstride(pixbuf) - 4 * w;
+        for ( int y = 0; y < h; y++, out += rowpad )
+        {
+            for ( int x = 0; x < w; x++, out += 4, rgbBits += 3 )
             {
-                for ( int x = 0; x < w; x++, out += 4, rgbBits += 3 )
-                {
-                    out[0] = rgbBits[0];
-                    out[1] = rgbBits[1];
-                    out[2] = rgbBits[2];
-                    if (bHasMask &&
-                        out[0] == rMask && out[1] == gMask && out[2] == bMask)
-                        out[3] = 0;
-                    else
-                        out[3] = alpha ? *alpha : 255;
-                    if ( alpha )
-                        ++alpha;
-                }
+                out[0] = rgbBits[0];
+                out[1] = rgbBits[1];
+                out[2] = rgbBits[2];
+                if (bHasMask &&
+                    out[0] == rMask && out[1] == gMask && out[2] == bMask)
+                    out[3] = 0;
+                else
+                    out[3] = alpha ? *alpha : 255;
+                if ( alpha )
+                    ++alpha;
             }
-
-            int hotSpotX, hotSpotY;
-            GetHotSpot(image, hotSpotX, hotSpotY);
-
-            m_refData = new wxCursorRefData;
-            M_CURSORDATA->m_cursor = gdk_cursor_new_from_pixbuf
-                                 (
-                                  gdk_display_get_default(),
-                                  pixbuf,
-                                  hotSpotX, hotSpotY
-                                 );
-            g_object_unref (pixbuf);
-            return;
         }
+
+        int hotSpotX, hotSpotY;
+        GetHotSpot(image, hotSpotX, hotSpotY);
+
+        m_refData = new wxCursorRefData;
+        M_CURSORDATA->m_cursor = gdk_cursor_new_from_pixbuf
+                             (
+                              gdk_display_get_default(),
+                              pixbuf,
+                              hotSpotX, hotSpotY
+                             );
+        g_object_unref (pixbuf);
+        return;
     }
-#endif // GTK+ 2.4+
 
     unsigned char * bits = new unsigned char [imagebitcount];
     unsigned char * maskBits = new unsigned char [imagebitcount];
index fa6d1cc5db36eb5dfb8e2ba5aba34d9a024fac0e..6ea3dc4f2f1d22f67b9a7ddf5ded82a32ff8957c 100644 (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
index 67f287aa24aebb1c512e0363e2ba9d98e7774bbf..3845198b4abae62fad823624a66dd547be29186b 100644 (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(),
index 846948571b754752aca96672a2348c1c63224af7..8613388d29cc6bd18ee215de6b391b48624e314f 100644 (file)
@@ -20,7 +20,7 @@
 
 
 
-#if wxUSE_DIRDLG && defined( __WXGTK24__ )
+#if wxUSE_DIRDLG
 
 #include "wx/dirdlg.h"
 
@@ -83,126 +83,95 @@ 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)
+wxDirDialog::wxDirDialog(wxWindow* parent,
+                         const wxString& title,
+                         const wxString& defaultPath,
+                         long style,
+                         const wxPoint& pos,
+                         const wxSize& WXUNUSED(sz),
+                         const wxString& WXUNUSED(name))
 {
-    if (!gtk_check_version(2,4,0))
+    m_message = title;
+
+    parent = GetParentForModalDialog(parent);
+
+    if (!PreCreation(parent, pos, wxDefaultSize) ||
+        !CreateBase(parent, wxID_ANY, pos, wxDefaultSize, style,
+                wxDefaultValidator, wxT("dirdialog")))
     {
-        m_message = title;
-
-        parent = GetParentForModalDialog(parent);
-
-        if (!PreCreation(parent, pos, wxDefaultSize) ||
-            !CreateBase(parent, wxID_ANY, pos, wxDefaultSize, style,
-                    wxDefaultValidator, wxT("dirdialog")))
-        {
-            wxFAIL_MSG( wxT("wxDirDialog creation failed") );
-            return;
-        }
-
-        GtkWindow* gtk_parent = NULL;
-        if (parent)
-            gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) );
-
-        m_widget = gtk_file_chooser_dialog_new(
-                       wxGTK_CONV(m_message),
-                       gtk_parent,
-                       GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
-                       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-                       GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
-                       NULL);
-
-        gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_ACCEPT);
-
-        // gtk_widget_hide_on_delete is used here to avoid that Gtk automatically destroys
-        // the dialog when the user press ESC on the dialog: in that case a second call to
-        // ShowModal() would result in a bunch of Gtk-CRITICAL errors...
-        g_signal_connect (G_OBJECT(m_widget),
-                        "delete_event",
-                        G_CALLBACK (gtk_widget_hide_on_delete),
-                        (gpointer)this);
-
-        // local-only property could be set to false to allow non-local files to be loaded.
-        // In that case get/set_uri(s) should be used instead of get/set_filename(s) everywhere
-        // and the GtkFileChooserDialog should probably also be created with a backend,
-        // e.g "gnome-vfs", "default", ... (gtk_file_chooser_dialog_new_with_backend).
-        // Currently local-only is kept as the default - true:
-        // gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(m_widget), true);
-
-        g_signal_connect (m_widget, "response",
-            G_CALLBACK (gtk_dirdialog_response_callback), this);
-
-        if ( !defaultPath.empty() )
-            gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(m_widget),
-                    defaultPath.fn_str() );
+        wxFAIL_MSG( wxT("wxDirDialog creation failed") );
+        return;
     }
-    else
-        wxGenericDirDialog::Create(parent, title, defaultPath, style, pos, sz, name);
-}
-
-void wxDirDialog::OnFakeOk( wxCommandEvent &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();
+    GtkWindow* gtk_parent = NULL;
+    if (parent)
+        gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) );
+
+    m_widget = gtk_file_chooser_dialog_new(
+                   wxGTK_CONV(m_message),
+                   gtk_parent,
+                   GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
+                   GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                   GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+                   NULL);
+
+    gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_ACCEPT);
+
+    // gtk_widget_hide_on_delete is used here to avoid that Gtk automatically destroys
+    // the dialog when the user press ESC on the dialog: in that case a second call to
+    // ShowModal() would result in a bunch of Gtk-CRITICAL errors...
+    g_signal_connect (G_OBJECT(m_widget),
+                    "delete_event",
+                    G_CALLBACK (gtk_widget_hide_on_delete),
+                    (gpointer)this);
+
+    // local-only property could be set to false to allow non-local files to be loaded.
+    // In that case get/set_uri(s) should be used instead of get/set_filename(s) everywhere
+    // and the GtkFileChooserDialog should probably also be created with a backend,
+    // e.g "gnome-vfs", "default", ... (gtk_file_chooser_dialog_new_with_backend).
+    // Currently local-only is kept as the default - true:
+    // gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(m_widget), true);
+
+    g_signal_connect (m_widget, "response",
+        G_CALLBACK (gtk_dirdialog_response_callback), this);
+
+    if ( !defaultPath.empty() )
+        gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(m_widget),
+                defaultPath.fn_str() );
 }
 
-bool wxDirDialog::Show( bool show )
+void wxDirDialog::OnFakeOk(wxCommandEvent& WXUNUSED(event))
 {
-    if (!gtk_check_version(2,4,0))
-        return wxDialog::Show( show );
-    else
-        return wxGenericDirDialog::Show( show );
+    EndDialog(wxID_OK);
 }
 
 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))
     {
-        if (wxDirExists(dir))
-        {
-            gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget),
-                                                dir.fn_str());
-        }
+        gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget),
+                                            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();
+    wxGtkString str(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(m_widget)));
+    return wxString(str, *wxConvFileName);
 }
 
 #endif // wxUSE_DIRDLG
index c79d27d3bcf03d55e12532ded55028c4b0ac9380..d2b6e8c501c02c8660ec7a07c5e9c354fc7cad89 100644 (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__)
index d0d224b110e86312b2ab4cb247867ad358e5ad64..77abe908a52f227b5f60a9a585d93c1ab6ed9f67 100644 (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);
 }
index 0664901c303ccc6643225726b2199fd46278be2d..a0e12a4978fbe14951268a5ff546d6764f4fdfc9 100644 (file)
@@ -50,7 +50,7 @@ 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,
@@ -58,45 +58,40 @@ bool wxFontButton::Create( wxWindow *parent, wxWindowID id,
                         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))
     {
-        if (!PreCreation( parent, pos, size ) ||
-            !wxControl::CreateBase(parent, id, pos, size, style, validator, name))
-        {
-            wxFAIL_MSG( wxT("wxFontButton creation failed") );
-            return false;
-        }
+        wxFAIL_MSG( wxT("wxFontButton creation failed") );
+        return false;
+    }
 
-        m_widget = gtk_font_button_new();
+    m_widget = gtk_font_button_new();
 
-        // set initial font
-        m_selectedFont = initial.IsOk() ? initial : *wxNORMAL_FONT;
-        UpdateFont();
+    // set initial font
+    m_selectedFont = initial.IsOk() ? initial : *wxNORMAL_FONT;
+    UpdateFont();
 
-        // honour the fontbutton styles
-        bool showall = (style & wxFNTP_FONTDESC_AS_LABEL) != 0,
-             usefont = (style & wxFNTP_USEFONT_FOR_LABEL) != 0;
-        gtk_font_button_set_show_style(GTK_FONT_BUTTON(m_widget), showall);
-        gtk_font_button_set_show_size(GTK_FONT_BUTTON(m_widget), showall);
+    // honour the fontbutton styles
+    bool showall = (style & wxFNTP_FONTDESC_AS_LABEL) != 0,
+         usefont = (style & wxFNTP_USEFONT_FOR_LABEL) != 0;
+    gtk_font_button_set_show_style(GTK_FONT_BUTTON(m_widget), showall);
+    gtk_font_button_set_show_size(GTK_FONT_BUTTON(m_widget), showall);
 
-        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_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(m_widget);
+    gtk_widget_show(m_widget);
 
-        // GtkFontButton signals
-        g_signal_connect(m_widget, "font-set",
-                        G_CALLBACK(gtk_fontbutton_setfont_callback), this);
+    // GtkFontButton signals
+    g_signal_connect(m_widget, "font-set",
+                    G_CALLBACK(gtk_fontbutton_setfont_callback), this);
 
 
-        m_parent->DoAddChild( this );
+    m_parent->DoAddChild( this );
+
+    PostCreation(size);
+    SetInitialSize(size);
 
-        PostCreation(size);
-        SetInitialSize(size);
-    }
-    else
-        return wxGenericFontButton::Create(parent, id, initial, pos, size,
-                                           style, validator, name);
     return true;
 }
 
@@ -106,16 +101,11 @@ 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 ?") );
+    const wxNativeFontInfo *info = m_selectedFont.GetNativeFontInfo();
+    wxASSERT_MSG( info, wxT("The fontbutton's internal font is not valid ?") );
 
-        const wxString& fontname = info->ToString();
-        gtk_font_button_set_font_name(GTK_FONT_BUTTON(m_widget), wxGTK_CONV(fontname));
-    }
-    else
-        wxGenericFontButton::UpdateFont();
+    const wxString& fontname = info->ToString();
+    gtk_font_button_set_font_name(GTK_FONT_BUTTON(m_widget), wxGTK_CONV(fontname));
 }
 
-#endif      // wxUSE_FONTPICKERCTRL
+#endif // wxUSE_FONTPICKERCTRL
index ad811ae0a6ce3a79e7bf2bf91a5c6ecfb69491d3..3fc37ba80ec2047f0915f15532ea296ee654c97b 100644 (file)
@@ -193,38 +193,22 @@ 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;
+    wxWindow::Create( parent, id, pos, size, style, name );
 
-        GdkScreen *screen = gtk_widget_get_screen( m_glWidget );
-        colormap = gdk_screen_get_default_colormap(screen);
-        visual = gdk_colormap_get_visual(colormap);
+    m_glWidget = m_wxwindow;
 
-        if (GDK_VISUAL_XVISUAL(visual)->visualid != xvi->visualid)
-        {
-            visual = gdk_x11_screen_lookup_visual( screen, xvi->visualid );
-            colormap = gdk_colormap_new(visual, FALSE);
-        }
+    GdkScreen *screen = gtk_widget_get_screen( m_glWidget );
+    colormap = gdk_screen_get_default_colormap(screen);
+    visual = gdk_colormap_get_visual(colormap);
 
-        gtk_widget_set_colormap( m_glWidget, colormap );
-    }
-    else
-#endif // GTK+ >= 2.2
+    if (GDK_VISUAL_XVISUAL(visual)->visualid != xvi->visualid)
     {
-        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;
+        visual = gdk_x11_screen_lookup_visual( screen, xvi->visualid );
+        colormap = gdk_colormap_new(visual, FALSE);
     }
 
+    gtk_widget_set_colormap( m_glWidget, colormap );
+
     gtk_widget_set_double_buffered( m_glWidget, FALSE );
 
 #if WXWIN_COMPATIBILITY_2_8
@@ -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
index a48c4c3b0436e7cbab5a6a483c1425b9cd62309e..aa3174cc8a3a04a329e3482d01cbaab9550c97d9 100644 (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
index 7202ba2a3249ba44c8857946c796fa18d5b84ff9..0b4dd87c22ac5d326881141bbbcafd9a121f7acf 100644 (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__)
index 279eeefce7f903aab34bfeabce17c7b2e6652565..b36978475ac9b1b5949fe72ad61b5e1484518adc 100644 (file)
@@ -399,28 +399,16 @@ 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)))
     {
-        if (gdk_x11_screen_supports_net_wm_hint(
-                gdk_drawable_get_screen(window),
-                gdk_atom_intern("_NET_FRAME_EXTENTS", false)))
-        {
-            success = true;
-            property = gdk_x11_get_xatom_by_name_for_display(
-                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");
-        }
+        success = true;
+        property = gdk_x11_get_xatom_by_name_for_display(
+            gdk_drawable_get_display(window),
+            "_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(),
-                                "gtk-double-click-distance", &dclick_distance, NULL);
+            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(),
-                             "gtk-dnd-drag-threshold", &drag_threshold, NULL);
-            }
+            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)
index b44668c172ad35f164a78bb69ad0cb00d9299bbc..ccdba0721ec09a11513f568f1262aa8c7c2a532a 100644 (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;
-    }
+        wrap = GTK_WRAP_WORD_CHAR;
 
     gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( m_text ), wrap );
 }
@@ -888,23 +868,16 @@ void wxTextCtrl::GTKSetJustification()
     }
     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) )
-                align = 1.0;
-            else if ( HasFlag(wxTE_CENTRE) )
-                align = 0.5;
-            else // single line
-                align = 0.0;
-
-            gtk_entry_set_alignment(GTK_ENTRY(m_text), align);
-        }
-#endif // __WXGTK24__
-    }
+        gfloat align;
+        if ( HasFlag(wxTE_RIGHT) )
+            align = 1.0;
+        else if ( HasFlag(wxTE_CENTRE) )
+            align = 0.5;
+        else // single line
+            align = 0.0;
 
+        gtk_entry_set_alignment(GTK_ENTRY(m_text), align);
+    }
 }
 
 void wxTextCtrl::SetWindowStyleFlag(long style)
index bae1558d8a7286a78f3e6926b11e2f6f7e5516b4..acaec2299a8353d33148e296b94de50e34a636a7 100644 (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(
-                gdk_drawable_get_display(event->window), property);
-        }
-        else
-#endif
-        {
-            xproperty = gdk_x11_atom_to_xatom(property);
-        }
+        Atom xproperty = gdk_x11_atom_to_xatom_for_display(
+                            gdk_drawable_get_display(event->window), property);
         Atom type;
         int format;
         gulong nitems, bytes_after;
@@ -514,24 +504,19 @@ 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)
             {
-                if (style & wxFRAME_TOOL_WINDOW)
-                {
-                    gtk_window_set_type_hint(GTK_WINDOW(m_widget),
-                                             GDK_WINDOW_TYPE_HINT_UTILITY);
-
-                    // On some WMs, like KDE, a TOOL_WINDOW will still show
-                    // on the taskbar, but on Gnome a TOOL_WINDOW will not.
-                    // For consistency between WMs and with Windows, we
-                    // should set the NO_TASKBAR flag which will apply
-                    // the set_skip_taskbar_hint if it is available,
-                    // ensuring no taskbar entry will appear.
-                    style |= wxFRAME_NO_TASKBAR;
-                }
+                gtk_window_set_type_hint(GTK_WINDOW(m_widget),
+                                         GDK_WINDOW_TYPE_HINT_UTILITY);
+
+                // On some WMs, like KDE, a TOOL_WINDOW will still show
+                // on the taskbar, but on Gnome a TOOL_WINDOW will not.
+                // For consistency between WMs and with Windows, we
+                // should set the NO_TASKBAR flag which will apply
+                // the set_skip_taskbar_hint if it is available,
+                // ensuring no taskbar entry will appear.
+                style |= wxFRAME_NO_TASKBAR;
             }
-#endif
         }
     }
 
@@ -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)
     {
-        if (style & wxFRAME_NO_TASKBAR)
-        {
-            gtk_window_set_skip_taskbar_hint(GTK_WINDOW(m_widget), TRUE);
-        }
+        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)
     {
-        if (style & wxSTAY_ON_TOP)
-        {
-            gtk_window_set_keep_above(GTK_WINDOW(m_widget), TRUE);
-        }
+        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);
-            }
+            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);
-            }
+            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_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);
+        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.
index bd5ceeb856f0b7a7a79ceb5edd6d0c8080f97b3c..9134aedf1a17b29e2086efb84b7bea09a00cab2f 100644 (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)
     {
index dc50c9b740091a1153f172abab94a8dff04363d3..b7a026e5b6ce71837f808a776574808586fa1b92 100644 (file)
@@ -68,46 +68,29 @@ 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 (
+    PangoFontFamily **families = NULL;
+    gint n_families = 0;
+    pango_context_list_families (
 #ifdef __WXGTK20__
-            gtk_widget_get_pango_context( wxGetRootWindow() ),
+        gtk_widget_get_pango_context( wxGetRootWindow() ),
 #else
-            wxTheApp->GetPangoContext(),
+        wxTheApp->GetPangoContext(),
 #endif
-            &families, &n_families );
-        qsort (families, n_families, sizeof (PangoFontFamily *), wxCompareFamilies);
+        &families, &n_families );
+    qsort (families, n_families, sizeof (PangoFontFamily *), wxCompareFamilies);
 
-        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])
-                                   ) )
+    for ( int i = 0; i < n_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]);
-                OnFacename(wxString(name, wxConvUTF8));
-            }
+        {
+            const gchar *name = pango_font_family_get_name(families[i]);
+            OnFacename(wxString(name, wxConvUTF8));
         }
-        g_free(families);
     }
+    g_free(families);
 
     return true;
 }
index 8ec7b7892d57ad690d4af308f4f8ae38fac00e69..7275663fe2565133f3cddd1b9c4a57a72e80a8d2 100644 (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)
     {