removed all compile- and run-time checks for GTK+ < 2.4; don't include the generic files which are now never used in wxGTK in the build
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49660 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -25,6 +25,13 @@ class WXDLLIMPEXP_FWD_CORE wxColourPickerEvent;
|
|||||||
extern WXDLLEXPORT_DATA(const wxChar) wxColourPickerWidgetNameStr[];
|
extern WXDLLEXPORT_DATA(const wxChar) wxColourPickerWidgetNameStr[];
|
||||||
extern WXDLLEXPORT_DATA(const wxChar) wxColourPickerCtrlNameStr[];
|
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
|
// wxColourPickerWidgetBase: a generic abstract interface which must be
|
||||||
@@ -70,7 +77,7 @@ protected:
|
|||||||
// same prototype for their contructor (and also explains why we use
|
// same prototype for their contructor (and also explains why we use
|
||||||
// define instead of a typedef)
|
// define instead of a typedef)
|
||||||
// since GTK > 2.4, there is GtkColorButton
|
// since GTK > 2.4, there is GtkColorButton
|
||||||
#if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__)
|
#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
|
||||||
#include "wx/gtk/clrpicker.h"
|
#include "wx/gtk/clrpicker.h"
|
||||||
#define wxColourPickerWidget wxColourButton
|
#define wxColourPickerWidget wxColourButton
|
||||||
#else
|
#else
|
||||||
|
@@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
#include "wx/control.h"
|
#include "wx/control.h"
|
||||||
|
|
||||||
|
// class name
|
||||||
|
extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxCollapsiblePaneNameStr[];
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxCollapsiblePaneBase: interface for wxCollapsiblePane
|
// wxCollapsiblePaneBase: interface for wxCollapsiblePane
|
||||||
@@ -90,7 +92,7 @@ typedef void (wxEvtHandler::*wxCollapsiblePaneEventFunction)(wxCollapsiblePaneEv
|
|||||||
wx__DECLARE_EVT1(wxEVT_COMMAND_COLLPANE_CHANGED, id, wxCollapsiblePaneEventHandler(fn))
|
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"
|
#include "wx/gtk/collpane.h"
|
||||||
#else
|
#else
|
||||||
#include "wx/generic/collpaneg.h"
|
#include "wx/generic/collpaneg.h"
|
||||||
|
@@ -106,7 +106,7 @@ protected:
|
|||||||
#define wxDirDialog wxGenericDirDialog
|
#define wxDirDialog wxGenericDirDialog
|
||||||
#elif defined(__WXMSW__)
|
#elif defined(__WXMSW__)
|
||||||
#include "wx/msw/dirdlg.h" // Native MSW
|
#include "wx/msw/dirdlg.h" // Native MSW
|
||||||
#elif defined(__WXGTK24__)
|
#elif defined(__WXGTK20__)
|
||||||
#include "wx/gtk/dirdlg.h" // Native GTK for gtk2.4
|
#include "wx/gtk/dirdlg.h" // Native GTK for gtk2.4
|
||||||
#elif defined(__WXGTK__)
|
#elif defined(__WXGTK__)
|
||||||
#include "wx/generic/dirdlgg.h"
|
#include "wx/generic/dirdlgg.h"
|
||||||
|
@@ -73,7 +73,7 @@ void GenerateFolderChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd );
|
|||||||
void GenerateSelectionChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd );
|
void GenerateSelectionChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd );
|
||||||
void GenerateFileActivatedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd, const wxString filename = wxEmptyString );
|
void GenerateFileActivatedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd, const wxString filename = wxEmptyString );
|
||||||
|
|
||||||
#if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__)
|
#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
|
||||||
#define wxFileCtrl wxGtkFileCtrl
|
#define wxFileCtrl wxGtkFileCtrl
|
||||||
#include "wx/gtk/filectrl.h"
|
#include "wx/gtk/filectrl.h"
|
||||||
#else
|
#else
|
||||||
|
@@ -192,7 +192,7 @@ wxSaveFileSelector(const wxString& what,
|
|||||||
#include "wx/msw/filedlg.h"
|
#include "wx/msw/filedlg.h"
|
||||||
#elif defined(__WXMOTIF__)
|
#elif defined(__WXMOTIF__)
|
||||||
#include "wx/motif/filedlg.h"
|
#include "wx/motif/filedlg.h"
|
||||||
#elif defined(__WXGTK24__)
|
#elif defined(__WXGTK20__)
|
||||||
#include "wx/gtk/filedlg.h" // GTK+ > 2.4 has native version
|
#include "wx/gtk/filedlg.h" // GTK+ > 2.4 has native version
|
||||||
#elif defined(__WXGTK__)
|
#elif defined(__WXGTK__)
|
||||||
#include "wx/gtk1/filedlg.h"
|
#include "wx/gtk1/filedlg.h"
|
||||||
|
@@ -66,8 +66,11 @@ protected:
|
|||||||
// uses the currently selected font to draw the label of the button
|
// uses the currently selected font to draw the label of the button
|
||||||
#define wxFNTP_USEFONT_FOR_LABEL 0x0010
|
#define wxFNTP_USEFONT_FOR_LABEL 0x0010
|
||||||
|
|
||||||
// since GTK > 2.4, there is GtkFontButton
|
#define wxFONTBTN_DEFAULT_STYLE \
|
||||||
#if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__)
|
(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"
|
#include "wx/gtk/fontpicker.h"
|
||||||
#define wxFontPickerWidget wxFontButton
|
#define wxFontPickerWidget wxFontButton
|
||||||
#else
|
#else
|
||||||
|
@@ -19,13 +19,6 @@
|
|||||||
// wxGenericColourButton: a button which brings up a wxColourDialog
|
// 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,
|
class WXDLLIMPEXP_CORE wxGenericColourButton : public wxButton,
|
||||||
public wxColourPickerWidgetBase
|
public wxColourPickerWidgetBase
|
||||||
{
|
{
|
||||||
|
@@ -16,9 +16,6 @@
|
|||||||
class WXDLLIMPEXP_FWD_CORE wxButton;
|
class WXDLLIMPEXP_FWD_CORE wxButton;
|
||||||
class WXDLLIMPEXP_FWD_CORE wxStaticLine;
|
class WXDLLIMPEXP_FWD_CORE wxStaticLine;
|
||||||
|
|
||||||
// class name
|
|
||||||
extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxCollapsiblePaneNameStr[];
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxGenericCollapsiblePane
|
// wxGenericCollapsiblePane
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -19,9 +19,6 @@
|
|||||||
// wxGenericFontButton: a button which brings up a wxColourDialog
|
// 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,
|
class WXDLLIMPEXP_CORE wxGenericFontButton : public wxButton,
|
||||||
public wxFontPickerWidgetBase
|
public wxFontPickerWidgetBase
|
||||||
{
|
{
|
||||||
|
@@ -12,16 +12,12 @@
|
|||||||
#ifndef _WX_GTK_CLRPICKER_H_
|
#ifndef _WX_GTK_CLRPICKER_H_
|
||||||
#define _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
|
// wxColourButton
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxColourButton : public wxGenericColourButton
|
class WXDLLIMPEXP_CORE wxColourButton : public wxButton,
|
||||||
|
public wxColourPickerWidgetBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxColourButton() : m_topParent(NULL) {}
|
wxColourButton() : m_topParent(NULL) {}
|
||||||
@@ -38,11 +34,6 @@ public:
|
|||||||
Create(parent, id, initial, pos, size, style, validator, name);
|
Create(parent, id, initial, pos, size, style, validator, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~wxColourButton();
|
|
||||||
|
|
||||||
|
|
||||||
public: // overrides
|
|
||||||
|
|
||||||
bool Create(wxWindow *parent,
|
bool Create(wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxColour& initial = *wxBLACK,
|
const wxColour& initial = *wxBLACK,
|
||||||
@@ -52,6 +43,8 @@ public: // overrides
|
|||||||
const wxValidator& validator = wxDefaultValidator,
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
const wxString& name = wxColourPickerWidgetNameStr);
|
const wxString& name = wxColourPickerWidgetNameStr);
|
||||||
|
|
||||||
|
virtual ~wxColourButton();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void UpdateColour();
|
void UpdateColour();
|
||||||
|
|
||||||
|
@@ -12,13 +12,11 @@
|
|||||||
#ifndef _WX_COLLAPSABLE_PANEL_H_GTK_
|
#ifndef _WX_COLLAPSABLE_PANEL_H_GTK_
|
||||||
#define _WX_COLLAPSABLE_PANEL_H_GTK_
|
#define _WX_COLLAPSABLE_PANEL_H_GTK_
|
||||||
|
|
||||||
#include "wx/generic/collpaneg.h"
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxCollapsiblePane
|
// wxCollapsiblePane
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxCollapsiblePane : public wxGenericCollapsiblePane
|
class WXDLLIMPEXP_CORE wxCollapsiblePane : public wxCollapsiblePaneBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxCollapsiblePane() { Init(); }
|
wxCollapsiblePane() { Init(); }
|
||||||
@@ -51,9 +49,12 @@ public:
|
|||||||
const wxValidator& val = wxDefaultValidator,
|
const wxValidator& val = wxDefaultValidator,
|
||||||
const wxString& name = wxCollapsiblePaneNameStr);
|
const wxString& name = wxCollapsiblePaneNameStr);
|
||||||
|
|
||||||
void Collapse(bool collapse = true);
|
virtual void Collapse(bool collapse = true);
|
||||||
bool IsCollapsed() const;
|
virtual bool IsCollapsed() const;
|
||||||
void SetLabel(const wxString &str);
|
virtual void SetLabel(const wxString& str);
|
||||||
|
|
||||||
|
virtual wxWindow *GetPane() const { return m_pPane; }
|
||||||
|
virtual wxString GetLabel() const { return m_strLabel; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
@@ -62,6 +63,11 @@ public: // used by GTK callbacks
|
|||||||
bool m_bIgnoreNextChange;
|
bool m_bIgnoreNextChange;
|
||||||
wxSize m_szCollapsed;
|
wxSize m_szCollapsed;
|
||||||
|
|
||||||
|
wxWindow *m_pPane;
|
||||||
|
|
||||||
|
// the button label without ">>" or "<<"
|
||||||
|
wxString m_strLabel;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnSize(wxSizeEvent&);
|
void OnSize(wxSizeEvent&);
|
||||||
|
|
||||||
|
@@ -11,6 +11,8 @@
|
|||||||
#ifndef _WX_GTK_COMBOBOX_H_
|
#ifndef _WX_GTK_COMBOBOX_H_
|
||||||
#define _WX_GTK_COMBOBOX_H_
|
#define _WX_GTK_COMBOBOX_H_
|
||||||
|
|
||||||
|
typedef struct _GtkEntry GtkEntry;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxComboBox
|
// wxComboBox
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -94,7 +96,6 @@ public:
|
|||||||
|
|
||||||
virtual void SetFocus();
|
virtual void SetFocus();
|
||||||
|
|
||||||
void OnSize( wxSizeEvent &event );
|
|
||||||
void OnChar( wxKeyEvent &event );
|
void OnChar( wxKeyEvent &event );
|
||||||
|
|
||||||
// Standard event handling
|
// Standard event handling
|
||||||
@@ -131,7 +132,6 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
// From wxWindowGTK:
|
// From wxWindowGTK:
|
||||||
virtual void DoApplyWidgetStyle(GtkRcStyle *style);
|
|
||||||
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
|
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
|
||||||
|
|
||||||
// From wxItemContainer:
|
// From wxItemContainer:
|
||||||
@@ -150,6 +150,9 @@ protected:
|
|||||||
// override this and return true.
|
// override this and return true.
|
||||||
virtual bool UseGTKStyleBase() const { return true; }
|
virtual bool UseGTKStyleBase() const { return true; }
|
||||||
|
|
||||||
|
// return the GtkEntry part of the combobox
|
||||||
|
GtkEntry *GetEntry() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// From wxTextEntry:
|
// From wxTextEntry:
|
||||||
virtual const wxWindow *GetEditableWindow() const { return this; }
|
virtual const wxWindow *GetEditableWindow() const { return this; }
|
||||||
|
@@ -10,13 +10,11 @@
|
|||||||
#ifndef __GTKDIRDLGH__
|
#ifndef __GTKDIRDLGH__
|
||||||
#define __GTKDIRDLGH__
|
#define __GTKDIRDLGH__
|
||||||
|
|
||||||
#include "wx/generic/dirdlgg.h"
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// wxDirDialog
|
// wxDirDialog
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxDirDialog : public wxGenericDirDialog
|
class WXDLLIMPEXP_CORE wxDirDialog : public wxDirDialogBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxDirDialog() { }
|
wxDirDialog() { }
|
||||||
@@ -37,9 +35,6 @@ public: // overrides from wxGenericDirDialog
|
|||||||
wxString GetPath() const;
|
wxString GetPath() const;
|
||||||
void SetPath(const wxString& path);
|
void SetPath(const wxString& path);
|
||||||
|
|
||||||
virtual int ShowModal();
|
|
||||||
virtual bool Show( bool show = true );
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// override this from wxTLW since the native
|
// override this from wxTLW since the native
|
||||||
@@ -50,9 +45,10 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void OnFakeOk( wxCommandEvent &event );
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxDirDialog)
|
DECLARE_DYNAMIC_CLASS(wxDirDialog)
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
void OnFakeOk( wxCommandEvent &event );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __GTKDIRDLGH__
|
#endif // __GTKDIRDLGH__
|
||||||
|
@@ -12,16 +12,12 @@
|
|||||||
#ifndef _WX_GTK_FONTPICKER_H_
|
#ifndef _WX_GTK_FONTPICKER_H_
|
||||||
#define _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
|
// wxFontButton
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLIMPEXP_CORE wxFontButton : public wxGenericFontButton
|
class WXDLLIMPEXP_CORE wxFontButton : public wxButton,
|
||||||
|
public wxFontPickerWidgetBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxFontButton() {}
|
wxFontButton() {}
|
||||||
@@ -37,11 +33,6 @@ public:
|
|||||||
Create(parent, id, initial, pos, size, style, validator, name);
|
Create(parent, id, initial, pos, size, style, validator, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~wxFontButton();
|
|
||||||
|
|
||||||
|
|
||||||
public: // overrides
|
|
||||||
|
|
||||||
bool Create(wxWindow *parent,
|
bool Create(wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxFont& initial = wxNullFont,
|
const wxFont& initial = wxNullFont,
|
||||||
@@ -51,6 +42,8 @@ public: // overrides
|
|||||||
const wxValidator& validator = wxDefaultValidator,
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
const wxString& name = wxFontPickerWidgetNameStr);
|
const wxString& name = wxFontPickerWidgetNameStr);
|
||||||
|
|
||||||
|
virtual ~wxFontButton();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void UpdateFont();
|
void UpdateFont();
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif //__BORLANDC__
|
#endif //__BORLANDC__
|
||||||
|
|
||||||
#if wxUSE_ANIMATIONCTRL && (!defined(__WXGTK20__) || defined(__WXUNIVERSAL__))
|
#if wxUSE_ANIMATIONCTRL
|
||||||
|
|
||||||
#include "wx/animate.h"
|
#include "wx/animate.h"
|
||||||
|
|
||||||
@@ -687,5 +687,5 @@ void wxAnimationCtrl::OnSize(wxSizeEvent &WXUNUSED(event))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_ANIMATIONCTRL
|
#endif // wxUSE_ANIMATIONCTRL
|
||||||
|
|
||||||
|
@@ -493,7 +493,7 @@ void wxButtonToolBar::OnCommand(wxCommandEvent& event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// paints a border
|
// paints a border
|
||||||
void wxButtonToolBar::OnPaint(wxPaintEvent& event)
|
void wxButtonToolBar::OnPaint(wxPaintEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxPaintDC dc(this);
|
wxPaintDC dc(this);
|
||||||
|
|
||||||
|
@@ -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
|
// FIXME: at least under wxCE and wxGTK1 the background is black if we don't do
|
||||||
// this, no idea why...
|
// this, no idea why...
|
||||||
#if defined(__WXWINCE__) || (defined(__WXGTK__) && !defined(__WXGTK20__))
|
#if defined(__WXWINCE__) || defined(__WXGTK__)
|
||||||
SetBackgroundColour(parent->GetBackgroundColour());
|
SetBackgroundColour(parent->GetBackgroundColour());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -259,8 +259,6 @@ int wxGenericCollapsiblePane::GetBorder() const
|
|||||||
{
|
{
|
||||||
#if defined( __WXMAC__ )
|
#if defined( __WXMAC__ )
|
||||||
return 6;
|
return 6;
|
||||||
#elif defined(__WXGTK20__)
|
|
||||||
return 3;
|
|
||||||
#elif defined(__WXMSW__)
|
#elif defined(__WXMSW__)
|
||||||
wxASSERT(m_pButton);
|
wxASSERT(m_pButton);
|
||||||
return m_pButton->ConvertDialogToPixels(wxSize(2, 0)).x;
|
return m_pButton->ConvertDialogToPixels(wxSize(2, 0)).x;
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_COLOURDLG && (!defined(__WXGTK20__) || defined(__WXUNIVERSAL__))
|
#if wxUSE_COLOURDLG
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
@@ -581,4 +581,4 @@ void wxGenericColourDialog::OnBlueSlider(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
#endif // wxUSE_SLIDER
|
#endif // wxUSE_SLIDER
|
||||||
|
|
||||||
#endif // wxUSE_COLOURDLG && !defined(__WXGTK20__)
|
#endif // wxUSE_COLOURDLG
|
||||||
|
@@ -1330,7 +1330,7 @@ void wxDirFilterListCtrl::FillFilterList(const wxString& filter, int defaultFilt
|
|||||||
// wxFileIconsTable icons
|
// wxFileIconsTable icons
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifndef __WXGTK24__
|
#ifndef __WXGTK20__
|
||||||
/* Computer (c) Julian Smart */
|
/* Computer (c) Julian Smart */
|
||||||
static const char * file_icons_tbl_computer_xpm[] = {
|
static const char * file_icons_tbl_computer_xpm[] = {
|
||||||
/* columns rows colors chars-per-pixel */
|
/* columns rows colors chars-per-pixel */
|
||||||
@@ -1395,7 +1395,7 @@ static const char * file_icons_tbl_computer_xpm[] = {
|
|||||||
" dfffffffffffffd",
|
" dfffffffffffffd",
|
||||||
" "
|
" "
|
||||||
};
|
};
|
||||||
#endif // GTK+ < 2.4
|
#endif // !GTK+ 2
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxFileIconsTable & friends
|
// wxFileIconsTable & friends
|
||||||
@@ -1464,7 +1464,7 @@ void wxFileIconsTable::Create()
|
|||||||
wxART_CMN_DIALOG,
|
wxART_CMN_DIALOG,
|
||||||
wxSize(16, 16)));
|
wxSize(16, 16)));
|
||||||
// computer
|
// computer
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK20__
|
||||||
// GTK24 uses this icon in the file open dialog
|
// GTK24 uses this icon in the file open dialog
|
||||||
m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_HARDDISK,
|
m_smallImageList->Add(wxArtProvider::GetBitmap(wxART_HARDDISK,
|
||||||
wxART_CMN_DIALOG,
|
wxART_CMN_DIALOG,
|
||||||
|
@@ -451,7 +451,8 @@ bool wxGenericDragImage::Hide()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// More efficient: erase and redraw simultaneously if possible
|
// 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)
|
bool eraseOld, bool drawNew)
|
||||||
{
|
{
|
||||||
if (!m_windowDC)
|
if (!m_windowDC)
|
||||||
|
@@ -257,11 +257,8 @@ wxBitmap wxGTK2ArtProvider::CreateBitmap(const wxArtID& id,
|
|||||||
stockid = id.ToAscii();
|
stockid = id.ToAscii();
|
||||||
|
|
||||||
GdkPixbuf *pixbuf = CreateStockIcon(stockid, stocksize);
|
GdkPixbuf *pixbuf = CreateStockIcon(stockid, stocksize);
|
||||||
|
if (!pixbuf)
|
||||||
if (!pixbuf && !gtk_check_version(2,4,0))
|
|
||||||
{
|
|
||||||
pixbuf = CreateThemeIcon(stockid, stocksize, size);
|
pixbuf = CreateThemeIcon(stockid, stocksize, size);
|
||||||
}
|
|
||||||
|
|
||||||
if (pixbuf && size != wxDefaultSize &&
|
if (pixbuf && size != wxDefaultSize &&
|
||||||
(size.x != gdk_pixbuf_get_width(pixbuf) ||
|
(size.x != gdk_pixbuf_get_width(pixbuf) ||
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#if wxUSE_COLOURPICKERCTRL && defined(__WXGTK24__)
|
#if wxUSE_COLOURPICKERCTRL
|
||||||
|
|
||||||
#include "wx/clrpicker.h"
|
#include "wx/clrpicker.h"
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ static void gtk_clrbutton_setcolor_callback(GtkColorButton *widget,
|
|||||||
// wxColourButton
|
// wxColourButton
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxColourButton, wxGenericColourButton)
|
IMPLEMENT_DYNAMIC_CLASS(wxColourButton, wxButton)
|
||||||
|
|
||||||
bool wxColourButton::Create( wxWindow *parent, wxWindowID id,
|
bool wxColourButton::Create( wxWindow *parent, wxWindowID id,
|
||||||
const wxColour &col,
|
const wxColour &col,
|
||||||
@@ -59,32 +59,27 @@ bool wxColourButton::Create( wxWindow *parent, wxWindowID id,
|
|||||||
long style, const wxValidator& validator,
|
long style, const wxValidator& validator,
|
||||||
const wxString &name )
|
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 ) ||
|
wxFAIL_MSG( wxT("wxColourButton creation failed") );
|
||||||
!wxControl::CreateBase(parent, id, pos, size, style, validator, name))
|
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);
|
|
||||||
|
|
||||||
// GtkColourButton signals
|
|
||||||
g_signal_connect(m_widget, "color-set",
|
|
||||||
G_CALLBACK(gtk_clrbutton_setcolor_callback), this);
|
|
||||||
|
|
||||||
|
|
||||||
m_parent->DoAddChild( this );
|
|
||||||
|
|
||||||
PostCreation(size);
|
|
||||||
SetInitialSize(size);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return wxGenericColourButton::Create(parent, id, col, pos, size,
|
m_colour = col;
|
||||||
style, validator, name);
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
|
PostCreation(size);
|
||||||
|
SetInitialSize(size);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,10 +89,7 @@ wxColourButton::~wxColourButton()
|
|||||||
|
|
||||||
void wxColourButton::UpdateColour()
|
void wxColourButton::UpdateColour()
|
||||||
{
|
{
|
||||||
if (!gtk_check_version(2,4,0))
|
gtk_color_button_set_color(GTK_COLOR_BUTTON(m_widget), m_colour.GetColor());
|
||||||
gtk_color_button_set_color(GTK_COLOR_BUTTON(m_widget), m_colour.GetColor());
|
|
||||||
else
|
|
||||||
wxGenericColourButton::UpdateColour();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_COLOURPICKERCTRL && defined(__WXGTK24__)
|
#endif // wxUSE_COLOURPICKERCTRL
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#if wxUSE_COLLPANE && defined(__WXGTK24__) && !defined(__WXUNIVERSAL__)
|
#if wxUSE_COLLPANE && !defined(__WXUNIVERSAL__)
|
||||||
|
|
||||||
#include "wx/collpane.h"
|
#include "wx/collpane.h"
|
||||||
#include "wx/toplevel.h"
|
#include "wx/toplevel.h"
|
||||||
@@ -26,6 +26,15 @@
|
|||||||
|
|
||||||
#include "wx/gtk/private.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
|
// implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -153,9 +162,9 @@ gtk_collapsiblepane_insert_callback(wxWindowGTK* parent, wxWindowGTK* child)
|
|||||||
// wxCollapsiblePane
|
// 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)
|
EVT_SIZE(wxCollapsiblePane::OnSize)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
@@ -168,10 +177,6 @@ bool wxCollapsiblePane::Create(wxWindow *parent,
|
|||||||
const wxValidator& val,
|
const wxValidator& val,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
if (gtk_check_version(2,4,0))
|
|
||||||
return wxGenericCollapsiblePane::Create(parent, id, label,
|
|
||||||
pos, size, style, val, name);
|
|
||||||
|
|
||||||
m_bIgnoreNextChange = false;
|
m_bIgnoreNextChange = false;
|
||||||
|
|
||||||
if ( !PreCreation( parent, pos, size ) ||
|
if ( !PreCreation( parent, pos, size ) ||
|
||||||
@@ -211,60 +216,42 @@ bool wxCollapsiblePane::Create(wxWindow *parent,
|
|||||||
|
|
||||||
wxSize wxCollapsiblePane::DoGetBestSize() const
|
wxSize wxCollapsiblePane::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
if (!gtk_check_version(2,4,0))
|
wxASSERT_MSG( m_widget, wxT("DoGetBestSize called before creation") );
|
||||||
{
|
|
||||||
wxASSERT_MSG( m_widget, wxT("DoGetBestSize called before creation") );
|
|
||||||
|
|
||||||
GtkRequisition req;
|
GtkRequisition req;
|
||||||
req.width = 2;
|
req.width = 2;
|
||||||
req.height = 2;
|
req.height = 2;
|
||||||
(* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_widget) )->size_request )
|
(* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_widget) )->size_request )
|
||||||
(m_widget, &req );
|
(m_widget, &req );
|
||||||
|
|
||||||
// notice that we do not cache our best size here as it changes
|
// notice that we do not cache our best size here as it changes
|
||||||
// all times the user expands/hide our pane
|
// all times the user expands/hide our pane
|
||||||
return wxSize(req.width, req.height);
|
return wxSize(req.width, req.height);
|
||||||
}
|
|
||||||
|
|
||||||
return wxGenericCollapsiblePane::DoGetBestSize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxCollapsiblePane::Collapse(bool collapse)
|
void wxCollapsiblePane::Collapse(bool collapse)
|
||||||
{
|
{
|
||||||
if (!gtk_check_version(2,4,0))
|
// optimization
|
||||||
{
|
if (IsCollapsed() == collapse)
|
||||||
// optimization
|
return;
|
||||||
if (IsCollapsed() == collapse)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// do not send event in next signal handler call
|
// do not send event in next signal handler call
|
||||||
m_bIgnoreNextChange = true;
|
m_bIgnoreNextChange = true;
|
||||||
gtk_expander_set_expanded(GTK_EXPANDER(m_widget), !collapse);
|
gtk_expander_set_expanded(GTK_EXPANDER(m_widget), !collapse);
|
||||||
}
|
|
||||||
else
|
|
||||||
wxGenericCollapsiblePane::Collapse(collapse);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxCollapsiblePane::IsCollapsed() const
|
bool wxCollapsiblePane::IsCollapsed() const
|
||||||
{
|
{
|
||||||
if (!gtk_check_version(2,4,0))
|
return !gtk_expander_get_expanded(GTK_EXPANDER(m_widget));
|
||||||
return !gtk_expander_get_expanded(GTK_EXPANDER(m_widget));
|
|
||||||
|
|
||||||
return wxGenericCollapsiblePane::IsCollapsed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxCollapsiblePane::SetLabel(const wxString &str)
|
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()
|
// 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!
|
// we may get the size of the control with the pane size summed up if we are expanded!
|
||||||
//m_szCollapsed.x = GetBestSize().x;
|
//m_szCollapsed.x = GetBestSize().x;
|
||||||
}
|
|
||||||
else
|
|
||||||
wxGenericCollapsiblePane::SetLabel(str);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxCollapsiblePane::OnSize(wxSizeEvent &ev)
|
void wxCollapsiblePane::OnSize(wxSizeEvent &ev)
|
||||||
@@ -287,5 +274,5 @@ void wxCollapsiblePane::OnSize(wxSizeEvent &ev)
|
|||||||
m_pPane->Layout();
|
m_pPane->Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_COLLPANE && defined(__WXGTK24__) && !defined(__WXUNIVERSAL__)
|
#endif // wxUSE_COLLPANE && !defined(__WXUNIVERSAL__)
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_COLOURDLG && defined(__WXGTK20__)
|
#if wxUSE_COLOURDLG
|
||||||
|
|
||||||
#include "wx/colordlg.h"
|
#include "wx/colordlg.h"
|
||||||
|
|
||||||
@@ -140,5 +140,5 @@ void wxColourDialog::DialogToColourData()
|
|||||||
g_free(pal);
|
g_free(pal);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_COLOURDLG && defined(__WXGTK20__)
|
#endif // wxUSE_COLOURDLG
|
||||||
|
|
||||||
|
@@ -21,148 +21,12 @@
|
|||||||
#include "wx/arrstr.h"
|
#include "wx/arrstr.h"
|
||||||
#endif
|
#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"
|
#include "wx/gtk/private.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// data
|
// GTK callbacks
|
||||||
//-----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
extern bool g_blockEventsOnDrag;
|
|
||||||
static int g_SelectionBeforePopup = wxID_NONE; // this means the popup is hidden
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// "changed" - typing and list item matches get changed, select-child
|
|
||||||
// if it doesn't match an item then just get a single changed
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
static void
|
|
||||||
gtkcombo_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
|
|
||||||
{
|
|
||||||
if (combo->m_ignoreNextUpdate)
|
|
||||||
{
|
|
||||||
combo->m_ignoreNextUpdate = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!combo->m_hasVMT) return;
|
|
||||||
|
|
||||||
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
|
|
||||||
event.SetString( combo->GetValue() );
|
|
||||||
event.SetEventObject( combo );
|
|
||||||
combo->GetEventHandler()->ProcessEvent( event );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
static void
|
|
||||||
gtkcombo_dummy_callback(GtkEntry *WXUNUSED(entry), GtkCombo *WXUNUSED(combo))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
static void
|
|
||||||
gtkcombo_popup_hide_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo)
|
|
||||||
{
|
|
||||||
// when the popup is hidden, throw a SELECTED event only if the combobox
|
|
||||||
// selection changed.
|
|
||||||
const int curSelection = combo->GetCurrentSelection();
|
|
||||||
|
|
||||||
const bool hasChanged = curSelection != g_SelectionBeforePopup;
|
|
||||||
|
|
||||||
// reset the selection flag to value meaning that it is hidden and do it
|
|
||||||
// now, before generating the events, so that GetSelection() returns the
|
|
||||||
// new value from the event handler
|
|
||||||
g_SelectionBeforePopup = wxID_NONE;
|
|
||||||
|
|
||||||
if ( hasChanged )
|
|
||||||
{
|
|
||||||
wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, combo->GetId() );
|
|
||||||
event.SetInt( curSelection );
|
|
||||||
event.SetString( combo->GetStringSelection() );
|
|
||||||
event.SetEventObject( combo );
|
|
||||||
combo->GetEventHandler()->ProcessEvent( event );
|
|
||||||
|
|
||||||
// for consistency with the other ports, send TEXT event
|
|
||||||
wxCommandEvent event2( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
|
|
||||||
event2.SetString( combo->GetStringSelection() );
|
|
||||||
event2.SetEventObject( combo );
|
|
||||||
combo->GetEventHandler()->ProcessEvent( event2 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
static void
|
|
||||||
gtkcombo_popup_show_callback(GtkCombo *WXUNUSED(gtk_combo), wxComboBox *combo)
|
|
||||||
{
|
|
||||||
// store the combobox selection value before the popup is shown
|
|
||||||
g_SelectionBeforePopup = combo->GetCurrentSelection();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// "select-child" - click/cursor get select-child, changed, select-child
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
static void
|
|
||||||
gtkcombo_combo_select_child_callback( GtkList *WXUNUSED(list), GtkWidget *WXUNUSED(widget), wxComboBox *combo )
|
|
||||||
{
|
|
||||||
if (!combo->m_hasVMT) return;
|
|
||||||
|
|
||||||
if (g_blockEventsOnDrag) return;
|
|
||||||
|
|
||||||
int curSelection = combo->GetCurrentSelection();
|
|
||||||
|
|
||||||
if (combo->m_prevSelection == curSelection) return;
|
|
||||||
|
|
||||||
GtkWidget *list = GTK_COMBO(combo->m_widget)->list;
|
|
||||||
gtk_list_unselect_item( GTK_LIST(list), combo->m_prevSelection );
|
|
||||||
|
|
||||||
combo->m_prevSelection = curSelection;
|
|
||||||
|
|
||||||
// Quickly set the value of the combo box
|
|
||||||
// as GTK+ does that only AFTER the event
|
|
||||||
// is sent.
|
|
||||||
GtkWidget* entry = GTK_COMBO(combo->GetHandle())->entry;
|
|
||||||
g_signal_handlers_block_by_func(
|
|
||||||
entry, (gpointer)gtkcombo_text_changed_callback, combo);
|
|
||||||
combo->SetValue( combo->GetStringSelection() );
|
|
||||||
g_signal_handlers_unblock_by_func(
|
|
||||||
entry, (gpointer)gtkcombo_text_changed_callback, combo);
|
|
||||||
|
|
||||||
// throw a SELECTED event only if the combobox popup is hidden (wxID_NONE)
|
|
||||||
// because when combobox popup is shown, gtkcombo_combo_select_child_callback is
|
|
||||||
// called each times the mouse is over an item with a pressed button so a lot
|
|
||||||
// of SELECTED event could be generated if the user keep the mouse button down
|
|
||||||
// and select other items ...
|
|
||||||
if (g_SelectionBeforePopup == wxID_NONE)
|
|
||||||
{
|
|
||||||
wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, combo->GetId() );
|
|
||||||
event.SetInt( curSelection );
|
|
||||||
event.SetString( combo->GetStringSelection() );
|
|
||||||
event.SetEventObject( combo );
|
|
||||||
combo->GetEventHandler()->ProcessEvent( event );
|
|
||||||
|
|
||||||
// for consistency with the other ports, don't generate text update
|
|
||||||
// events while the user is browsing the combobox neither
|
|
||||||
wxCommandEvent event2( wxEVT_COMMAND_TEXT_UPDATED, combo->GetId() );
|
|
||||||
event2.SetString( combo->GetValue() );
|
|
||||||
event2.SetEventObject( combo );
|
|
||||||
combo->GetEventHandler()->ProcessEvent( event2 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __WXGTK24__
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
static void
|
static void
|
||||||
gtkcombobox_text_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
|
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 );
|
event.SetEventObject( combo );
|
||||||
combo->GetEventHandler()->ProcessEvent( event );
|
combo->GetEventHandler()->ProcessEvent( event );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
static void
|
static void
|
||||||
gtkcombobox_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
|
gtkcombobox_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
|
||||||
{
|
{
|
||||||
@@ -193,8 +55,6 @@ gtkcombobox_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxComboBox
|
// wxComboBox
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -202,7 +62,6 @@ gtkcombobox_changed_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
|
|||||||
IMPLEMENT_DYNAMIC_CLASS(wxComboBox,wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxComboBox,wxControl)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxComboBox, wxControl)
|
BEGIN_EVENT_TABLE(wxComboBox, wxControl)
|
||||||
EVT_SIZE(wxComboBox::OnSize)
|
|
||||||
EVT_CHAR(wxComboBox::OnChar)
|
EVT_CHAR(wxComboBox::OnChar)
|
||||||
|
|
||||||
EVT_MENU(wxID_CUT, wxComboBox::OnCut)
|
EVT_MENU(wxID_CUT, wxComboBox::OnCut)
|
||||||
@@ -255,111 +114,47 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value,
|
|||||||
if(HasFlag(wxCB_SORT))
|
if(HasFlag(wxCB_SORT))
|
||||||
m_strings = new wxSortedArrayString();
|
m_strings = new wxSortedArrayString();
|
||||||
|
|
||||||
#ifdef __WXGTK24__
|
m_widget = gtk_combo_box_entry_new_text();
|
||||||
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 );
|
GtkEntry * const entry = GetEntry();
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
m_widget = gtk_combo_new();
|
|
||||||
GtkCombo* combo = GTK_COMBO(m_widget);
|
|
||||||
|
|
||||||
// Disable GTK's broken events ...
|
gtk_entry_set_editable( entry, TRUE );
|
||||||
g_signal_handler_disconnect (combo->entry, combo->entry_change_id);
|
|
||||||
// ... and add surrogate handler.
|
|
||||||
combo->entry_change_id = g_signal_connect (combo->entry, "changed",
|
|
||||||
G_CALLBACK (gtkcombo_dummy_callback),
|
|
||||||
combo);
|
|
||||||
|
|
||||||
// make it more useable
|
|
||||||
gtk_combo_set_use_arrows_always( GTK_COMBO(m_widget), TRUE );
|
|
||||||
|
|
||||||
// and case-sensitive
|
|
||||||
gtk_combo_set_case_sensitive( GTK_COMBO(m_widget), TRUE );
|
|
||||||
|
|
||||||
if (style & wxNO_BORDER)
|
|
||||||
g_object_set (combo->entry, "has-frame", FALSE, NULL );
|
|
||||||
}
|
|
||||||
|
|
||||||
Append(n, choices);
|
Append(n, choices);
|
||||||
|
|
||||||
m_parent->DoAddChild( this );
|
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 );
|
m_focusWidget = GTK_WIDGET( entry );
|
||||||
|
|
||||||
PostCreation(size);
|
PostCreation(size);
|
||||||
|
|
||||||
#ifdef __WXGTK24__
|
ConnectWidget( m_widget );
|
||||||
if (!gtk_check_version(2,4,0))
|
|
||||||
ConnectWidget( m_widget );
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
ConnectWidget( GTK_COMBO(m_widget)->button );
|
|
||||||
|
|
||||||
#ifdef __WXGTK24__
|
gtk_entry_set_text( entry, wxGTK_CONV(value) );
|
||||||
if (!gtk_check_version(2,4,0))
|
|
||||||
{
|
|
||||||
gtk_entry_set_text( entry, wxGTK_CONV(value) );
|
|
||||||
|
|
||||||
if (style & wxCB_READONLY)
|
if (style & wxCB_READONLY)
|
||||||
gtk_entry_set_editable( entry, FALSE );
|
gtk_entry_set_editable( entry, FALSE );
|
||||||
|
|
||||||
g_signal_connect_after (entry, "changed",
|
g_signal_connect_after (entry, "changed",
|
||||||
G_CALLBACK (gtkcombobox_text_changed_callback), this);
|
G_CALLBACK (gtkcombobox_text_changed_callback), this);
|
||||||
|
|
||||||
g_signal_connect_after (m_widget, "changed",
|
g_signal_connect_after (m_widget, "changed",
|
||||||
G_CALLBACK (gtkcombobox_changed_callback), this);
|
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
|
SetInitialSize(size); // need this too because this is a wxControlWithItems
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GtkEntry *wxComboBox::GetEntry() const
|
||||||
|
{
|
||||||
|
return GTK_ENTRY(GTK_BIN(m_widget)->child);
|
||||||
|
}
|
||||||
|
|
||||||
GtkEditable *wxComboBox::GetEditable() const
|
GtkEditable *wxComboBox::GetEditable() const
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
return GTK_EDITABLE( GTK_BIN(m_widget)->child );
|
||||||
if ( !gtk_check_version(2,4,0) )
|
|
||||||
return GTK_EDITABLE( GTK_BIN(m_widget)->child );
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
return GTK_EDITABLE( GTK_COMBO(m_widget)->entry );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxComboBox::~wxComboBox()
|
wxComboBox::~wxComboBox()
|
||||||
@@ -393,60 +188,19 @@ int wxComboBox::DoInsertItems(const wxArrayStringsAdapter & items,
|
|||||||
|
|
||||||
int n = wxNOT_FOUND;
|
int n = wxNOT_FOUND;
|
||||||
|
|
||||||
#ifdef __WXGTK24__
|
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
||||||
if (!gtk_check_version(2,4,0))
|
for( int i = 0; i < count; ++i )
|
||||||
{
|
{
|
||||||
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
n = pos + i;
|
||||||
for( int i = 0; i < count; ++i )
|
// If sorted, use this wxSortedArrayStrings to determine
|
||||||
{
|
// the right insertion point
|
||||||
n = pos + i;
|
if(m_strings)
|
||||||
// If sorted, use this wxSortedArrayStrings to determine
|
n = m_strings->Add(items[i]);
|
||||||
// the right insertion point
|
|
||||||
if(m_strings)
|
|
||||||
n = m_strings->Add(items[i]);
|
|
||||||
|
|
||||||
gtk_combo_box_insert_text( combobox, n, wxGTK_CONV( items[i] ) );
|
gtk_combo_box_insert_text( combobox, n, wxGTK_CONV( items[i] ) );
|
||||||
|
|
||||||
m_clientData.Insert( NULL, n );
|
m_clientData.Insert( NULL, n );
|
||||||
AssignNewItemClientData(n, clientData, i, type);
|
AssignNewItemClientData(n, clientData, i, type);
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
DisableEvents();
|
|
||||||
|
|
||||||
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
|
||||||
for( int i = 0; i < count; ++i )
|
|
||||||
{
|
|
||||||
n = pos + i;
|
|
||||||
// If sorted, use this wxSortedArrayStrings to determine
|
|
||||||
// the right insertion point
|
|
||||||
if(m_strings)
|
|
||||||
n = m_strings->Add(items[i]);
|
|
||||||
|
|
||||||
GtkWidget *list_item = gtk_list_item_new_with_label( wxGTK_CONV( items[i] ) );
|
|
||||||
|
|
||||||
// TODO construct a list with all items and call gtk_list_insert_items once?
|
|
||||||
GList *gitem_list = g_list_alloc ();
|
|
||||||
gitem_list->data = list_item;
|
|
||||||
gtk_list_insert_items( GTK_LIST (list), gitem_list, n );
|
|
||||||
|
|
||||||
m_clientData.Insert( NULL, n );
|
|
||||||
AssignNewItemClientData(n, clientData, i, type);
|
|
||||||
|
|
||||||
if (GTK_WIDGET_REALIZED(m_widget))
|
|
||||||
{
|
|
||||||
gtk_widget_realize( list_item );
|
|
||||||
gtk_widget_realize( GTK_BIN(list_item)->child );
|
|
||||||
|
|
||||||
ApplyWidgetStyle();
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_widget_show( list_item );
|
|
||||||
}
|
|
||||||
|
|
||||||
EnableEvents();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
@@ -470,20 +224,10 @@ void wxComboBox::DoClear()
|
|||||||
|
|
||||||
DisableEvents();
|
DisableEvents();
|
||||||
|
|
||||||
#ifdef __WXGTK24__
|
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
||||||
if (!gtk_check_version(2,4,0))
|
const unsigned int count = GetCount();
|
||||||
{
|
for (unsigned int i = 0; i < count; i++)
|
||||||
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
gtk_combo_box_remove_text( combobox, 0 );
|
||||||
const unsigned int count = GetCount();
|
|
||||||
for (unsigned int i = 0; i < count; i++)
|
|
||||||
gtk_combo_box_remove_text( combobox, 0 );
|
|
||||||
}
|
|
||||||
else // GTK+ < 2.4.0
|
|
||||||
#endif // __WXGTK24__
|
|
||||||
{
|
|
||||||
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
|
||||||
gtk_list_clear_items( GTK_LIST(list), 0, GetCount() );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_clientData.Clear();
|
m_clientData.Clear();
|
||||||
|
|
||||||
@@ -499,35 +243,10 @@ void wxComboBox::DoDeleteOneItem(unsigned int n)
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
|
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
|
||||||
|
|
||||||
#ifdef __WXGTK24__
|
wxCHECK_RET( IsValid(n), wxT("invalid index") );
|
||||||
if (!gtk_check_version(2,4,0))
|
|
||||||
{
|
|
||||||
wxCHECK_RET( IsValid(n), wxT("invalid index") );
|
|
||||||
|
|
||||||
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
||||||
gtk_combo_box_remove_text( combobox, n );
|
gtk_combo_box_remove_text( combobox, n );
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
GtkList *listbox = GTK_LIST( GTK_COMBO(m_widget)->list );
|
|
||||||
|
|
||||||
GList *child = g_list_nth( listbox->children, n );
|
|
||||||
|
|
||||||
if (!child)
|
|
||||||
{
|
|
||||||
wxFAIL_MSG(wxT("wrong index"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DisableEvents();
|
|
||||||
|
|
||||||
GList *list = g_list_append( (GList*) NULL, child->data );
|
|
||||||
gtk_list_remove_items( listbox, list );
|
|
||||||
g_list_free( list );
|
|
||||||
|
|
||||||
EnableEvents();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_clientData.RemoveAt( n );
|
m_clientData.RemoveAt( n );
|
||||||
if(m_strings)
|
if(m_strings)
|
||||||
@@ -540,39 +259,18 @@ void wxComboBox::SetString(unsigned int n, const wxString &text)
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
|
wxCHECK_RET( m_widget != NULL, wxT("invalid combobox") );
|
||||||
|
|
||||||
#ifdef __WXGTK24__
|
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
||||||
if (!gtk_check_version(2,4,0))
|
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 );
|
GtkTreeModel *model = gtk_combo_box_get_model( combobox );
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
if (gtk_tree_model_iter_nth_child (model, &iter, NULL, n))
|
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
|
|
||||||
{
|
{
|
||||||
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
GValue value = { 0, };
|
||||||
|
g_value_init( &value, G_TYPE_STRING );
|
||||||
GList *child = g_list_nth( GTK_LIST(list)->children, n );
|
g_value_set_string( &value, wxGTK_CONV( text ) );
|
||||||
if (child)
|
gtk_list_store_set_value( GTK_LIST_STORE(model), &iter, 0, &value );
|
||||||
{
|
g_value_unset( &value );
|
||||||
GtkBin *bin = GTK_BIN( child->data );
|
|
||||||
GtkLabel *label = GTK_LABEL( bin->child );
|
|
||||||
gtk_label_set_text(label, wxGTK_CONV(text));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wxFAIL_MSG( wxT("wxComboBox: wrong index") );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
@@ -582,100 +280,42 @@ int wxComboBox::FindString( const wxString &item, bool bCase ) const
|
|||||||
{
|
{
|
||||||
wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid combobox") );
|
wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid combobox") );
|
||||||
|
|
||||||
#ifdef __WXGTK24__
|
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
||||||
if (!gtk_check_version(2,4,0))
|
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 );
|
GValue value = { 0, };
|
||||||
GtkTreeModel* model = gtk_combo_box_get_model( combobox );
|
gtk_tree_model_get_value( model, &iter, 0, &value );
|
||||||
GtkTreeIter iter;
|
wxString str = wxGTK_CONV_BACK( g_value_get_string( &value ) );
|
||||||
gtk_tree_model_get_iter_first( model, &iter );
|
g_value_unset( &value );
|
||||||
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 );
|
|
||||||
|
|
||||||
if (item.IsSameAs( str, bCase ) )
|
if (item.IsSameAs( str, bCase ) )
|
||||||
return count;
|
return count;
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
} while (gtk_tree_model_iter_next( model, &iter ));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
|
||||||
|
|
||||||
GList *child = GTK_LIST(list)->children;
|
|
||||||
int count = 0;
|
|
||||||
while (child)
|
|
||||||
{
|
|
||||||
GtkBin *bin = GTK_BIN( child->data );
|
|
||||||
GtkLabel *label = GTK_LABEL( bin->child );
|
|
||||||
wxString str( wxGTK_CONV_BACK( gtk_label_get_text(label) ) );
|
|
||||||
|
|
||||||
if (item.IsSameAs( str , bCase ) )
|
|
||||||
return count;
|
|
||||||
|
|
||||||
count++;
|
|
||||||
child = child->next;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
while ( gtk_tree_model_iter_next(model, &iter) );
|
||||||
|
|
||||||
return wxNOT_FOUND;
|
return wxNOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxComboBox::GetSelection() const
|
int wxComboBox::GetSelection() const
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
||||||
if (!gtk_check_version(2,4,0))
|
return gtk_combo_box_get_active( combobox );
|
||||||
{
|
|
||||||
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
|
||||||
return gtk_combo_box_get_active( combobox );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
// if the popup is currently opened, use the selection as it had been
|
|
||||||
// before it dropped down
|
|
||||||
return g_SelectionBeforePopup == wxID_NONE ? GetCurrentSelection()
|
|
||||||
: g_SelectionBeforePopup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxComboBox::GetCurrentSelection() const
|
int wxComboBox::GetCurrentSelection() const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid combobox") );
|
wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid combobox") );
|
||||||
|
|
||||||
#ifdef __WXGTK24__
|
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
||||||
if (!gtk_check_version(2,4,0))
|
return gtk_combo_box_get_active( combobox );
|
||||||
{
|
|
||||||
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
|
||||||
return gtk_combo_box_get_active( combobox );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
|
||||||
|
|
||||||
GList *selection = GTK_LIST(list)->selection;
|
|
||||||
if (selection)
|
|
||||||
{
|
|
||||||
GList *child = GTK_LIST(list)->children;
|
|
||||||
int count = 0;
|
|
||||||
while (child)
|
|
||||||
{
|
|
||||||
if (child->data == selection->data) return count;
|
|
||||||
count++;
|
|
||||||
child = child->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxComboBox::GetString(unsigned int n) const
|
wxString wxComboBox::GetString(unsigned int n) const
|
||||||
@@ -684,37 +324,16 @@ wxString wxComboBox::GetString(unsigned int n) const
|
|||||||
|
|
||||||
wxString str;
|
wxString str;
|
||||||
|
|
||||||
#ifdef __WXGTK24__
|
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
||||||
if (!gtk_check_version(2,4,0))
|
GtkTreeModel *model = gtk_combo_box_get_model( combobox );
|
||||||
|
GtkTreeIter iter;
|
||||||
|
if (gtk_tree_model_iter_nth_child (model, &iter, NULL, n))
|
||||||
{
|
{
|
||||||
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
GValue value = { 0, };
|
||||||
GtkTreeModel *model = gtk_combo_box_get_model( combobox );
|
gtk_tree_model_get_value( model, &iter, 0, &value );
|
||||||
GtkTreeIter iter;
|
wxString tmp = wxGTK_CONV_BACK( g_value_get_string( &value ) );
|
||||||
if (gtk_tree_model_iter_nth_child (model, &iter, NULL, n))
|
g_value_unset( &value );
|
||||||
{
|
return tmp;
|
||||||
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
|
|
||||||
{
|
|
||||||
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
|
||||||
|
|
||||||
GList *child = g_list_nth( GTK_LIST(list)->children, n );
|
|
||||||
if (child)
|
|
||||||
{
|
|
||||||
GtkBin *bin = GTK_BIN( child->data );
|
|
||||||
GtkLabel *label = GTK_LABEL( bin->child );
|
|
||||||
str = wxGTK_CONV_BACK( gtk_label_get_text(label) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wxFAIL_MSG( wxT("wxComboBox: wrong index") );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
@@ -724,34 +343,16 @@ unsigned int wxComboBox::GetCount() const
|
|||||||
{
|
{
|
||||||
wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid combobox") );
|
wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid combobox") );
|
||||||
|
|
||||||
#ifdef __WXGTK24__
|
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
||||||
if (!gtk_check_version(2,4,0))
|
GtkTreeModel* model = gtk_combo_box_get_model( combobox );
|
||||||
{
|
GtkTreeIter iter;
|
||||||
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
gtk_tree_model_get_iter_first( model, &iter );
|
||||||
GtkTreeModel* model = gtk_combo_box_get_model( combobox );
|
if (!gtk_list_store_iter_is_valid(GTK_LIST_STORE(model), &iter ))
|
||||||
GtkTreeIter iter;
|
return 0;
|
||||||
gtk_tree_model_get_iter_first( model, &iter );
|
unsigned int ret = 1;
|
||||||
if (!gtk_list_store_iter_is_valid(GTK_LIST_STORE(model), &iter ))
|
while (gtk_tree_model_iter_next( model, &iter ))
|
||||||
return 0;
|
ret++;
|
||||||
unsigned int ret = 1;
|
return ret;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxComboBox::SetSelection( int n )
|
void wxComboBox::SetSelection( int n )
|
||||||
@@ -760,20 +361,8 @@ void wxComboBox::SetSelection( int n )
|
|||||||
|
|
||||||
DisableEvents();
|
DisableEvents();
|
||||||
|
|
||||||
#ifdef __WXGTK24__
|
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
||||||
if (!gtk_check_version(2,4,0))
|
gtk_combo_box_set_active( combobox, n );
|
||||||
{
|
|
||||||
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
|
|
||||||
gtk_combo_box_set_active( combobox, n );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
GtkWidget *list = GTK_COMBO(m_widget)->list;
|
|
||||||
gtk_list_unselect_item( GTK_LIST(list), m_prevSelection );
|
|
||||||
gtk_list_select_item( GTK_LIST(list), n );
|
|
||||||
m_prevSelection = n;
|
|
||||||
}
|
|
||||||
|
|
||||||
EnableEvents();
|
EnableEvents();
|
||||||
}
|
}
|
||||||
@@ -806,131 +395,32 @@ void wxComboBox::OnChar( wxKeyEvent &event )
|
|||||||
|
|
||||||
void wxComboBox::DisableEvents()
|
void wxComboBox::DisableEvents()
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
g_signal_handlers_block_by_func(GTK_BIN(m_widget)->child,
|
||||||
if (!gtk_check_version(2,4,0))
|
(gpointer)gtkcombobox_text_changed_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(m_widget,
|
g_signal_handlers_block_by_func(m_widget,
|
||||||
(gpointer)gtkcombobox_changed_callback, this);
|
(gpointer)gtkcombobox_changed_callback, this);
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
g_signal_handlers_block_by_func(GTK_COMBO(m_widget)->list,
|
|
||||||
(gpointer) gtkcombo_combo_select_child_callback, this);
|
|
||||||
|
|
||||||
g_signal_handlers_block_by_func(GTK_COMBO(m_widget)->entry,
|
|
||||||
(gpointer) gtkcombo_text_changed_callback, this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxComboBox::EnableEvents()
|
void wxComboBox::EnableEvents()
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
g_signal_handlers_unblock_by_func(GTK_BIN(m_widget)->child,
|
||||||
if (!gtk_check_version(2,4,0))
|
(gpointer)gtkcombobox_text_changed_callback, this);
|
||||||
{
|
|
||||||
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,
|
g_signal_handlers_unblock_by_func(m_widget,
|
||||||
(gpointer)gtkcombobox_changed_callback, this);
|
(gpointer)gtkcombobox_changed_callback, this);
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
g_signal_handlers_unblock_by_func(GTK_COMBO(m_widget)->list,
|
|
||||||
(gpointer) gtkcombo_combo_select_child_callback, this);
|
|
||||||
|
|
||||||
g_signal_handlers_unblock_by_func(GTK_COMBO(m_widget)->entry,
|
|
||||||
(gpointer) gtkcombo_text_changed_callback, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxComboBox::OnSize( wxSizeEvent &event )
|
|
||||||
{
|
|
||||||
#ifdef __WXGTK24__
|
|
||||||
if (!gtk_check_version(2,4,0))
|
|
||||||
{
|
|
||||||
// Do nothing
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
// NB: In some situations (e.g. on non-first page of a wizard, if the
|
|
||||||
// size used is default size), GtkCombo widget is resized correctly,
|
|
||||||
// but it's look is not updated, it's rendered as if it was much wider.
|
|
||||||
// No other widgets are affected, so it looks like a bug in GTK+.
|
|
||||||
// Manually requesting resize calculation (as gtk_pizza_set_size does)
|
|
||||||
// fixes it.
|
|
||||||
if (GTK_WIDGET_VISIBLE(m_widget))
|
|
||||||
gtk_widget_queue_resize(m_widget);
|
|
||||||
}
|
|
||||||
|
|
||||||
event.Skip();
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxComboBox::DoApplyWidgetStyle(GtkRcStyle *style)
|
|
||||||
{
|
|
||||||
#ifdef __WXGTK24__
|
|
||||||
if (!gtk_check_version(2,4,0))
|
|
||||||
{
|
|
||||||
// Do nothing
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
// gtk_widget_modify_style( GTK_COMBO(m_widget)->button, syle );
|
|
||||||
|
|
||||||
gtk_widget_modify_style( GTK_COMBO(m_widget)->entry, style );
|
|
||||||
gtk_widget_modify_style( GTK_COMBO(m_widget)->list, style );
|
|
||||||
|
|
||||||
GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list );
|
|
||||||
GList *child = list->children;
|
|
||||||
while (child)
|
|
||||||
{
|
|
||||||
gtk_widget_modify_style( GTK_WIDGET(child->data), style );
|
|
||||||
|
|
||||||
GtkBin *bin = GTK_BIN(child->data);
|
|
||||||
gtk_widget_modify_style( bin->child, style );
|
|
||||||
|
|
||||||
child = child->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget* wxComboBox::GetConnectWidget()
|
GtkWidget* wxComboBox::GetConnectWidget()
|
||||||
{
|
{
|
||||||
GtkEntry *entry = NULL;
|
return GTK_WIDGET( GetEntry() );
|
||||||
#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 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkWindow *wxComboBox::GTKGetWindow(wxArrayGdkWindows& windows) const
|
GdkWindow *wxComboBox::GTKGetWindow(wxArrayGdkWindows& windows) const
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
wxUnusedVar(windows);
|
||||||
if (!gtk_check_version(2,4,0))
|
|
||||||
{
|
|
||||||
wxUnusedVar(windows);
|
|
||||||
|
|
||||||
return GTK_ENTRY(GTK_BIN(m_widget)->child)->text_area;
|
return GetEntry()->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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxComboBox::DoGetBestSize() const
|
wxSize wxComboBox::DoGetBestSize() const
|
||||||
@@ -963,12 +453,7 @@ wxSize wxComboBox::DoGetBestSize() const
|
|||||||
wxVisualAttributes
|
wxVisualAttributes
|
||||||
wxComboBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
|
wxComboBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
return GetDefaultAttributesFromGTKWidget(gtk_combo_box_entry_new, true);
|
||||||
if (!gtk_check_version(2,4,0))
|
|
||||||
return GetDefaultAttributesFromGTKWidget(gtk_combo_box_entry_new, true);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
return GetDefaultAttributesFromGTKWidget(gtk_combo_new, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -178,57 +178,52 @@ wxCursor::wxCursor( const wxImage & image )
|
|||||||
bool bHasMask = image.HasMask();
|
bool bHasMask = image.HasMask();
|
||||||
int imagebitcount = (w*h)/8;
|
int imagebitcount = (w*h)/8;
|
||||||
|
|
||||||
#ifdef __WXGTK24__
|
if ( gdk_display_supports_cursor_color(gdk_display_get_default()) )
|
||||||
if (!gtk_check_version(2,4,0))
|
|
||||||
{
|
{
|
||||||
if ( gdk_display_supports_cursor_color(gdk_display_get_default()) )
|
unsigned char rMask = 0,
|
||||||
|
gMask = 0,
|
||||||
|
bMask = 0;
|
||||||
|
if (bHasMask)
|
||||||
{
|
{
|
||||||
unsigned char rMask = 0,
|
rMask = image.GetMaskRed();
|
||||||
gMask = 0,
|
gMask = image.GetMaskGreen();
|
||||||
bMask = 0;
|
bMask = image.GetMaskBlue();
|
||||||
if (bHasMask)
|
|
||||||
{
|
|
||||||
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 )
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 )
|
||||||
|
{
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
#endif // GTK+ 2.4+
|
|
||||||
|
|
||||||
unsigned char * bits = new unsigned char [imagebitcount];
|
unsigned char * bits = new unsigned char [imagebitcount];
|
||||||
unsigned char * maskBits = new unsigned char [imagebitcount];
|
unsigned char * maskBits = new unsigned char [imagebitcount];
|
||||||
|
@@ -204,7 +204,8 @@ bool wxDataObject::IsSupportedFormat(const wxDataFormat& format, Direction dir)
|
|||||||
// wxTextDataObject
|
// wxTextDataObject
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#if defined(__WXGTK20__) && wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
|
|
||||||
void
|
void
|
||||||
wxTextDataObject::GetAllFormats(wxDataFormat *formats,
|
wxTextDataObject::GetAllFormats(wxDataFormat *formats,
|
||||||
wxDataObjectBase::Direction WXUNUSED(dir)) const
|
wxDataObjectBase::Direction WXUNUSED(dir)) const
|
||||||
@@ -212,7 +213,8 @@ wxTextDataObject::GetAllFormats(wxDataFormat *formats,
|
|||||||
*formats++ = GetPreferredFormat();
|
*formats++ = GetPreferredFormat();
|
||||||
*formats = g_altTextAtom;
|
*formats = g_altTextAtom;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
#endif // wxUSE_UNICODE
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxFileDataObject
|
// wxFileDataObject
|
||||||
|
@@ -399,11 +399,7 @@ void wxGTKWindowImplDC::SetUpDC( bool isMemDC )
|
|||||||
/* background colour */
|
/* background colour */
|
||||||
m_backgroundBrush = *wxWHITE_BRUSH;
|
m_backgroundBrush = *wxWHITE_BRUSH;
|
||||||
m_backgroundBrush.GetColour().CalcPixel( m_cmap );
|
m_backgroundBrush.GetColour().CalcPixel( m_cmap );
|
||||||
#ifdef __WXGTK24__
|
|
||||||
const GdkColor *bg_col = m_backgroundBrush.GetColour().GetColor();
|
const GdkColor *bg_col = m_backgroundBrush.GetColour().GetColor();
|
||||||
#else
|
|
||||||
GdkColor *bg_col = m_backgroundBrush.GetColour().GetColor();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* m_textGC */
|
/* m_textGC */
|
||||||
m_textForegroundColour.CalcPixel( m_cmap );
|
m_textForegroundColour.CalcPixel( m_cmap );
|
||||||
@@ -1139,13 +1135,6 @@ void wxGTKWindowImplDC::DoDrawBitmap( const wxBitmap &bitmap,
|
|||||||
if ((w != ww) || (h != hh))
|
if ((w != ww) || (h != hh))
|
||||||
use_bitmap = use_bitmap.Rescale( 0, 0, ww, hh, ww, 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
|
// apply mask if any
|
||||||
GdkBitmap *mask = (GdkBitmap *) NULL;
|
GdkBitmap *mask = (GdkBitmap *) NULL;
|
||||||
if (useMask && use_bitmap.GetMask())
|
if (useMask && use_bitmap.GetMask())
|
||||||
@@ -1199,8 +1188,7 @@ void wxGTKWindowImplDC::DoDrawBitmap( const wxBitmap &bitmap,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if GTK_CHECK_VERSION(2,2,0)
|
if (use_bitmap.HasPixbuf())
|
||||||
if (!gtk_check_version(2,2,0) && use_bitmap.HasPixbuf())
|
|
||||||
{
|
{
|
||||||
gdk_draw_pixbuf(m_window, use_gc,
|
gdk_draw_pixbuf(m_window, use_gc,
|
||||||
use_bitmap.GetPixbuf(),
|
use_bitmap.GetPixbuf(),
|
||||||
@@ -1208,7 +1196,6 @@ void wxGTKWindowImplDC::DoDrawBitmap( const wxBitmap &bitmap,
|
|||||||
GDK_RGB_DITHER_NORMAL, xx, yy);
|
GDK_RGB_DITHER_NORMAL, xx, yy);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
gdk_draw_drawable(m_window, use_gc,
|
gdk_draw_drawable(m_window, use_gc,
|
||||||
use_bitmap.GetPixmap(),
|
use_bitmap.GetPixmap(),
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if wxUSE_DIRDLG && defined( __WXGTK24__ )
|
#if wxUSE_DIRDLG
|
||||||
|
|
||||||
#include "wx/dirdlg.h"
|
#include "wx/dirdlg.h"
|
||||||
|
|
||||||
@@ -83,126 +83,95 @@ static void gtk_dirdialog_response_callback(GtkWidget *w,
|
|||||||
// wxDirDialog
|
// 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)
|
EVT_BUTTON(wxID_OK, wxDirDialog::OnFakeOk)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
wxDirDialog::wxDirDialog(wxWindow* parent, const wxString& title,
|
wxDirDialog::wxDirDialog(wxWindow* parent,
|
||||||
const wxString& defaultPath, long style,
|
const wxString& title,
|
||||||
const wxPoint& pos, const wxSize& sz,
|
const wxString& defaultPath,
|
||||||
const wxString& name)
|
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;
|
wxFAIL_MSG( wxT("wxDirDialog creation failed") );
|
||||||
|
return;
|
||||||
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() );
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
wxGenericDirDialog::Create(parent, title, defaultPath, style, pos, sz, name);
|
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() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDirDialog::OnFakeOk( wxCommandEvent &event )
|
void wxDirDialog::OnFakeOk(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
if (!gtk_check_version(2,4,0))
|
EndDialog(wxID_OK);
|
||||||
EndDialog(wxID_OK);
|
|
||||||
else
|
|
||||||
wxGenericDirDialog::OnOK( event );
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxDirDialog::ShowModal()
|
|
||||||
{
|
|
||||||
if (!gtk_check_version(2,4,0))
|
|
||||||
return wxDialog::ShowModal();
|
|
||||||
else
|
|
||||||
return wxGenericDirDialog::ShowModal();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxDirDialog::Show( bool show )
|
|
||||||
{
|
|
||||||
if (!gtk_check_version(2,4,0))
|
|
||||||
return wxDialog::Show( show );
|
|
||||||
else
|
|
||||||
return wxGenericDirDialog::Show( show );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDirDialog::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
void wxDirDialog::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||||
{
|
{
|
||||||
if (!m_wxwindow)
|
if (!m_wxwindow)
|
||||||
return;
|
return;
|
||||||
else
|
|
||||||
wxGenericDirDialog::DoSetSize( x, y, width, height, sizeFlags );
|
wxDirDialogBase::DoSetSize( x, y, width, height, sizeFlags );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDirDialog::SetPath(const wxString& dir)
|
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
|
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);
|
||||||
wxGtkString str(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(m_widget)));
|
|
||||||
return wxString(str, *wxConvFileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
return wxGenericDirDialog::GetPath();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_DIRDLG
|
#endif // wxUSE_DIRDLG
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#include "wx/filectrl.h"
|
#include "wx/filectrl.h"
|
||||||
|
|
||||||
#if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__)
|
#if !defined(__WXUNIVERSAL__)
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
# include "wx/sizer.h"
|
# include "wx/sizer.h"
|
||||||
@@ -421,8 +421,6 @@ void wxGtkFileCtrl::ShowHidden(bool show)
|
|||||||
g_object_set (G_OBJECT (m_fcWidget), "show-hidden", show, NULL);
|
g_object_set (G_OBJECT (m_fcWidget), "show-hidden", show, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // wxUSE_FILECTRL
|
||||||
// wxUSE_FILECTRL
|
|
||||||
|
|
||||||
#endif
|
#endif // !defined(__WXUNIVERSAL__)
|
||||||
// if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__)
|
|
||||||
|
@@ -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);
|
EndDialog(wxID_OK);
|
||||||
}
|
}
|
||||||
|
@@ -50,7 +50,7 @@ static void gtk_fontbutton_setfont_callback(GtkFontButton *widget,
|
|||||||
// wxFontButton
|
// wxFontButton
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxFontButton, wxGenericFontButton)
|
IMPLEMENT_DYNAMIC_CLASS(wxFontButton, wxButton)
|
||||||
|
|
||||||
bool wxFontButton::Create( wxWindow *parent, wxWindowID id,
|
bool wxFontButton::Create( wxWindow *parent, wxWindowID id,
|
||||||
const wxFont &initial,
|
const wxFont &initial,
|
||||||
@@ -58,45 +58,40 @@ bool wxFontButton::Create( wxWindow *parent, wxWindowID id,
|
|||||||
long style, const wxValidator& validator,
|
long style, const wxValidator& validator,
|
||||||
const wxString &name )
|
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 ) ||
|
wxFAIL_MSG( wxT("wxFontButton creation failed") );
|
||||||
!wxControl::CreateBase(parent, id, pos, size, style, validator, name))
|
return false;
|
||||||
{
|
|
||||||
wxFAIL_MSG( wxT("wxFontButton creation failed") );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_widget = gtk_font_button_new();
|
|
||||||
|
|
||||||
// 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);
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
// GtkFontButton signals
|
|
||||||
g_signal_connect(m_widget, "font-set",
|
|
||||||
G_CALLBACK(gtk_fontbutton_setfont_callback), this);
|
|
||||||
|
|
||||||
|
|
||||||
m_parent->DoAddChild( this );
|
|
||||||
|
|
||||||
PostCreation(size);
|
|
||||||
SetInitialSize(size);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return wxGenericFontButton::Create(parent, id, initial, pos, size,
|
m_widget = gtk_font_button_new();
|
||||||
style, validator, name);
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
// GtkFontButton signals
|
||||||
|
g_signal_connect(m_widget, "font-set",
|
||||||
|
G_CALLBACK(gtk_fontbutton_setfont_callback), this);
|
||||||
|
|
||||||
|
|
||||||
|
m_parent->DoAddChild( this );
|
||||||
|
|
||||||
|
PostCreation(size);
|
||||||
|
SetInitialSize(size);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,16 +101,11 @@ wxFontButton::~wxFontButton()
|
|||||||
|
|
||||||
void wxFontButton::UpdateFont()
|
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();
|
const wxString& fontname = info->ToString();
|
||||||
gtk_font_button_set_font_name(GTK_FONT_BUTTON(m_widget), wxGTK_CONV(fontname));
|
gtk_font_button_set_font_name(GTK_FONT_BUTTON(m_widget), wxGTK_CONV(fontname));
|
||||||
}
|
|
||||||
else
|
|
||||||
wxGenericFontButton::UpdateFont();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_FONTPICKERCTRL
|
#endif // wxUSE_FONTPICKERCTRL
|
||||||
|
@@ -193,37 +193,21 @@ bool wxGLCanvas::Create(wxWindow *parent,
|
|||||||
GdkVisual *visual;
|
GdkVisual *visual;
|
||||||
GdkColormap *colormap;
|
GdkColormap *colormap;
|
||||||
|
|
||||||
// MR: This needs a fix for lower gtk+ versions too. Might need to rethink logic (FIXME)
|
wxWindow::Create( parent, id, pos, size, style, name );
|
||||||
#if defined(__WXGTK20__) && GTK_CHECK_VERSION(2,2,0)
|
|
||||||
if (!gtk_check_version(2,2,0))
|
m_glWidget = m_wxwindow;
|
||||||
|
|
||||||
|
GdkScreen *screen = gtk_widget_get_screen( m_glWidget );
|
||||||
|
colormap = gdk_screen_get_default_colormap(screen);
|
||||||
|
visual = gdk_colormap_get_visual(colormap);
|
||||||
|
|
||||||
|
if (GDK_VISUAL_XVISUAL(visual)->visualid != xvi->visualid)
|
||||||
{
|
{
|
||||||
wxWindow::Create( parent, id, pos, size, style, name );
|
visual = gdk_x11_screen_lookup_visual( screen, xvi->visualid );
|
||||||
|
colormap = gdk_colormap_new(visual, FALSE);
|
||||||
m_glWidget = m_wxwindow;
|
|
||||||
|
|
||||||
GdkScreen *screen = gtk_widget_get_screen( m_glWidget );
|
|
||||||
colormap = gdk_screen_get_default_colormap(screen);
|
|
||||||
visual = gdk_colormap_get_visual(colormap);
|
|
||||||
|
|
||||||
if (GDK_VISUAL_XVISUAL(visual)->visualid != xvi->visualid)
|
|
||||||
{
|
|
||||||
visual = gdk_x11_screen_lookup_visual( screen, xvi->visualid );
|
|
||||||
colormap = gdk_colormap_new(visual, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_widget_set_colormap( m_glWidget, colormap );
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
#endif // GTK+ >= 2.2
|
|
||||||
{
|
|
||||||
visual = gdkx_visual_get( xvi->visualid );
|
|
||||||
colormap = gdk_colormap_new( visual, TRUE );
|
|
||||||
|
|
||||||
gtk_widget_push_colormap( colormap );
|
gtk_widget_set_colormap( m_glWidget, colormap );
|
||||||
|
|
||||||
wxWindow::Create( parent, id, pos, size, style, name );
|
|
||||||
m_glWidget = m_wxwindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_widget_set_double_buffered( m_glWidget, FALSE );
|
gtk_widget_set_double_buffered( m_glWidget, FALSE );
|
||||||
|
|
||||||
@@ -234,11 +218,6 @@ bool wxGLCanvas::Create(wxWindow *parent,
|
|||||||
g_signal_connect(m_wxwindow, "expose_event", G_CALLBACK(gtk_glwindow_expose_callback), this);
|
g_signal_connect(m_wxwindow, "expose_event", G_CALLBACK(gtk_glwindow_expose_callback), this);
|
||||||
g_signal_connect(m_widget, "size_allocate", G_CALLBACK(gtk_glcanvas_size_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 WXWIN_COMPATIBILITY_2_8
|
||||||
// if our parent window is already visible, we had been realized before we
|
// 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
|
// connected to the "realize" signal and hence our m_glContext hasn't been
|
||||||
|
@@ -1695,8 +1695,6 @@ bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y )
|
|||||||
|
|
||||||
#endif // wxUSE_MENUS_NATIVE
|
#endif // wxUSE_MENUS_NATIVE
|
||||||
|
|
||||||
#ifdef __WXGTK20__
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
const char *wxGetStockGtkID(wxWindowID id)
|
const char *wxGetStockGtkID(wxWindowID id)
|
||||||
@@ -1815,6 +1813,4 @@ bool wxGetStockGtkAccelerator(const char *id, GdkModifierType *mod, guint *key)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // __WXGTK20__
|
|
||||||
|
|
||||||
#endif // wxUSE_MENUS
|
#endif // wxUSE_MENUS
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_MSGDLG && defined(__WXGTK20__) && !defined(__WXGPE__)
|
#if wxUSE_MSGDLG && !defined(__WXGPE__)
|
||||||
|
|
||||||
#include "wx/msgdlg.h"
|
#include "wx/msgdlg.h"
|
||||||
|
|
||||||
@@ -179,4 +179,4 @@ int wxMessageDialog::ShowModal()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // wxUSE_MSGDLG && defined(__WXGTK20__) && !defined(__WXGPE__)
|
#endif // wxUSE_MSGDLG && !defined(__WXGPE__)
|
||||||
|
@@ -399,28 +399,16 @@ static bool GetFrameExtents(GdkWindow* window, int* left, int* right, int* top,
|
|||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
Atom property = 0;
|
Atom property = 0;
|
||||||
#if GTK_CHECK_VERSION(2, 2, 0)
|
if (gdk_x11_screen_supports_net_wm_hint(
|
||||||
if (gtk_check_version(2, 2, 0) == NULL)
|
gdk_drawable_get_screen(window),
|
||||||
|
gdk_atom_intern("_NET_FRAME_EXTENTS", false)))
|
||||||
{
|
{
|
||||||
if (gdk_x11_screen_supports_net_wm_hint(
|
success = true;
|
||||||
gdk_drawable_get_screen(window),
|
property = gdk_x11_get_xatom_by_name_for_display(
|
||||||
gdk_atom_intern("_NET_FRAME_EXTENTS", false)))
|
gdk_drawable_get_display(window),
|
||||||
{
|
"_NET_FRAME_EXTENTS");
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
Atom type;
|
Atom type;
|
||||||
@@ -453,6 +441,14 @@ static bool GetFrameExtents(GdkWindow* window, int* left, int* right, int* top,
|
|||||||
return success;
|
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 )
|
int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win )
|
||||||
{
|
{
|
||||||
GdkWindow *window = NULL;
|
GdkWindow *window = NULL;
|
||||||
@@ -499,55 +495,29 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win )
|
|||||||
|
|
||||||
case wxSYS_CURSOR_X:
|
case wxSYS_CURSOR_X:
|
||||||
case wxSYS_CURSOR_Y:
|
case wxSYS_CURSOR_Y:
|
||||||
#ifdef __WXGTK24__
|
return gdk_display_get_default_cursor_size(
|
||||||
if (!gtk_check_version(2,4,0))
|
window ? gdk_drawable_get_display(window)
|
||||||
{
|
: gdk_display_get_default());
|
||||||
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;
|
|
||||||
|
|
||||||
case wxSYS_DCLICK_X:
|
case wxSYS_DCLICK_X:
|
||||||
case wxSYS_DCLICK_Y:
|
case wxSYS_DCLICK_Y:
|
||||||
gint dclick_distance;
|
gint dclick_distance;
|
||||||
#if GTK_CHECK_VERSION(2,2,0)
|
g_object_get(GetSettingsForWindowScreen(window),
|
||||||
if (window && !gtk_check_version(2,2,0))
|
"gtk-double-click-distance", &dclick_distance, NULL);
|
||||||
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);
|
|
||||||
|
|
||||||
return dclick_distance * 2;
|
return dclick_distance * 2;
|
||||||
|
|
||||||
case wxSYS_DCLICK_MSEC:
|
case wxSYS_DCLICK_MSEC:
|
||||||
gint dclick;
|
gint dclick;
|
||||||
g_object_get(gtk_settings_get_default(),
|
g_object_get(GetSettingsForWindowScreen(window),
|
||||||
"gtk-double-click-time", &dclick, NULL);
|
"gtk-double-click-time", &dclick, NULL);
|
||||||
return dclick;
|
return dclick;
|
||||||
|
|
||||||
case wxSYS_DRAG_X:
|
case wxSYS_DRAG_X:
|
||||||
case wxSYS_DRAG_Y:
|
case wxSYS_DRAG_Y:
|
||||||
gint drag_threshold;
|
gint drag_threshold;
|
||||||
#if GTK_CHECK_VERSION(2,2,0)
|
g_object_get(GetSettingsForWindowScreen(window),
|
||||||
if (window && !gtk_check_version(2,2,0))
|
"gtk-dnd-drag-threshold", &drag_threshold, NULL);
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// The correct thing here would be to double the value
|
// The correct thing here would be to double the value
|
||||||
// since that is what the API wants. But the values
|
// since that is what the API wants. But the values
|
||||||
@@ -557,28 +527,25 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win )
|
|||||||
|
|
||||||
return drag_threshold;
|
return drag_threshold;
|
||||||
|
|
||||||
// MBN: ditto for icons
|
case wxSYS_ICON_X:
|
||||||
case wxSYS_ICON_X: return 32;
|
case wxSYS_ICON_Y:
|
||||||
case wxSYS_ICON_Y: return 32;
|
return 32;
|
||||||
|
|
||||||
case wxSYS_SCREEN_X:
|
case wxSYS_SCREEN_X:
|
||||||
#if GTK_CHECK_VERSION(2,2,0)
|
if (window)
|
||||||
if (window && !gtk_check_version(2,2,0))
|
|
||||||
return gdk_screen_get_width(gdk_drawable_get_screen(window));
|
return gdk_screen_get_width(gdk_drawable_get_screen(window));
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
return gdk_screen_width();
|
return gdk_screen_width();
|
||||||
|
|
||||||
case wxSYS_SCREEN_Y:
|
case wxSYS_SCREEN_Y:
|
||||||
#if GTK_CHECK_VERSION(2,2,0)
|
if (window)
|
||||||
if (window && !gtk_check_version(2,2,0))
|
|
||||||
return gdk_screen_get_height(gdk_drawable_get_screen(window));
|
return gdk_screen_get_height(gdk_drawable_get_screen(window));
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
return gdk_screen_height();
|
return gdk_screen_height();
|
||||||
|
|
||||||
case wxSYS_HSCROLL_Y: return 15;
|
case wxSYS_HSCROLL_Y:
|
||||||
case wxSYS_VSCROLL_X: return 15;
|
case wxSYS_VSCROLL_X:
|
||||||
|
return 15;
|
||||||
|
|
||||||
case wxSYS_CAPTION_Y:
|
case wxSYS_CAPTION_Y:
|
||||||
if (!window)
|
if (!window)
|
||||||
|
@@ -198,14 +198,9 @@ static void wxGtkTextApplyTagsFromAttr(GtkWidget *text,
|
|||||||
wxGtkTextRemoveTagsWithPrefix(text_buffer, "WXINDENT", start, end);
|
wxGtkTextRemoveTagsWithPrefix(text_buffer, "WXINDENT", start, end);
|
||||||
|
|
||||||
// Convert indent from 1/10th of a mm into pixels
|
// Convert indent from 1/10th of a mm into pixels
|
||||||
float factor;
|
float factor =
|
||||||
#if GTK_CHECK_VERSION(2,2,0)
|
(float)gdk_screen_get_width(gtk_widget_get_screen(text)) /
|
||||||
if (!gtk_check_version(2,2,0))
|
|
||||||
factor = (float)gdk_screen_get_width(gtk_widget_get_screen(text)) /
|
|
||||||
gdk_screen_get_width_mm(gtk_widget_get_screen(text)) / 10;
|
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 indent = (int)(factor * attr.GetLeftIndent());
|
||||||
const int subIndent = (int)(factor * attr.GetLeftSubIndent());
|
const int subIndent = (int)(factor * attr.GetLeftSubIndent());
|
||||||
@@ -260,14 +255,9 @@ static void wxGtkTextApplyTagsFromAttr(GtkWidget *text,
|
|||||||
if (!tag)
|
if (!tag)
|
||||||
{
|
{
|
||||||
// Factor to convert from 1/10th of a mm into pixels
|
// Factor to convert from 1/10th of a mm into pixels
|
||||||
float factor;
|
float factor =
|
||||||
#if GTK_CHECK_VERSION(2,2,0)
|
(float)gdk_screen_get_width(gtk_widget_get_screen(text)) /
|
||||||
if (!gtk_check_version(2,2,0))
|
|
||||||
factor = (float)gdk_screen_get_width(gtk_widget_get_screen(text)) /
|
|
||||||
gdk_screen_get_width_mm(gtk_widget_get_screen(text)) / 10;
|
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);
|
PangoTabArray* tabArray = pango_tab_array_new(tabs.GetCount(), TRUE);
|
||||||
for (size_t i = 0; i < tabs.GetCount(); i++)
|
for (size_t i = 0; i < tabs.GetCount(); i++)
|
||||||
@@ -857,17 +847,7 @@ void wxTextCtrl::GTKSetWrapMode()
|
|||||||
else if ( HasFlag( wxTE_WORDWRAP ) )
|
else if ( HasFlag( wxTE_WORDWRAP ) )
|
||||||
wrap = GTK_WRAP_WORD;
|
wrap = GTK_WRAP_WORD;
|
||||||
else // HasFlag(wxTE_BESTWRAP) always true as wxTE_BESTWRAP == 0
|
else // HasFlag(wxTE_BESTWRAP) always true as wxTE_BESTWRAP == 0
|
||||||
{
|
wrap = GTK_WRAP_WORD_CHAR;
|
||||||
// GTK_WRAP_WORD_CHAR seems to be new in GTK+ 2.4
|
|
||||||
#ifdef __WXGTK24__
|
|
||||||
if ( !gtk_check_version(2,4,0) )
|
|
||||||
{
|
|
||||||
wrap = GTK_WRAP_WORD_CHAR;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif // __WXGTK24__
|
|
||||||
wrap = GTK_WRAP_WORD;
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( m_text ), wrap );
|
gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( m_text ), wrap );
|
||||||
}
|
}
|
||||||
@@ -888,23 +868,16 @@ void wxTextCtrl::GTKSetJustification()
|
|||||||
}
|
}
|
||||||
else // single line
|
else // single line
|
||||||
{
|
{
|
||||||
#ifdef __WXGTK24__
|
gfloat align;
|
||||||
// gtk_entry_set_alignment was introduced in gtk+-2.3.5
|
if ( HasFlag(wxTE_RIGHT) )
|
||||||
if (!gtk_check_version(2,4,0))
|
align = 1.0;
|
||||||
{
|
else if ( HasFlag(wxTE_CENTRE) )
|
||||||
gfloat align;
|
align = 0.5;
|
||||||
if ( HasFlag(wxTE_RIGHT) )
|
else // single line
|
||||||
align = 1.0;
|
align = 0.0;
|
||||||
else if ( HasFlag(wxTE_CENTRE) )
|
|
||||||
align = 0.5;
|
|
||||||
else // single line
|
|
||||||
align = 0.0;
|
|
||||||
|
|
||||||
gtk_entry_set_alignment(GTK_ENTRY(m_text), align);
|
gtk_entry_set_alignment(GTK_ENTRY(m_text), align);
|
||||||
}
|
|
||||||
#endif // __WXGTK24__
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTextCtrl::SetWindowStyleFlag(long style)
|
void wxTextCtrl::SetWindowStyleFlag(long style)
|
||||||
|
@@ -405,18 +405,8 @@ static gboolean property_notify_event(
|
|||||||
if (event->state == GDK_PROPERTY_NEW_VALUE && event->atom == property &&
|
if (event->state == GDK_PROPERTY_NEW_VALUE && event->atom == property &&
|
||||||
win->IsDecorCacheable() && !win->IsFullScreen())
|
win->IsDecorCacheable() && !win->IsFullScreen())
|
||||||
{
|
{
|
||||||
Atom xproperty;
|
Atom xproperty = gdk_x11_atom_to_xatom_for_display(
|
||||||
#if GTK_CHECK_VERSION(2, 2, 0)
|
gdk_drawable_get_display(event->window), property);
|
||||||
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 type;
|
Atom type;
|
||||||
int format;
|
int format;
|
||||||
gulong nitems, bytes_after;
|
gulong nitems, bytes_after;
|
||||||
@@ -514,24 +504,19 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if GTK_CHECK_VERSION(2,1,0)
|
if (style & wxFRAME_TOOL_WINDOW)
|
||||||
if (!gtk_check_version(2,1,0))
|
|
||||||
{
|
{
|
||||||
if (style & wxFRAME_TOOL_WINDOW)
|
gtk_window_set_type_hint(GTK_WINDOW(m_widget),
|
||||||
{
|
GDK_WINDOW_TYPE_HINT_UTILITY);
|
||||||
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 some WMs, like KDE, a TOOL_WINDOW will still show
|
||||||
// on the taskbar, but on Gnome a TOOL_WINDOW will not.
|
// on the taskbar, but on Gnome a TOOL_WINDOW will not.
|
||||||
// For consistency between WMs and with Windows, we
|
// For consistency between WMs and with Windows, we
|
||||||
// should set the NO_TASKBAR flag which will apply
|
// should set the NO_TASKBAR flag which will apply
|
||||||
// the set_skip_taskbar_hint if it is available,
|
// the set_skip_taskbar_hint if it is available,
|
||||||
// ensuring no taskbar entry will appear.
|
// ensuring no taskbar entry will appear.
|
||||||
style |= wxFRAME_NO_TASKBAR;
|
style |= wxFRAME_NO_TASKBAR;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -544,25 +529,15 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
|
|||||||
GTK_WINDOW(topParent->m_widget) );
|
GTK_WINDOW(topParent->m_widget) );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTK_CHECK_VERSION(2,2,0)
|
if (style & wxFRAME_NO_TASKBAR)
|
||||||
if (!gtk_check_version(2,2,0))
|
|
||||||
{
|
{
|
||||||
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 (style & wxSTAY_ON_TOP)
|
||||||
if (!gtk_check_version(2,4,0))
|
|
||||||
{
|
{
|
||||||
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 0
|
||||||
if (!name.empty())
|
if (!name.empty())
|
||||||
@@ -723,12 +698,11 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long)
|
|||||||
wxGetFullScreenMethodX11((WXDisplay*)GDK_DISPLAY(),
|
wxGetFullScreenMethodX11((WXDisplay*)GDK_DISPLAY(),
|
||||||
(WXWindow)GDK_ROOT_WINDOW());
|
(WXWindow)GDK_ROOT_WINDOW());
|
||||||
|
|
||||||
#if GTK_CHECK_VERSION(2,2,0)
|
|
||||||
// NB: gtk_window_fullscreen() uses freedesktop.org's WMspec extensions
|
// NB: gtk_window_fullscreen() uses freedesktop.org's WMspec extensions
|
||||||
// to switch to fullscreen, which is not always available. We must
|
// to switch to fullscreen, which is not always available. We must
|
||||||
// check if WM supports the spec and use legacy methods if it
|
// check if WM supports the spec and use legacy methods if it
|
||||||
// doesn't.
|
// doesn't.
|
||||||
if ( (method == wxX11_FS_WMSPEC) && !gtk_check_version(2,2,0) )
|
if ( method == wxX11_FS_WMSPEC )
|
||||||
{
|
{
|
||||||
if (show)
|
if (show)
|
||||||
gtk_window_fullscreen( GTK_WINDOW( m_widget ) );
|
gtk_window_fullscreen( GTK_WINDOW( m_widget ) );
|
||||||
@@ -736,7 +710,6 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long)
|
|||||||
gtk_window_unfullscreen( GTK_WINDOW( m_widget ) );
|
gtk_window_unfullscreen( GTK_WINDOW( m_widget ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif // GTK+ >= 2.2.0
|
|
||||||
{
|
{
|
||||||
GdkWindow *window = m_widget->window;
|
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 client_x, client_y, root_x, root_y;
|
||||||
gint width, height;
|
gint width, height;
|
||||||
|
|
||||||
if (method != wxX11_FS_WMSPEC)
|
m_fsSaveGdkFunc = m_gdkFunc;
|
||||||
{
|
m_fsSaveGdkDecor = m_gdkDecor;
|
||||||
// don't do it always, Metacity hates it
|
m_gdkFunc = m_gdkDecor = 0;
|
||||||
m_fsSaveGdkFunc = m_gdkFunc;
|
gdk_window_set_decorations(window, (GdkWMDecoration)0);
|
||||||
m_fsSaveGdkDecor = m_gdkDecor;
|
gdk_window_set_functions(window, (GdkWMFunction)0);
|
||||||
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_origin (m_widget->window, &root_x, &root_y);
|
||||||
gdk_window_get_geometry (m_widget->window, &client_x, &client_y,
|
gdk_window_get_geometry (m_widget->window, &client_x, &client_y,
|
||||||
@@ -775,14 +744,10 @@ bool wxTopLevelWindowGTK::ShowFullScreen(bool show, long)
|
|||||||
}
|
}
|
||||||
else // hide
|
else // hide
|
||||||
{
|
{
|
||||||
if (method != wxX11_FS_WMSPEC)
|
m_gdkFunc = m_fsSaveGdkFunc;
|
||||||
{
|
m_gdkDecor = m_fsSaveGdkDecor;
|
||||||
// don't do it always, Metacity hates it
|
gdk_window_set_decorations(window, (GdkWMDecoration)m_gdkDecor);
|
||||||
m_gdkFunc = m_fsSaveGdkFunc;
|
gdk_window_set_functions(window, (GdkWMFunction)m_gdkFunc);
|
||||||
m_gdkDecor = m_fsSaveGdkDecor;
|
|
||||||
gdk_window_set_decorations(window, (GdkWMDecoration)m_gdkDecor);
|
|
||||||
gdk_window_set_functions(window, (GdkWMFunction)m_gdkFunc);
|
|
||||||
}
|
|
||||||
|
|
||||||
wxSetFullScreenStateX11((WXDisplay*)GDK_DISPLAY(),
|
wxSetFullScreenStateX11((WXDisplay*)GDK_DISPLAY(),
|
||||||
(WXWindow)GDK_ROOT_WINDOW(),
|
(WXWindow)GDK_ROOT_WINDOW(),
|
||||||
@@ -1189,10 +1154,8 @@ void wxTopLevelWindowGTK::RequestUserAttention(int flags)
|
|||||||
|
|
||||||
void wxTopLevelWindowGTK::SetWindowStyleFlag( long style )
|
void wxTopLevelWindowGTK::SetWindowStyleFlag( long style )
|
||||||
{
|
{
|
||||||
#if defined(__WXGTK24__) || GTK_CHECK_VERSION(2,2,0)
|
|
||||||
// Store which styles were changed
|
// Store which styles were changed
|
||||||
long styleChanges = style ^ m_windowStyle;
|
long styleChanges = style ^ m_windowStyle;
|
||||||
#endif
|
|
||||||
|
|
||||||
// Process wxWindow styles. This also updates the internal variable
|
// Process wxWindow styles. This also updates the internal variable
|
||||||
// Therefore m_windowStyle bits carry now the _new_ style values
|
// Therefore m_windowStyle bits carry now the _new_ style values
|
||||||
@@ -1202,16 +1165,17 @@ void wxTopLevelWindowGTK::SetWindowStyleFlag( long style )
|
|||||||
if (!m_widget)
|
if (!m_widget)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef __WXGTK24__
|
if ( styleChanges & wxSTAY_ON_TOP )
|
||||||
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) )
|
|
||||||
{
|
{
|
||||||
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(m_widget), m_windowStyle & wxFRAME_NO_TASKBAR);
|
gtk_window_set_keep_above(GTK_WINDOW(m_widget),
|
||||||
|
m_windowStyle & wxSTAY_ON_TOP);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( styleChanges & wxFRAME_NO_TASKBAR )
|
||||||
|
{
|
||||||
|
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(m_widget),
|
||||||
|
m_windowStyle & wxFRAME_NO_TASKBAR);
|
||||||
}
|
}
|
||||||
#endif // GTK+ 2.2
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the X Window between child and the root window.
|
/* Get the X Window between child and the root window.
|
||||||
|
@@ -1453,10 +1453,7 @@ gtk_window_button_press_callback( GtkWidget *widget,
|
|||||||
|
|
||||||
wxEventType event_type = wxEVT_NULL;
|
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 &&
|
if ( gdk_event->type == GDK_2BUTTON_PRESS &&
|
||||||
!gtk_check_version(2,2,0) &&
|
|
||||||
gdk_event->button >= 1 && gdk_event->button <= 3 )
|
gdk_event->button >= 1 && gdk_event->button <= 3 )
|
||||||
{
|
{
|
||||||
// Reset GDK internal timestamp variables in order to disable GDK
|
// 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[1] = 0;
|
||||||
display->button_click_time[0] = 0;
|
display->button_click_time[0] = 0;
|
||||||
}
|
}
|
||||||
#endif // GTK 2+
|
|
||||||
|
|
||||||
if (gdk_event->button == 1)
|
if (gdk_event->button == 1)
|
||||||
{
|
{
|
||||||
|
@@ -68,46 +68,29 @@ bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__WXGTK20__) || !defined(HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE)
|
PangoFontFamily **families = NULL;
|
||||||
if ( fixedWidthOnly
|
gint n_families = 0;
|
||||||
#if defined(__WXGTK24__)
|
pango_context_list_families (
|
||||||
&& (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 (
|
|
||||||
#ifdef __WXGTK20__
|
#ifdef __WXGTK20__
|
||||||
gtk_widget_get_pango_context( wxGetRootWindow() ),
|
gtk_widget_get_pango_context( wxGetRootWindow() ),
|
||||||
#else
|
#else
|
||||||
wxTheApp->GetPangoContext(),
|
wxTheApp->GetPangoContext(),
|
||||||
#endif
|
#endif
|
||||||
&families, &n_families );
|
&families, &n_families );
|
||||||
qsort (families, n_families, sizeof (PangoFontFamily *), wxCompareFamilies);
|
qsort (families, n_families, sizeof (PangoFontFamily *), wxCompareFamilies);
|
||||||
|
|
||||||
for (int i=0; i<n_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
|
||||||
{
|
{
|
||||||
#if defined(__WXGTK24__) || defined(HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE)
|
const gchar *name = pango_font_family_get_name(families[i]);
|
||||||
if (!fixedWidthOnly || (
|
OnFacename(wxString(name, wxConvUTF8));
|
||||||
#ifdef __WXGTK24__
|
|
||||||
!gtk_check_version(2,4,0) &&
|
|
||||||
#endif
|
|
||||||
pango_font_family_is_monospace(families[i])
|
|
||||||
) )
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
const gchar *name = pango_font_family_get_name(families[i]);
|
|
||||||
OnFacename(wxString(name, wxConvUTF8));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
g_free(families);
|
|
||||||
}
|
}
|
||||||
|
g_free(families);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -158,9 +158,9 @@ wxFontFamily wxNativeFontInfo::GetFamily() const
|
|||||||
ret = wxFONTFAMILY_TELETYPE; // begins with "Monospace"
|
ret = wxFONTFAMILY_TELETYPE; // begins with "Monospace"
|
||||||
else if (strncmp( family_text, "courier", 7 ) == 0)
|
else if (strncmp( family_text, "courier", 7 ) == 0)
|
||||||
ret = wxFONTFAMILY_TELETYPE; // begins with "Courier"
|
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
|
else
|
||||||
#ifdef __WXGTK24__
|
#ifdef __WXGTK20__
|
||||||
if (!gtk_check_version(2,4,0))
|
if (!gtk_check_version(2,4,0))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@@ -196,7 +196,7 @@ wxFontFamily wxNativeFontInfo::GetFamily() const
|
|||||||
if (family != NULL && pango_font_family_is_monospace( family ))
|
if (family != NULL && pango_font_family_is_monospace( family ))
|
||||||
ret = wxFONTFAMILY_TELETYPE; // is deemed a monospace font by pango
|
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)
|
if (ret == wxFONTFAMILY_DEFAULT)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user