Fix wxGTK 1 build after gtk/gtk.h wrapper header addition
Changes of c0b0562533
to common code broke
wxGTK1 build, as wx/gtk/private/wrapgtk.h is for wxGTK 2+ only.
Fix this by handling wxGTK 1 separately and including gtk/gtk.h directly
for it.
Hopefully this code will be removed, together with the rest of wxGTK1
support, in some not so distant future.
This commit is contained in:
80
include/wx/gtk1/private/addremovectrl.h
Normal file
80
include/wx/gtk1/private/addremovectrl.h
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: wx/gtk/private/addremovectrl.h
|
||||||
|
// Purpose: GTK specific wxAddRemoveImpl implementation
|
||||||
|
// Author: Vadim Zeitlin
|
||||||
|
// Created: 2015-02-05
|
||||||
|
// Copyright: (c) 2015 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef _WX_GTK_PRIVATE_ADDREMOVECTRL_H_
|
||||||
|
#define _WX_GTK_PRIVATE_ADDREMOVECTRL_H_
|
||||||
|
|
||||||
|
#include "wx/artprov.h"
|
||||||
|
#include "wx/bmpbuttn.h"
|
||||||
|
#include "wx/toolbar.h"
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxAddRemoveImpl
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class wxAddRemoveImpl : public wxAddRemoveImplBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxAddRemoveImpl(wxAddRemoveAdaptor* adaptor,
|
||||||
|
wxAddRemoveCtrl* parent,
|
||||||
|
wxWindow* ctrlItems)
|
||||||
|
: wxAddRemoveImplBase(adaptor, parent, ctrlItems),
|
||||||
|
m_tbar(new wxToolBar(parent, wxID_ANY))
|
||||||
|
{
|
||||||
|
m_tbar->AddTool(wxID_ADD, wxString(), GetNamedBitmap("list-add"));
|
||||||
|
m_tbar->AddTool(wxID_REMOVE, wxString(), GetNamedBitmap("list-remove"));
|
||||||
|
|
||||||
|
#if defined(__WXGTK3__) && !defined(__WXUNIVERSAL__)
|
||||||
|
// Tweak the toolbar appearance to correspond to how the toolbars used
|
||||||
|
// in other GNOME applications for similar purposes look.
|
||||||
|
GtkToolbar* const toolbar = m_tbar->GTKGetToolbar();
|
||||||
|
GtkStyleContext* context = gtk_widget_get_style_context(GTK_WIDGET(toolbar));
|
||||||
|
gtk_style_context_add_class(context, GTK_STYLE_CLASS_INLINE_TOOLBAR);
|
||||||
|
gtk_style_context_set_junction_sides(context, GTK_JUNCTION_TOP);
|
||||||
|
#endif // GTK+3
|
||||||
|
|
||||||
|
wxSizer* const sizerTop = new wxBoxSizer(wxVERTICAL);
|
||||||
|
sizerTop->Add(ctrlItems, wxSizerFlags(1).Expand());
|
||||||
|
sizerTop->Add(m_tbar, wxSizerFlags().Expand());
|
||||||
|
parent->SetSizer(sizerTop);
|
||||||
|
|
||||||
|
m_tbar->Bind(wxEVT_UPDATE_UI,
|
||||||
|
&wxAddRemoveImplBase::OnUpdateUIAdd, this, wxID_ADD);
|
||||||
|
m_tbar->Bind(wxEVT_UPDATE_UI,
|
||||||
|
&wxAddRemoveImplBase::OnUpdateUIRemove, this, wxID_REMOVE);
|
||||||
|
|
||||||
|
m_tbar->Bind(wxEVT_TOOL, &wxAddRemoveImplBase::OnAdd, this, wxID_ADD);
|
||||||
|
m_tbar->Bind(wxEVT_TOOL, &wxAddRemoveImplBase::OnRemove, this, wxID_REMOVE);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void SetButtonsToolTips(const wxString& addtip,
|
||||||
|
const wxString& removetip) wxOVERRIDE
|
||||||
|
{
|
||||||
|
m_tbar->SetToolShortHelp(wxID_ADD, addtip);
|
||||||
|
m_tbar->SetToolShortHelp(wxID_REMOVE, removetip);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
static wxBitmap GetNamedBitmap(const wxString& name)
|
||||||
|
{
|
||||||
|
// GTK UI guidelines recommend using "symbolic" versions of the icons
|
||||||
|
// for these buttons, so try them first but fall back to the normal
|
||||||
|
// ones if symbolic theme is not installed.
|
||||||
|
wxBitmap bmp = wxArtProvider::GetBitmap(name + "-symbolic", wxART_MENU);
|
||||||
|
if ( !bmp.IsOk() )
|
||||||
|
bmp = wxArtProvider::GetBitmap(name, wxART_MENU);
|
||||||
|
return bmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxToolBar* const m_tbar;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _WX_GTK_PRIVATE_ADDREMOVECTRL_H_
|
@@ -145,8 +145,10 @@ protected:
|
|||||||
|
|
||||||
#ifdef __WXOSX__
|
#ifdef __WXOSX__
|
||||||
#include "wx/osx/private/addremovectrl.h"
|
#include "wx/osx/private/addremovectrl.h"
|
||||||
#elif defined(__WXGTK__)
|
#elif defined(__WXGTK20__)
|
||||||
#include "wx/gtk/private/addremovectrl.h"
|
#include "wx/gtk/private/addremovectrl.h"
|
||||||
|
#elif defined(__WXGTK__)
|
||||||
|
#include "wx/gtk1/private/addremovectrl.h"
|
||||||
#else
|
#else
|
||||||
#include "wx/generic/private/addremovectrl.h"
|
#include "wx/generic/private/addremovectrl.h"
|
||||||
#endif
|
#endif
|
||||||
|
@@ -43,7 +43,12 @@
|
|||||||
|
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
#include "wx/renderer.h"
|
#include "wx/renderer.h"
|
||||||
#include "wx/gtk/private/wrapgtk.h"
|
#ifdef __WXGTK20__
|
||||||
|
#include "wx/gtk/private/wrapgtk.h"
|
||||||
|
#else
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
#define gtk_widget_is_drawable GTK_WIDGET_DRAWABLE
|
||||||
|
#endif
|
||||||
#ifdef __WXGTK3__
|
#ifdef __WXGTK3__
|
||||||
#include "wx/graphics.h"
|
#include "wx/graphics.h"
|
||||||
#include "wx/gtk/private.h"
|
#include "wx/gtk/private.h"
|
||||||
|
@@ -41,8 +41,11 @@
|
|||||||
#include "wx/scrolbar.h"
|
#include "wx/scrolbar.h"
|
||||||
#endif // __WXUNIVERSAL__
|
#endif // __WXUNIVERSAL__
|
||||||
|
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK20__
|
||||||
#include "wx/gtk/private/wrapgtk.h"
|
#include "wx/gtk/private/wrapgtk.h"
|
||||||
|
#elif defined(__WXGTK__)
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
#define gtk_widget_get_window(x) x->window
|
||||||
#elif defined(__WXMSW__)
|
#elif defined(__WXMSW__)
|
||||||
#include "wx/msw/private.h"
|
#include "wx/msw/private.h"
|
||||||
#elif defined(__WXX11__)
|
#elif defined(__WXX11__)
|
||||||
|
@@ -103,13 +103,17 @@
|
|||||||
#include "wx/msw/private.h"
|
#include "wx/msw/private.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_GUI && defined(__WXGTK__)
|
#if wxUSE_GUI
|
||||||
#include "wx/gtk/private/wrapgtk.h" // for GTK_XXX_VERSION constants
|
// Include the definitions of GTK_XXX_VERSION constants.
|
||||||
|
#ifdef __WXGTK20__
|
||||||
|
#include "wx/gtk/private/wrapgtk.h"
|
||||||
|
#elif defined(__WXGTK__)
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
#elif defined(__WXQT__)
|
||||||
|
#include <QtCore/QtGlobal> // for QT_VERSION_STR constants
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_GUI && defined(__WXQT__)
|
|
||||||
#include <QtCore/QtGlobal> // for QT_VERSION_STR constants
|
|
||||||
#endif
|
|
||||||
#if wxUSE_BASE
|
#if wxUSE_BASE
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
@@ -83,7 +83,11 @@ using namespace std;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
|
#ifdef __WXGTK20__
|
||||||
#include "wx/gtk/private/wrapgtk.h"
|
#include "wx/gtk/private/wrapgtk.h"
|
||||||
|
#else // GTK+ 1.x
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
#endif
|
||||||
#include "wx/fontutil.h"
|
#include "wx/fontutil.h"
|
||||||
#ifndef __WXGTK3__
|
#ifndef __WXGTK3__
|
||||||
#include "wx/gtk/dc.h"
|
#include "wx/gtk/dc.h"
|
||||||
|
@@ -64,7 +64,11 @@
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#if defined(__WXGTK__)
|
#if defined(__WXGTK__)
|
||||||
#include "wx/gtk/private/wrapgtk.h"
|
#ifdef __WXGTK20__
|
||||||
|
#include "wx/gtk/private/wrapgtk.h"
|
||||||
|
#else // GTK+ 1.x
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
#endif
|
||||||
#include <gdk/gdkx.h>
|
#include <gdk/gdkx.h>
|
||||||
#define GetDisplay() GDK_DISPLAY()
|
#define GetDisplay() GDK_DISPLAY()
|
||||||
#define GetXWindow(wxwin) GDK_WINDOW_XWINDOW((wxwin)->m_widget->window)
|
#define GetXWindow(wxwin) GDK_WINDOW_XWINDOW((wxwin)->m_widget->window)
|
||||||
|
@@ -37,7 +37,12 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WXGTK__
|
#ifdef __WXGTK__
|
||||||
|
#ifdef __WXGTK20__
|
||||||
#include "wx/gtk/private/wrapgtk.h"
|
#include "wx/gtk/private/wrapgtk.h"
|
||||||
|
#else // GTK+ 1.x
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
#define GDK_WINDOWING_X11
|
||||||
|
#endif
|
||||||
#ifdef GDK_WINDOWING_X11
|
#ifdef GDK_WINDOWING_X11
|
||||||
#include <gdk/gdkx.h>
|
#include <gdk/gdkx.h>
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user