initial commit

Signed-off-by: Peter Siegmund <mars3142@noreply.mars3142.dev>
This commit is contained in:
2025-10-31 23:37:30 +01:00
commit bf6b52fd94
9654 changed files with 4035664 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/accel.h
// Purpose: wxAcceleratorTable redirection file
// Author: Julian Smart
// Created:
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// VZ: keeping the old file just in case we're going to have a native GTK+
// wxAcceleratorTable implementation one day, but for now use the generic
// version
#include "wx/generic/accel.h"

View File

@@ -0,0 +1,66 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/activityindicator.h
// Purpose: Declaration of wxActivityIndicator for wxGTK.
// Author: Vadim Zeitlin
// Created: 2015-03-05
// Copyright: (c) 2015 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_ACTIVITYINDICATOR_H_
#define _WX_GTK_ACTIVITYINDICATOR_H_
// With GTK+ 3 we can always be certain that this control is available, so use
// the normal base class. With GTK+ 2 however, we may determine during run-time
// that we need to fall back to the generic implementation because the GTK+
// version is earlier than 2.20, so we need to inherit from the generic class.
#ifdef __WXGTK3__
#define wxActivityIndicatorGtkBase wxActivityIndicatorBase
#else
#include "wx/generic/activityindicator.h"
#define wxActivityIndicatorGtkBase wxActivityIndicatorGeneric
#endif
// ----------------------------------------------------------------------------
// wxActivityIndicator: implementation using GtkSpinner.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxActivityIndicator : public wxActivityIndicatorGtkBase
{
public:
wxActivityIndicator()
{
}
explicit
wxActivityIndicator(wxWindow* parent,
wxWindowID winid = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxActivityIndicatorNameStr)
{
Create(parent, winid, pos, size, style, name);
}
bool Create(wxWindow* parent,
wxWindowID winid = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxActivityIndicatorNameStr);
virtual void Start() override;
virtual void Stop() override;
virtual bool IsRunning() const override;
protected:
virtual wxSize DoGetBestClientSize() const override;
private:
wxDECLARE_DYNAMIC_CLASS(wxActivityIndicator);
wxDECLARE_NO_COPY_CLASS(wxActivityIndicator);
};
#endif // _WX_GTK_ACTIVITYINDICATOR_H_

View File

@@ -0,0 +1,103 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/animate.h
// Purpose: Animation classes
// Author: Julian Smart and Guillermo Rodriguez Garcia
// Modified by: Francesco Montorsi
// Created: 13/8/99
// Copyright: (c) Julian Smart and Guillermo Rodriguez Garcia
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTKANIMATEH__
#define _WX_GTKANIMATEH__
typedef struct _GdkPixbufAnimation GdkPixbufAnimation;
typedef struct _GdkPixbufAnimationIter GdkPixbufAnimationIter;
// ----------------------------------------------------------------------------
// wxAnimationCtrl
// ----------------------------------------------------------------------------
// Resize to animation size if this is set
#define wxAN_FIT_ANIMATION 0x0010
class WXDLLIMPEXP_ADV wxAnimationCtrl: public wxAnimationCtrlBase
{
public:
wxAnimationCtrl() { Init(); }
wxAnimationCtrl(wxWindow *parent,
wxWindowID id,
const wxAnimation& anim = wxNullAnimation,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxAC_DEFAULT_STYLE,
const wxString& name = wxASCII_STR(wxAnimationCtrlNameStr))
{
Init();
Create(parent, id, anim, pos, size, style, name);
}
bool Create(wxWindow *parent, wxWindowID id,
const wxAnimation& anim = wxNullAnimation,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxAC_DEFAULT_STYLE,
const wxString& name = wxASCII_STR(wxAnimationCtrlNameStr));
~wxAnimationCtrl();
public: // event handler
void OnTimer(wxTimerEvent &);
public: // public API
virtual bool LoadFile(const wxString& filename, wxAnimationType type = wxANIMATION_TYPE_ANY) override;
virtual bool Load(wxInputStream& stream, wxAnimationType type = wxANIMATION_TYPE_ANY) override;
void SetAnimation(const wxAnimationBundle& anim) override;
virtual bool Play() override;
virtual void Stop() override;
virtual bool IsPlaying() const override;
bool SetBackgroundColour( const wxColour &colour ) override;
static wxAnimation CreateCompatibleAnimation();
protected:
virtual wxAnimationImpl* DoCreateAnimationImpl() const override;
virtual void DisplayStaticImage() override;
virtual wxSize DoGetBestSize() const override;
void FitToAnimation();
void ClearToBackgroundColour();
void ResetAnim();
void ResetIter();
// Helpers to safely access methods in the wxAnimationGTKImpl that are
// specific to the gtk implementation
GdkPixbufAnimation *AnimationImplGetPixbuf() const;
void AnimationImplSetPixbuf(GdkPixbufAnimation* p);
protected: // internal vars
GdkPixbufAnimation *m_anim;
GdkPixbufAnimationIter *m_iter;
wxTimer m_timer;
bool m_bPlaying;
private:
typedef wxAnimationCtrlBase base_type;
void Init();
wxDECLARE_DYNAMIC_CLASS(wxAnimationCtrl);
wxDECLARE_EVENT_TABLE();
};
#endif // _WX_GTKANIMATEH__

View File

@@ -0,0 +1,82 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/anybutton.h
// Purpose: wxGTK wxAnyButton class declaration
// Author: Robert Roebling
// Created: 1998-05-20 (extracted from button.h)
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_ANYBUTTON_H_
#define _WX_GTK_ANYBUTTON_H_
//-----------------------------------------------------------------------------
// wxAnyButton
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxAnyButton : public wxAnyButtonBase
{
typedef wxAnyButtonBase BaseType;
public:
wxAnyButton()
{
m_isCurrent =
m_isPressed = false;
}
virtual void SetLabel(const wxString& label) override;
// implementation
// --------------
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
// called from GTK callbacks: they update the button state and call
// GTKUpdateBitmap()
void GTKMouseEnters();
void GTKMouseLeaves();
void GTKPressed();
void GTKReleased();
protected:
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const override;
virtual void DoEnable(bool enable) override;
virtual wxBitmap DoGetBitmap(State which) const override;
virtual void DoSetBitmap(const wxBitmapBundle& bitmap, State which) override;
virtual void DoSetBitmapPosition(wxDirection dir) override;
// update the bitmap to correspond to the current button state
void GTKUpdateBitmap();
private:
typedef wxAnyButtonBase base_type;
// focus event handler: calls GTKUpdateBitmap()
void GTKOnFocus(wxFocusEvent& event);
// return the state whose bitmap is being currently shown (so this is
// different from the real current state, e.g. it could be State_Normal
// even if the button is pressed if no button was set for State_Pressed)
State GTKGetCurrentBitmapState() const;
// show the given bitmap (must be valid)
void GTKDoShowBitmap(const wxBitmapBundle& bitmap);
// the bitmaps for the different state of the buttons, all of them may be
// invalid and the button only shows a bitmap at all if State_Normal bitmap
// is valid
wxBitmapBundle m_bitmaps[State_Max];
// true iff mouse is currently over the button
bool m_isCurrent;
// true iff the button is in pressed state
bool m_isPressed;
wxDECLARE_NO_COPY_CLASS(wxAnyButton);
};
#endif // _WX_GTK_ANYBUTTON_H_

View File

@@ -0,0 +1,94 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/app.h
// Purpose: wxApp definition for wxGTK
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling, Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_APP_H_
#define _WX_GTK_APP_H_
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// wxApp
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxApp: public wxAppBase
{
public:
wxApp();
virtual ~wxApp();
/* override for altering the way wxGTK initializes the GUI
* (palette/visual/colorcube). under wxMSW, OnInitGui() does nothing by
* default. when overriding this method, the code in it is likely to be
* platform dependent, otherwise use OnInit(). */
virtual bool SetNativeTheme(const wxString& theme) override;
virtual AppearanceResult SetAppearance(Appearance appearance) override;
virtual bool OnInitGui() override;
// override base class (pure) virtuals
virtual void WakeUpIdle() override;
virtual bool Initialize(int& argc, wxChar **argv) override;
virtual void CleanUp() override;
virtual void OnAssertFailure(const wxChar *file,
int line,
const wxChar *func,
const wxChar *cond,
const wxChar *msg) override;
// GTK-specific methods
// -------------------
// this can be overridden to return a specific visual to be used for GTK+
// instead of the default one (it's used by wxGLApp)
//
// must return XVisualInfo pointer (it is not freed by caller)
virtual void *GetXVisualInfo() { return nullptr; }
// Check if we're using a global menu. Currently this is only true when
// running under Ubuntu Unity and global menu is not disabled.
//
// This is mostly used in the implementation in order to work around
// various bugs arising due to this.
static bool GTKIsUsingGlobalMenu();
// Provide the ability to suppress GTK output. By default, all output
// will be suppressed, but the user can pass in a mask specifying the
// types of messages to suppress. Flags are defined by glib with the
// GLogLevelFlags enum.
static void GTKSuppressDiagnostics(int flags = -1);
// Allow wxWidgets to control GTK diagnostics. This is recommended because
// it prevents spurious GTK messages from appearing, but can't be done by
// default because it would result in a fatal error if the application
// calls g_log_set_writer_func() itself.
static void GTKAllowDiagnosticsControl();
// implementation only from now on
// -------------------------------
// check for pending events, without interference from our idle source
bool EventsPending();
bool DoIdle();
private:
// true if we're inside an assert modal dialog
bool m_isInAssert;
#if wxUSE_THREADS
wxMutex m_idleMutex;
#endif
unsigned m_idleSourceId;
wxDECLARE_DYNAMIC_CLASS(wxApp);
};
#endif // _WX_GTK_APP_H_

View File

@@ -0,0 +1,77 @@
/* ///////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/assertdlg_gtk.h
// Purpose: GtkAssertDialog
// Author: Francesco Montorsi
// Copyright: (c) 2006 Francesco Montorsi
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////// */
#ifndef _WX_GTK_ASSERTDLG_H_
#define _WX_GTK_ASSERTDLG_H_
#define GTK_TYPE_ASSERT_DIALOG (gtk_assert_dialog_get_type ())
#define GTK_ASSERT_DIALOG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_ASSERT_DIALOG, GtkAssertDialog))
#define GTK_ASSERT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ASSERT_DIALOG, GtkAssertDialogClass))
#define GTK_IS_ASSERT_DIALOG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GTK_TYPE_ASSERT_DIALOG))
#define GTK_IS_ASSERT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ASSERT_DIALOG))
#define GTK_ASSERT_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ASSERT_DIALOG, GtkAssertDialogClass))
typedef struct _GtkAssertDialog GtkAssertDialog;
typedef struct _GtkAssertDialogClass GtkAssertDialogClass;
typedef void (*GtkAssertDialogStackFrameCallback)(void *);
struct _GtkAssertDialog
{
GtkDialog parent_instance;
/* GtkAssertDialog widgets */
GtkWidget *expander;
GtkWidget *message;
GtkWidget *treeview;
GtkWidget *shownexttime;
/* callback for processing the stack frame */
GtkAssertDialogStackFrameCallback callback;
void *userdata;
};
struct _GtkAssertDialogClass
{
GtkDialogClass parent_class;
};
typedef enum
{
GTK_ASSERT_DIALOG_STOP,
GTK_ASSERT_DIALOG_CONTINUE,
GTK_ASSERT_DIALOG_CONTINUE_SUPPRESSING
} GtkAssertDialogResponseID;
GType gtk_assert_dialog_get_type(void);
GtkWidget *gtk_assert_dialog_new(void);
/* get the assert message */
gchar *gtk_assert_dialog_get_message(GtkAssertDialog *assertdlg);
/* set the assert message */
void gtk_assert_dialog_set_message(GtkAssertDialog *assertdlg, const gchar *msg);
/* get a string containing all stack frames appended to the dialog */
gchar *gtk_assert_dialog_get_backtrace(GtkAssertDialog *assertdlg);
/* sets the callback to use when the user wants to see the stackframe */
void gtk_assert_dialog_set_backtrace_callback(GtkAssertDialog *assertdlg,
GtkAssertDialogStackFrameCallback callback,
void *userdata);
/* appends a stack frame to the dialog */
void gtk_assert_dialog_append_stack_frame(GtkAssertDialog *dlg,
const gchar *function,
const gchar *sourcefile,
guint line_number);
#endif /* _WX_GTK_ASSERTDLG_H_ */

View File

@@ -0,0 +1,188 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/bitmap.h
// Purpose:
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_BITMAP_H_
#define _WX_GTK_BITMAP_H_
#ifdef __WXGTK3__
typedef struct _cairo cairo_t;
typedef struct _cairo_surface cairo_surface_t;
#endif
typedef struct _GdkPixbuf GdkPixbuf;
//-----------------------------------------------------------------------------
// wxMask
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxMask: public wxMaskBase
{
public:
wxMask();
wxMask(const wxMask& mask);
wxMask( const wxBitmap& bitmap, const wxColour& colour );
#if wxUSE_PALETTE
wxMask( const wxBitmap& bitmap, int paletteIndex );
#endif // wxUSE_PALETTE
wxMask( const wxBitmap& bitmap );
virtual ~wxMask();
wxBitmap GetBitmap() const;
// implementation
#ifdef __WXGTK3__
wxMask(cairo_surface_t*);
operator cairo_surface_t*() const;
#else
wxMask(GdkPixmap*);
operator GdkPixmap*() const;
#endif
protected:
virtual void FreeData() override;
virtual bool InitFromColour(const wxBitmap& bitmap, const wxColour& colour) override;
virtual bool InitFromMonoBitmap(const wxBitmap& bitmap) override;
private:
#ifdef __WXGTK3__
cairo_surface_t* m_bitmap;
#else
GdkPixmap* m_bitmap;
#endif
wxDECLARE_DYNAMIC_CLASS(wxMask);
};
//-----------------------------------------------------------------------------
// wxBitmap
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase
{
public:
wxBitmap() = default;
wxBitmap( int width, int height, int depth = wxBITMAP_SCREEN_DEPTH )
{ Create(width, height, depth); }
wxBitmap( const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH )
{ Create(sz, depth); }
wxBitmap( int width, int height, const wxDC& dc )
{ Create(width, height, dc); }
wxBitmap( const char bits[], int width, int height, int depth = 1 );
wxBitmap( const char* const* bits );
wxBitmap( const wxString &filename, wxBitmapType type = wxBITMAP_DEFAULT_TYPE );
#if wxUSE_IMAGE
wxBitmap(const wxImage& image, int depth = wxBITMAP_SCREEN_DEPTH, double scale = 1.0);
wxBitmap(const wxImage& image, const wxDC& dc);
#endif // wxUSE_IMAGE
wxBitmap(GdkPixbuf* pixbuf, int depth = 0);
explicit wxBitmap(const wxCursor& cursor);
bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH) final;
bool Create(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH) final
{ return Create(sz.GetWidth(), sz.GetHeight(), depth); }
#ifdef __WXGTK3__
bool Create(int width, int height, const wxDC& dc);
virtual void SetScaleFactor(double scale) override;
virtual double GetScaleFactor() const override;
#else
bool Create(int width, int height, const wxDC& WXUNUSED(dc))
{ return Create(width,height); }
#endif
virtual int GetHeight() const override;
virtual int GetWidth() const override;
virtual int GetDepth() const override;
#if wxUSE_IMAGE
wxImage ConvertToImage() const override;
#endif // wxUSE_IMAGE
wxMask *GetMask() const override;
void SetMask( wxMask *mask ) override;
wxBitmap GetSubBitmap( const wxRect& rect ) const override;
bool SaveFile(const wxString &name, wxBitmapType type,
const wxPalette *palette = nullptr) const override;
bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE) override;
#if wxUSE_PALETTE
wxPalette *GetPalette() const override;
void SetPalette(const wxPalette& palette) override;
wxPalette *GetColourMap() const { return GetPalette(); }
#endif // wxUSE_PALETTE
static void InitStandardHandlers();
// implementation
// --------------
#if WXWIN_COMPATIBILITY_3_0
wxDEPRECATED(void SetHeight( int height ) override);
wxDEPRECATED(void SetWidth( int width ) override);
wxDEPRECATED(void SetDepth( int depth ) override);
#endif
#ifdef __WXGTK3__
cairo_t* CairoCreate() const;
void Draw(cairo_t* cr, int x, int y, bool useMask = true, const wxColour* fg = nullptr, const wxColour* bg = nullptr) const;
void SetSourceSurface(cairo_t* cr, int x, int y, const wxColour* fg = nullptr, const wxColour* bg = nullptr) const;
wxBitmap CreateDisabled() const;
#else
GdkPixmap *GetPixmap() const;
bool HasPixmap() const;
bool HasPixbuf() const;
wxBitmap(GdkPixmap* pixmap);
#endif
GdkPixbuf* GetPixbufNoMask() const;
GdkPixbuf *GetPixbuf() const;
// raw bitmap access support functions
void *GetRawData(wxPixelDataBase& data, int bpp);
void UngetRawData(wxPixelDataBase& data);
bool HasAlpha() const override;
protected:
#if wxUSE_IMAGE
void InitFromImage(const wxImage& image, int depth, double scale);
#ifndef __WXGTK3__
bool CreateFromImage(const wxImage& image, int depth);
#endif
#endif // wxUSE_IMAGE
virtual wxGDIRefData* CreateGDIRefData() const override;
wxNODISCARD virtual wxGDIRefData* CloneGDIRefData(const wxGDIRefData* data) const override;
#ifdef __WXGTK3__
virtual bool DoCreate(const wxSize& sz, double scale, int depth) override;
#endif
private:
#ifndef __WXGTK3__
void SetPixmap(GdkPixmap* pixmap);
#if wxUSE_IMAGE
// to be called from CreateFromImage only!
bool CreateFromImageAsPixmap(const wxImage& image, int depth);
bool CreateFromImageAsPixbuf(const wxImage& image);
#endif // wxUSE_IMAGE
public:
// implementation only
enum Representation
{
Pixmap,
Pixbuf
};
// removes other representations from memory, keeping only 'keep'
// (wxBitmap may keep same bitmap e.g. as both pixmap and pixbuf):
void PurgeOtherRepresentations(Representation keep);
#endif
wxDECLARE_DYNAMIC_CLASS(wxBitmap);
};
#endif // _WX_GTK_BITMAP_H_

View File

@@ -0,0 +1,49 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/bmpbutton.h
// Purpose:
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_BMPBUTTON_H_
#define _WX_GTK_BMPBUTTON_H_
// ----------------------------------------------------------------------------
// wxBitmapButton
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxBitmapButton : public wxBitmapButtonBase
{
public:
wxBitmapButton() = default;
wxBitmapButton(wxWindow *parent,
wxWindowID id,
const wxBitmapBundle& bitmap,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxButtonNameStr))
{
Create(parent, id, bitmap, pos, size, style, validator, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxBitmapBundle& bitmap,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxButtonNameStr));
bool CreateCloseButton(wxWindow* parent,
wxWindowID winid,
const wxString& name = wxString());
private:
wxDECLARE_DYNAMIC_CLASS(wxBitmapButton);
};
#endif // _WX_GTK_BMPBUTTON_H_

View File

@@ -0,0 +1,145 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/bmpcbox.h
// Purpose: wxBitmapComboBox
// Author: Jaakko Salli
// Created: 2008-05-19
// Copyright: (c) 2008 Jaakko Salli
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_BMPCBOX_H_
#define _WX_GTK_BMPCBOX_H_
#include "wx/combobox.h"
// ----------------------------------------------------------------------------
// wxBitmapComboBox: a wxComboBox that allows images to be shown
// in front of string items.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxBitmapComboBox : public wxComboBox,
public wxBitmapComboBoxBase
{
public:
// ctors and such
wxBitmapComboBox() : wxComboBox(), wxBitmapComboBoxBase()
{
Init();
}
wxBitmapComboBox(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0,
const wxString choices[] = nullptr,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr))
: wxComboBox(),
wxBitmapComboBoxBase()
{
Init();
(void)Create(parent, id, value, pos, size, n,
choices, style, validator, name);
}
wxBitmapComboBox(wxWindow *parent,
wxWindowID id,
const wxString& value,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr));
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& value,
const wxPoint& pos,
const wxSize& size,
int n,
const wxString choices[],
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr));
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& value,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxBitmapComboBoxNameStr));
virtual ~wxBitmapComboBox();
// Sets the image for the given item.
virtual void SetItemBitmap(unsigned int n, const wxBitmapBundle& bitmap) override;
// Returns the image of the item with the given index.
virtual wxBitmap GetItemBitmap(unsigned int n) const override;
// Returns size of the image used in list
virtual wxSize GetBitmapSize() const override
{
return m_bitmapSize;
}
// Adds item with image to the end of the combo box.
int Append(const wxString& item, const wxBitmapBundle& bitmap = wxBitmapBundle());
int Append(const wxString& item, const wxBitmapBundle& bitmap, void *clientData);
int Append(const wxString& item, const wxBitmapBundle& bitmap, wxClientData *clientData);
// Inserts item with image into the list before pos. Not valid for wxCB_SORT
// styles, use Append instead.
int Insert(const wxString& item, const wxBitmapBundle& bitmap, unsigned int pos);
int Insert(const wxString& item, const wxBitmapBundle& bitmap,
unsigned int pos, void *clientData);
int Insert(const wxString& item, const wxBitmapBundle& bitmap,
unsigned int pos, wxClientData *clientData);
// Override some wxTextEntry interface.
virtual void WriteText(const wxString& value) override;
virtual wxString GetValue() const override;
virtual void Remove(long from, long to) override;
virtual void SetInsertionPoint(long pos) override;
virtual long GetInsertionPoint() const override;
virtual long GetLastPosition() const override;
virtual void SetSelection(long from, long to) override;
virtual void GetSelection(long *from, long *to) const override;
virtual void SetSelection(int n) override { wxComboBox::SetSelection(n); }
virtual int GetSelection() const override { return wxComboBox::GetSelection(); }
virtual bool IsEditable() const override;
virtual void SetEditable(bool editable) override;
virtual GtkWidget* GetConnectWidget() const override;
protected:
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const override;
virtual void GTKCreateComboBoxWidget() override;
virtual wxSize DoGetBestSize() const override;
wxSize m_bitmapSize;
int m_bitmapCellIndex;
private:
void Init();
wxDECLARE_DYNAMIC_CLASS(wxBitmapComboBox);
};
#endif // _WX_GTK_BMPCBOX_H_

View File

@@ -0,0 +1,52 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/brush.h
// Purpose:
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_BRUSH_H_
#define _WX_GTK_BRUSH_H_
class WXDLLIMPEXP_FWD_CORE wxBitmap;
class WXDLLIMPEXP_FWD_CORE wxColour;
//-----------------------------------------------------------------------------
// wxBrush
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxBrush: public wxBrushBase
{
public:
wxBrush() = default;
wxBrush( const wxColour &colour, wxBrushStyle style = wxBRUSHSTYLE_SOLID );
wxBrush( const wxBitmap &stippleBitmap );
bool operator==(const wxBrush& brush) const;
bool operator!=(const wxBrush& brush) const { return !(*this == brush); }
wxBrushStyle GetStyle() const override;
wxColour GetColour() const override;
wxBitmap *GetStipple() const override;
void SetColour( const wxColour& col ) override;
void SetColour( unsigned char r, unsigned char g, unsigned char b ) override;
void SetStyle( wxBrushStyle style ) override;
void SetStipple( const wxBitmap& stipple ) override;
wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants")
wxBrush(const wxColour& col, int style);
wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants")
void SetStyle(int style) { SetStyle((wxBrushStyle)style); }
protected:
virtual wxGDIRefData *CreateGDIRefData() const override;
wxNODISCARD virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const override;
wxDECLARE_DYNAMIC_CLASS(wxBrush);
};
#endif // _WX_GTK_BRUSH_H_

View File

@@ -0,0 +1,79 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/button.h
// Purpose: wxGTK wxButton class declaration
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_BUTTON_H_
#define _WX_GTK_BUTTON_H_
//-----------------------------------------------------------------------------
// wxButton
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxButton : public wxButtonBase
{
public:
wxButton() = default;
wxButton(wxWindow *parent, wxWindowID id,
const wxString& label = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxButtonNameStr))
{
Create(parent, id, label, pos, size, style, validator, name);
}
bool Create(wxWindow *parent, wxWindowID id,
const wxString& label = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxButtonNameStr));
virtual wxWindow *SetDefault() override;
virtual void SetLabel( const wxString &label ) override;
// implementation
// --------------
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
// helper to allow access to protected member from GTK callback
void MoveWindow(int x, int y, int width, int height) { DoMoveWindow(x, y, width, height); }
// called from GTK callbacks: they update the button state and call
// GTKUpdateBitmap()
void GTKMouseEnters();
void GTKMouseLeaves();
void GTKPressed();
void GTKReleased();
protected:
virtual wxSize DoGetBestSize() const override;
virtual void DoApplyWidgetStyle(GtkRcStyle *style) override;
#if wxUSE_MARKUP
virtual bool DoSetLabelMarkup(const wxString& markup) override;
#endif // wxUSE_MARKUP
private:
typedef wxButtonBase base_type;
// Return the GtkLabel used by this button.
GtkLabel *GTKGetLabel() const;
#ifndef __WXGTK3__
// To mark if special GTK style for buttons with wxBU_EXACTFIT flag
// was already defined.
static bool m_exactFitStyleDefined;
#endif // !__WXGTK3__
wxDECLARE_DYNAMIC_CLASS(wxButton);
};
#endif // _WX_GTK_BUTTON_H_

View File

@@ -0,0 +1,69 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/calctrl.h
// Purpose: wxGtkCalendarCtrl control
// Author: Marcin Wojdyr
// Copyright: (C) 2008 Marcin Wojdyr
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef GTK_CALCTRL_H__
#define GTK_CALCTRL_H__
class WXDLLIMPEXP_ADV wxGtkCalendarCtrl : public wxCalendarCtrlBase
{
public:
wxGtkCalendarCtrl() = default;
wxGtkCalendarCtrl(wxWindow *parent,
wxWindowID id,
const wxDateTime& date = wxDefaultDateTime,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCAL_SHOW_HOLIDAYS,
const wxString& name = wxASCII_STR(wxCalendarNameStr))
{
Create(parent, id, date, pos, size, style, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxDateTime& date = wxDefaultDateTime,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCAL_SHOW_HOLIDAYS,
const wxString& name = wxASCII_STR(wxCalendarNameStr));
virtual ~wxGtkCalendarCtrl() = default;
virtual bool SetDate(const wxDateTime& date) override;
virtual wxDateTime GetDate() const override;
virtual bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime,
const wxDateTime& upperdate = wxDefaultDateTime) override;
virtual bool GetDateRange(wxDateTime *lowerdate, wxDateTime *upperdate) const override;
virtual bool EnableMonthChange(bool enable = true) override;
virtual void Mark(size_t day, bool mark) override;
// implementation
// --------------
void GTKGenerateEvent(wxEventType type);
private:
bool IsInValidRange(const wxDateTime& dt) const;
// Range of the dates that can be selected by user, either or both may be
// invalid to indicate that no corresponding restriction is set.
wxDateTime m_validStart,
m_validEnd;
// Last known selected date, may be different from the real selection in
// the control while a handler for day-selected is running.
wxDateTime m_selectedDate;
wxDECLARE_DYNAMIC_CLASS(wxGtkCalendarCtrl);
wxDECLARE_NO_COPY_CLASS(wxGtkCalendarCtrl);
};
#endif // GTK_CALCTRL_H__

View File

@@ -0,0 +1,70 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/checkbox.h
// Purpose:
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTKCHECKBOX_H_
#define _WX_GTKCHECKBOX_H_
// ----------------------------------------------------------------------------
// wxCheckBox
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxCheckBox : public wxCheckBoxBase
{
public:
wxCheckBox();
~wxCheckBox();
wxCheckBox( wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxCheckBoxNameStr))
{
Create(parent, id, label, pos, size, style, validator, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxCheckBoxNameStr) );
void SetValue( bool state ) override;
bool GetValue() const override;
virtual void SetLabel( const wxString& label ) override;
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
// implementation
void GTKDisableEvents();
void GTKEnableEvents();
protected:
virtual void DoApplyWidgetStyle(GtkRcStyle *style) override;
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const override;
virtual void DoEnable(bool enable) override;
void DoSet3StateValue(wxCheckBoxState state) override;
wxCheckBoxState DoGet3StateValue() const override;
private:
typedef wxCheckBoxBase base_type;
virtual void GTKRemoveBorder() override;
GtkWidget *m_widgetCheckbox;
GtkWidget *m_widgetLabel;
wxDECLARE_DYNAMIC_CLASS(wxCheckBox);
};
#endif // _WX_GTKCHECKBOX_H_

View File

@@ -0,0 +1,47 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/checklst.h
// Purpose: wxCheckListBox class
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTKCHECKLIST_H_
#define _WX_GTKCHECKLIST_H_
//-----------------------------------------------------------------------------
// wxCheckListBox
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxCheckListBox : public wxCheckListBoxBase
{
public:
wxCheckListBox();
wxCheckListBox(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int nStrings = 0,
const wxString *choices = nullptr,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxListBoxNameStr));
wxCheckListBox(wxWindow *parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxListBoxNameStr));
virtual bool IsChecked(unsigned int index) const override;
virtual void Check(unsigned int index, bool check = true) override;
int GetItemHeight() const;
void DoCreateCheckList();
private:
wxDECLARE_DYNAMIC_CLASS(wxCheckListBox);
};
#endif // _WX_GTKCHECKLIST_H_

View File

@@ -0,0 +1,98 @@
/*
* Name: wx/gtk/chkconf.h
* Purpose: wxGTK-specific settings consistency checks
* Author: Vadim Zeitlin
* Created: 2007-07-19 (extracted from wx/chkconf.h)
* Copyright: (c) 2000-2007 Vadim Zeitlin <vadim@wxwidgets.org>
* Licence: wxWindows licence
*/
#ifndef __WXUNIVERSAL__
# if wxUSE_MDI_ARCHITECTURE && !wxUSE_MENUS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "MDI requires wxUSE_MENUS in wxGTK"
# else
# undef wxUSE_MENUS
# define wxUSE_MENUS 1
# endif
# endif
#endif /* !__WXUNIVERSAL__ */
#if wxUSE_JOYSTICK
# if !wxUSE_THREADS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxJoystick requires threads in wxGTK"
# else
# undef wxUSE_JOYSTICK
# define wxUSE_JOYSTICK 0
# endif
# endif
#endif /* wxUSE_JOYSTICK */
#if wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW && !wxUSE_POSTSCRIPT
# undef wxUSE_POSTSCRIPT
# define wxUSE_POSTSCRIPT 1
#endif
#if wxUSE_OWNER_DRAWN
# undef wxUSE_OWNER_DRAWN
# define wxUSE_OWNER_DRAWN 0
#endif
#if wxUSE_METAFILE
# undef wxUSE_METAFILE
# define wxUSE_METAFILE 0
#endif
#if wxUSE_ENH_METAFILE
# undef wxUSE_ENH_METAFILE
# define wxUSE_ENH_METAFILE 0
#endif
#ifndef __UNIX__
# undef wxUSE_WEBVIEW
# define wxUSE_WEBVIEW 0
# undef wxUSE_WEBVIEW_WEBKIT
# define wxUSE_WEBVIEW_WEBKIT 0
# undef wxUSE_MEDIACTRL
# define wxUSE_MEDIACTRL 0
/*
We could use GDK_WINDOWING_X11 for those but this would require
including gdk/gdk.h and we don't want to do it from here, so assume
we're not using X11 if we're not under Unix.
*/
# undef wxUSE_UIACTIONSIMULATOR
# define wxUSE_UIACTIONSIMULATOR 0
# undef wxUSE_GLCANVAS
# define wxUSE_GLCANVAS 0
#endif /* __UNIX__ */
/*
We always need Cairo with wxGTK, enable it if necessary (this can only
happen under Windows).
*/
#ifdef __WINDOWS__
#if !wxUSE_CAIRO
# undef wxUSE_CAIRO
# define wxUSE_CAIRO 1
#endif
#endif /* __WINDOWS__ */
#ifdef __WXGTK3__
#if !wxUSE_GRAPHICS_CONTEXT
#ifdef wxABORT_ON_CONFIG_ERROR
#error "GTK+ 3 support requires wxGraphicsContext"
#else
#undef wxUSE_GRAPHICS_CONTEXT
#define wxUSE_GRAPHICS_CONTEXT 1
#endif
#endif
#endif

View File

@@ -0,0 +1,115 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/choice.h
// Purpose:
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_CHOICE_H_
#define _WX_GTK_CHOICE_H_
class WXDLLIMPEXP_FWD_BASE wxSortedArrayString;
class WXDLLIMPEXP_FWD_BASE wxArrayString;
//-----------------------------------------------------------------------------
// wxChoice
//-----------------------------------------------------------------------------
class wxGtkCollatedArrayString;
class WXDLLIMPEXP_CORE wxChoice : public wxChoiceBase
{
public:
wxChoice()
{
Init();
}
wxChoice( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = (const wxString *) nullptr,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxChoiceNameStr) )
{
Init();
Create(parent, id, pos, size, n, choices, style, validator, name);
}
wxChoice( wxWindow *parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxChoiceNameStr) )
{
Init();
Create(parent, id, pos, size, choices, style, validator, name);
}
virtual ~wxChoice();
bool Create( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = nullptr,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxChoiceNameStr) );
bool Create( wxWindow *parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxChoiceNameStr) );
int GetSelection() const override;
void SetSelection(int n) override;
virtual unsigned int GetCount() const override;
virtual int FindString(const wxString& s, bool bCase = false) const override;
virtual wxString GetString(unsigned int n) const override;
virtual void SetString(unsigned int n, const wxString& string) override;
virtual void SetColumns(int n=1) override;
virtual int GetColumns() const override;
virtual void GTKDisableEvents();
virtual void GTKEnableEvents();
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
protected:
// this array is only used for controls with wxCB_SORT style, so only
// allocate it if it's needed (hence using pointer)
wxGtkCollatedArrayString *m_strings;
// contains the client data for the items
wxArrayPtrVoid m_clientData;
// index to GtkListStore cell which displays the item text
int m_stringCellIndex;
virtual wxSize DoGetBestSize() const override;
virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const override;
virtual int DoInsertItems(const wxArrayStringsAdapter& items,
unsigned int pos,
void **clientData, wxClientDataType type) override;
virtual void DoSetItemClientData(unsigned int n, void* clientData) override;
virtual void* DoGetItemClientData(unsigned int n) const override;
virtual void DoClear() override;
virtual void DoDeleteOneItem(unsigned int n) override;
virtual bool GTKHandleFocusOut() override;
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const override;
virtual void DoApplyWidgetStyle(GtkRcStyle *style) override;
private:
void Init();
wxDECLARE_DYNAMIC_CLASS(wxChoice);
};
#endif // _WX_GTK_CHOICE_H_

View File

@@ -0,0 +1,140 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/clipbrd.h
// Purpose: wxClipboard for wxGTK
// Author: Robert Roebling, Vadim Zeitlin
// Copyright: (c) 1998 Robert Roebling
// (c) 2007 Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_CLIPBOARD_H_
#define _WX_GTK_CLIPBOARD_H_
// ----------------------------------------------------------------------------
// wxClipboard
// ----------------------------------------------------------------------------
#include "wx/weakref.h"
class WXDLLIMPEXP_CORE wxClipboard : public wxClipboardBase
{
public:
// there are several clipboards in X11 (and in GDK)
enum Kind
{
Primary,
Clipboard
};
wxClipboard();
virtual ~wxClipboard();
// open the clipboard before SetData() and GetData()
virtual bool Open() override;
// close the clipboard after SetData() and GetData()
virtual void Close() override;
// query whether the clipboard is opened
virtual bool IsOpened() const override;
// set the clipboard data. all other formats will be deleted.
virtual bool SetData( wxDataObject *data ) override;
// add to the clipboard data.
virtual bool AddData( wxDataObject *data ) override;
// ask if data in correct format is available
virtual bool IsSupported( const wxDataFormat& format ) override;
// ask if data in correct format is available
virtual bool IsSupportedAsync( wxEvtHandler *sink ) override;
// fill data with data on the clipboard (if available)
virtual bool GetData( wxDataObject& data ) override;
// flushes the clipboard; that means that the data which is currently on
// clipboard will stay available even after the application exits (possibly
// eating memory), otherwise the clipboard will be emptied on exit
virtual bool Flush() override;
// clears wxTheClipboard and the system's clipboard if possible
virtual void Clear() override;
// implementation from now on
// --------------------------
// get our clipboard item (depending on m_usePrimary value)
GdkAtom GTKGetClipboardAtom() const;
// get the data object currently being requested
wxDataObject *GTKGetDataObject( GdkAtom atom );
// clear the data for the given clipboard kind
void GTKClearData(Kind kind);
// called when selection data is received
void GTKOnSelectionReceived(const GtkSelectionData& sel);
// called when available target information is received
bool GTKOnTargetReceived(const wxDataFormat& format);
private:
// the data object for the specific selection
wxDataObject *& Data(Kind kind)
{
return kind == Primary ? m_dataPrimary : m_dataClipboard;
}
// the data object we're currently using
wxDataObject *& Data()
{
return Data(m_usePrimary ? Primary : Clipboard);
}
// set or unset selection ownership
bool SetSelectionOwner(bool set = true);
// get the atom corresponding to the given format if it's supported
GdkAtom DoGetTarget(const wxDataFormat& format);
// just check if the given format is supported
bool DoIsSupported(const wxDataFormat& format);
// both of these pointers can be non-null simultaneously but we only use
// one of them at any moment depending on m_usePrimary value, use Data()
// (from inside) or GTKGetDataObject() (from outside) accessors
wxDataObject *m_dataPrimary,
*m_dataClipboard;
// this is used to temporarily hold the object passed to our GetData() so
// that GTK callbacks could access it
wxDataObject *m_receivedData;
// used to pass information about the format we need from DoIsSupported()
// to GTKOnTargetReceived() and return the supported format from the latter
GdkAtom m_targetRequested;
GtkWidget *m_clipboardWidget; // for getting and offering data
GtkWidget *m_targetsWidget; // for getting list of supported formats
// ID of the connection to "selection_get" signal, initially 0.
unsigned long m_idSelectionGetHandler;
bool m_open;
bool m_formatSupported;
public:
// async stuff
wxEvtHandlerRef m_sink;
private:
GtkWidget *m_targetsWidgetAsync; // for getting list of supported formats
wxDECLARE_DYNAMIC_CLASS(wxClipboard);
};
#endif // _WX_GTK_CLIPBOARD_H_

View File

@@ -0,0 +1,63 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/clrpicker.h
// Purpose: wxColourButton header
// Author: Francesco Montorsi
// Created: 14/4/2006
// Copyright: (c) Francesco Montorsi
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_CLRPICKER_H_
#define _WX_GTK_CLRPICKER_H_
#include "wx/button.h"
//-----------------------------------------------------------------------------
// wxColourButton
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxColourButton : public wxButton,
public wxColourPickerWidgetBase
{
public:
wxColourButton() : m_topParent(nullptr) {}
wxColourButton(wxWindow *parent,
wxWindowID id,
const wxColour& initial = *wxBLACK,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCLRBTN_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxColourPickerWidgetNameStr))
: m_topParent(nullptr)
{
Create(parent, id, initial, pos, size, style, validator, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxColour& initial = *wxBLACK,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCLRBTN_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxColourPickerWidgetNameStr));
virtual ~wxColourButton();
protected:
void UpdateColour() override;
public: // used by the GTK callback only
void GTKSetColour(const wxColour& colour)
{ m_colour = colour; }
wxWindow *m_topParent;
private:
wxDECLARE_DYNAMIC_CLASS(wxColourButton);
};
#endif // _WX_GTK_CLRPICKER_H_

View File

@@ -0,0 +1,78 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/collpane.h
// Purpose: wxCollapsiblePane
// Author: Francesco Montorsi
// Created: 8/10/2006
// Copyright: (c) Francesco Montorsi
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_COLLAPSABLE_PANEL_H_GTK_
#define _WX_COLLAPSABLE_PANEL_H_GTK_
// ----------------------------------------------------------------------------
// wxCollapsiblePane
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxCollapsiblePane : public wxCollapsiblePaneBase
{
public:
wxCollapsiblePane() { Init(); }
wxCollapsiblePane(wxWindow *parent,
wxWindowID winid,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCP_DEFAULT_STYLE,
const wxValidator& val = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxCollapsiblePaneNameStr))
{
Init();
Create(parent, winid, label, pos, size, style, val, name);
}
bool Create(wxWindow *parent,
wxWindowID winid,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCP_DEFAULT_STYLE,
const wxValidator& val = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxCollapsiblePaneNameStr));
virtual void Collapse(bool collapse = true) override;
virtual bool IsCollapsed() const override;
virtual void SetLabel(const wxString& str) override;
virtual wxWindow *GetPane() const override { return m_pPane; }
virtual wxString GetLabel() const override { return m_strLabel; }
protected:
virtual wxSize DoGetBestSize() const override;
public: // used by GTK callbacks
bool m_bIgnoreNextChange;
wxSize m_szCollapsed;
wxWindow *m_pPane;
// the button label without ">>" or "<<"
wxString m_strLabel;
private:
void Init()
{
m_bIgnoreNextChange = false;
}
void OnSize(wxSizeEvent&);
virtual void AddChildGTK(wxWindowGTK* child) override;
GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const override;
wxDECLARE_DYNAMIC_CLASS(wxCollapsiblePane);
wxDECLARE_EVENT_TABLE();
};
#endif // _WX_COLLAPSABLE_PANEL_H_GTK_

View File

@@ -0,0 +1,47 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/colordlg.h
// Purpose: wxColourDialog
// Author: Vaclav Slavik
// Created: 2004/06/04
// Copyright: (c) Vaclav Slavik, 2004
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_COLORDLG_H_
#define _WX_GTK_COLORDLG_H_
#include "wx/dialog.h"
class WXDLLIMPEXP_CORE wxColourDialog : public wxDialog
{
public:
wxColourDialog() = default;
wxColourDialog(wxWindow *parent,
const wxColourData *data = nullptr);
virtual ~wxColourDialog() = default;
bool Create(wxWindow *parent, const wxColourData *data = nullptr);
wxColourData &GetColourData() { return m_data; }
virtual int ShowModal() override;
protected:
// implement some base class methods to do nothing to avoid asserts and
// GTK warnings, since this is not a real wxDialog.
virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y),
int WXUNUSED(width), int WXUNUSED(height),
int WXUNUSED(sizeFlags) = wxSIZE_AUTO) override {}
virtual void DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y),
int WXUNUSED(width), int WXUNUSED(height)) override {}
// copy data between the dialog and m_colourData:
void ColourDataToDialog();
void DialogToColourData();
wxColourData m_data;
wxDECLARE_DYNAMIC_CLASS(wxColourDialog);
};
#endif

View File

@@ -0,0 +1,55 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/colour.h
// Purpose:
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_COLOUR_H_
#define _WX_GTK_COLOUR_H_
#ifdef __WXGTK3__
typedef struct _GdkRGBA GdkRGBA;
#endif
//-----------------------------------------------------------------------------
// wxColour
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxWARN_UNUSED wxColour : public wxColourBase
{
public:
// constructors
// ------------
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
wxColour(const GdkColor& gdkColor);
#ifdef __WXGTK3__
wxColour(const GdkRGBA& gdkRGBA);
#endif
bool operator==(const wxColour& col) const;
bool operator!=(const wxColour& col) const { return !(*this == col); }
unsigned char Red() const override;
unsigned char Green() const override;
unsigned char Blue() const override;
unsigned char Alpha() const override;
// Implementation part
#ifdef __WXGTK3__
operator const GdkRGBA*() const;
#else
void CalcPixel( GdkColormap *cmap );
int GetPixel() const;
#endif
const GdkColor *GetColor() const;
protected:
virtual void
InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a) override;
wxDECLARE_DYNAMIC_CLASS(wxColour);
};
#endif // _WX_GTK_COLOUR_H_

View File

@@ -0,0 +1,167 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/combobox.h
// Purpose:
// Author: Robert Roebling
// Created: 01/02/97
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_COMBOBOX_H_
#define _WX_GTK_COMBOBOX_H_
#include "wx/choice.h"
typedef struct _GtkEntry GtkEntry;
//-----------------------------------------------------------------------------
// wxComboBox
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxComboBox : public wxChoice,
public wxTextEntry
{
public:
wxComboBox()
: wxChoice(), wxTextEntry()
{
Init();
}
wxComboBox(wxWindow *parent,
wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = nullptr,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxComboBoxNameStr))
: wxChoice(), wxTextEntry()
{
Init();
Create(parent, id, value, pos, size, n, choices, style, validator, name);
}
wxComboBox(wxWindow *parent, wxWindowID id,
const wxString& value,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxComboBoxNameStr))
: wxChoice(), wxTextEntry()
{
Init();
Create(parent, id, value, pos, size, choices, style, validator, name);
}
~wxComboBox();
bool Create(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = (const wxString *) nullptr,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxComboBoxNameStr));
bool Create(wxWindow *parent, wxWindowID id,
const wxString& value,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxComboBoxNameStr));
// Set/GetSelection() from wxTextEntry and wxChoice
virtual void SetSelection(int n) override { wxChoice::SetSelection(n); }
virtual void SetSelection(long from, long to) override
{ wxTextEntry::SetSelection(from, to); }
virtual int GetSelection() const override { return wxChoice::GetSelection(); }
virtual void GetSelection(long *from, long *to) const override
{ return wxTextEntry::GetSelection(from, to); }
virtual wxString GetStringSelection() const override
{
return wxItemContainer::GetStringSelection();
}
virtual void SetString(unsigned int n, const wxString& string) override;
virtual void Popup();
virtual void Dismiss();
virtual void Clear() override;
// See wxComboBoxBase discussion of IsEmpty().
bool IsListEmpty() const { return wxItemContainer::IsEmpty(); }
bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); }
void OnChar( wxKeyEvent &event );
virtual void SetValue(const wxString& value) override;
// Standard event handling
void OnCut(wxCommandEvent& event);
void OnCopy(wxCommandEvent& event);
void OnPaste(wxCommandEvent& event);
void OnUndo(wxCommandEvent& event);
void OnRedo(wxCommandEvent& event);
void OnDelete(wxCommandEvent& event);
void OnSelectAll(wxCommandEvent& event);
void OnUpdateCut(wxUpdateUIEvent& event);
void OnUpdateCopy(wxUpdateUIEvent& event);
void OnUpdatePaste(wxUpdateUIEvent& event);
void OnUpdateUndo(wxUpdateUIEvent& event);
void OnUpdateRedo(wxUpdateUIEvent& event);
void OnUpdateDelete(wxUpdateUIEvent& event);
void OnUpdateSelectAll(wxUpdateUIEvent& event);
virtual void GTKDisableEvents() override;
virtual void GTKEnableEvents() override;
GtkWidget* GetConnectWidget() const override;
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
virtual const wxTextEntry* WXGetTextEntry() const override { return this; }
protected:
// From wxWindowGTK:
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const override;
// Widgets that use the style->base colour for the BG colour should
// override this and return true.
virtual bool UseGTKStyleBase() const override { return true; }
// Override in derived classes to create combo box widgets with
// custom list stores.
virtual void GTKCreateComboBoxWidget();
virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const override;
virtual GtkEntry *GetEntry() const override
{ return m_entry; }
virtual int GTKIMFilterKeypress(GdkEventKey* event) const override
{ return GTKEntryIMFilterKeypress(event); }
GtkEntry* m_entry;
private:
// From wxTextEntry:
virtual wxWindow *GetEditableWindow() override { return this; }
virtual GtkEditable *GetEditable() const override;
void Init();
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox);
wxDECLARE_EVENT_TABLE();
};
#endif // _WX_GTK_COMBOBOX_H_

View File

@@ -0,0 +1,95 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/control.h
// Purpose:
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling, Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_CONTROL_H_
#define _WX_GTK_CONTROL_H_
typedef struct _GtkLabel GtkLabel;
typedef struct _GtkFrame GtkFrame;
typedef struct _GtkEntry GtkEntry;
//-----------------------------------------------------------------------------
// wxControl
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxControl : public wxControlBase
{
typedef wxControlBase base_type;
public:
wxControl();
wxControl(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxControlNameStr))
{
Create(parent, id, pos, size, style, validator, name);
}
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxControlNameStr));
virtual wxVisualAttributes GetDefaultAttributes() const override;
#ifdef __WXGTK3__
virtual bool SetFont(const wxFont& font) override;
#endif
protected:
virtual wxSize DoGetBestSize() const override;
void PostCreation(const wxSize& size);
// sets the label to the given string and also sets it for the given widget
void GTKSetLabelForLabel(GtkLabel *w, const wxString& label);
#if wxUSE_MARKUP
void GTKSetLabelWithMarkupForLabel(GtkLabel *w, const wxString& label);
#endif // wxUSE_MARKUP
// GtkFrame helpers
GtkWidget* GTKCreateFrame(const wxString& label);
void GTKSetLabelForFrame(GtkFrame *w, const wxString& label);
void GTKFrameApplyWidgetStyle(GtkFrame* w, GtkRcStyle* rc);
void GTKFrameSetMnemonicWidget(GtkFrame* w, GtkWidget* widget);
// remove mnemonics ("&"s) from the label
static wxString GTKRemoveMnemonics(const wxString& label);
// converts wx label to GTK+ label, i.e. basically replace "&"s with "_"s
static wxString GTKConvertMnemonics(const wxString &label);
// converts wx label to GTK+ labels preserving Pango markup
static wxString GTKConvertMnemonicsWithMarkup(const wxString& label);
// These are used by GetDefaultAttributes
static wxVisualAttributes
GetDefaultAttributesFromGTKWidget(GtkWidget* widget,
bool useBase = false,
int state = 0);
// Widgets that use the style->base colour for the BG colour should
// override this and return true.
virtual bool UseGTKStyleBase() const { return false; }
// Fix sensitivity due to bug in GTK+ < 2.14
void GTKFixSensitivity(bool onlyIfUnderMouse = true);
// Ask GTK+ for preferred size. Use it after setting the font.
wxSize GTKGetPreferredSize(GtkWidget* widget) const;
// Inner margins in a GtkEntry
wxSize GTKGetEntryMargins(GtkEntry* entry) const;
private:
virtual void GTKRemoveBorder() override;
wxDECLARE_DYNAMIC_CLASS(wxControl);
};
#endif // _WX_GTK_CONTROL_H_

View File

@@ -0,0 +1,64 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/cursor.h
// Purpose:
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_CURSOR_H_
#define _WX_GTK_CURSOR_H_
class WXDLLIMPEXP_FWD_CORE wxImage;
//-----------------------------------------------------------------------------
// wxCursor
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxCursor : public wxCursorBase
{
public:
wxCursor();
wxCursor(wxStockCursor id) { InitFromStock(id); }
wxCursor(const wxBitmap& bitmap, const wxPoint& hotSpot)
: wxCursor(bitmap, hotSpot.x, hotSpot.y) { }
wxCursor(const wxBitmap& bitmap, int hotSpotX = 0, int hotSpotY = 0);
#if wxUSE_IMAGE
wxCursor( const wxImage & image );
wxCursor(const char* const* xpmData);
#endif // wxUSE_IMAGE
wxCursor(const wxString& name, wxBitmapType type, const wxPoint& hotSpot)
: wxCursor(name, type, hotSpot.x, hotSpot.y) { }
wxCursor(const wxString& name,
wxBitmapType type = wxCURSOR_DEFAULT_TYPE,
int hotSpotX = 0, int hotSpotY = 0);
// Non-portable wxGTK-specific ctor.
wxCursor( const char bits[], int width, int height,
int hotSpotX = -1, int hotSpotY = -1,
const char maskBits[] = nullptr,
const wxColour* fg = nullptr, const wxColour* bg = nullptr);
virtual wxPoint GetHotSpot() const override;
// implementation
GdkCursor *GetCursor() const;
protected:
void InitFromStock(wxStockCursor);
#if wxUSE_IMAGE
void InitFromImage(const wxImage& image);
#endif
void
InitFromBitmap(const wxBitmap& bitmap, int hotSpotX, int hotSpotY,
const wxColour *fg = nullptr, const wxColour *bg = nullptr);
virtual wxGDIRefData *CreateGDIRefData() const override;
wxNODISCARD virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const override;
private:
wxDECLARE_DYNAMIC_CLASS(wxCursor);
};
#endif // _WX_GTK_CURSOR_H_

View File

@@ -0,0 +1,73 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/dataform.h
// Purpose: declaration of the wxDataFormat class
// Author: Vadim Zeitlin
// Created: 19.10.99 (extracted from gtk/dataobj.h)
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_DATAFORM_H
#define _WX_GTK_DATAFORM_H
class WXDLLIMPEXP_CORE wxDataFormat
{
public:
// the clipboard formats under GDK are GdkAtoms
typedef GdkAtom NativeFormat;
wxDataFormat();
wxDataFormat( wxDataFormatId type );
wxDataFormat( NativeFormat format );
// we have to provide all the overloads to allow using strings instead of
// data formats (as a lot of existing code does)
wxDataFormat( const wxString& id ) { InitFromString(id); }
#ifndef wxNO_IMPLICIT_WXSTRING_ENCODING
wxDataFormat( const char *id ) { InitFromString(id); }
#endif
wxDataFormat( const wchar_t *id ) { InitFromString(id); }
wxDataFormat( const wxCStrData& id ) { InitFromString(id); }
wxDataFormat& operator=(NativeFormat format)
{ SetId(format); return *this; }
// comparison
bool operator==(wxDataFormatId type) const
{ return m_type == type; }
bool operator!=(wxDataFormatId type) const
{ return !(*this == type); }
bool operator==(NativeFormat format) const
{ return m_format == (NativeFormat)format; }
bool operator!=(NativeFormat format) const
{ return !(*this == (NativeFormat)format); }
bool operator==(const wxDataFormat& other) const;
bool operator!=(const wxDataFormat& other) const
{ return !(*this == other); }
// explicit and implicit conversions to NativeFormat which is one of
// standard data types (implicit conversion is useful for preserving the
// compatibility with old code)
NativeFormat GetFormatId() const { return m_format; }
operator NativeFormat() const { return m_format; }
void SetId( NativeFormat format );
// string ids are used for custom types - this SetId() must be used for
// application-specific formats
wxString GetId() const;
void SetId( const wxString& id );
// implementation
wxDataFormatId GetType() const;
void SetType( wxDataFormatId type );
private:
// common part of ctors from format name
void InitFromString(const wxString& id);
wxDataFormatId m_type;
NativeFormat m_format;
};
#endif // _WX_GTK_DATAFORM_H

View File

@@ -0,0 +1,26 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/dataobj.h
// Purpose: declaration of the wxDataObject
// Author: Robert Roebling
// Copyright: (c) 1998, 1999 Vadim Zeitlin, Robert Roebling
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_DATAOBJ_H_
#define _WX_GTK_DATAOBJ_H_
// ----------------------------------------------------------------------------
// wxDataObject is the same as wxDataObjectBase under wxGTK
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDataObject : public wxDataObjectBase
{
public:
wxDataObject();
virtual ~wxDataObject();
virtual bool IsSupportedFormat( const wxDataFormat& format, Direction dir = Get ) const;
};
#endif // _WX_GTK_DATAOBJ_H_

View File

@@ -0,0 +1,114 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/dataobj2.h
// Purpose: declaration of standard wxDataObjectSimple-derived classes
// Author: Robert Roebling
// Created: 19.10.99 (extracted from gtk/dataobj.h)
// Copyright: (c) 1998, 1999 Vadim Zeitlin, Robert Roebling
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_DATAOBJ2_H_
#define _WX_GTK_DATAOBJ2_H_
// ----------------------------------------------------------------------------
// wxBitmapDataObject is a specialization of wxDataObject for bitmaps
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxBitmapDataObject : public wxBitmapDataObjectBase
{
public:
// ctors
wxBitmapDataObject();
wxBitmapDataObject(const wxBitmap& bitmap);
// destr
virtual ~wxBitmapDataObject();
// override base class virtual to update PNG data too
virtual void SetBitmap(const wxBitmap& bitmap) override;
// implement base class pure virtuals
// ----------------------------------
virtual size_t GetDataSize() const override { return m_pngSize; }
virtual bool GetDataHere(void *buf) const override;
virtual bool SetData(size_t len, const void *buf) override;
// Must provide overloads to avoid hiding them (and warnings about it)
virtual size_t GetDataSize(const wxDataFormat&) const override
{
return GetDataSize();
}
virtual bool GetDataHere(const wxDataFormat&, void *buf) const override
{
return GetDataHere(buf);
}
virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) override
{
return SetData(len, buf);
}
protected:
void Clear() { free(m_pngData); }
void ClearAll() { Clear(); Init(); }
size_t m_pngSize;
void *m_pngData;
void DoConvertToPng();
private:
void Init() { m_pngData = nullptr; m_pngSize = 0; }
};
// ----------------------------------------------------------------------------
// wxFileDataObject is a specialization of wxDataObject for file names
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxFileDataObject : public wxFileDataObjectBase
{
public:
// implement base class pure virtuals
// ----------------------------------
void AddFile( const wxString &filename );
virtual size_t GetDataSize() const override;
virtual bool GetDataHere(void *buf) const override;
virtual bool SetData(size_t len, const void *buf) override;
// Must provide overloads to avoid hiding them (and warnings about it)
virtual size_t GetDataSize(const wxDataFormat&) const override
{
return GetDataSize();
}
virtual bool GetDataHere(const wxDataFormat&, void *buf) const override
{
return GetDataHere(buf);
}
virtual bool SetData(const wxDataFormat&, size_t len, const void *buf) override
{
return SetData(len, buf);
}
};
// ----------------------------------------------------------------------------
// wxURLDataObject is a specialization of wxDataObject for URLs
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxURLDataObject : public wxDataObjectComposite
{
public:
wxURLDataObject(const wxString& url = wxEmptyString);
wxString GetURL() const;
void SetURL(const wxString& url);
private:
class wxTextURIListDataObject* const m_dobjURIList;
wxTextDataObject* const m_dobjText;
wxDECLARE_NO_COPY_CLASS(wxURLDataObject);
};
#endif // _WX_GTK_DATAOBJ2_H_

View File

@@ -0,0 +1,256 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/dataview.h
// Purpose: wxDataViewCtrl GTK+2 implementation header
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTKDATAVIEWCTRL_H_
#define _WX_GTKDATAVIEWCTRL_H_
#include <memory>
#include <vector>
class WXDLLIMPEXP_FWD_CORE wxDataViewCtrlInternal;
struct _GtkTreePath;
// ---------------------------------------------------------
// wxDataViewColumn
// ---------------------------------------------------------
class WXDLLIMPEXP_CORE wxDataViewColumn: public wxDataViewColumnBase
{
public:
wxDataViewColumn( const wxString &title, wxDataViewRenderer *renderer,
unsigned int model_column, int width = wxDVC_DEFAULT_WIDTH,
wxAlignment align = wxALIGN_CENTER,
int flags = wxDATAVIEW_COL_RESIZABLE );
wxDataViewColumn( const wxBitmapBundle &bitmap, wxDataViewRenderer *renderer,
unsigned int model_column, int width = wxDVC_DEFAULT_WIDTH,
wxAlignment align = wxALIGN_CENTER,
int flags = wxDATAVIEW_COL_RESIZABLE );
// setters:
virtual void SetTitle( const wxString &title ) override;
virtual void SetBitmap( const wxBitmapBundle &bitmap ) override;
virtual void SetOwner( wxDataViewCtrl *owner ) override;
virtual void SetAlignment( wxAlignment align ) override;
virtual void SetSortable( bool sortable ) override;
virtual void SetSortOrder( bool ascending ) override;
virtual void UnsetAsSortKey() override;
virtual void SetResizeable( bool resizable ) override;
virtual void SetHidden( bool hidden ) override;
virtual void SetMinWidth( int minWidth ) override;
virtual void SetWidth( int width ) override;
virtual void SetReorderable( bool reorderable ) override;
virtual void SetFlags(int flags) override { SetIndividualFlags(flags); }
// getters:
virtual wxString GetTitle() const override;
virtual wxAlignment GetAlignment() const override;
virtual bool IsSortable() const override;
virtual bool IsSortOrderAscending() const override;
virtual bool IsSortKey() const override;
virtual bool IsResizeable() const override;
virtual bool IsHidden() const override;
virtual int GetWidth() const override;
virtual int GetMinWidth() const override;
virtual bool IsReorderable() const override;
virtual int GetFlags() const override { return GetFromIndividualFlags(); }
// implementation
GtkWidget* GetGtkHandle() const { return m_column; }
private:
// holds the GTK handle
GtkWidget *m_column;
// holds GTK handles for title/bitmap in the header
GtkWidget *m_image;
GtkWidget *m_label;
// delayed connection to mouse events
friend class wxDataViewCtrl;
void OnInternalIdle();
bool m_isConnected;
void Init(wxAlignment align, int flags, int width);
};
// ---------------------------------------------------------
// wxDataViewCtrl
// ---------------------------------------------------------
class WXDLLIMPEXP_CORE wxDataViewCtrl: public wxDataViewCtrlBase
{
public:
wxDataViewCtrl()
{
Init();
}
wxDataViewCtrl( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxDataViewCtrlNameStr) )
{
Init();
Create(parent, id, pos, size, style, validator, name);
}
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxDataViewCtrlNameStr));
virtual ~wxDataViewCtrl();
virtual bool AssociateModel( wxDataViewModel *model ) override;
virtual bool PrependColumn( wxDataViewColumn *col ) override;
virtual bool AppendColumn( wxDataViewColumn *col ) override;
virtual bool InsertColumn( unsigned int pos, wxDataViewColumn *col ) override;
virtual unsigned int GetColumnCount() const override;
virtual wxDataViewColumn* GetColumn( unsigned int pos ) const override;
virtual bool DeleteColumn( wxDataViewColumn *column ) override;
virtual bool ClearColumns() override;
virtual int GetColumnPosition( const wxDataViewColumn *column ) const override;
virtual wxDataViewColumn *GetSortingColumn() const override;
virtual int GetSelectedItemsCount() const override;
virtual int GetSelections( wxDataViewItemArray & sel ) const override;
virtual void SetSelections( const wxDataViewItemArray & sel ) override;
virtual void Select( const wxDataViewItem & item ) override;
virtual void Unselect( const wxDataViewItem & item ) override;
virtual bool IsSelected( const wxDataViewItem & item ) const override;
virtual void SelectAll() override;
virtual void UnselectAll() override;
virtual void EnsureVisible( const wxDataViewItem& item,
const wxDataViewColumn *column = nullptr ) override;
virtual void HitTest( const wxPoint &point,
wxDataViewItem &item,
wxDataViewColumn *&column ) const override;
virtual wxRect GetItemRect( const wxDataViewItem &item,
const wxDataViewColumn *column = nullptr ) const override;
virtual bool SetRowHeight( int rowHeight ) override;
virtual void EditItem(const wxDataViewItem& item, const wxDataViewColumn *column) override;
virtual void Collapse( const wxDataViewItem & item ) override;
virtual bool IsExpanded( const wxDataViewItem & item ) const override;
virtual bool EnableDragSource( const wxDataFormat &format ) override;
virtual bool DoEnableDropTarget( const wxVector<wxDataFormat>& formats ) override;
virtual wxDataViewColumn *GetCurrentColumn() const override;
virtual wxDataViewItem GetTopItem() const override;
virtual int GetCountPerPage() const override;
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
wxWindow *GetMainWindow() { return (wxWindow*) this; }
GtkWidget *GtkGetTreeView() { return m_treeview; }
wxDataViewCtrlInternal* GtkGetInternal() { return m_internal; }
// Convert GTK path to our item. Returned item may be invalid if get_iter()
// failed.
wxDataViewItem GTKPathToItem(struct _GtkTreePath *path) const;
// Return wxDataViewColumn matching the given GtkTreeViewColumn.
//
// If the input argument is null, return nullptr too. Otherwise we must find
// the matching column and assert if we didn't.
wxDataViewColumn* GTKColumnToWX(GtkTreeViewColumn *gtk_col) const;
virtual void OnInternalIdle() override;
int GTKGetUniformRowHeight() const { return m_uniformRowHeight; }
// Simple RAII helper for disabling selection events during its lifetime.
class SelectionEventsSuppressor
{
public:
explicit SelectionEventsSuppressor(wxDataViewCtrl* ctrl)
: m_ctrl(ctrl)
{
m_ctrl->GtkDisableSelectionEvents();
}
~SelectionEventsSuppressor()
{
m_ctrl->GtkEnableSelectionEvents();
}
private:
wxDataViewCtrl* const m_ctrl;
};
protected:
virtual void DoSetExpanderColumn() override;
virtual void DoSetIndent() override;
virtual void DoExpand(const wxDataViewItem& item, bool expandChildren) override;
virtual void DoApplyWidgetStyle(GtkRcStyle *style) override;
virtual GdkWindow* GTKGetWindow(wxArrayGdkWindows& windows) const override;
private:
void Init();
virtual wxDataViewItem DoGetCurrentItem() const override;
virtual void DoSetCurrentItem(const wxDataViewItem& item) override;
friend class wxDataViewCtrlDCImpl;
friend class wxDataViewColumn;
friend class wxDataViewCtrlInternal;
GtkWidget *m_treeview;
wxDataViewCtrlInternal *m_internal;
using wxDataViewColumnPtr = std::unique_ptr<wxDataViewColumn>;
std::vector<wxDataViewColumnPtr> m_cols;
wxDataViewItem m_ensureVisibleDefered;
// By default this is set to -1 and the height of the rows is determined by
// GetRect() methods of the renderers but this can be set to a positive
// value to force the height of all rows to the given value.
int m_uniformRowHeight;
virtual void AddChildGTK(wxWindowGTK* child) override;
void GtkEnableSelectionEvents();
void GtkDisableSelectionEvents();
wxDECLARE_DYNAMIC_CLASS(wxDataViewCtrl);
wxDECLARE_NO_COPY_CLASS(wxDataViewCtrl);
};
#endif // _WX_GTKDATAVIEWCTRL_H_

View File

@@ -0,0 +1,164 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/dc.h
// Purpose:
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTKDC_H_
#define _WX_GTKDC_H_
#ifdef __WXGTK3__
#include "wx/dcgraph.h"
class wxGTKCairoDCImpl: public wxGCDCImpl
{
typedef wxGCDCImpl BaseType;
public:
wxGTKCairoDCImpl(wxDC* owner);
wxGTKCairoDCImpl(wxDC* owner, wxWindow* window, wxLayoutDirection dir = wxLayout_Default, int width = 0);
virtual void DoDrawBitmap(const wxBitmap& bitmap, int x, int y, bool useMask) override;
virtual void DoDrawCheckMark(int x, int y, int width, int height) override;
virtual void DoDrawIcon(const wxIcon& icon, int x, int y) override;
virtual void DoDrawText(const wxString& text, int x, int y) override;
virtual void DoDrawRotatedText(const wxString& text, int x, int y, double angle) override;
#if wxUSE_IMAGE
virtual bool DoFloodFill(int x, int y, const wxColour& col, wxFloodFillStyle style) override;
#endif
virtual wxBitmap DoGetAsBitmap(const wxRect* subrect) const override;
virtual bool DoGetPixel(int x, int y, wxColour* col) const override;
virtual void DoGetSize(int* width, int* height) const override;
virtual bool DoStretchBlit(int xdest, int ydest, int dstWidth, int dstHeight, wxDC* source, int xsrc, int ysrc, int srcWidth, int srcHeight, wxRasterOperationMode rop, bool useMask, int xsrcMask, int ysrcMask) override;
virtual void* GetCairoContext() const override;
virtual wxSize GetPPI() const override;
virtual void SetLayoutDirection(wxLayoutDirection dir) override;
virtual wxLayoutDirection GetLayoutDirection() const override;
protected:
// Set m_size from the given (valid) GdkWindow.
void InitSize(GdkWindow* window);
void AdjustForRTL(cairo_t* cr);
wxSize m_size;
wxLayoutDirection m_layoutDir;
wxDECLARE_NO_COPY_CLASS(wxGTKCairoDCImpl);
};
//-----------------------------------------------------------------------------
class wxWindowDCImpl: public wxGTKCairoDCImpl
{
public:
wxWindowDCImpl(wxWindowDC* owner, wxWindow* window);
wxDECLARE_NO_COPY_CLASS(wxWindowDCImpl);
};
//-----------------------------------------------------------------------------
class wxClientDCImpl: public wxGTKCairoDCImpl
{
public:
wxClientDCImpl(wxClientDC* owner, wxWindow* window);
static bool CanBeUsedForDrawing(const wxWindow* window);
wxDECLARE_NO_COPY_CLASS(wxClientDCImpl);
};
//-----------------------------------------------------------------------------
class wxPaintDCImpl: public wxGTKCairoDCImpl
{
public:
wxPaintDCImpl(wxPaintDC* owner, wxWindow* window);
wxDECLARE_NO_COPY_CLASS(wxPaintDCImpl);
};
//-----------------------------------------------------------------------------
class wxScreenDCImpl: public wxGTKCairoDCImpl
{
public:
wxScreenDCImpl(wxScreenDC* owner);
virtual wxSize GetPPI() const override;
wxDECLARE_NO_COPY_CLASS(wxScreenDCImpl);
};
//-----------------------------------------------------------------------------
class wxMemoryDCImpl: public wxGTKCairoDCImpl
{
public:
wxMemoryDCImpl(wxMemoryDC* owner);
wxMemoryDCImpl(wxMemoryDC* owner, wxBitmap& bitmap);
wxMemoryDCImpl(wxMemoryDC* owner, wxDC* dc);
virtual wxBitmap DoGetAsBitmap(const wxRect* subrect) const override;
virtual void DoSelect(const wxBitmap& bitmap) override;
virtual const wxBitmap& GetSelectedBitmap() const override;
virtual wxBitmap& GetSelectedBitmap() override;
private:
void Setup();
wxBitmap m_bitmap;
wxDECLARE_NO_COPY_CLASS(wxMemoryDCImpl);
};
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGTKCairoDC: public wxDC
{
public:
wxGTKCairoDC(cairo_t* cr, wxWindow* window, wxLayoutDirection dir = wxLayout_LeftToRight, int width = 0);
wxDECLARE_NO_COPY_CLASS(wxGTKCairoDC);
};
#else
#include "wx/dc.h"
//-----------------------------------------------------------------------------
// wxDC
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGTKDCImpl : public wxDCImpl
{
public:
wxGTKDCImpl( wxDC *owner );
virtual ~wxGTKDCImpl();
#if wxUSE_PALETTE
void SetColourMap( const wxPalette& palette ) { SetPalette(palette); }
#endif // wxUSE_PALETTE
// Resolution in pixels per logical inch
virtual wxSize GetPPI() const override;
virtual bool StartDoc( const wxString& WXUNUSED(message) ) override { return true; }
virtual void EndDoc() override { }
virtual void StartPage() override { }
virtual void EndPage() override { }
virtual GdkWindow* GetGDKWindow() const { return nullptr; }
virtual void* GetHandle() const override { return GetGDKWindow(); }
// base class pure virtuals implemented here
virtual void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height) override;
virtual void DoGetSizeMM(int* width, int* height) const override;
wxDECLARE_ABSTRACT_CLASS(wxGTKDCImpl);
};
// this must be defined when wxDC::Blit() honours the DC origin and needed to
// allow wxUniv code in univ/winuniv.cpp to work with versions of wxGTK
// 2.3.[23]
#ifndef wxHAS_WORKING_GTK_DC_BLIT
#define wxHAS_WORKING_GTK_DC_BLIT
#endif
#endif
#endif // _WX_GTKDC_H_

View File

@@ -0,0 +1,173 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/dcclient.h
// Purpose:
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTKDCCLIENT_H_
#define _WX_GTKDCCLIENT_H_
#include "wx/gtk/dc.h"
//-----------------------------------------------------------------------------
// wxWindowDCImpl
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxWindowDCImpl : public wxGTKDCImpl
{
public:
wxWindowDCImpl( wxDC *owner );
wxWindowDCImpl( wxDC *owner, wxWindow *win );
virtual ~wxWindowDCImpl();
virtual bool CanDrawBitmap() const override { return true; }
virtual bool CanGetTextExtent() const override { return true; }
virtual void DoGetSize(int *width, int *height) const override;
virtual bool DoFloodFill( wxCoord x, wxCoord y, const wxColour& col,
wxFloodFillStyle style=wxFLOOD_SURFACE ) override;
virtual bool DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const override;
virtual void DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ) override;
virtual void DoCrossHair( wxCoord x, wxCoord y ) override;
virtual void DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2,
wxCoord xc, wxCoord yc ) override;
virtual void DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord height,
double sa, double ea ) override;
virtual void DoDrawPoint( wxCoord x, wxCoord y ) override;
virtual void DoDrawLines(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset) override;
virtual void DoDrawPolygon(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE) override;
virtual void DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) override;
virtual void DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0 ) override;
virtual void DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) override;
virtual void DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ) override;
virtual void DoDrawBitmap( const wxBitmap &bitmap, wxCoord x, wxCoord y,
bool useMask = false ) override;
virtual bool DoBlit( wxCoord xdest, wxCoord ydest,
wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc,
wxRasterOperationMode logical_func = wxCOPY,
bool useMask = false,
wxCoord xsrcMask = -1, wxCoord ysrcMask = -1 ) override;
virtual void DoDrawText( const wxString &text, wxCoord x, wxCoord y ) override;
virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
double angle) override;
virtual void DoGetTextExtent( const wxString &string,
wxCoord *width, wxCoord *height,
wxCoord *descent = nullptr,
wxCoord *externalLeading = nullptr,
const wxFont *theFont = nullptr) const override;
virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const override;
virtual void DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) override;
virtual void DoSetDeviceClippingRegion( const wxRegion &region ) override;
virtual bool DoGetClippingRect(wxRect& rect) const override;
virtual wxCoord GetCharWidth() const override;
virtual wxCoord GetCharHeight() const override;
virtual void Clear() override;
virtual void SetFont( const wxFont &font ) override;
virtual void SetPen( const wxPen &pen ) override;
virtual void SetBrush( const wxBrush &brush ) override;
virtual void SetBackground( const wxBrush &brush ) override;
virtual void SetLogicalFunction( wxRasterOperationMode function ) override;
virtual void SetTextForeground( const wxColour &col ) override;
virtual void SetTextBackground( const wxColour &col ) override;
virtual void SetBackgroundMode( int mode ) override;
#if wxUSE_PALETTE
virtual void SetPalette( const wxPalette& palette ) override;
#endif
virtual void DestroyClippingRegion() override;
// Resolution in pixels per logical inch
virtual wxSize GetPPI() const override;
virtual int GetDepth() const override;
// overridden here for RTL
virtual void SetDeviceOrigin( wxCoord x, wxCoord y ) override;
virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp ) override;
// protected:
// implementation
// --------------
GdkWindow *m_gdkwindow;
GdkGC *m_penGC;
GdkGC *m_brushGC;
GdkGC *m_textGC;
GdkGC *m_bgGC;
GdkColormap *m_cmap;
bool m_isScreenDC;
wxRegion m_currentClippingRegion;
wxRegion m_paintClippingRegion;
bool m_isClipBoxValid;
// PangoContext stuff for GTK 2.0
PangoContext *m_context;
PangoLayout *m_layout;
PangoFontDescription *m_fontdesc;
void SetUpDC( bool ismem = false );
void DontClipSubWindows();
void Destroy();
virtual void ComputeScaleAndOrigin() override;
virtual GdkWindow *GetGDKWindow() const override { return m_gdkwindow; }
// Update the internal clip box variables
void UpdateClipBox();
private:
void DrawingSetup(GdkGC*& gc, bool& originChanged);
GdkPixmap* MonoToColor(GdkPixmap* monoPixmap, int x, int y, int w, int h) const;
wxDECLARE_ABSTRACT_CLASS(wxWindowDCImpl);
};
//-----------------------------------------------------------------------------
// wxClientDCImpl
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxClientDCImpl : public wxWindowDCImpl
{
public:
wxClientDCImpl( wxDC *owner );
wxClientDCImpl( wxDC *owner, wxWindow *win );
virtual void DoGetSize(int *width, int *height) const override;
static bool
CanBeUsedForDrawing(const wxWindow* WXUNUSED(window)) { return true; }
wxDECLARE_ABSTRACT_CLASS(wxClientDCImpl);
};
//-----------------------------------------------------------------------------
// wxPaintDCImpl
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxPaintDCImpl : public wxClientDCImpl
{
public:
wxPaintDCImpl( wxDC *owner );
wxPaintDCImpl( wxDC *owner, wxWindow *win );
wxDECLARE_ABSTRACT_CLASS(wxPaintDCImpl);
};
#endif // _WX_GTKDCCLIENT_H_

View File

@@ -0,0 +1,59 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/dcmemory.h
// Purpose:
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_DCMEMORY_H_
#define _WX_GTK_DCMEMORY_H_
#include "wx/dcmemory.h"
#include "wx/gtk/dcclient.h"
//-----------------------------------------------------------------------------
// wxMemoryDCImpl
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxMemoryDCImpl : public wxWindowDCImpl
{
public:
wxMemoryDCImpl( wxMemoryDC *owner );
wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap );
wxMemoryDCImpl( wxMemoryDC *owner, wxDC *dc );
virtual ~wxMemoryDCImpl();
// these get reimplemented for mono-bitmaps to behave
// more like their Win32 counterparts. They now interpret
// wxWHITE, wxWHITE_BRUSH and wxWHITE_PEN as drawing 0
// and everything else as drawing 1.
virtual void SetPen( const wxPen &pen ) override;
virtual void SetBrush( const wxBrush &brush ) override;
virtual void SetBackground( const wxBrush &brush ) override;
virtual void SetTextForeground( const wxColour &col ) override;
virtual void SetTextBackground( const wxColour &col ) override;
// overridden from wxDCImpl
virtual void DoGetSize( int *width, int *height ) const override;
virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const override;
virtual void* GetHandle() const override;
// overridden for wxMemoryDC Impl
virtual void DoSelect(const wxBitmap& bitmap) override;
virtual const wxBitmap& GetSelectedBitmap() const override;
virtual wxBitmap& GetSelectedBitmap() override;
private:
wxBitmap m_selected;
void Init();
wxDECLARE_ABSTRACT_CLASS(wxMemoryDCImpl);
};
#endif
// _WX_GTK_DCMEMORY_H_

View File

@@ -0,0 +1,33 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/dcscreen.h
// Purpose:
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTKDCSCREEN_H_
#define _WX_GTKDCSCREEN_H_
#include "wx/dcscreen.h"
#include "wx/gtk/dcclient.h"
//-----------------------------------------------------------------------------
// wxScreenDCImpl
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxScreenDCImpl : public wxWindowDCImpl
{
public:
wxScreenDCImpl( wxScreenDC *owner );
~wxScreenDCImpl();
virtual void DoGetSize(int *width, int *height) const override;
private:
void Init();
wxDECLARE_ABSTRACT_CLASS(wxScreenDCImpl);
};
#endif // _WX_GTKDCSCREEN_H_

View File

@@ -0,0 +1,52 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/dialog.h
// Purpose:
// Author: Robert Roebling
// Created:
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTKDIALOG_H_
#define _WX_GTKDIALOG_H_
class WXDLLIMPEXP_FWD_CORE wxGUIEventLoop;
//-----------------------------------------------------------------------------
// wxDialog
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDialog: public wxDialogBase
{
public:
wxDialog() { Init(); }
wxDialog( wxWindow *parent, wxWindowID id,
const wxString &title,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE,
const wxString &name = wxASCII_STR(wxDialogNameStr) );
bool Create( wxWindow *parent, wxWindowID id,
const wxString &title,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE,
const wxString &name = wxASCII_STR(wxDialogNameStr) );
virtual ~wxDialog();
virtual bool Show( bool show = true ) override;
virtual int ShowModal() override;
virtual void EndModal( int retCode ) override;
virtual bool IsModal() const override;
private:
// common part of all ctors
void Init();
bool m_modalShowing;
wxGUIEventLoop *m_modalLoop;
wxDECLARE_DYNAMIC_CLASS(wxDialog);
};
#endif // _WX_GTKDIALOG_H_

View File

@@ -0,0 +1,64 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/dirdlg.h
// Purpose: wxDirDialog
// Author: Francesco Montorsi
// Copyright: (c) 2006 Francesco Montorsi
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTKDIRDLG_H_
#define _WX_GTKDIRDLG_H_
typedef struct _GtkFileChooser GtkFileChooser;
//-------------------------------------------------------------------------
// wxDirDialog
//-------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDirDialog : public wxDirDialogBase
{
typedef wxDirDialogBase BaseType;
public:
wxDirDialog() = default;
wxDirDialog(wxWindow *parent,
const wxString& message = wxASCII_STR(wxDirSelectorPromptStr),
const wxString& defaultPath = wxEmptyString,
long style = wxDD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const wxString& name = wxASCII_STR(wxDirDialogNameStr));
bool Create(wxWindow *parent,
const wxString& message = wxASCII_STR(wxDirSelectorPromptStr),
const wxString& defaultPath = wxEmptyString,
long style = wxDD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const wxString& name = wxASCII_STR(wxDirDialogNameStr));
~wxDirDialog();
virtual int ShowModal() override;
virtual void EndModal(int retCode) override;
void SetPath(const wxString& path) override;
// Implementation only.
void GTKOnAccept();
void GTKOnCancel();
protected:
// override this from wxTLW since the native
// form doesn't have any m_wxwindow
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO) override;
private:
void GTKAccept();
GtkFileChooser* m_fileChooser = nullptr;
wxDECLARE_DYNAMIC_CLASS(wxDirDialog);
};
#endif // _WX_GTKDIRDLG_H_

View File

@@ -0,0 +1,121 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/dnd.h
// Purpose: declaration of the wxDropTarget class
// Author: Robert Roebling
// Copyright: (c) 1998 Vadim Zeitlin, Robert Roebling
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_DND_H_
#define _WX_GTK_DND_H_
#include "wx/icon.h"
// ----------------------------------------------------------------------------
// macros
// ----------------------------------------------------------------------------
// this macro may be used instead for wxDropSource ctor arguments: it will use
// the icon 'name' from an XPM file under GTK, but will expand to something
// else under MSW. If you don't use it, you will have to use #ifdef in the
// application code.
#define wxDROP_ICON(name) wxICON(name)
//-------------------------------------------------------------------------
// wxDropTarget
//-------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDropTarget: public wxDropTargetBase
{
public:
wxDropTarget(wxDataObject *dataObject = nullptr );
virtual wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def) override;
virtual bool OnDrop(wxCoord x, wxCoord y) override;
virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def) override;
virtual bool GetData() override;
// Can only be called during OnXXX methods.
wxDataFormat GetMatchingPair();
// implementation
GdkAtom GTKGetMatchingPair(bool quiet = false);
wxDragResult GTKFigureOutSuggestedAction();
void GtkRegisterWidget( GtkWidget *widget );
void GtkUnregisterWidget( GtkWidget *widget );
GdkDragContext *m_dragContext;
GtkWidget *m_dragWidget;
GtkSelectionData *m_dragData;
unsigned m_dragTime;
bool m_firstMotion; // gdk has no "gdk_drag_enter" event
void GTKSetDragContext( GdkDragContext *dc ) { m_dragContext = dc; }
void GTKSetDragWidget( GtkWidget *w ) { m_dragWidget = w; }
void GTKSetDragData( GtkSelectionData *sd ) { m_dragData = sd; }
void GTKSetDragTime(unsigned time) { m_dragTime = time; }
};
//-------------------------------------------------------------------------
// wxDropSource
//-------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDropSource: public wxDropSourceBase
{
public:
// constructor. set data later with SetData()
wxDropSource( wxWindow *win = nullptr,
const wxIcon &copy = wxNullIcon,
const wxIcon &move = wxNullIcon,
const wxIcon &none = wxNullIcon);
// constructor for setting one data object
wxDropSource( wxDataObject& data,
wxWindow *win,
const wxIcon &copy = wxNullIcon,
const wxIcon &move = wxNullIcon,
const wxIcon &none = wxNullIcon);
virtual ~wxDropSource();
// set the icon corresponding to given drag result
void SetIcon(wxDragResult res, const wxIcon& icon)
{
if ( res == wxDragCopy )
m_iconCopy = icon;
else if ( res == wxDragMove )
m_iconMove = icon;
else
m_iconNone = icon;
}
// start drag action
virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly) override;
// implementation
GdkDragContext* m_dragContext;
wxDragResult m_retValue;
bool m_waiting;
private:
void PrepareIcon( int action, GdkDragContext *context );
GtkWidget *m_widget;
GtkWidget *m_iconWindow;
wxIcon m_iconCopy,
m_iconMove,
m_iconNone;
void Init(wxWindow* win);
// GTK implementation
void GTKConnectDragSignals();
void GTKDisconnectDragSignals();
};
#endif // _WX_GTK_DND_H_

View File

@@ -0,0 +1,111 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/dvrenderer.h
// Purpose: wxDataViewRenderer for GTK wxDataViewCtrl implementation
// Author: Robert Roebling, Vadim Zeitlin
// Created: 2009-11-07 (extracted from wx/gtk/dataview.h)
// Copyright: (c) 2006 Robert Roebling
// (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_DVRENDERER_H_
#define _WX_GTK_DVRENDERER_H_
typedef struct _GtkCellRendererText GtkCellRendererText;
typedef struct _GtkTreeViewColumn GtkTreeViewColumn;
// ----------------------------------------------------------------------------
// wxDataViewRenderer
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxDataViewRenderer: public wxDataViewRendererBase
{
public:
wxDataViewRenderer( const wxString &varianttype,
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT );
virtual void SetMode( wxDataViewCellMode mode ) override;
virtual wxDataViewCellMode GetMode() const override;
virtual void SetAlignment( int align ) override;
virtual int GetAlignment() const override;
virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE) override;
virtual wxEllipsizeMode GetEllipsizeMode() const override;
virtual bool FinishEditing() override;
// GTK-specific implementation
// ---------------------------
// pack the GTK cell renderers used by this renderer to the given column
//
// by default only a single m_renderer is used but some renderers use more
// than one GTK cell renderer
virtual void GtkPackIntoColumn(GtkTreeViewColumn *column);
// called when the cell value was edited by user with the new value
//
// it uses GtkGetValueFromString() to parse the new value, then validates
// it by calling Validate() and notifies the model about the change if it
// passes validation
void GtkOnTextEdited(const char *itempath, const wxString& value);
GtkCellRenderer* GetGtkHandle() { return m_renderer; }
void GtkInitHandlers();
virtual void GtkUpdateAlignment() { GtkApplyAlignment(m_renderer); }
// return the text renderer used by this renderer for setting text cell
// specific attributes: can return nullptr if this renderer doesn't render any
// text
virtual GtkCellRendererText *GtkGetTextRenderer() const { return nullptr; }
// return the widget actually used by the renderer for editing, this may be
// different from the editor control widget for the custom renderers
virtual GtkWidget* GtkGetEditorWidget() const;
void GtkSetCurrentItem(const wxDataViewItem& item) { m_itemBeingRendered = item; }
private:
// Change the mode at GTK level without touching m_mode, this is useful for
// temporarily making the renderer insensitive but does mean that GetMode()
// may return a value different from the actual GTK renderer mode.
void GtkSetMode(wxDataViewCellMode mode);
protected:
virtual void SetAttr(const wxDataViewItemAttr& attr) override;
virtual void SetEnabled(bool enabled) override;
virtual bool IsHighlighted() const override;
// Apply our effective alignment (i.e. m_alignment if specified or the
// associated column alignment by default) to the given renderer.
void GtkApplyAlignment(GtkCellRenderer *renderer);
// This method is used to interpret the string entered by user and by
// default just uses it as is, but can be overridden for classes requiring
// special treatment.
virtual wxVariant GtkGetValueFromString(const wxString& str) const;
GtkCellRenderer *m_renderer;
int m_alignment;
// We store the renderer mode at wx level as it can differ from the mode of
// the corresponding GTK+ renderer as explained above.
wxDataViewCellMode m_mode;
// true if we hadn't changed any visual attributes or restored them since
// doing this
bool m_usingDefaultAttrs;
// the item currently being rendered
wxDataViewItem m_itemBeingRendered;
protected:
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewRenderer);
};
#endif // _WX_GTK_DVRENDERER_H_

View File

@@ -0,0 +1,289 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/dvrenderers.h
// Purpose: All GTK wxDataViewCtrl renderer classes
// Author: Robert Roebling, Vadim Zeitlin
// Created: 2009-11-07 (extracted from wx/gtk/dataview.h)
// Copyright: (c) 2006 Robert Roebling
// (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_DVRENDERERS_H_
#define _WX_GTK_DVRENDERERS_H_
#ifdef __WXGTK3__
typedef struct _cairo_rectangle_int cairo_rectangle_int_t;
typedef cairo_rectangle_int_t GdkRectangle;
#else
typedef struct _GdkRectangle GdkRectangle;
#endif
// ---------------------------------------------------------
// wxDataViewTextRenderer
// ---------------------------------------------------------
class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer
{
public:
static wxString GetDefaultType() { return wxS("string"); }
wxDataViewTextRenderer( const wxString &varianttype = GetDefaultType(),
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT );
#if wxUSE_MARKUP
void EnableMarkup(bool enable = true);
#endif // wxUSE_MARKUP
virtual bool SetValue( const wxVariant &value ) override
{
return SetTextValue(value);
}
virtual bool GetValue( wxVariant &value ) const override
{
wxString str;
if ( !GetTextValue(str) )
return false;
value = str;
return true;
}
virtual void GtkUpdateAlignment() override;
virtual GtkCellRendererText *GtkGetTextRenderer() const override;
protected:
virtual void SetAttr(const wxDataViewItemAttr& attr) override;
// implementation of Set/GetValue()
bool SetTextValue(const wxString& str);
bool GetTextValue(wxString& str) const;
// Return the name of the GtkCellRendererText property to use: "text" or
// "markup".
const char* GetTextPropertyName() const;
#if wxUSE_MARKUP
// True if we should interpret markup in our text.
bool m_useMarkup;
#endif // wxUSE_MARKUP
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextRenderer);
};
// ---------------------------------------------------------
// wxDataViewBitmapRenderer
// ---------------------------------------------------------
class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer
{
public:
static wxString GetDefaultType() { return wxS("wxBitmapBundle"); }
wxDataViewBitmapRenderer( const wxString &varianttype = GetDefaultType(),
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT );
bool SetValue( const wxVariant &value ) override;
bool GetValue( wxVariant &value ) const override;
virtual
bool IsCompatibleVariantType(const wxString& variantType) const override;
protected:
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapRenderer);
};
// ---------------------------------------------------------
// wxDataViewToggleRenderer
// ---------------------------------------------------------
class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer
{
public:
static wxString GetDefaultType() { return wxS("bool"); }
wxDataViewToggleRenderer( const wxString &varianttype = GetDefaultType(),
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT );
void ShowAsRadio();
bool SetValue( const wxVariant &value ) override;
bool GetValue( wxVariant &value ) const override;
protected:
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleRenderer);
};
// ---------------------------------------------------------
// wxDataViewCustomRenderer
// ---------------------------------------------------------
class WXDLLIMPEXP_ADV wxDataViewCustomRenderer: public wxDataViewCustomRendererBase
{
public:
static wxString GetDefaultType() { return wxS("string"); }
wxDataViewCustomRenderer( const wxString &varianttype = GetDefaultType(),
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT,
bool no_init = false );
virtual ~wxDataViewCustomRenderer();
// Create DC on request
virtual wxDC *GetDC() override;
// override the base class function to use GTK text cell renderer
virtual void RenderText(const wxString& text,
int xoffset,
wxRect cell,
wxDC *dc,
int state) override;
struct GTKRenderParams;
// store GTK render call parameters for possible later use
void GTKSetRenderParams(GTKRenderParams* renderParams)
{
m_renderParams = renderParams;
}
virtual GtkCellRendererText *GtkGetTextRenderer() const override;
virtual GtkWidget* GtkGetEditorWidget() const override;
virtual void GtkUpdateAlignment() override;
private:
bool Init(wxDataViewCellMode mode, int align);
// Called from GtkGetTextRenderer() to really create the renderer if
// necessary.
void GtkInitTextRenderer();
wxDC *m_dc;
GtkCellRendererText *m_text_renderer;
// parameters of the original render() call stored so that we could pass
// them forward to m_text_renderer if our RenderText() is called
GTKRenderParams* m_renderParams;
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomRenderer);
};
// ---------------------------------------------------------
// wxDataViewProgressRenderer
// ---------------------------------------------------------
class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewCustomRenderer
{
public:
static wxString GetDefaultType() { return wxS("long"); }
wxDataViewProgressRenderer( const wxString &label = wxEmptyString,
const wxString &varianttype = GetDefaultType(),
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT );
virtual ~wxDataViewProgressRenderer();
bool SetValue( const wxVariant &value ) override;
bool GetValue( wxVariant &value ) const override;
virtual bool Render( wxRect cell, wxDC *dc, int state ) override;
virtual wxSize GetSize() const override;
private:
void GTKSetLabel();
wxString m_label;
int m_value;
protected:
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressRenderer);
};
// ---------------------------------------------------------
// wxDataViewIconTextRenderer
// ---------------------------------------------------------
class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewTextRenderer
{
typedef wxDataViewTextRenderer BaseType;
public:
static wxString GetDefaultType() { return wxS("wxDataViewIconText"); }
wxDataViewIconTextRenderer( const wxString &varianttype = GetDefaultType(),
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT );
virtual ~wxDataViewIconTextRenderer();
bool SetValue( const wxVariant &value ) override;
bool GetValue( wxVariant &value ) const override;
virtual void GtkPackIntoColumn(GtkTreeViewColumn *column) override;
protected:
virtual void SetAttr(const wxDataViewItemAttr& attr) override;
virtual wxVariant GtkGetValueFromString(const wxString& str) const override;
private:
wxDataViewIconText m_value;
// we use the base class m_renderer for the text and this one for the icon
GtkCellRenderer *m_rendererIcon;
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewIconTextRenderer);
};
// -------------------------------------
// wxDataViewChoiceRenderer
// -------------------------------------
class WXDLLIMPEXP_ADV wxDataViewChoiceRenderer: public wxDataViewCustomRenderer
{
public:
wxDataViewChoiceRenderer(const wxArrayString &choices,
wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
int alignment = wxDVR_DEFAULT_ALIGNMENT );
virtual bool Render( wxRect rect, wxDC *dc, int state ) override;
virtual wxSize GetSize() const override;
virtual bool SetValue( const wxVariant &value ) override;
virtual bool GetValue( wxVariant &value ) const override;
virtual void GtkUpdateAlignment() override;
wxString GetChoice(size_t index) const { return m_choices[index]; }
const wxArrayString& GetChoices() const { return m_choices; }
private:
wxArrayString m_choices;
wxString m_data;
};
// ----------------------------------------------------------------------------
// wxDataViewChoiceByIndexRenderer
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxDataViewChoiceByIndexRenderer: public wxDataViewChoiceRenderer
{
public:
wxDataViewChoiceByIndexRenderer( const wxArrayString &choices,
wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
int alignment = wxDVR_DEFAULT_ALIGNMENT );
virtual bool SetValue( const wxVariant &value ) override;
virtual bool GetValue( wxVariant &value ) const override;
private:
virtual wxVariant GtkGetValueFromString(const wxString& str) const override;
};
#endif // _WX_GTK_DVRENDERERS_H_

View File

@@ -0,0 +1,59 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/evtloop.h
// Purpose: wxGTK event loop implementation
// Author: Vadim Zeitlin
// Created: 2008-12-27
// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_EVTLOOP_H_
#define _WX_GTK_EVTLOOP_H_
// ----------------------------------------------------------------------------
// wxGUIEventLoop for wxGTK
// ----------------------------------------------------------------------------
typedef union _GdkEvent GdkEvent;
#include <vector>
class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxEventLoopBase
{
public:
wxGUIEventLoop();
virtual ~wxGUIEventLoop();
virtual bool Pending() const override;
virtual bool Dispatch() override;
virtual int DispatchTimeout(unsigned long timeout) override;
virtual void WakeUp() override;
// implementation only from now on
void StoreGdkEventForLaterProcessing(GdkEvent* ev)
{ m_queuedGdkEvents.push_back(ev); }
// Check if this event is the same as the last event passed to this
// function and store it for future checks.
bool GTKIsSameAsLastEvent(const GdkEvent* ev, size_t size);
protected:
virtual int DoRun() override;
virtual void DoStop(int rc) override;
virtual void DoYieldFor(long eventsToProcess) override;
private:
// the exit code of this event loop
int m_exitcode;
// used to temporarily store events processed in DoYieldFor()
std::vector<GdkEvent*> m_queuedGdkEvents;
// last event passed to GTKIsSameAsLastEvent()
GdkEvent* m_lastEvent;
wxDECLARE_NO_COPY_CLASS(wxGUIEventLoop);
};
#endif // _WX_GTK_EVTLOOP_H_

View File

@@ -0,0 +1,39 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/evtloopsrc.h
// Purpose: wxGTKEventLoopSource class
// Author: Vadim Zeitlin
// Created: 2009-10-21
// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_EVTLOOPSRC_H_
#define _WX_GTK_EVTLOOPSRC_H_
// ----------------------------------------------------------------------------
// wxGTKEventLoopSource: wxEventLoopSource for GTK port
// ----------------------------------------------------------------------------
class wxGTKEventLoopSource : public wxEventLoopSource
{
public:
// sourceId is the id of the watch in GTK context, not the FD of the file
// this source corresponds to
wxGTKEventLoopSource(unsigned sourceId,
wxEventLoopSourceHandler *handler,
int flags)
: wxEventLoopSource(handler, flags),
m_sourceId(sourceId)
{
}
virtual ~wxGTKEventLoopSource();
private:
const unsigned m_sourceId;
wxDECLARE_NO_COPY_CLASS(wxGTKEventLoopSource);
};
#endif // _WX_GTK_EVTLOOPSRC_H_

View File

@@ -0,0 +1,143 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/filectrl.h
// Purpose: wxGtkFileCtrl Header
// Author: Diaa M. Sami
// Created: Aug-10-2007
// Copyright: (c) Diaa M. Sami
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_FILECTRL_H_
#define _WX_GTK_FILECTRL_H_
#include "wx/control.h"
#include "wx/filectrl.h"
extern WXDLLIMPEXP_DATA_CORE(const char) wxFileSelectorDefaultWildcardStr[];
typedef struct _GtkFileChooser GtkFileChooser;
// [GTK] current problems:
// All methods(e.g. SetFilename(), SetPath(), etc) which change the state of
// the control result in events fired, such events should be suppressed.
// ------
// Sometimes a selection event(with 0 files) is fired before
// wxEVT_FILECTRL_FOLDERCHANGED, unfortunately this can hardly be detected!
// A wx wrapper for any Gtk object implementing the interface GtkFileChooser
class WXDLLIMPEXP_CORE wxGtkFileChooser
{
public:
wxGtkFileChooser() { m_ignoreNextFilterEvent = false; }
void SetWidget(GtkFileChooser *w);
wxString GetPath() const;
void GetPaths( wxArrayString& paths ) const;
wxString GetDirectory() const;
wxString GetFilename() const;
void GetFilenames( wxArrayString& files ) const;
int GetFilterIndex() const;
bool SetPath( const wxString& path );
bool SetDirectory( const wxString& dir );
void SetWildcard( const wxString& wildCard );
void SetFilterIndex( int filterIndex );
bool HasFilterChoice() const;
bool ShouldIgnoreNextFilterEvent() const { return m_ignoreNextFilterEvent; }
wxString GetCurrentWildCard() const
{ return m_wildcards[GetFilterIndex()]; }
private:
GtkFileChooser *m_widget;
// First wildcard in filter, to be used when the user
// saves a file without giving an extension.
wxArrayString m_wildcards;
// If true, ignore the next event because it was generated by us and not
// the user.
bool m_ignoreNextFilterEvent;
};
#if wxUSE_FILECTRL
class WXDLLIMPEXP_CORE wxGtkFileCtrl: public wxControl,
public wxFileCtrlBase
{
public:
wxGtkFileCtrl () { Init(); }
wxGtkFileCtrl ( wxWindow *parent,
wxWindowID id,
const wxString& defaultDirectory = wxEmptyString,
const wxString& defaultFilename = wxEmptyString,
const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr),
long style = wxFC_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const wxString& name = wxASCII_STR(wxFileCtrlNameStr) )
{
Init();
Create( parent, id, defaultDirectory, defaultFilename, wildCard, style, pos, size, name );
}
virtual ~wxGtkFileCtrl();
bool Create( wxWindow *parent,
wxWindowID id,
const wxString& defaultDirectory = wxEmptyString,
const wxString& defaultFileName = wxEmptyString,
const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr),
long style = wxFC_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const wxString& name = wxASCII_STR(wxFileCtrlNameStr) );
virtual void SetWildcard( const wxString& wildCard ) override;
virtual void SetFilterIndex( int filterIndex ) override;
virtual bool SetDirectory( const wxString& dir ) override;
virtual bool SetFilename( const wxString& name ) override;
virtual bool SetPath( const wxString& path ) override;
virtual wxString GetFilename() const override;
virtual wxString GetDirectory() const override;
virtual wxString GetWildcard() const override { return this->m_wildCard; }
virtual wxString GetPath() const override;
virtual void GetPaths( wxArrayString& paths ) const override;
virtual void GetFilenames( wxArrayString& files ) const override;
virtual int GetFilterIndex() const override { return m_fc.GetFilterIndex(); }
virtual bool HasMultipleFileSelection() const override { return HasFlag( wxFC_MULTIPLE ); }
virtual void ShowHidden(bool show) override;
virtual bool HasFilterChoice() const
{ return m_fc.HasFilterChoice(); }
// Implementation only from now on.
bool GTKShouldIgnoreNextFilterEvent() const
{ return m_fc.ShouldIgnoreNextFilterEvent(); }
bool m_checkNextSelEvent;
bool m_ignoreNextFolderChangeEvent;
protected:
GtkFileChooser *m_fcWidget;
wxGtkFileChooser m_fc;
wxString m_wildCard;
private:
void Init();
wxDECLARE_DYNAMIC_CLASS(wxGtkFileCtrl);
};
#endif // wxUSE_FILECTRL
#endif // _WX_GTK_FILECTRL_H_

View File

@@ -0,0 +1,96 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/filedlg.h
// Purpose:
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTKFILEDLG_H_
#define _WX_GTKFILEDLG_H_
#include "wx/gtk/filectrl.h" // for wxGtkFileChooser
typedef struct _GtkFileChooser GtkFileChooser;
//-------------------------------------------------------------------------
// wxFileDialog
//-------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxFileDialog: public wxFileDialogBase
{
typedef wxFileDialogBase BaseType;
public:
wxFileDialog() = default;
wxFileDialog(wxWindow *parent,
const wxString& message = wxASCII_STR(wxFileSelectorPromptStr),
const wxString& defaultDir = wxEmptyString,
const wxString& defaultFile = wxEmptyString,
const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr),
long style = wxFD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& sz = wxDefaultSize,
const wxString& name = wxASCII_STR(wxFileDialogNameStr));
bool Create(wxWindow *parent,
const wxString& message = wxASCII_STR(wxFileSelectorPromptStr),
const wxString& defaultDir = wxEmptyString,
const wxString& defaultFile = wxEmptyString,
const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr),
long style = wxFD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& sz = wxDefaultSize,
const wxString& name = wxASCII_STR(wxFileDialogNameStr));
virtual ~wxFileDialog();
virtual wxString GetPath() const override;
virtual void GetPaths(wxArrayString& paths) const override;
virtual wxString GetFilename() const override;
virtual void GetFilenames(wxArrayString& files) const override;
virtual int GetFilterIndex() const override;
virtual void SetMessage(const wxString& message) override;
virtual void SetPath(const wxString& path) override;
virtual void SetDirectory(const wxString& dir) override;
virtual void SetFilename(const wxString& name) override;
virtual void SetWildcard(const wxString& wildCard) override;
virtual void SetFilterIndex(int filterIndex) override;
virtual int ShowModal() override;
virtual void EndModal(int retCode) override;
virtual bool AddShortcut(const wxString& directory, int flags = 0) override;
virtual bool SupportsExtraControl() const override { return true; }
// Implementation only.
void GTKSelectionChanged(const wxString& filename);
void GTKDropNative();
protected:
// override this from wxTLW since the native
// form doesn't have any m_wxwindow
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO) override;
private:
void OnFakeOk( wxCommandEvent &event );
void OnSize(wxSizeEvent&);
virtual void AddChildGTK(wxWindowGTK* child) override;
const wxGtkFileChooser& GetFileChooser() const
{
return m_fcNative ? *m_fcNative : m_fc;
}
wxGtkFileChooser m_fc;
wxGtkFileChooser* m_fcNative = nullptr;
GtkFileChooser* m_fileChooserNative = nullptr;
wxDECLARE_DYNAMIC_CLASS(wxFileDialog);
wxDECLARE_EVENT_TABLE();
};
#endif // _WX_GTKFILEDLG_H_

View File

@@ -0,0 +1,24 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/filehistory.h
// Purpose: GTK+ bits for wxFileHistory
// Author: Vaclav Slavik
// Created: 2010-05-06
// Copyright: (c) 2010 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_FILEHISTORY_H_
#define _WX_GTK_FILEHISTORY_H_
class WXDLLIMPEXP_CORE wxFileHistory : public wxFileHistoryBase
{
public:
wxFileHistory(size_t maxFiles = 9, wxWindowID idBase = wxID_FILE1)
: wxFileHistoryBase(maxFiles, idBase) {}
virtual void AddFileToHistory(const wxString& file) override;
wxDECLARE_DYNAMIC_CLASS(wxFileHistory);
};
#endif // _WX_GTK_FILEHISTORY_H_

View File

@@ -0,0 +1,144 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/filedirpicker.h
// Purpose: wxFileButton, wxDirButton header
// Author: Francesco Montorsi
// Created: 14/4/2006
// Copyright: (c) Francesco Montorsi
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_FILEPICKER_H_
#define _WX_GTK_FILEPICKER_H_
class WXDLLIMPEXP_FWD_CORE wxFileDialog;
class WXDLLIMPEXP_FWD_CORE wxDirDialog;
class WXDLLIMPEXP_FWD_CORE wxGenericFileButton;
class WXDLLIMPEXP_FWD_CORE wxGenericDirButton;
extern WXDLLIMPEXP_DATA_CORE(const char) wxFileSelectorPromptStr[];
extern WXDLLIMPEXP_DATA_CORE(const char) wxFileSelectorDefaultWildcardStr[];
//-----------------------------------------------------------------------------
// wxFileButton
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxFileButton : public wxControl,
public wxFileDirPickerWidgetBase
{
public:
wxFileButton() = default;
wxFileButton(wxWindow *parent,
wxWindowID id,
const wxString& label = wxASCII_STR(wxFilePickerWidgetLabel),
const wxString &path = wxEmptyString,
const wxString &message = wxASCII_STR(wxFileSelectorPromptStr),
const wxString &wildcard = wxASCII_STR(wxFileSelectorDefaultWildcardStr),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxFILEBTN_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxFilePickerWidgetNameStr))
{
Create(parent, id, label, path, message, wildcard,
pos, size, style, validator, name);
}
virtual ~wxFileButton();
public: // overrides
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& label = wxASCII_STR(wxFilePickerWidgetLabel),
const wxString &path = wxEmptyString,
const wxString &message = wxASCII_STR(wxFileSelectorPromptStr),
const wxString &wildcard = wxASCII_STR(wxFileSelectorDefaultWildcardStr),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxFilePickerWidgetNameStr));
// event handler for the click
void OnDialogOK(wxCommandEvent &);
virtual wxString GetPath() const override;
virtual void SetPath(const wxString &str) override;
virtual void SetInitialDirectory(const wxString& dir) override;
virtual wxControl* AsControl() override { return this; }
protected:
wxFileDialog* m_dialog = nullptr;
private:
wxGenericFileButton* m_genericButton = nullptr;
wxDECLARE_DYNAMIC_CLASS(wxFileButton);
};
//-----------------------------------------------------------------------------
// wxDirButton
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDirButton : public wxControl,
public wxFileDirPickerWidgetBase
{
public:
wxDirButton() = default;
wxDirButton(wxWindow *parent,
wxWindowID id,
const wxString& label = wxASCII_STR(wxFilePickerWidgetLabel),
const wxString &path = wxEmptyString,
const wxString &message = wxASCII_STR(wxFileSelectorPromptStr),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDIRBTN_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxFilePickerWidgetNameStr))
{
Create(parent, id, label, path, message,
pos, size, style, validator, name);
}
virtual ~wxDirButton();
public: // overrides
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& label = wxASCII_STR(wxFilePickerWidgetLabel),
const wxString &path = wxEmptyString,
const wxString &message = wxASCII_STR(wxFileSelectorPromptStr),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxFilePickerWidgetNameStr));
virtual wxString GetPath() const override;
virtual void SetPath(const wxString &str) override;
virtual void SetInitialDirectory(const wxString& dir) override;
virtual wxControl* AsControl() override { return this; }
protected:
wxDirDialog* m_dialog = nullptr;
public: // used by the GTK callback only
bool m_bIgnoreNextChange = false;
private:
wxGenericDirButton* m_genericButton = nullptr;
wxDECLARE_DYNAMIC_CLASS(wxDirButton);
};
#endif // _WX_GTK_FILEPICKER_H_

View File

@@ -0,0 +1,119 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/font.h
// Purpose:
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_FONT_H_
#define _WX_GTK_FONT_H_
// ----------------------------------------------------------------------------
// wxFont
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxFont : public wxFontBase
{
public:
wxFont() = default;
wxFont(const wxFontInfo& info);
wxFont(const wxString& nativeFontInfoString)
{
Create(nativeFontInfoString);
}
wxFont(const wxNativeFontInfo& info);
wxFont(int size,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
Create(size, family, style, weight, underlined, face, encoding);
}
wxFont(const wxSize& pixelSize,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
Create(10, family, style, weight, underlined, face, encoding);
SetPixelSize(pixelSize);
}
bool Create(int size,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
// wxGTK-specific
bool Create(const wxString& fontname);
// implement base class pure virtuals
virtual double GetFractionalPointSize() const override;
virtual wxFontStyle GetStyle() const override;
virtual int GetNumericWeight() const override;
virtual wxString GetFaceName() const override;
virtual bool GetUnderlined() const override;
virtual bool GetStrikethrough() const override;
virtual wxFontEncoding GetEncoding() const override;
virtual const wxNativeFontInfo *GetNativeFontInfo() const override;
virtual bool IsFixedWidth() const override;
virtual void SetFractionalPointSize(double pointSize) override;
virtual void SetFamily(wxFontFamily family) override;
virtual void SetStyle(wxFontStyle style) override;
virtual void SetNumericWeight(int weight) override;
virtual bool SetFaceName( const wxString& faceName ) override;
virtual void SetUnderlined( bool underlined ) override;
virtual void SetStrikethrough(bool strikethrough) override;
virtual void SetEncoding(wxFontEncoding encoding) override;
wxDECLARE_COMMON_FONT_METHODS();
wxDEPRECATED_MSG("use wxFONT{FAMILY,STYLE,WEIGHT}_XXX constants")
wxFont(int size,
int family,
int style,
int weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
{
(void)Create(size, (wxFontFamily)family, (wxFontStyle)style, (wxFontWeight)weight, underlined, face, encoding);
}
// Set Pango attributes in the specified layout. Currently only
// underlined and strike-through attributes are handled by this function.
//
// If neither of them is specified, returns false, otherwise sets up the
// attributes and returns true.
bool GTKSetPangoAttrs(PangoLayout* layout) const;
protected:
virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info ) override;
virtual wxGDIRefData* CreateGDIRefData() const override;
wxNODISCARD virtual wxGDIRefData* CloneGDIRefData(const wxGDIRefData* data) const override;
virtual wxFontFamily DoGetFamily() const override;
private:
void Init();
wxDECLARE_DYNAMIC_CLASS(wxFont);
};
#endif // _WX_GTK_FONT_H_

View File

@@ -0,0 +1,35 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/fontdlg.h
// Purpose: wxFontDialog
// Author: Robert Roebling
// Created:
// Copyright: (c) Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_FONTDLG_H_
#define _WX_GTK_FONTDLG_H_
//-----------------------------------------------------------------------------
// wxFontDialog
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxFontDialog : public wxFontDialogBase
{
public:
wxFontDialog() : wxFontDialogBase() { /* must be Create()d later */ }
wxFontDialog(wxWindow *parent)
: wxFontDialogBase(parent) { Create(parent); }
wxFontDialog(wxWindow *parent, const wxFontData& data)
: wxFontDialogBase(parent, data) { Create(parent, data); }
virtual ~wxFontDialog();
protected:
// create the GTK dialog
virtual bool DoCreate(wxWindow *parent) override;
wxDECLARE_DYNAMIC_CLASS(wxFontDialog);
};
#endif

View File

@@ -0,0 +1,77 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/fontpicker.h
// Purpose: wxFontButton header
// Author: Francesco Montorsi
// Created: 14/4/2006
// Copyright: (c) Francesco Montorsi
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_FONTPICKER_H_
#define _WX_GTK_FONTPICKER_H_
#include "wx/button.h"
//-----------------------------------------------------------------------------
// wxFontButton
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxFontButton : public wxButton,
public wxFontPickerWidgetBase
{
public:
wxFontButton() { Init(); }
wxFontButton(wxWindow *parent,
wxWindowID id,
const wxFont& initial = wxNullFont,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxFONTBTN_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxFontPickerWidgetNameStr))
{
Init();
Create(parent, id, initial, pos, size, style, validator, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxFont& initial = wxNullFont,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxFONTBTN_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxFontPickerWidgetNameStr));
virtual wxColour GetSelectedColour() const override
{ return m_selectedColour; }
void SetSelectedColour(const wxColour &colour) override
{ m_selectedColour = colour; }
virtual ~wxFontButton();
protected:
void UpdateFont() override;
public: // used by the GTK callback only
void SetNativeFontInfo(const char* gtkdescription);
private:
// Common part of both ctors.
void Init()
{
m_selectedColour = *wxBLACK;
}
// This can't be changed by the user, but is provided to
// satisfy the wxFontPickerWidgetBase interface.
wxColour m_selectedColour;
wxDECLARE_DYNAMIC_CLASS(wxFontButton);
};
#endif // _WX_GTK_FONTPICKER_H_

View File

@@ -0,0 +1,75 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/frame.h
// Purpose:
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling, Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_FRAME_H_
#define _WX_GTK_FRAME_H_
//-----------------------------------------------------------------------------
// wxFrame
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxFrame : public wxFrameBase
{
public:
// construction
wxFrame() { Init(); }
wxFrame(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxASCII_STR(wxFrameNameStr))
{
Init();
Create(parent, id, title, pos, size, style, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxASCII_STR(wxFrameNameStr));
#if wxUSE_STATUSBAR
void SetStatusBar(wxStatusBar *statbar) override;
#endif // wxUSE_STATUSBAR
#if wxUSE_TOOLBAR
void SetToolBar(wxToolBar *toolbar) override;
#endif // wxUSE_TOOLBAR
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) override;
wxPoint GetClientAreaOrigin() const override { return wxPoint(0, 0); }
// implementation from now on
// --------------------------
virtual bool SendIdleEvents(wxIdleEvent& event) override;
protected:
// override wxWindow methods to take into account tool/menu/statusbars
virtual void DoGetClientSize( int *width, int *height ) const override;
#if wxUSE_MENUS_NATIVE
virtual void DetachMenuBar() override;
virtual void AttachMenuBar(wxMenuBar *menubar) override;
#endif // wxUSE_MENUS_NATIVE
private:
void Init();
long m_fsSaveFlag;
wxDECLARE_DYNAMIC_CLASS(wxFrame);
};
#endif // _WX_GTK_FRAME_H_

View File

@@ -0,0 +1,75 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/gauge.h
// Purpose:
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_GAUGE_H_
#define _WX_GTK_GAUGE_H_
//-----------------------------------------------------------------------------
// wxGauge
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGauge: public wxGaugeBase
{
public:
wxGauge() { Init(); }
wxGauge( wxWindow *parent,
wxWindowID id,
int range,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxGA_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxGaugeNameStr) )
{
Init();
Create(parent, id, range, pos, size, style, validator, name);
}
bool Create( wxWindow *parent,
wxWindowID id, int range,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxGA_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxGaugeNameStr) );
// implement base class virtual methods
void SetRange(int range) override;
int GetRange() const override;
void SetValue(int pos) override;
int GetValue() const override;
virtual void Pulse() override;
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
virtual wxVisualAttributes GetDefaultAttributes() const override;
// implementation
// -------------
// the max and current gauge values
int m_rangeMax,
m_gaugePos;
protected:
// set the gauge value to the value of m_gaugePos
void DoSetGauge();
private:
void Init() { m_rangeMax = m_gaugePos = 0; }
wxDECLARE_DYNAMIC_CLASS(wxGauge);
};
#endif
// _WX_GTK_GAUGE_H_

View File

@@ -0,0 +1,90 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/glcanvas.h
// Purpose: wxGLCanvas, for using OpenGL/Mesa with wxWidgets and GTK
// Author: Robert Roebling
// Created: 17/8/98
// Copyright: (c) Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GLCANVAS_H_
#define _WX_GLCANVAS_H_
#include "wx/setup.h"
#if wxUSE_GLCANVAS_EGL
#include "wx/unix/glegl.h"
typedef wxGLCanvasEGL wxGLCanvasImpl;
#else
#include "wx/unix/glx11.h"
typedef wxGLCanvasX11 wxGLCanvasImpl;
#endif
//---------------------------------------------------------------------------
// wxGLCanvas
//---------------------------------------------------------------------------
class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasImpl
{
typedef wxGLCanvasImpl BaseType;
public:
wxGLCanvas() = default;
wxGLCanvas(wxWindow *parent,
const wxGLAttributes& dispAttrs,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxGLCanvasName,
const wxPalette& palette = wxNullPalette);
explicit // avoid implicitly converting a wxWindow* to wxGLCanvas
wxGLCanvas(wxWindow *parent,
wxWindowID id = wxID_ANY,
const int *attribList = nullptr,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxGLCanvasName,
const wxPalette& palette = wxNullPalette);
bool Create(wxWindow *parent,
const wxGLAttributes& dispAttrs,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxGLCanvasName,
const wxPalette& palette = wxNullPalette);
bool Create(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxGLCanvasName,
const int *attribList = nullptr,
const wxPalette& palette = wxNullPalette);
virtual bool SetBackgroundStyle(wxBackgroundStyle style) override;
// implement wxGLCanvasX11 methods
// --------------------------------
virtual unsigned long GetXWindow() const override;
void* GetNativeWindow() const;
// implementation from now on
virtual void GTKHandleRealized() override;
#ifdef __WXGTK3__
wxSize m_size;
#endif
private:
wxDECLARE_CLASS(wxGLCanvas);
};
#endif // _WX_GLCANVAS_H_

View File

@@ -0,0 +1,52 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/gnome/gvfs.h
// Author: Robert Roebling
// Purpose: GNOME VFS support
// Created: 17/03/06
// Copyright: Robert Roebling
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_GVFS_H_
#define _WX_GTK_GVFS_H_
#include "wx/defs.h"
#if wxUSE_MIMETYPE && wxUSE_LIBGNOMEVFS
#include "wx/string.h"
#include "wx/unix/mimetype.h"
//----------------------------------------------------------------------------
// wxGnomeVFSMimeTypesManagerImpl
//----------------------------------------------------------------------------
class wxGnomeVFSMimeTypesManagerImpl: public wxMimeTypesManagerImpl
{
public:
wxGnomeVFSMimeTypesManagerImpl() = default;
protected:
virtual bool DoAssociation(const wxString& strType,
const wxString& strIcon,
wxMimeTypeCommands *entry,
const wxArrayString& strExtensions,
const wxString& strDesc);
};
//----------------------------------------------------------------------------
// wxGnomeVFSMimeTypesManagerFactory
//----------------------------------------------------------------------------
class wxGnomeVFSMimeTypesManagerFactory: public wxMimeTypesManagerFactory
{
public:
wxGnomeVFSMimeTypesManagerFactory() = default;
virtual wxMimeTypesManagerImpl *CreateMimeTypesManagerImpl();
};
#endif
// wxUSE_MIMETYPE
#endif

View File

@@ -0,0 +1,71 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/hyperlink.h
// Purpose: Hyperlink control
// Author: Francesco Montorsi
// Created: 14/2/2007
// Copyright: (c) 2007 Francesco Montorsi
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTKHYPERLINKCTRL_H_
#define _WX_GTKHYPERLINKCTRL_H_
#include "wx/generic/hyperlink.h"
// ----------------------------------------------------------------------------
// wxHyperlinkCtrl
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxHyperlinkCtrl : public wxGenericHyperlinkCtrl
{
typedef wxGenericHyperlinkCtrl base_type;
public:
wxHyperlinkCtrl();
wxHyperlinkCtrl(wxWindow *parent,
wxWindowID id,
const wxString& label, const wxString& url,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxHL_DEFAULT_STYLE,
const wxString& name = wxASCII_STR(wxHyperlinkCtrlNameStr));
virtual ~wxHyperlinkCtrl();
// Creation function (for two-step construction).
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& label, const wxString& url,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxHL_DEFAULT_STYLE,
const wxString& name = wxASCII_STR(wxHyperlinkCtrlNameStr));
// get/set
virtual wxColour GetHoverColour() const override;
virtual void SetHoverColour(const wxColour &colour) override;
virtual wxColour GetNormalColour() const override;
virtual void SetNormalColour(const wxColour &colour) override;
virtual wxColour GetVisitedColour() const override;
virtual void SetVisitedColour(const wxColour &colour) override;
virtual wxString GetURL() const override;
virtual void SetURL(const wxString &url) override;
virtual void SetVisited(bool visited = true) override;
virtual bool GetVisited() const override;
virtual void SetLabel(const wxString &label) override;
protected:
virtual wxSize DoGetBestSize() const override;
virtual wxSize DoGetBestClientSize() const override;
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const override;
wxDECLARE_DYNAMIC_CLASS(wxHyperlinkCtrl);
};
#endif // _WX_GTKHYPERLINKCTRL_H_

View File

@@ -0,0 +1,79 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/infobar.h
// Purpose: native implementation of wxInfoBar for GTK+ 2.18 and later
// Author: Vadim Zeitlin
// Created: 2009-09-26
// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_INFOBAR_H_
#define _WX_GTK_INFOBAR_H_
#include "wx/generic/infobar.h"
// ----------------------------------------------------------------------------
// wxInfoBar for GTK+
// ----------------------------------------------------------------------------
// notice that the native GTK+ implementation is only available since 2.18,
// so we inherit from the generic one to be able to
// fall back to it if GTK+ version is determined to be too old during run-time
class WXDLLIMPEXP_CORE wxInfoBar : public wxInfoBarGeneric
{
public:
wxInfoBar() { Init(); }
wxInfoBar(wxWindow *parent, wxWindowID winid = wxID_ANY, long style = 0)
{
Init();
Create(parent, winid, style);
}
bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY, long style = 0);
virtual ~wxInfoBar();
// implement base class methods
// ----------------------------
virtual void ShowMessage(const wxString& msg,
int flags = wxICON_INFORMATION) override;
virtual void Dismiss() override;
virtual void AddButton(wxWindowID btnid,
const wxString& label = wxString()) override;
virtual void RemoveButton(wxWindowID btnid) override;
virtual size_t GetButtonCount() const override;
virtual wxWindowID GetButtonId(size_t idx) const override;
virtual bool HasButtonId(wxWindowID btnid) const override;
// implementation only
// -------------------
void GTKResponse(int btnid);
protected:
virtual void DoApplyWidgetStyle(GtkRcStyle *style) override;
private:
void Init() { m_impl = nullptr; }
virtual bool UseNative() const override;
// add a button with the given id/label and return its widget
GtkWidget *GTKAddButton(wxWindowID btnid,
const wxString& label = wxString());
// only used when the native implementation is really being used
class wxInfoBarGTKImpl *m_impl;
wxDECLARE_NO_COPY_CLASS(wxInfoBar);
};
#endif // _WX_GTK_INFOBAR_H_

View File

@@ -0,0 +1,138 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/listbox.h
// Purpose: wxListBox class declaration
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_LISTBOX_H_
#define _WX_GTK_LISTBOX_H_
struct _wxTreeEntry;
struct _GtkTreeIter;
//-----------------------------------------------------------------------------
// wxListBox
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase
{
public:
// ctors and such
wxListBox()
{
Init();
}
wxListBox( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = (const wxString *) nullptr,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxListBoxNameStr) )
{
Init();
Create(parent, id, pos, size, n, choices, style, validator, name);
}
wxListBox( wxWindow *parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxListBoxNameStr) )
{
Init();
Create(parent, id, pos, size, choices, style, validator, name);
}
virtual ~wxListBox();
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = (const wxString *) nullptr,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxListBoxNameStr));
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxListBoxNameStr));
virtual unsigned int GetCount() const override;
virtual wxString GetString(unsigned int n) const override;
virtual void SetString(unsigned int n, const wxString& s) override;
virtual int FindString(const wxString& s, bool bCase = false) const override;
virtual bool IsSelected(int n) const override;
virtual int GetSelection() const override;
virtual int GetSelections(wxArrayInt& aSelections) const override;
virtual void EnsureVisible(int n) override;
virtual int GetTopItem() const override;
virtual int GetCountPerPage() const override;
virtual void Update() override;
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
// implementation from now on
virtual GtkWidget *GetConnectWidget() const override;
struct _GtkTreeView *m_treeview;
struct _GtkListStore *m_liststore;
#if wxUSE_CHECKLISTBOX
bool m_hasCheckBoxes;
#endif // wxUSE_CHECKLISTBOX
struct _wxTreeEntry* GTKGetEntry(unsigned pos) const;
void GTKDisableEvents();
void GTKEnableEvents();
void GTKOnSelectionChanged();
void GTKOnActivated(int item);
protected:
virtual void DoClear() override;
virtual void DoDeleteOneItem(unsigned int n) override;
virtual wxSize DoGetBestSize() const override;
virtual void DoApplyWidgetStyle(GtkRcStyle *style) override;
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const override;
virtual void DoSetSelection(int n, bool select) override;
virtual int DoInsertItems(const wxArrayStringsAdapter& items,
unsigned int pos,
void **clientData, wxClientDataType type) override;
virtual int DoInsertOneItem(const wxString& item, unsigned int pos) override;
virtual void DoSetFirstItem(int n) override;
virtual void DoSetItemClientData(unsigned int n, void* clientData) override;
virtual void* DoGetItemClientData(unsigned int n) const override;
virtual int DoListHitTest(const wxPoint& point) const override;
// get the iterator for the given index, returns false if invalid
bool GTKGetIteratorFor(unsigned pos, _GtkTreeIter *iter) const;
// get the index for the given iterator, return wxNOT_FOUND on failure
int GTKGetIndexFor(_GtkTreeIter& iter) const;
// common part of DoSetFirstItem() and EnsureVisible()
void DoScrollToCell(int n, float alignY, float alignX);
private:
void Init(); //common construction
wxDECLARE_DYNAMIC_CLASS(wxListBox);
};
#endif // _WX_GTK_LISTBOX_H_

View File

@@ -0,0 +1,156 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/mdi.h
// Purpose: TDI-based MDI implementation for wxGTK
// Author: Robert Roebling
// Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes
// Copyright: (c) 1998 Robert Roebling
// (c) 2008 Vadim Zeitlin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_MDI_H_
#define _WX_GTK_MDI_H_
#include "wx/frame.h"
class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow;
typedef struct _GtkNotebook GtkNotebook;
//-----------------------------------------------------------------------------
// wxMDIParentFrame
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase
{
public:
wxMDIParentFrame() { Init(); }
wxMDIParentFrame(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
const wxString& name = wxASCII_STR(wxFrameNameStr))
{
Init();
(void)Create(parent, id, title, pos, size, style, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
const wxString& name = wxASCII_STR(wxFrameNameStr));
// we don't store the active child in m_currentChild unlike the base class
// version so override this method to find it dynamically
virtual wxMDIChildFrame *GetActiveChild() const override;
// implement base class pure virtuals
// ----------------------------------
virtual void ActivateNext() override;
virtual void ActivatePrevious() override;
static bool IsTDI() { return true; }
// implementation
bool m_justInserted;
virtual void OnInternalIdle() override;
protected:
virtual void DoGetClientSize(int* width, int* height) const override;
private:
friend class wxMDIChildFrame;
void Init();
wxDECLARE_DYNAMIC_CLASS(wxMDIParentFrame);
};
//-----------------------------------------------------------------------------
// wxMDIChildFrame
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxTDIChildFrame
{
public:
wxMDIChildFrame() { Init(); }
wxMDIChildFrame(wxMDIParentFrame *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxASCII_STR(wxFrameNameStr))
{
Init();
Create(parent, id, title, pos, size, style, name);
}
bool Create(wxMDIParentFrame *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxASCII_STR(wxFrameNameStr));
virtual ~wxMDIChildFrame();
virtual void SetMenuBar( wxMenuBar *menu_bar ) override;
virtual wxMenuBar *GetMenuBar() const override;
virtual void Activate() override;
virtual void SetTitle(const wxString& title) override;
// implementation
void OnActivate( wxActivateEvent& event );
void OnMenuHighlight( wxMenuEvent& event );
virtual void GTKHandleRealized() override;
wxMenuBar *m_menuBar;
bool m_justInserted;
protected:
virtual void DoGetPosition(int *x, int *y) const override;
private:
void Init();
GtkNotebook *GTKGetNotebook() const;
wxDECLARE_EVENT_TABLE();
wxDECLARE_DYNAMIC_CLASS(wxMDIChildFrame);
};
//-----------------------------------------------------------------------------
// wxMDIClientWindow
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase
{
public:
wxMDIClientWindow() = default;
~wxMDIClientWindow();
virtual bool CreateClient(wxMDIParentFrame *parent,
long style = wxVSCROLL | wxHSCROLL) override;
private:
virtual void AddChildGTK(wxWindowGTK* child) override;
wxDECLARE_DYNAMIC_CLASS(wxMDIClientWindow);
};
#endif // _WX_GTK_MDI_H_

View File

@@ -0,0 +1,112 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/menu.h
// Purpose:
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling, Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTKMENU_H_
#define _WX_GTKMENU_H_
//-----------------------------------------------------------------------------
// wxMenuBar
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxMenuBar : public wxMenuBarBase
{
public:
// ctors
wxMenuBar();
wxMenuBar(long style);
wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0);
~wxMenuBar();
// implement base class (pure) virtuals
virtual bool Append( wxMenu *menu, const wxString &title ) override;
virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title) override;
virtual wxMenu *Replace(size_t pos, wxMenu *menu, const wxString& title) override;
virtual wxMenu *Remove(size_t pos) override;
virtual int FindMenuItem(const wxString& menuString,
const wxString& itemString) const override;
virtual wxMenuItem* FindItem( int id, wxMenu **menu = nullptr ) const override;
virtual void EnableTop( size_t pos, bool flag ) override;
virtual bool IsEnabledTop(size_t pos) const override;
virtual void SetMenuLabel( size_t pos, const wxString& label ) override;
virtual wxString GetMenuLabel( size_t pos ) const override;
void SetLayoutDirection(wxLayoutDirection dir) override;
wxLayoutDirection GetLayoutDirection() const override;
virtual void Attach(wxFrame *frame) override;
virtual void Detach() override;
private:
// common part of Append and Insert
void GtkAppend(wxMenu* menu, const wxString& title, int pos = -1);
void Init(size_t n, wxMenu *menus[], const wxString titles[], long style);
// wxMenuBar is not a top level window but it still doesn't need a parent
// window
virtual bool GTKNeedsParent() const override { return false; }
GtkWidget* m_menubar;
wxDECLARE_DYNAMIC_CLASS(wxMenuBar);
};
//-----------------------------------------------------------------------------
// wxMenu
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxMenu : public wxMenuBase
{
public:
// ctors & dtor
wxMenu(const wxString& title, long style = 0)
: wxMenuBase(title, style) { Init(); }
wxMenu(long style = 0) : wxMenuBase(style) { Init(); }
virtual ~wxMenu();
void Attach(wxMenuBarBase *menubar) override;
void SetupBitmaps(wxWindow *win);
void SetLayoutDirection(wxLayoutDirection dir);
wxLayoutDirection GetLayoutDirection() const;
// Returns the title, with mnemonics translated to wx format
wxString GetTitle() const;
// Sets the title, with mnemonics translated to gtk format
virtual void SetTitle(const wxString& title) override;
// implementation GTK only
GtkWidget *m_menu; // GtkMenu
GtkWidget *m_owner;
GtkAccelGroup *m_accel;
bool m_popupShown;
protected:
virtual wxMenuItem* DoAppend(wxMenuItem *item) override;
virtual wxMenuItem* DoInsert(size_t pos, wxMenuItem *item) override;
virtual wxMenuItem* DoRemove(wxMenuItem *item) override;
private:
// common code for all constructors:
void Init();
// common part of Append (if pos == -1) and Insert
void GtkAppend(wxMenuItem* item, int pos = -1);
wxDECLARE_DYNAMIC_CLASS(wxMenu);
};
#endif
// _WX_GTKMENU_H_

View File

@@ -0,0 +1,54 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/menuitem.h
// Purpose: wxMenuItem class
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTKMENUITEM_H_
#define _WX_GTKMENUITEM_H_
//-----------------------------------------------------------------------------
// wxMenuItem
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxMenuItem : public wxMenuItemBase
{
public:
wxMenuItem(wxMenu *parentMenu = nullptr,
int id = wxID_SEPARATOR,
const wxString& text = wxEmptyString,
const wxString& help = wxEmptyString,
wxItemKind kind = wxITEM_NORMAL,
wxMenu *subMenu = nullptr);
virtual ~wxMenuItem();
// implement base class virtuals
virtual void SetItemLabel( const wxString& str ) override;
virtual void Enable( bool enable = true ) override;
virtual void Check( bool check = true ) override;
virtual bool IsChecked() const override;
void SetupBitmaps(wxWindow *win);
#if wxUSE_ACCEL
virtual void AddExtraAccel(const wxAcceleratorEntry& accel) override;
virtual void ClearExtraAccels() override;
#endif // wxUSE_ACCEL
// implementation
void SetMenuItem(GtkWidget *menuItem);
GtkWidget *GetMenuItem() const { return m_menuItem; }
void SetGtkLabel();
#if wxUSE_ACCEL
void GTKSetExtraAccels();
#endif // wxUSE_ACCEL
private:
GtkWidget *m_menuItem; // GtkMenuItem
wxDECLARE_DYNAMIC_CLASS(wxMenuItem);
};
#endif // _WX_GTKMENUITEM_H_

View File

@@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/mimetype.h
// Purpose: classes and functions to manage MIME types
// Author: Hans Mackowiak
// Created: 2016-06-05
// Copyright: (c) 2016 Hans Mackowiak <hanmac@gmx.de>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_MIMETYPE_IMPL_H
#define _WX_GTK_MIMETYPE_IMPL_H
#include "wx/defs.h"
#if defined(__UNIX__)
#include "wx/unix/mimetype.h"
#elif defined(__WINDOWS__)
#include "wx/msw/mimetype.h"
#endif
#if wxUSE_MIMETYPE
class WXDLLIMPEXP_CORE wxGTKMimeTypesManagerImpl : public wxMimeTypesManagerImpl
{
protected:
#if defined(__UNIX__)
wxString GetIconFromMimeType(const wxString& mime) override;
#endif
};
class WXDLLIMPEXP_CORE wxGTKMimeTypesManagerFactory : public wxMimeTypesManagerFactory
{
public:
wxMimeTypesManagerImpl *CreateMimeTypesManagerImpl() override;
};
#endif // wxUSE_MIMETYPE
#endif // _WX_GTK_MIMETYPE_IMPL_H

View File

@@ -0,0 +1,64 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/minifram.h
// Purpose: wxMiniFrame class
// Author: Robert Roebling
// Copyright: (c) Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_MINIFRAME_H_
#define _WX_GTK_MINIFRAME_H_
#include "wx/bitmap.h"
#include "wx/frame.h"
//-----------------------------------------------------------------------------
// wxMiniFrame
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxMiniFrame: public wxFrame
{
wxDECLARE_DYNAMIC_CLASS(wxMiniFrame);
public:
wxMiniFrame() = default;
wxMiniFrame(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCAPTION | wxRESIZE_BORDER,
const wxString& name = wxASCII_STR(wxFrameNameStr))
{
Create(parent, id, title, pos, size, style, name);
}
~wxMiniFrame();
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCAPTION | wxRESIZE_BORDER,
const wxString& name = wxASCII_STR(wxFrameNameStr));
virtual void SetTitle( const wxString &title ) override;
protected:
virtual void DoSetSizeHints( int minW, int minH,
int maxW, int maxH,
int incW, int incH ) override;
virtual void DoGetClientSize(int* width, int* height) const override;
// implementation
public:
#ifndef __WXGTK4__
bool m_isDragMove;
wxSize m_dragOffset;
#endif
wxBitmap m_closeButton;
int m_miniEdge;
int m_miniTitle;
};
#endif // _WX_GTK_MINIFRAME_H_

View File

@@ -0,0 +1,50 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/msgdlg.h
// Purpose: wxMessageDialog for GTK+2
// Author: Vaclav Slavik
// Created: 2003/02/28
// Copyright: (c) Vaclav Slavik, 2003
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_MSGDLG_H_
#define _WX_GTK_MSGDLG_H_
class WXDLLIMPEXP_CORE wxMessageDialog : public wxMessageDialogBase
{
public:
wxMessageDialog(wxWindow *parent, const wxString& message,
const wxString& caption = wxASCII_STR(wxMessageBoxCaptionStr),
long style = wxOK|wxCENTRE,
const wxPoint& pos = wxDefaultPosition);
virtual int ShowModal() override;
virtual bool Show(bool WXUNUSED(show) = true) override { return false; }
protected:
// implement some base class methods to do nothing to avoid asserts and
// GTK warnings, since this is not a real wxDialog.
virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y),
int WXUNUSED(width), int WXUNUSED(height),
int WXUNUSED(sizeFlags) = wxSIZE_AUTO) override {}
virtual void DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y),
int WXUNUSED(width), int WXUNUSED(height)) override {}
// override to convert wx mnemonics to GTK+ ones and handle stock ids
virtual void DoSetCustomLabel(wxString& var, const ButtonLabel& label) override;
private:
// override to use stock GTK+ defaults instead of just string ones
virtual wxString GetDefaultYesLabel() const override;
virtual wxString GetDefaultNoLabel() const override;
virtual wxString GetDefaultOKLabel() const override;
virtual wxString GetDefaultCancelLabel() const override;
virtual wxString GetDefaultHelpLabel() const override;
// create the real GTK+ dialog: this is done from ShowModal() to allow
// changing the message between constructing the dialog and showing it
void GTKCreateMsgDialog();
wxDECLARE_DYNAMIC_CLASS(wxMessageDialog);
};
#endif // _WX_GTK_MSGDLG_H_

View File

@@ -0,0 +1,43 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/nonownedwnd.h
// Purpose: wxGTK-specific wxNonOwnedWindow declaration.
// Author: Vadim Zeitlin
// Created: 2011-10-12
// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_NONOWNEDWND_H_
#define _WX_GTK_NONOWNEDWND_H_
class wxNonOwnedWindowShapeImpl;
// ----------------------------------------------------------------------------
// wxNonOwnedWindow contains code common to wx{Popup,TopLevel}Window in wxGTK.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxNonOwnedWindowBase
{
public:
wxNonOwnedWindow() { m_shapeImpl = nullptr; }
virtual ~wxNonOwnedWindow();
// Overridden to actually set the shape when the window becomes realized.
virtual void GTKHandleRealized() override;
protected:
virtual bool DoClearShape() override;
virtual bool DoSetRegionShape(const wxRegion& region) override;
#if wxUSE_GRAPHICS_CONTEXT
virtual bool DoSetPathShape(const wxGraphicsPath& path) override;
#endif // wxUSE_GRAPHICS_CONTEXT
private:
// If non-null, contains information about custom window shape.
wxNonOwnedWindowShapeImpl* m_shapeImpl;
wxDECLARE_NO_COPY_CLASS(wxNonOwnedWindow);
};
#endif // _WX_GTK_NONOWNEDWND_H_

View File

@@ -0,0 +1,142 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/notebook.h
// Purpose: wxNotebook class
// Author: Robert Roebling
// Copyright: (c) Julian Smart and Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTKNOTEBOOK_H_
#define _WX_GTKNOTEBOOK_H_
#include <vector>
//-----------------------------------------------------------------------------
// internal class
//-----------------------------------------------------------------------------
class wxGtkNotebookPage;
//-----------------------------------------------------------------------------
// wxNotebook
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase
{
public:
// default for dynamic class
wxNotebook();
// the same arguments as for wxControl
wxNotebook(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxASCII_STR(wxNotebookNameStr));
// Create() function
bool Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxASCII_STR(wxNotebookNameStr));
// dtor
virtual ~wxNotebook();
// accessors
// ---------
// set the currently selected page, return the index of the previously
// selected one (or wxNOT_FOUND on error)
// NB: this function will _not_ generate wxEVT_NOTEBOOK_PAGE_xxx events
int SetSelection(size_t nPage) override { return DoSetSelection(nPage, SetSelection_SendEvent); }
// get the currently selected page
int GetSelection() const override;
// changes selected page without sending events
int ChangeSelection(size_t nPage) override { return DoSetSelection(nPage); }
// set/get the title of a page
bool SetPageText(size_t nPage, const wxString& strText) override;
wxString GetPageText(size_t nPage) const override;
// sets/returns item's image index in the current image list
int GetPageImage(size_t nPage) const override;
bool SetPageImage(size_t nPage, int nImage) override;
// control the appearance of the notebook pages
// set the padding between tabs (in pixels)
void SetPadding(const wxSize& padding) override;
// sets the size of the tabs (assumes all tabs are the same size)
void SetTabSize(const wxSize& sz) override;
// geometry
virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const override;
virtual int HitTest(const wxPoint& pt, long *flags = nullptr) const override;
// operations
// ----------
// remove all pages
bool DeleteAllPages() override;
// adds a new page to the notebook (it will be deleted by the notebook,
// don't delete it yourself). If bSelect, this page becomes active.
// the same as AddPage(), but adds it at the specified position
bool InsertPage( size_t position,
wxNotebookPage *win,
const wxString& strText,
bool bSelect = false,
int imageId = NO_IMAGE ) override;
// handler for tab navigation
// --------------------------
void OnNavigationKey(wxNavigationKeyEvent& event);
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
// implementation
// --------------
#if wxUSE_CONSTRAINTS
void SetConstraintSizes(bool recurse) override;
bool DoPhase(int phase) override;
#endif
// Called by GTK event handler when the current page is definitely changed.
void GTKOnPageChanged();
// helper function
wxGtkNotebookPage* GetNotebookPage(int page) const;
// we need to store the old selection since there
// is no other way to know about it at the time
// of the change selection event
int m_oldSelection;
protected:
// set all page's attributes
virtual void DoApplyWidgetStyle(GtkRcStyle *style) override;
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const override;
// remove one page from the notebook but do not destroy it
virtual wxNotebookPage *DoRemovePage(size_t nPage) override;
int DoSetSelection(size_t nPage, int flags = 0) override;
private:
// the padding set by SetPadding()
int m_padding;
// the additional page data (the pages themselves are in m_pages array)
std::vector<wxGtkNotebookPage> m_pagesData;
void Init();
virtual void AddChildGTK(wxWindowGTK* child) override;
wxDECLARE_DYNAMIC_CLASS(wxNotebook);
wxDECLARE_EVENT_TABLE();
};
#endif // _WX_GTKNOTEBOOK_H_

View File

@@ -0,0 +1,61 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/pen.h
// Purpose:
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PEN_H_
#define _WX_GTK_PEN_H_
//-----------------------------------------------------------------------------
// wxPen
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxPen: public wxPenBase
{
public:
wxPen() = default;
wxPen( const wxColour &colour, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID );
wxPen( const wxPenInfo& info );
bool operator==(const wxPen& pen) const;
bool operator!=(const wxPen& pen) const { return !(*this == pen); }
void SetColour( const wxColour &colour ) override;
void SetColour( unsigned char red, unsigned char green, unsigned char blue ) override;
void SetCap( wxPenCap capStyle ) override;
void SetJoin( wxPenJoin joinStyle ) override;
void SetStyle( wxPenStyle style ) override;
void SetWidth( int width ) override;
void SetDashes( int number_of_dashes, const wxDash *dash ) override;
void SetStipple(const wxBitmap& stipple) override;
wxColour GetColour() const override;
wxPenCap GetCap() const override;
wxPenJoin GetJoin() const override;
wxPenStyle GetStyle() const override;
int GetWidth() const override;
int GetDashes(wxDash **ptr) const override;
int GetDashCount() const;
wxDash* GetDash() const;
wxBitmap *GetStipple() const override;
wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants")
wxPen(const wxColour& col, int width, int style);
wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants")
void SetStyle(int style) { SetStyle((wxPenStyle)style); }
protected:
virtual wxGDIRefData *CreateGDIRefData() const override;
wxNODISCARD virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const override;
wxDECLARE_DYNAMIC_CLASS(wxPen);
};
#endif // _WX_GTK_PEN_H_

View File

@@ -0,0 +1,50 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/popupwin.h
// Purpose:
// Author: Robert Roebling
// Created:
// Copyright: (c) 2001 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_POPUPWIN_H_
#define _WX_GTK_POPUPWIN_H_
//-----------------------------------------------------------------------------
// wxPopUpWindow
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxPopupWindow: public wxPopupWindowBase
{
public:
wxPopupWindow() = default;
virtual ~wxPopupWindow();
wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE)
{ (void)Create(parent, flags); }
bool Create(wxWindow *parent, int flags = wxBORDER_NONE);
virtual bool Show(bool show = true) override;
virtual void SetFocus() override;
// implementation
// --------------
// GTK time when connecting to button_press signal
wxUint32 m_time;
protected:
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO) override;
virtual void DoMoveWindow(int x, int y, int width, int height) override;
#ifdef __WXUNIVERSAL__
wxDECLARE_EVENT_TABLE();
#endif
wxDECLARE_DYNAMIC_CLASS(wxPopupWindow);
};
#endif // _WX_GTK_POPUPWIN_H_

View File

@@ -0,0 +1,354 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/print.h
// Author: Anthony Bretaudeau
// Purpose: GTK printing support
// Created: 2007-08-25
// Copyright: (c) Anthony Bretaudeau
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRINT_H_
#define _WX_GTK_PRINT_H_
#include "wx/defs.h"
#if wxUSE_GTKPRINT
#include "wx/print.h"
#include "wx/printdlg.h"
#include "wx/prntbase.h"
#include "wx/dc.h"
typedef struct _GtkPrintOperation GtkPrintOperation;
typedef struct _GtkPrintContext GtkPrintContext;
typedef struct _GtkPrintSettings GtkPrintSettings;
typedef struct _GtkPageSetup GtkPageSetup;
typedef struct _cairo cairo_t;
//----------------------------------------------------------------------------
// wxGtkPrintFactory
//----------------------------------------------------------------------------
class wxGtkPrintFactory: public wxPrintFactory
{
public:
virtual wxPrinterBase *CreatePrinter( wxPrintDialogData *data ) override;
virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
wxPrintout *printout = nullptr,
wxPrintDialogData *data = nullptr ) override;
virtual wxPrintPreviewBase *CreatePrintPreview( wxPrintout *preview,
wxPrintout *printout,
wxPrintData *data ) override;
virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent,
wxPrintDialogData *data = nullptr ) override;
virtual wxPrintDialogBase *CreatePrintDialog( wxWindow *parent,
wxPrintData *data ) override;
virtual wxPageSetupDialogBase *CreatePageSetupDialog( wxWindow *parent,
wxPageSetupDialogData * data = nullptr ) override;
virtual wxDCImpl* CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data ) override;
virtual bool HasPrintSetupDialog() override;
virtual wxDialog *CreatePrintSetupDialog( wxWindow *parent, wxPrintData *data ) override;
virtual bool HasOwnPrintToFile() override;
virtual bool HasPrinterLine() override;
virtual wxString CreatePrinterLine() override;
virtual bool HasStatusLine() override;
virtual wxString CreateStatusLine() override;
virtual wxPrintNativeDataBase *CreatePrintNativeData() override;
};
//----------------------------------------------------------------------------
// wxGtkPrintDialog
//----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGtkPrintDialog: public wxPrintDialogBase
{
public:
wxGtkPrintDialog( wxWindow *parent,
wxPrintDialogData* data = nullptr );
wxGtkPrintDialog( wxWindow *parent, wxPrintData* data);
virtual ~wxGtkPrintDialog();
wxPrintData& GetPrintData() override
{ return m_printDialogData.GetPrintData(); }
wxPrintDialogData& GetPrintDialogData() override
{ return m_printDialogData; }
wxDC *GetPrintDC() override;
virtual int ShowModal() override;
virtual bool Validate() override { return true; }
virtual bool TransferDataToWindow() override { return true; }
virtual bool TransferDataFromWindow() override { return true; }
void SetShowDialog(bool show) { m_showDialog = show; }
bool GetShowDialog() { return m_showDialog; }
protected:
// Implement some base class methods to do nothing to avoid asserts and
// GTK warnings, since this is not a real wxDialog.
virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y),
int WXUNUSED(width), int WXUNUSED(height),
int WXUNUSED(sizeFlags) = wxSIZE_AUTO) override {}
virtual void DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y),
int WXUNUSED(width), int WXUNUSED(height)) override {}
private:
wxPrintDialogData m_printDialogData;
wxWindow *m_parent;
bool m_showDialog;
wxDECLARE_DYNAMIC_CLASS(wxGtkPrintDialog);
};
//----------------------------------------------------------------------------
// wxGtkPageSetupDialog
//----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGtkPageSetupDialog: public wxPageSetupDialogBase
{
public:
wxGtkPageSetupDialog( wxWindow *parent,
wxPageSetupDialogData* data = nullptr );
virtual ~wxGtkPageSetupDialog();
virtual wxPageSetupDialogData& GetPageSetupDialogData() override { return m_pageDialogData; }
virtual int ShowModal() override;
virtual bool Validate() override { return true; }
virtual bool TransferDataToWindow() override { return true; }
virtual bool TransferDataFromWindow() override { return true; }
protected:
// Implement some base class methods to do nothing to avoid asserts and
// GTK warnings, since this is not a real wxDialog.
virtual void DoSetSize(int WXUNUSED(x), int WXUNUSED(y),
int WXUNUSED(width), int WXUNUSED(height),
int WXUNUSED(sizeFlags) = wxSIZE_AUTO) override {}
virtual void DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y),
int WXUNUSED(width), int WXUNUSED(height)) override {}
private:
wxPageSetupDialogData m_pageDialogData;
wxWindow *m_parent;
wxDECLARE_DYNAMIC_CLASS(wxGtkPageSetupDialog);
};
//----------------------------------------------------------------------------
// wxGtkPrinter
//----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGtkPrinter : public wxPrinterBase
{
public:
wxGtkPrinter(wxPrintDialogData *data = nullptr);
virtual ~wxGtkPrinter();
virtual bool Print(wxWindow *parent,
wxPrintout *printout,
bool prompt = true) override;
virtual wxDC* PrintDialog(wxWindow *parent) override;
virtual bool Setup(wxWindow *parent) override;
GtkPrintContext *GetPrintContext() { return m_gpc; }
void SetPrintContext(GtkPrintContext *context) {m_gpc = context;}
void BeginPrint(wxPrintout *printout, GtkPrintOperation *operation, GtkPrintContext *context);
void DrawPage(wxPrintout *printout, GtkPrintOperation *operation, GtkPrintContext *context, int page_nr);
private:
GtkPrintContext *m_gpc;
wxDC *m_dc;
wxDECLARE_DYNAMIC_CLASS(wxGtkPrinter);
wxDECLARE_NO_COPY_CLASS(wxGtkPrinter);
};
//----------------------------------------------------------------------------
// wxGtkPrintNativeData
//----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGtkPrintNativeData : public wxPrintNativeDataBase
{
public:
wxGtkPrintNativeData();
virtual ~wxGtkPrintNativeData();
virtual bool TransferTo( wxPrintData &data ) override;
virtual bool TransferFrom( const wxPrintData &data ) override;
virtual bool Ok() const override { return IsOk(); }
virtual bool IsOk() const override { return true; }
GtkPrintSettings* GetPrintConfig() { return m_config; }
void SetPrintConfig( GtkPrintSettings * config );
GtkPrintOperation* GetPrintJob() { return m_job; }
void SetPrintJob(GtkPrintOperation *job);
GtkPrintContext *GetPrintContext() { return m_context; }
void SetPrintContext(GtkPrintContext *context) {m_context = context; }
private:
// NB: m_config is created and owned by us, but the other objects are not
// and their accessors don't change their ref count.
GtkPrintSettings *m_config;
GtkPrintOperation *m_job;
GtkPrintContext *m_context;
wxDECLARE_DYNAMIC_CLASS(wxGtkPrintNativeData);
};
//-----------------------------------------------------------------------------
// wxGtkPrinterDC
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGtkPrinterDCImpl : public wxDCImpl
{
public:
wxGtkPrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data );
virtual ~wxGtkPrinterDCImpl();
bool Ok() const { return IsOk(); }
bool IsOk() const override;
virtual void* GetCairoContext() const override;
virtual void* GetHandle() const override;
bool CanDrawBitmap() const override { return true; }
void Clear() override;
void SetFont( const wxFont& font ) override;
void SetPen( const wxPen& pen ) override;
void SetBrush( const wxBrush& brush ) override;
void SetLogicalFunction( wxRasterOperationMode function ) override;
void SetBackground( const wxBrush& brush ) override;
void DestroyClippingRegion() override;
bool StartDoc(const wxString& message) override;
void EndDoc() override;
void StartPage() override;
void EndPage() override;
wxCoord GetCharHeight() const override;
wxCoord GetCharWidth() const override;
bool CanGetTextExtent() const override { return true; }
wxSize GetPPI() const override;
virtual int GetDepth() const override { return 24; }
void SetBackgroundMode(int mode) override;
#if wxUSE_PALETTE
void SetPalette(const wxPalette& WXUNUSED(palette)) override { }
#endif
void SetResolution(int ppi);
// overridden for wxPrinterDC Impl
virtual int GetResolution() const override;
virtual wxRect GetPaperRect() const override;
protected:
bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col,
wxFloodFillStyle style=wxFLOOD_SURFACE ) override;
void DoGradientFillConcentric(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, const wxPoint& circleCenter) override;
void DoGradientFillLinear(const wxRect& rect, const wxColour& initialColour, const wxColour& destColour, wxDirection nDirection = wxEAST) override;
bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const override;
void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) override;
void DoCrossHair(wxCoord x, wxCoord y) override;
void DoDrawArc(wxCoord x1,wxCoord y1,wxCoord x2,wxCoord y2,wxCoord xc,wxCoord yc) override;
void DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,double ea) override;
void DoDrawPoint(wxCoord x, wxCoord y) override;
void DoDrawLines(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0) override;
void DoDrawPolygon(int n, const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, wxPolygonFillMode fillStyle=wxODDEVEN_RULE) override;
void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, wxPolygonFillMode fillStyle=wxODDEVEN_RULE) override;
void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) override;
void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0) override;
void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height) override;
#if wxUSE_SPLINES
void DoDrawSpline(const wxPointList *points) override;
#endif
bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc,
wxRasterOperationMode rop = wxCOPY, bool useMask = false,
wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord) override;
void DoDrawIcon( const wxIcon& icon, wxCoord x, wxCoord y ) override;
void DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask = false ) override;
void DoDrawText(const wxString& text, wxCoord x, wxCoord y ) override;
void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle) override;
void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height) override;
void DoSetDeviceClippingRegion( const wxRegion &WXUNUSED(clip) ) override
{
wxFAIL_MSG( "not implemented" );
}
void DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
wxCoord *descent = nullptr,
wxCoord *externalLeading = nullptr,
const wxFont *theFont = nullptr ) const override;
bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const override;
void DoGetSize(int* width, int* height) const override;
void DoGetSizeMM(int *width, int *height) const override;
wxPrintData& GetPrintData() { return m_printData; }
void SetPrintData(const wxPrintData& data);
private:
// Call cairo_set_source_rgba() if necessary.
void SetSourceColour(const wxColour& col);
wxPrintData m_printData;
PangoContext *m_context;
PangoLayout *m_layout;
PangoFontDescription *m_fontdesc;
cairo_t *m_cairo;
// Last colour passed to cairo_set_source_rgba().
mutable wxColour m_currentSourceColour;
GtkPrintContext *m_gpc;
int m_resolution;
double m_PS2DEV;
double m_DEV2PS;
friend class wxGtkPrinterDCContextSaver;
wxDECLARE_DYNAMIC_CLASS(wxGtkPrinterDCImpl);
wxDECLARE_NO_COPY_CLASS(wxGtkPrinterDCImpl);
};
// ----------------------------------------------------------------------------
// wxGtkPrintPreview: programmer creates an object of this class to preview a
// wxPrintout.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGtkPrintPreview : public wxPrintPreviewBase
{
public:
wxGtkPrintPreview(wxPrintout *printout,
wxPrintout *printoutForPrinting = nullptr,
wxPrintDialogData *data = nullptr);
wxGtkPrintPreview(wxPrintout *printout,
wxPrintout *printoutForPrinting,
wxPrintData *data);
virtual ~wxGtkPrintPreview();
virtual bool Print(bool interactive) override;
virtual void DetermineScaling() override;
private:
void Init(wxPrintout *printout,
wxPrintout *printoutForPrinting,
wxPrintData *data);
// resolution to use in DPI
int m_resolution;
wxDECLARE_CLASS(wxGtkPrintPreview);
};
#endif // wxUSE_GTKPRINT
#endif // _WX_GTK_PRINT_H_

View File

@@ -0,0 +1,69 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private.h
// Purpose: wxGTK private macros, functions &c
// Author: Vadim Zeitlin
// Created: 12.03.02
// Copyright: (c) 2002 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_H_
#define _WX_GTK_PRIVATE_H_
#include "wx/gtk/private/wrapgtk.h"
#include "wx/gtk/private/string.h"
#ifndef G_VALUE_INIT
// introduced in GLib 2.30
#define G_VALUE_INIT { 0, { { 0 } } }
#endif
// pango_version_check symbol is quite recent ATM (4/2007)... so we
// use our own wrapper which implements a smart trick.
// Use this function as you'd use pango_version_check:
//
// if (!wx_pango_version_check(1,18,0))
// ... call to a function available only in pango >= 1.18 ...
//
// and use it only to test for pango versions >= 1.16.0
extern const gchar *wx_pango_version_check(int major, int minor, int micro);
// Define a macro for converting wxString to char* in appropriate encoding for
// the file names.
#ifdef G_OS_WIN32
// Under MSW, UTF-8 file name encodings are always used.
#define wxGTK_CONV_FN(s) (s).utf8_str()
#else
// Under Unix use GLib file name encoding (which is also UTF-8 by default
// but may be different from it).
#define wxGTK_CONV_FN(s) (s).fn_str()
#endif
// ----------------------------------------------------------------------------
// various private helper functions
// ----------------------------------------------------------------------------
namespace wxGTKPrivate
{
// these functions create the GTK widgets of the specified types which can then
// used to retrieve their styles, pass them to drawing functions &c
//
// the returned widgets shouldn't be destroyed, this is done automatically on
// shutdown
WXDLLIMPEXP_CORE GtkWidget *GetButtonWidget();
WXDLLIMPEXP_CORE GtkWidget *GetCheckButtonWidget();
WXDLLIMPEXP_CORE GtkWidget *GetComboBoxWidget();
WXDLLIMPEXP_CORE GtkWidget *GetEntryWidget();
WXDLLIMPEXP_CORE GtkWidget *GetHeaderButtonWidgetFirst();
WXDLLIMPEXP_CORE GtkWidget *GetHeaderButtonWidgetLast();
WXDLLIMPEXP_CORE GtkWidget *GetHeaderButtonWidget();
WXDLLIMPEXP_CORE GtkWidget *GetNotebookWidget();
WXDLLIMPEXP_CORE GtkWidget *GetRadioButtonWidget();
WXDLLIMPEXP_CORE GtkWidget *GetSplitterWidget(wxOrientation orient = wxHORIZONTAL);
WXDLLIMPEXP_CORE GtkWidget *GetTreeWidget();
} // wxGTKPrivate
#endif // _WX_GTK_PRIVATE_H_

View File

@@ -0,0 +1,80 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/addremovectrl.h
// Purpose: GTK specific wxAddRemoveImpl implementation
// Author: Vadim Zeitlin
// Created: 2015-02-05
// Copyright: (c) 2015 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_ADDREMOVECTRL_H_
#define _WX_GTK_PRIVATE_ADDREMOVECTRL_H_
#include "wx/artprov.h"
#include "wx/bmpbuttn.h"
#include "wx/toolbar.h"
#include "wx/gtk/private/wrapgtk.h"
// ----------------------------------------------------------------------------
// wxAddRemoveImpl
// ----------------------------------------------------------------------------
class wxAddRemoveImpl : public wxAddRemoveImplBase
{
public:
wxAddRemoveImpl(wxAddRemoveAdaptor* adaptor,
wxAddRemoveCtrl* parent,
wxWindow* ctrlItems)
: wxAddRemoveImplBase(adaptor, parent, ctrlItems),
m_tbar(new wxToolBar(parent, wxID_ANY))
{
m_tbar->AddTool(wxID_ADD, wxString(), GetNamedBitmap("list-add"));
m_tbar->AddTool(wxID_REMOVE, wxString(), GetNamedBitmap("list-remove"));
#if defined(__WXGTK3__) && !defined(__WXUNIVERSAL__)
// Tweak the toolbar appearance to correspond to how the toolbars used
// in other GNOME applications for similar purposes look.
GtkToolbar* const toolbar = m_tbar->GTKGetToolbar();
GtkStyleContext* context = gtk_widget_get_style_context(GTK_WIDGET(toolbar));
gtk_style_context_add_class(context, GTK_STYLE_CLASS_INLINE_TOOLBAR);
gtk_style_context_set_junction_sides(context, GTK_JUNCTION_TOP);
#endif // GTK+3
wxSizer* const sizerTop = new wxBoxSizer(wxVERTICAL);
sizerTop->Add(ctrlItems, wxSizerFlags(1).Expand());
sizerTop->Add(m_tbar, wxSizerFlags().Expand());
parent->SetSizer(sizerTop);
m_tbar->Bind(wxEVT_UPDATE_UI,
&wxAddRemoveImplBase::OnUpdateUIAdd, this, wxID_ADD);
m_tbar->Bind(wxEVT_UPDATE_UI,
&wxAddRemoveImplBase::OnUpdateUIRemove, this, wxID_REMOVE);
m_tbar->Bind(wxEVT_TOOL, &wxAddRemoveImplBase::OnAdd, this, wxID_ADD);
m_tbar->Bind(wxEVT_TOOL, &wxAddRemoveImplBase::OnRemove, this, wxID_REMOVE);
}
virtual void SetButtonsToolTips(const wxString& addtip,
const wxString& removetip) override
{
m_tbar->SetToolShortHelp(wxID_ADD, addtip);
m_tbar->SetToolShortHelp(wxID_REMOVE, removetip);
}
private:
static wxBitmapBundle GetNamedBitmap(const wxString& name)
{
// GTK UI guidelines recommend using "symbolic" versions of the icons
// for these buttons, so try them first but fall back to the normal
// ones if symbolic theme is not installed.
wxBitmap bmp = wxArtProvider::GetBitmap(name + wxASCII_STR("-symbolic"), wxART_MENU);
if ( !bmp.IsOk() )
bmp = wxArtProvider::GetBitmap(name, wxART_MENU);
return bmp;
}
wxToolBar* const m_tbar;
};
#endif // _WX_GTK_PRIVATE_ADDREMOVECTRL_H_

View File

@@ -0,0 +1,69 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/animate.h
// Purpose: Animation classes
// Author: Julian Smart and Guillermo Rodriguez Garcia
// Modified by: Francesco Montorsi
// Created: 13/8/99
// Copyright: (c) Julian Smart and Guillermo Rodriguez Garcia
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_ANIMATEH__
#define _WX_GTK_PRIVATE_ANIMATEH__
#include "wx/private/animate.h"
typedef struct _GdkPixbufAnimation GdkPixbufAnimation;
typedef struct _GdkPixbufAnimationIter GdkPixbufAnimationIter;
// ----------------------------------------------------------------------------
// wxAnimationGTKImpl
// Unlike the generic wxAnimation object we won't use directly
// wxAnimationDecoders as gdk-pixbuf already provides the concept of decoder and
// will automatically use the available handlers.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxAnimationGTKImpl : public wxAnimationImpl
{
public:
wxAnimationGTKImpl()
: m_pixbuf(nullptr) {}
~wxAnimationGTKImpl() { UnRef(); }
virtual bool IsOk() const override
{ return m_pixbuf != nullptr; }
virtual bool IsCompatibleWith(wxClassInfo* ci) const override;
// unfortunately GdkPixbufAnimation does not expose these info:
virtual unsigned int GetFrameCount() const override { return 0; }
virtual wxImage GetFrame(unsigned int frame) const override;
// we can retrieve the delay for a frame only after building
// a GdkPixbufAnimationIter...
virtual int GetDelay(unsigned int WXUNUSED(frame)) const override { return 0; }
virtual wxSize GetSize() const override;
virtual bool LoadFile(const wxString &name, wxAnimationType type = wxANIMATION_TYPE_ANY) override;
virtual bool Load(wxInputStream &stream, wxAnimationType type = wxANIMATION_TYPE_ANY) override;
// Implementation
public: // used by GTK callbacks
GdkPixbufAnimation *GetPixbuf() const
{ return m_pixbuf; }
void SetPixbuf(GdkPixbufAnimation* p);
protected:
GdkPixbufAnimation *m_pixbuf;
private:
void UnRef();
typedef wxAnimationImpl base_type;
wxDECLARE_NO_COPY_CLASS(wxAnimationGTKImpl);
};
#endif // _WX_GTK_PRIVATE_ANIMATEH__

View File

@@ -0,0 +1,30 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/appearance.h
// Purpose: Private wxGTK functions for working with appearance settings
// Copyright: (c) 2024 Vadim Zeitlin
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_APPEARANCE_H_
#define _WX_GTK_PRIVATE_APPEARANCE_H_
namespace wxGTKImpl
{
// This enum uses the same values as org.freedesktop.appearance.color-scheme
enum class ColorScheme
{
NoPreference = 0,
PreferDark = 1,
PreferLight = 2
};
// Update GTK color scheme if possible.
//
// Return false if the preference wasn't changed because it is overridden by
// the theme anyhow.
bool UpdateColorScheme(ColorScheme colorScheme);
} // namespace wxGTKImpl
#endif // _WX_GTK_PRIVATE_APPEARANCE_H_

View File

@@ -0,0 +1,14 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/backend.h
// Author: Paul Cornett
// Copyright: (c) 2022 Paul Cornett
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifdef __WXGTK3__
namespace wxGTKImpl
{
WXDLLIMPEXP_CORE bool IsWayland(void* instance);
WXDLLIMPEXP_CORE bool IsX11(void* instance);
}
#endif

View File

@@ -0,0 +1,55 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/cairo.h
// Purpose: Cairo-related helpers
// Author: Vadim Zeitlin
// Created: 2022-09-23
// Copyright: (c) 2022 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_CAIRO_H_
#define _WX_GTK_PRIVATE_CAIRO_H_
// ----------------------------------------------------------------------------
// Redefine GDK function to avoiding deprecation warnings
// ----------------------------------------------------------------------------
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
static inline
cairo_t* wx_gdk_cairo_create(GdkWindow* w) { return gdk_cairo_create(w); }
#define gdk_cairo_create wx_gdk_cairo_create
wxGCC_WARNING_RESTORE(deprecated-declarations)
// ----------------------------------------------------------------------------
// RAII helper creating a Cairo context in ctor and destroying it in dtor
// ----------------------------------------------------------------------------
namespace wxGTKImpl
{
class CairoContext
{
public:
explicit CairoContext(GdkWindow* window)
: m_cr(gdk_cairo_create(window))
{
}
~CairoContext()
{
cairo_destroy(m_cr);
}
operator cairo_t*() const { return m_cr; }
private:
cairo_t* const m_cr;
wxDECLARE_NO_COPY_CLASS(CairoContext);
};
} // namespace wxGTKImpl
#endif // _WX_GTK_PRIVATE_CAIRO_H_

View File

@@ -0,0 +1,64 @@
///////////////////////////////////////////////////////////////////////////////
// Name: gtk/private/error.h
// Purpose: Wrapper around GError.
// Author: Vadim Zeitlin
// Created: 2012-07-25
// Copyright: (c) 2012 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_ERROR_H_
#define _WX_GTK_PRIVATE_ERROR_H_
// ----------------------------------------------------------------------------
// wxGtkError wraps GError and releases it automatically.
// ----------------------------------------------------------------------------
// Create an object of this class and pass the result of its Out() method to a
// function taking "GError**", then use GetMessage() if the function returned
// false.
class wxGtkError
{
public:
wxGtkError() { m_error = nullptr; }
explicit wxGtkError(GError* error) { m_error = error; }
~wxGtkError() { if ( m_error ) g_error_free(m_error); }
GError** Out()
{
// This would result in a GError leak.
wxASSERT_MSG( !m_error, wxS("Can't reuse the same object.") );
return &m_error;
}
// Check if any error actually occurred.
operator bool() const
{
return m_error != nullptr;
}
operator GError*() const
{
return m_error;
}
const gchar* GetMessageStr() const
{
return m_error->message;
}
wxString GetMessage() const
{
wxCHECK( m_error, wxASCII_STR("missing error object") );
return wxString::FromUTF8(m_error->message);
}
private:
GError* m_error;
wxDECLARE_NO_COPY_CLASS(wxGtkError);
};
#endif // _WX_GTK_PRIVATE_ERROR_H_

View File

@@ -0,0 +1,129 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/event.h
// Purpose: Helper functions for working with GDK and wx events
// Author: Vaclav Slavik
// Created: 2011-10-14
// Copyright: (c) 2011 Vaclav Slavik
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _GTK_PRIVATE_EVENT_H_
#define _GTK_PRIVATE_EVENT_H_
#if !GTK_CHECK_VERSION(2,10,0)
// GTK+ can reliably detect Meta key state only since 2.10 when
// GDK_META_MASK was introduced -- there wasn't any way to detect it
// in older versions. wxGTK used GDK_MOD2_MASK for this purpose, but
// GDK_MOD2_MASK is documented as:
//
// the fifth modifier key (it depends on the modifier mapping of the X
// server which key is interpreted as this modifier)
//
// In other words, it isn't guaranteed to map to Meta. This is a real
// problem: it is common to map NumLock to it (in fact, it's an exception
// if the X server _doesn't_ use it for NumLock). So the old code caused
// wxKeyEvent::MetaDown() to always return true as long as NumLock was
// on many systems, which broke all applications using
// wxKeyEvent::GetModifiers() to check modifiers state (see e.g. here:
// http://tinyurl.com/56lsk2).
//
// Because of this, it's better to not detect Meta key state at all than
// to detect it incorrectly. Hence the following #define, which causes
// m_metaDown to be always set to false.
#define GDK_META_MASK 0
#endif
namespace wxGTKImpl
{
// init wxMouseEvent with the info from GdkEventXXX struct
template<typename T> void InitMouseEvent(wxWindowGTK *win,
wxMouseEvent& event,
T *gdk_event)
{
event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK) != 0;
event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK) != 0;
event.m_altDown = (gdk_event->state & GDK_MOD1_MASK) != 0;
event.m_metaDown = (gdk_event->state & GDK_META_MASK) != 0;
event.m_leftDown = (gdk_event->state & GDK_BUTTON1_MASK) != 0;
event.m_middleDown = (gdk_event->state & GDK_BUTTON2_MASK) != 0;
event.m_rightDown = (gdk_event->state & GDK_BUTTON3_MASK) != 0;
// In gdk/win32 VK_XBUTTON1 is translated to GDK_BUTTON4_MASK
// and VK_XBUTTON2 to GDK_BUTTON5_MASK. In x11/gdk buttons 4/5
// are wheel rotation and buttons 8/9 don't change the state.
event.m_aux1Down = (gdk_event->state & GDK_BUTTON4_MASK) != 0;
event.m_aux2Down = (gdk_event->state & GDK_BUTTON5_MASK) != 0;
wxPoint pt = win->GetClientAreaOrigin();
event.m_x = (wxCoord)gdk_event->x - pt.x;
event.m_y = (wxCoord)gdk_event->y - pt.y;
// Some no-window widgets, notably GtkEntry on GTK3, have a GdkWindow
// covering part of their area. Event coordinates from that window are
// not relative to the widget, so do the conversion here.
if (win->m_wxwindow == nullptr && !gtk_widget_get_has_window(win->m_widget) &&
gtk_widget_get_window(win->m_widget) == gdk_window_get_parent(gdk_event->window))
{
GtkAllocation a;
gtk_widget_get_allocation(win->m_widget, &a);
int posX, posY;
gdk_window_get_position(gdk_event->window, &posX, &posY);
event.m_x += posX - a.x;
event.m_y += posY - a.y;
}
if ((win->m_wxwindow) && (win->GetLayoutDirection() == wxLayout_RightToLeft))
{
// origin in the upper right corner
GtkAllocation a;
gtk_widget_get_allocation(win->m_wxwindow, &a);
int window_width = a.width;
event.m_x = window_width - event.m_x;
}
event.SetEventObject( win );
event.SetId( win->GetId() );
event.SetTimestamp( gdk_event->time );
}
// Update the window currently known to be under the mouse pointer.
//
// Returns true if it was updated, false if this window was already known to
// contain the mouse pointer.
bool SetWindowUnderMouse(wxWindowGTK* win);
// Implementation of enter/leave window callbacks.
gboolean
WindowEnterCallback(GtkWidget* widget,
GdkEventCrossing* event,
wxWindowGTK* win);
gboolean
WindowLeaveCallback(GtkWidget* widget,
GdkEventCrossing* event,
wxWindowGTK* win);
gboolean
WindowMotionCallback(GtkWidget* widget,
GdkEventMotion* event,
wxWindowGTK* win,
bool synthesized = false);
gboolean
WindowButtonPressCallback(GtkWidget* widget,
GdkEventButton* event,
wxWindowGTK* win,
bool synthesized = false);
gboolean
WindowButtonReleaseCallback(GtkWidget* widget,
GdkEventButton* event,
wxWindowGTK* win,
bool synthesized = false);
} // namespace wxGTKImpl
#endif // _GTK_PRIVATE_EVENT_H_

View File

@@ -0,0 +1,41 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/eventsdisabler.h
// Purpose: Helper for temporarily disabling events.
// Author: Vadim Zeitlin
// Created: 2016-02-06
// Copyright: (c) 2016 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _GTK_PRIVATE_EVENTSDISABLER_H_
#define _GTK_PRIVATE_EVENTSDISABLER_H_
// ----------------------------------------------------------------------------
// wxGtkEventsDisabler: calls GTKDisableEvents() and GTKEnableEvents() in dtor.
// ----------------------------------------------------------------------------
// Template parameter T must be a wxGTK class providing the required methods,
// e.g. wxCheckBox, wxChoice, ...
template <typename T>
class wxGtkEventsDisabler
{
public:
// Disable the events for the specified (non-null, having lifetime greater
// than ours) window for the lifetime of this object.
explicit wxGtkEventsDisabler(T* win) : m_win(win)
{
m_win->GTKDisableEvents();
}
~wxGtkEventsDisabler()
{
m_win->GTKEnableEvents();
}
private:
T* const m_win;
wxDECLARE_NO_COPY_TEMPLATE_CLASS(wxGtkEventsDisabler, T);
};
#endif // _GTK_PRIVATE_EVENTSDISABLER_H_

View File

@@ -0,0 +1,32 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/gdkconv.h
// Purpose: Helper functions for converting between GDK and wx types
// Author: Vadim Zeitlin
// Created: 2009-11-10
// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _GTK_PRIVATE_GDKCONV_H_
#define _GTK_PRIVATE_GDKCONV_H_
namespace wxGTKImpl
{
inline wxRect wxRectFromGDKRect(const GdkRectangle *r)
{
return wxRect(r->x, r->y, r->width, r->height);
}
inline void wxRectToGDKRect(const wxRect& rect, GdkRectangle& r)
{
r.x = rect.x;
r.y = rect.y;
r.width = rect.width;
r.height = rect.height;
}
} // namespace wxGTKImpl
#endif // _GTK_PRIVATE_GDKCONV_H_

View File

@@ -0,0 +1,57 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/glibptr.h
// Purpose: Simple RAII helper for calling g_free() automatically
// Author: Vadim Zeitlin
// Created: 2024-12-28
// Copyright: (c) 2024 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_OWNEDPTR_H_
#define _WX_GTK_PRIVATE_OWNEDPTR_H_
// ----------------------------------------------------------------------------
// Convenience class for calling g_free() automatically
// ----------------------------------------------------------------------------
template <typename T>
class wxGlibPtr
{
public:
wxGlibPtr() = default;
explicit wxGlibPtr(const T *p) : m_ptr(const_cast<T*>(p)) { }
wxGlibPtr(wxGlibPtr&& other) : m_ptr(other.m_ptr) { other.m_ptr = nullptr; }
~wxGlibPtr() { g_free(m_ptr); }
wxGlibPtr& operator=(wxGlibPtr&& other)
{
if ( &other != this )
{
g_free(m_ptr);
m_ptr = other.m_ptr;
other.m_ptr = nullptr;
}
return *this;
}
const T* get() const { return m_ptr; }
operator const T*() const { return m_ptr; }
T** Out()
{
wxASSERT_MSG( !m_ptr, wxS("Can't reuse the same object.") );
return &m_ptr;
}
private:
// We store the pointer as non-const because it avoids casts in the dtor
// and Out(), but it's actually always handled as a const one.
T* m_ptr = nullptr;
wxDECLARE_NO_COPY_CLASS(wxGlibPtr);
};
#endif // _WX_GTK_PRIVATE_OWNEDPTR_H_

View File

@@ -0,0 +1,705 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/compat.h
// Purpose: Compatibility code for older GTK+ versions
// Author: Vaclav Slavik
// Created: 2011-03-25
// Copyright: (c) 2011 Vaclav Slavik <vslavik@fastmail.fm>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_COMPAT_H_
#define _WX_GTK_PRIVATE_COMPAT_H_
// ----------------------------------------------------------------------------
// Implementations of new accessors for older GTK+ versions
// ----------------------------------------------------------------------------
// GTK+ deprecated direct access to struct members and some other stuff,
// replacing them with simple accessor functions. These aren't available in
// older versions, though, so we have to provide them for compatibility.
//
// Note: wx_ prefix is used to avoid symbol conflicts at runtime
//
// Note 2: We support building against newer GTK+ version and using an older
// one at runtime, so we must provide our implementations of these
// functions even if GTK_CHECK_VERSION would indicate the function is
// already available in GTK+.
#ifndef __WXGTK3__
// ----------------------------------------------------------------------------
// the following were introduced in GTK+ 2.8
static inline GtkWidget* wx_gtk_scrolled_window_get_hscrollbar(GtkScrolledWindow* scrolled_window)
{
return scrolled_window->hscrollbar;
}
#define gtk_scrolled_window_get_hscrollbar wx_gtk_scrolled_window_get_hscrollbar
static inline GtkWidget* wx_gtk_scrolled_window_get_vscrollbar(GtkScrolledWindow* scrolled_window)
{
return scrolled_window->vscrollbar;
}
#define gtk_scrolled_window_get_vscrollbar wx_gtk_scrolled_window_get_vscrollbar
// ----------------------------------------------------------------------------
// the following were introduced in GLib 2.10
static inline gpointer wx_g_object_ref_sink(gpointer object)
{
g_object_ref(object);
gtk_object_sink(GTK_OBJECT(object));
return object;
}
#undef g_object_ref_sink
#define g_object_ref_sink wx_g_object_ref_sink
// ----------------------------------------------------------------------------
// the following were introduced in GTK+ 2.12
static inline void wx_gtk_about_dialog_set_program_name(GtkAboutDialog* about, const gchar* name)
{
gtk_about_dialog_set_name(about, name);
}
#define gtk_about_dialog_set_program_name wx_gtk_about_dialog_set_program_name
// ----------------------------------------------------------------------------
// the following were introduced in GTK+ 2.14
static inline gdouble wx_gtk_adjustment_get_lower(GtkAdjustment* adjustment)
{
return adjustment->lower;
}
#define gtk_adjustment_get_lower wx_gtk_adjustment_get_lower
static inline gdouble wx_gtk_adjustment_get_page_increment(GtkAdjustment* adjustment)
{
return adjustment->page_increment;
}
#define gtk_adjustment_get_page_increment wx_gtk_adjustment_get_page_increment
static inline gdouble wx_gtk_adjustment_get_page_size(GtkAdjustment* adjustment)
{
return adjustment->page_size;
}
#define gtk_adjustment_get_page_size wx_gtk_adjustment_get_page_size
static inline gdouble wx_gtk_adjustment_get_step_increment(GtkAdjustment* adjustment)
{
return adjustment->step_increment;
}
#define gtk_adjustment_get_step_increment wx_gtk_adjustment_get_step_increment
static inline gdouble wx_gtk_adjustment_get_upper(GtkAdjustment* adjustment)
{
return adjustment->upper;
}
#define gtk_adjustment_get_upper wx_gtk_adjustment_get_upper
static inline void wx_gtk_adjustment_set_step_increment(GtkAdjustment* adjustment, gdouble step_increment)
{
adjustment->step_increment = step_increment;
gtk_adjustment_changed(adjustment);
}
#define gtk_adjustment_set_step_increment wx_gtk_adjustment_set_step_increment
static inline void wx_gtk_adjustment_set_page_increment(GtkAdjustment* adjustment, gdouble page_increment)
{
adjustment->page_increment = page_increment;
gtk_adjustment_changed(adjustment);
}
#define gtk_adjustment_set_page_increment wx_gtk_adjustment_set_page_increment
static inline void wx_gtk_adjustment_set_page_size(GtkAdjustment* adjustment, gdouble page_size)
{
adjustment->page_size = page_size;
}
#define gtk_adjustment_set_page_size wx_gtk_adjustment_set_page_size
static inline GtkWidget* wx_gtk_color_selection_dialog_get_color_selection(GtkColorSelectionDialog* csd)
{
return csd->colorsel;
}
#define gtk_color_selection_dialog_get_color_selection wx_gtk_color_selection_dialog_get_color_selection
static inline GtkWidget* wx_gtk_dialog_get_content_area(GtkDialog* dialog)
{
return dialog->vbox;
}
#define gtk_dialog_get_content_area wx_gtk_dialog_get_content_area
static inline GtkWidget* wx_gtk_dialog_get_action_area(GtkDialog* dialog)
{
return dialog->action_area;
}
#define gtk_dialog_get_action_area wx_gtk_dialog_get_action_area
static inline guint16 wx_gtk_entry_get_text_length(GtkEntry* entry)
{
return entry->text_length;
}
#define gtk_entry_get_text_length wx_gtk_entry_get_text_length
static inline const guchar* wx_gtk_selection_data_get_data(GtkSelectionData* selection_data)
{
return selection_data->data;
}
#define gtk_selection_data_get_data wx_gtk_selection_data_get_data
static inline GdkAtom wx_gtk_selection_data_get_data_type(GtkSelectionData* selection_data)
{
return selection_data->type;
}
#define gtk_selection_data_get_data_type wx_gtk_selection_data_get_data_type
static inline gint wx_gtk_selection_data_get_format(GtkSelectionData* selection_data)
{
return selection_data->format;
}
#define gtk_selection_data_get_format wx_gtk_selection_data_get_format
static inline gint wx_gtk_selection_data_get_length(GtkSelectionData* selection_data)
{
return selection_data->length;
}
#define gtk_selection_data_get_length wx_gtk_selection_data_get_length
static inline GdkAtom wx_gtk_selection_data_get_target(GtkSelectionData* selection_data)
{
return selection_data->target;
}
#define gtk_selection_data_get_target wx_gtk_selection_data_get_target
static inline GdkWindow* wx_gtk_widget_get_window(GtkWidget* widget)
{
return widget->window;
}
#define gtk_widget_get_window wx_gtk_widget_get_window
static inline GtkWidget* wx_gtk_window_get_default_widget(GtkWindow* window)
{
return window->default_widget;
}
#define gtk_window_get_default_widget wx_gtk_window_get_default_widget
// ----------------------------------------------------------------------------
// the following were introduced in GTK+ 2.16
static inline GdkAtom wx_gtk_selection_data_get_selection(GtkSelectionData* selection_data)
{
return selection_data->selection;
}
#define gtk_selection_data_get_selection wx_gtk_selection_data_get_selection
// ----------------------------------------------------------------------------
// the following were introduced in GTK+ 2.18
static inline void wx_gtk_cell_renderer_get_alignment(GtkCellRenderer* cell, gfloat* xalign, gfloat* yalign)
{
*xalign = cell->xalign;
*yalign = cell->yalign;
}
#define gtk_cell_renderer_get_alignment wx_gtk_cell_renderer_get_alignment
static inline void wx_gtk_cell_renderer_get_padding(GtkCellRenderer* cell, gint* xpad, gint* ypad)
{
*xpad = cell->xpad;
*ypad = cell->ypad;
}
#define gtk_cell_renderer_get_padding wx_gtk_cell_renderer_get_padding
static inline void wx_gtk_cell_renderer_set_padding(GtkCellRenderer* cell, gint xpad, gint ypad)
{
cell->xpad = xpad;
cell->ypad = ypad;
}
#define gtk_cell_renderer_set_padding wx_gtk_cell_renderer_set_padding
static inline void wx_gtk_widget_get_allocation(GtkWidget* widget, GtkAllocation* allocation)
{
*allocation = widget->allocation;
}
#define gtk_widget_get_allocation wx_gtk_widget_get_allocation
inline gboolean wx_gtk_widget_get_has_window(GtkWidget *widget)
{
return !GTK_WIDGET_NO_WINDOW(widget);
}
#define gtk_widget_get_has_window wx_gtk_widget_get_has_window
inline gboolean wx_gtk_widget_get_has_grab(GtkWidget *widget)
{
return GTK_WIDGET_HAS_GRAB(widget);
}
#define gtk_widget_get_has_grab wx_gtk_widget_get_has_grab
inline gboolean wx_gtk_widget_get_visible(GtkWidget *widget)
{
return GTK_WIDGET_VISIBLE(widget);
}
#define gtk_widget_get_visible wx_gtk_widget_get_visible
inline gboolean wx_gtk_widget_get_sensitive(GtkWidget *widget)
{
return GTK_WIDGET_SENSITIVE(widget);
}
#define gtk_widget_get_sensitive wx_gtk_widget_get_sensitive
inline gboolean wx_gtk_widget_is_drawable(GtkWidget *widget)
{
return GTK_WIDGET_DRAWABLE(widget);
}
#define gtk_widget_is_drawable wx_gtk_widget_is_drawable
inline gboolean wx_gtk_widget_get_can_focus(GtkWidget *widget)
{
return GTK_WIDGET_CAN_FOCUS(widget);
}
#define gtk_widget_get_can_focus wx_gtk_widget_get_can_focus
inline void wx_gtk_widget_set_can_focus(GtkWidget *widget, gboolean can)
{
if ( can )
GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_FOCUS);
else
GTK_WIDGET_UNSET_FLAGS(widget, GTK_CAN_FOCUS);
}
#define gtk_widget_set_can_focus wx_gtk_widget_set_can_focus
static inline gboolean wx_gtk_widget_has_focus(GtkWidget* widget)
{
return GTK_WIDGET_HAS_FOCUS(widget);
}
#define gtk_widget_has_focus wx_gtk_widget_has_focus
inline gboolean wx_gtk_widget_get_can_default(GtkWidget *widget)
{
return GTK_WIDGET_CAN_DEFAULT(widget);
}
#define gtk_widget_get_can_default wx_gtk_widget_get_can_default
inline void wx_gtk_widget_set_can_default(GtkWidget *widget, gboolean can)
{
if ( can )
GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_DEFAULT);
else
GTK_WIDGET_UNSET_FLAGS(widget, GTK_CAN_DEFAULT);
}
#define gtk_widget_set_can_default wx_gtk_widget_set_can_default
inline gboolean wx_gtk_widget_has_default(GtkWidget *widget)
{
return GTK_WIDGET_HAS_DEFAULT(widget);
}
#define gtk_widget_has_default wx_gtk_widget_has_default
inline GtkStateType wx_gtk_widget_get_state(GtkWidget *widget)
{
return (GtkStateType)GTK_WIDGET_STATE(widget);
}
#define gtk_widget_get_state wx_gtk_widget_get_state
inline gboolean wx_gtk_widget_get_double_buffered(GtkWidget *widget)
{
return GTK_WIDGET_DOUBLE_BUFFERED(widget);
}
#define gtk_widget_get_double_buffered wx_gtk_widget_get_double_buffered
static inline gboolean wx_gtk_widget_has_grab(GtkWidget* widget)
{
return GTK_WIDGET_HAS_GRAB(widget);
}
#define gtk_widget_has_grab wx_gtk_widget_has_grab
static inline void wx_gtk_widget_set_allocation(GtkWidget* widget, const GtkAllocation* allocation)
{
widget->allocation = *allocation;
}
#define gtk_widget_set_allocation wx_gtk_widget_set_allocation
static inline gboolean wx_gtk_widget_is_toplevel(GtkWidget* widget)
{
return GTK_WIDGET_TOPLEVEL(widget);
}
#define gtk_widget_is_toplevel wx_gtk_widget_is_toplevel
// ----------------------------------------------------------------------------
// the following were introduced in GTK+ 2.20
inline gboolean wx_gtk_widget_get_realized(GtkWidget *widget)
{
return GTK_WIDGET_REALIZED(widget);
}
#define gtk_widget_get_realized wx_gtk_widget_get_realized
inline gboolean wx_gtk_widget_get_mapped(GtkWidget *widget)
{
return GTK_WIDGET_MAPPED(widget);
}
#define gtk_widget_get_mapped wx_gtk_widget_get_mapped
static inline void wx_gtk_widget_get_requisition(GtkWidget* widget, GtkRequisition* requisition)
{
*requisition = widget->requisition;
}
#define gtk_widget_get_requisition wx_gtk_widget_get_requisition
static inline GdkWindow* wx_gtk_entry_get_text_window(GtkEntry* entry)
{
return entry->text_area;
}
#define gtk_entry_get_text_window wx_gtk_entry_get_text_window
// ----------------------------------------------------------------------------
// the following were introduced in GTK+ 2.22
static inline GdkWindow* wx_gtk_button_get_event_window(GtkButton* button)
{
return button->event_window;
}
#define gtk_button_get_event_window wx_gtk_button_get_event_window
static inline GdkDragAction wx_gdk_drag_context_get_actions(GdkDragContext* context)
{
return context->actions;
}
#define gdk_drag_context_get_actions wx_gdk_drag_context_get_actions
static inline GdkDragAction wx_gdk_drag_context_get_selected_action(GdkDragContext* context)
{
return context->action;
}
#define gdk_drag_context_get_selected_action wx_gdk_drag_context_get_selected_action
static inline GdkDragAction wx_gdk_drag_context_get_suggested_action(GdkDragContext* context)
{
return context->suggested_action;
}
#define gdk_drag_context_get_suggested_action wx_gdk_drag_context_get_suggested_action
static inline GList* wx_gdk_drag_context_list_targets(GdkDragContext* context)
{
return context->targets;
}
#define gdk_drag_context_list_targets wx_gdk_drag_context_list_targets
static inline gint wx_gdk_visual_get_depth(GdkVisual* visual)
{
return visual->depth;
}
#define gdk_visual_get_depth wx_gdk_visual_get_depth
static inline gboolean wx_gtk_window_has_group(GtkWindow* window)
{
return window->group != nullptr;
}
#define gtk_window_has_group wx_gtk_window_has_group
// ----------------------------------------------------------------------------
// the following were introduced in GTK+ 2.24
#define gdk_window_get_visual gdk_drawable_get_visual
static inline GdkDisplay* wx_gdk_window_get_display(GdkWindow* window)
{
return gdk_drawable_get_display(window);
}
#define gdk_window_get_display wx_gdk_window_get_display
static inline GdkScreen* wx_gdk_window_get_screen(GdkWindow* window)
{
return gdk_drawable_get_screen(window);
}
#define gdk_window_get_screen wx_gdk_window_get_screen
static inline gint wx_gdk_window_get_height(GdkWindow* window)
{
int h;
gdk_drawable_get_size(window, nullptr, &h);
return h;
}
#define gdk_window_get_height wx_gdk_window_get_height
static inline gint wx_gdk_window_get_width(GdkWindow* window)
{
int w;
gdk_drawable_get_size(window, &w, nullptr);
return w;
}
#define gdk_window_get_width wx_gdk_window_get_width
#if GTK_CHECK_VERSION(2,10,0)
static inline void wx_gdk_cairo_set_source_window(cairo_t* cr, GdkWindow* window, gdouble x, gdouble y)
{
gdk_cairo_set_source_pixmap(cr, window, x, y);
}
#define gdk_cairo_set_source_window wx_gdk_cairo_set_source_window
#endif
// ----------------------------------------------------------------------------
// the following were introduced in Glib 2.32
#ifndef g_signal_handlers_disconnect_by_data
#define g_signal_handlers_disconnect_by_data(instance, data) \
g_signal_handlers_disconnect_matched ((instance), G_SIGNAL_MATCH_DATA, 0, 0, nullptr, nullptr, (data))
#endif
// ----------------------------------------------------------------------------
// the following were introduced in GTK+ 3.0
static inline void wx_gdk_window_get_geometry(GdkWindow* window, gint* x, gint* y, gint* width, gint* height)
{
gdk_window_get_geometry(window, x, y, width, height, nullptr);
}
#define gdk_window_get_geometry wx_gdk_window_get_geometry
static inline GtkWidget* wx_gtk_tree_view_column_get_button(GtkTreeViewColumn* tree_column)
{
return tree_column->button;
}
#define gtk_tree_view_column_get_button wx_gtk_tree_view_column_get_button
static inline GtkWidget* wx_gtk_box_new(GtkOrientation orientation, gint spacing)
{
GtkWidget* widget;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
widget = gtk_hbox_new(false, spacing);
else
widget = gtk_vbox_new(false, spacing);
return widget;
}
#define gtk_box_new wx_gtk_box_new
static inline GtkWidget* wx_gtk_button_box_new(GtkOrientation orientation)
{
GtkWidget* widget;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
widget = gtk_hbutton_box_new();
else
widget = gtk_vbutton_box_new();
return widget;
}
#define gtk_button_box_new wx_gtk_button_box_new
static inline GtkWidget* wx_gtk_scale_new(GtkOrientation orientation, GtkAdjustment* adjustment)
{
GtkWidget* widget;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
widget = gtk_hscale_new(adjustment);
else
widget = gtk_vscale_new(adjustment);
return widget;
}
#define gtk_scale_new wx_gtk_scale_new
static inline GtkWidget* wx_gtk_scrollbar_new(GtkOrientation orientation, GtkAdjustment* adjustment)
{
GtkWidget* widget;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
widget = gtk_hscrollbar_new(adjustment);
else
widget = gtk_vscrollbar_new(adjustment);
return widget;
}
#define gtk_scrollbar_new wx_gtk_scrollbar_new
static inline GtkWidget* wx_gtk_separator_new(GtkOrientation orientation)
{
GtkWidget* widget;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
widget = gtk_hseparator_new();
else
widget = gtk_vseparator_new();
return widget;
}
#define gtk_separator_new wx_gtk_separator_new
static inline void wx_gtk_widget_get_preferred_height(GtkWidget* widget, gint* minimum, gint* natural)
{
GtkRequisition req;
gtk_widget_size_request(widget, &req);
if (minimum)
*minimum = req.height;
if (natural)
*natural = req.height;
}
#define gtk_widget_get_preferred_height wx_gtk_widget_get_preferred_height
static inline void wx_gtk_widget_get_preferred_width(GtkWidget* widget, gint* minimum, gint* natural)
{
GtkRequisition req;
gtk_widget_size_request(widget, &req);
if (minimum)
*minimum = req.width;
if (natural)
*natural = req.width;
}
#define gtk_widget_get_preferred_width wx_gtk_widget_get_preferred_width
static inline void wx_gtk_widget_get_preferred_size(GtkWidget* widget, GtkRequisition* minimum, GtkRequisition* natural)
{
GtkRequisition* req = minimum;
if (req == nullptr)
req = natural;
gtk_widget_size_request(widget, req);
}
#define gtk_widget_get_preferred_size wx_gtk_widget_get_preferred_size
#define wx_gdk_device_get_window_at_position(unused, win_x, win_y) \
gdk_window_at_pointer(win_x, win_y)
#include <gdk/gdkkeysyms.h>
#if defined(GDK_Alt_L) && !defined(GDK_KEY_Alt_L)
#define GDK_KEY_Alt_L GDK_Alt_L
#define GDK_KEY_Alt_R GDK_Alt_R
#define GDK_KEY_AudioLowerVolume GDK_AudioLowerVolume
#define GDK_KEY_AudioMute GDK_AudioMute
#define GDK_KEY_AudioNext GDK_AudioNext
#define GDK_KEY_AudioPlay GDK_AudioPlay
#define GDK_KEY_AudioPrev GDK_AudioPrev
#define GDK_KEY_AudioRaiseVolume GDK_AudioRaiseVolume
#define GDK_KEY_AudioStop GDK_AudioStop
#define GDK_KEY_Back GDK_Back
#define GDK_KEY_BackSpace GDK_BackSpace
#define GDK_KEY_Begin GDK_Begin
#define GDK_KEY_Caps_Lock GDK_Caps_Lock
#define GDK_KEY_Clear GDK_Clear
#define GDK_KEY_Control_L GDK_Control_L
#define GDK_KEY_Control_R GDK_Control_R
#define GDK_KEY_Delete GDK_Delete
#define GDK_KEY_Down GDK_Down
#define GDK_KEY_End GDK_End
#define GDK_KEY_Escape GDK_Escape
#define GDK_KEY_Execute GDK_Execute
#define GDK_KEY_F10 GDK_F10
#define GDK_KEY_F11 GDK_F11
#define GDK_KEY_F12 GDK_F12
#define GDK_KEY_F1 GDK_F1
#define GDK_KEY_F2 GDK_F2
#define GDK_KEY_F3 GDK_F3
#define GDK_KEY_F4 GDK_F4
#define GDK_KEY_F5 GDK_F5
#define GDK_KEY_F6 GDK_F6
#define GDK_KEY_F7 GDK_F7
#define GDK_KEY_F8 GDK_F8
#define GDK_KEY_F9 GDK_F9
#define GDK_KEY_Favorites GDK_Favorites
#define GDK_KEY_Forward GDK_Forward
#define GDK_KEY_Help GDK_Help
#define GDK_KEY_Home GDK_Home
#define GDK_KEY_HomePage GDK_HomePage
#define GDK_KEY_Insert GDK_Insert
#define GDK_KEY_ISO_Enter GDK_ISO_Enter
#define GDK_KEY_ISO_Left_Tab GDK_ISO_Left_Tab
#define GDK_KEY_KP_0 GDK_KP_0
#define GDK_KEY_KP_1 GDK_KP_1
#define GDK_KEY_KP_2 GDK_KP_2
#define GDK_KEY_KP_3 GDK_KP_3
#define GDK_KEY_KP_4 GDK_KP_4
#define GDK_KEY_KP_5 GDK_KP_5
#define GDK_KEY_KP_6 GDK_KP_6
#define GDK_KEY_KP_7 GDK_KP_7
#define GDK_KEY_KP_8 GDK_KP_8
#define GDK_KEY_KP_9 GDK_KP_9
#define GDK_KEY_KP_Add GDK_KP_Add
#define GDK_KEY_KP_Begin GDK_KP_Begin
#define GDK_KEY_KP_Decimal GDK_KP_Decimal
#define GDK_KEY_KP_Delete GDK_KP_Delete
#define GDK_KEY_KP_Divide GDK_KP_Divide
#define GDK_KEY_KP_Down GDK_KP_Down
#define GDK_KEY_KP_End GDK_KP_End
#define GDK_KEY_KP_Enter GDK_KP_Enter
#define GDK_KEY_KP_Equal GDK_KP_Equal
#define GDK_KEY_KP_F1 GDK_KP_F1
#define GDK_KEY_KP_F2 GDK_KP_F2
#define GDK_KEY_KP_F3 GDK_KP_F3
#define GDK_KEY_KP_F4 GDK_KP_F4
#define GDK_KEY_KP_Home GDK_KP_Home
#define GDK_KEY_KP_Insert GDK_KP_Insert
#define GDK_KEY_KP_Left GDK_KP_Left
#define GDK_KEY_KP_Multiply GDK_KP_Multiply
#define GDK_KEY_KP_Next GDK_KP_Next
#define GDK_KEY_KP_Prior GDK_KP_Prior
#define GDK_KEY_KP_Right GDK_KP_Right
#define GDK_KEY_KP_Separator GDK_KP_Separator
#define GDK_KEY_KP_Space GDK_KP_Space
#define GDK_KEY_KP_Subtract GDK_KP_Subtract
#define GDK_KEY_KP_Tab GDK_KP_Tab
#define GDK_KEY_KP_Up GDK_KP_Up
#define GDK_KEY_Launch0 GDK_Launch0
#define GDK_KEY_Launch1 GDK_Launch1
#define GDK_KEY_Launch2 GDK_Launch2
#define GDK_KEY_Launch3 GDK_Launch3
#define GDK_KEY_Launch4 GDK_Launch4
#define GDK_KEY_Launch5 GDK_Launch5
#define GDK_KEY_Launch6 GDK_Launch6
#define GDK_KEY_Launch7 GDK_Launch7
#define GDK_KEY_Launch8 GDK_Launch8
#define GDK_KEY_Launch9 GDK_Launch9
#define GDK_KEY_LaunchA GDK_LaunchA
#define GDK_KEY_LaunchB GDK_LaunchB
#define GDK_KEY_LaunchC GDK_LaunchC
#define GDK_KEY_LaunchD GDK_LaunchD
#define GDK_KEY_LaunchE GDK_LaunchE
#define GDK_KEY_LaunchF GDK_LaunchF
#define GDK_KEY_Left GDK_Left
#define GDK_KEY_Linefeed GDK_Linefeed
#define GDK_KEY_Mail GDK_Mail
#define GDK_KEY_Menu GDK_Menu
#define GDK_KEY_Meta_L GDK_Meta_L
#define GDK_KEY_Meta_R GDK_Meta_R
#define GDK_KEY_Next GDK_Next
#define GDK_KEY_Num_Lock GDK_Num_Lock
#define GDK_KEY_Page_Down GDK_Page_Down
#define GDK_KEY_Page_Up GDK_Page_Up
#define GDK_KEY_Pause GDK_Pause
#define GDK_KEY_Print GDK_Print
#define GDK_KEY_Prior GDK_Prior
#define GDK_KEY_Refresh GDK_Refresh
#define GDK_KEY_Return GDK_Return
#define GDK_KEY_Right GDK_Right
#define GDK_KEY_Scroll_Lock GDK_Scroll_Lock
#define GDK_KEY_Search GDK_Search
#define GDK_KEY_Select GDK_Select
#define GDK_KEY_Shift_L GDK_Shift_L
#define GDK_KEY_Shift_R GDK_Shift_R
#define GDK_KEY_Stop GDK_Stop
#define GDK_KEY_Super_L GDK_Super_L
#define GDK_KEY_Super_R GDK_Super_R
#define GDK_KEY_Tab GDK_Tab
#define GDK_KEY_Up GDK_Up
#endif
// Do perform runtime checks for GTK+ 2 version: we only take the minor version
// component here, major must be 2 and we never need to test for the micro one
// anyhow.
inline bool wx_is_at_least_gtk2(int minor)
{
return gtk_check_version(2, minor, 0) == nullptr;
}
#else // __WXGTK3__
#define wx_gdk_device_get_window_at_position(device, win_x, win_y) \
gdk_device_get_window_at_position(device, win_x, win_y)
// With GTK+ 3 we don't need to check for GTK+ 2 version and
// gtk_check_version() would fail due to major version mismatch.
inline bool wx_is_at_least_gtk2(int WXUNUSED(minor))
{
return true;
}
#endif // !__WXGTK3__/__WXGTK3__
#endif // _WX_GTK_PRIVATE_COMPAT_H_

View File

@@ -0,0 +1,79 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/gtk3-compat.h
// Purpose: Compatibility code for older GTK+ 3 versions
// Author: Paul Cornett
// Created: 2015-10-10
// Copyright: (c) 2015 Paul Cornett
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_COMPAT3_H_
#define _WX_GTK_PRIVATE_COMPAT3_H_
#ifdef __WXGTK4__
inline GdkDevice* wx_get_gdk_device_from_display(GdkDisplay* display)
{
GdkSeat* seat = gdk_display_get_default_seat(display);
return gdk_seat_get_pointer(seat);
}
#else // !__WXGTK4__
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
// ----------------------------------------------------------------------------
// the following were introduced in GTK+ 3.20
static inline gboolean wx_gtk_text_iter_starts_tag(const GtkTextIter* iter, GtkTextTag* tag)
{
return gtk_text_iter_begins_tag(iter, tag);
}
#define gtk_text_iter_starts_tag wx_gtk_text_iter_starts_tag
#ifdef __WXGTK3__
// ----------------------------------------------------------------------------
// the following were introduced in GTK+ 3.12
static inline void wx_gtk_widget_set_margin_start(GtkWidget* widget, gint margin)
{
gtk_widget_set_margin_left(widget, margin);
}
#define gtk_widget_set_margin_start wx_gtk_widget_set_margin_start
static inline void wx_gtk_widget_set_margin_end(GtkWidget* widget, gint margin)
{
gtk_widget_set_margin_right(widget, margin);
}
#define gtk_widget_set_margin_end wx_gtk_widget_set_margin_end
inline GdkDevice* wx_get_gdk_device_from_display(GdkDisplay* display)
{
GdkDeviceManager* manager = gdk_display_get_device_manager(display);
return gdk_device_manager_get_client_pointer(manager);
}
#endif // __WXGTK3__
wxGCC_WARNING_RESTORE()
#endif // __WXGTK4__/!__WXGTK4__
#if defined(__WXGTK4__) || !defined(__WXGTK3__)
static inline bool wx_is_at_least_gtk3(int /* minor */)
{
#ifdef __WXGTK4__
return true;
#else
return false;
#endif
}
#else
static inline bool wx_is_at_least_gtk3(int minor)
{
return gtk_check_version(3, minor, 0) == nullptr;
}
#endif
#endif // _WX_GTK_PRIVATE_COMPAT3_H_

View File

@@ -0,0 +1,48 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/image.h
// Author: Paul Cornett
// Copyright: (c) 2020 Paul Cornett
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// Class that can be used in place of GtkImage, to allow drawing of alternate
// bitmaps, such as HiDPI or disabled.
class wxGtkImage: GtkImage
{
public:
struct BitmapProvider
{
virtual ~BitmapProvider() = default;
virtual wxBitmap Get(int scale) const = 0;
virtual void Set(const wxBitmapBundle&) { }
// Simple helpers used in implementation.
static wxBitmap GetAtScale(const wxBitmapBundle& b, int scale)
{
return b.GetBitmap(b.GetDefaultSize() * scale);
}
};
static GType Type();
static GtkWidget* New(BitmapProvider* provider);
static GtkWidget* New(wxWindow* win = nullptr);
// Use bitmaps from the given bundle, the logical bitmap size is the
// default size of the bundle.
void Set(const wxBitmapBundle& bitmapBundle);
// This pointer is never null and is owned by this class.
BitmapProvider* m_provider;
wxDECLARE_NO_COPY_CLASS(wxGtkImage);
// This class is constructed by New() and destroyed by its GObject
// finalizer, so neither its ctor nor dtor can ever be used.
wxGtkImage() wxMEMBER_DELETE;
~wxGtkImage() wxMEMBER_DELETE;
};
#define WX_GTK_IMAGE(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, wxGtkImage::Type(), wxGtkImage)
#define WX_GTK_IS_IMAGE(obj) G_TYPE_CHECK_INSTANCE_TYPE(obj, wxGtkImage::Type())

View File

@@ -0,0 +1,32 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/list.h
// Purpose: wxGtkList class.
// Author: Vadim Zeitlin
// Created: 2011-08-21
// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_LIST_H_
#define _WX_GTK_PRIVATE_LIST_H_
// ----------------------------------------------------------------------------
// Convenience class for calling g_list_free() automatically
// ----------------------------------------------------------------------------
class wxGtkList
{
public:
explicit wxGtkList(GList* list) : m_list(list) { }
~wxGtkList() { g_list_free(m_list); }
operator GList *() const { return m_list; }
GList * operator->() const { return m_list; }
protected:
GList* const m_list;
wxDECLARE_NO_COPY_CLASS(wxGtkList);
};
#endif // _WX_GTK_PRIVATE_LIST_H_

View File

@@ -0,0 +1,156 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/log.h
// Purpose: Support for filtering GTK log messages.
// Author: Vadim Zeitlin
// Created: 2022-05-11
// Copyright: (c) 2022 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_LOG_H_
#define _WX_GTK_PRIVATE_LOG_H_
#include <glib.h>
// Support for custom log writers is only available in glib 2.50 or later.
#if GLIB_CHECK_VERSION(2, 50, 0)
#define wxHAS_GLIB_LOG_WRITER
#endif
namespace wxGTKImpl
{
#ifdef wxHAS_GLIB_LOG_WRITER
// LogFilter is the base class for filtering GTK log messages
//
// Note that all members of this class are defined in src/gtk/app.cpp.
class LogFilter
{
public:
LogFilter()
{
m_next = nullptr;
}
// Allow installing our own log writer function, we don't do it by default
// because this results in a fatal error if the application had already
// called g_log_set_writer_func() on its own.
static void Allow() { ms_allowed = true; }
// Function to call to install this filter as the active one if we're
// allowed to do this, i.e. if Allow() had been called before.
//
// Does nothing and just returns false if run-time glib version is too old.
bool Install();
protected:
// Function to override in the derived class to actually filter: return
// true if the message should be suppressed or false if it should be passed
// through to the default writer (which may, or not, show it).
virtual bool Filter(GLogLevelFlags log_level,
const GLogField* fields,
gsize n_fields) const = 0;
// Typically called from the derived class dtor to stop using this filter.
void Uninstall();
private:
// The function used as glib log writer.
static GLogWriterOutput
wx_log_writer(GLogLevelFlags log_level,
const GLogField *fields,
gsize n_fields,
gpointer user_data);
// False initially, indicating that we're not allowed to install our own
// logging function.
static bool ms_allowed;
// False initially, set to true when we install wx_log_writer() as the log
// writer. Once we do it, we never change it any more.
static bool ms_installed;
// We maintain a simple linked list of log filters and this is the head of
// this list.
static LogFilter* ms_first;
// Next entry in the linked list, may be null.
LogFilter* m_next;
wxDECLARE_NO_COPY_CLASS(LogFilter);
};
// LogFilterByLevel filters out all the messages at the specified level.
class LogFilterByLevel : public LogFilter
{
public:
LogFilterByLevel() = default;
void SetLevelToIgnore(int flags)
{
m_logLevelToIgnore = flags;
}
protected:
bool Filter(GLogLevelFlags log_level,
const GLogField* WXUNUSED(fields),
gsize WXUNUSED(n_fields)) const override
{
return log_level & m_logLevelToIgnore;
}
private:
int m_logLevelToIgnore;
wxDECLARE_NO_COPY_CLASS(LogFilterByLevel);
};
// LogFilterByMessage filters out all the messages with the specified content.
class LogFilterByMessage : public LogFilter
{
public:
// Objects of this class are supposed to be created with literal strings as
// argument, so don't bother copying the string but just use the pointer.
explicit LogFilterByMessage(const char* message)
: m_message(message)
{
// We shouldn't warn about anything if Install() failed.
m_warnNotFiltered = Install();
}
// Remove this filter when the object goes out of scope.
//
// The dtor also checks if we actually filtered the message and logs a
// trace message with the "gtklog" mask if we didn't: this allows checking
// if the filter is actually being used.
~LogFilterByMessage();
protected:
bool Filter(GLogLevelFlags WXUNUSED(log_level),
const GLogField* fields,
gsize n_fields) const override;
private:
const char* const m_message;
mutable bool m_warnNotFiltered;
wxDECLARE_NO_COPY_CLASS(LogFilterByMessage);
};
#else // !wxHAS_GLIB_LOG_WRITER
// Provide stubs to avoid having to use preprocessor checks in the code using
// these classes.
class LogFilterByMessage
{
public:
explicit LogFilterByMessage(const char* WXUNUSED(message)) { }
};
#endif // wxHAS_GLIB_LOG_WRITER/!wxHAS_GLIB_LOG_WRITER
} // namespace wxGTKImpl
#endif // _WX_GTK_PRIVATE_LOG_H_

View File

@@ -0,0 +1,51 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/mediactrl.h
// Purpose: Wrap runtime checks to manage GTK windows with Wayland and X11
// Author: Pierluigi Passaro
// Created: 2021-03-18
// Copyright: (c) 2021 Pierluigi Passaro <pierluigi.p@variscite.com>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_MEDIACTRL_H_
#define _WX_GTK_PRIVATE_MEDIACTRL_H_
#include "wx/gtk/private/wrapgdk.h"
#include "wx/gtk/private/backend.h"
//-----------------------------------------------------------------------------
// "wxGtkGetIdFromWidget" from widget
//
// Get the windows_id performing run-time checks If the window wasn't realized
// when Load was called, this is the callback for when it is - the purpose of
// which is to tell GStreamer to play the video in our control
//-----------------------------------------------------------------------------
extern "C" {
inline gpointer wxGtkGetIdFromWidget(GtkWidget* widget)
{
GdkDisplay* display = gtk_widget_get_display(widget);
gdk_display_flush(display);
GdkWindow* window = gtk_widget_get_window(widget);
wxASSERT(window);
#ifdef GDK_WINDOWING_X11
#ifdef __WXGTK3__
if (wxGTKImpl::IsX11(window))
#endif
{
return (gpointer)GDK_WINDOW_XID(window);
}
#endif
#ifdef GDK_WINDOWING_WAYLAND
if (wxGTKImpl::IsWayland(window))
{
return (gpointer)gdk_wayland_window_get_wl_surface(window);
}
#endif
return (gpointer)nullptr;
}
}
#endif // _WX_GTK_PRIVATE_MEDIACTRL_H_

View File

@@ -0,0 +1,46 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/messagetype.h
// Purpose: translate between wx and GtkMessageType
// Author: Vadim Zeitlin
// Created: 2009-09-27
// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _GTK_PRIVATE_MSGTYPE_H_
#define _GTK_PRIVATE_MSGTYPE_H_
#include <gtk/gtk.h>
#include "wx/gtk/private/gtk2-compat.h"
namespace wxGTKImpl
{
// Convert the given wx style to GtkMessageType, return true if succeeded or
// false if failed.
inline bool ConvertMessageTypeFromWX(int style, GtkMessageType *type)
{
#ifdef __WXGTK210__
if ( wx_is_at_least_gtk2(10) && (style & wxICON_NONE))
*type = GTK_MESSAGE_OTHER;
else
#endif // __WXGTK210__
if (style & wxICON_EXCLAMATION)
*type = GTK_MESSAGE_WARNING;
else if (style & wxICON_ERROR)
*type = GTK_MESSAGE_ERROR;
else if (style & wxICON_INFORMATION)
*type = GTK_MESSAGE_INFO;
else if (style & wxICON_QUESTION)
*type = GTK_MESSAGE_QUESTION;
else
return false;
return true;
}
} // namespace wxGTKImpl
#endif // _GTK_PRIVATE_MSGTYPE_H_

View File

@@ -0,0 +1,38 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/mnemonics.h
// Purpose: helper functions for dealing with GTK+ mnemonics
// Author: Vadim Zeitlin
// Created: 2007-11-12
// Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _GTK_PRIVATE_MNEMONICS_H_
#define _GTK_PRIVATE_MNEMONICS_H_
#if wxUSE_CONTROLS || wxUSE_MENUS
#include "wx/string.h"
// ----------------------------------------------------------------------------
// functions to convert between wxWidgets and GTK+ string containing mnemonics
// ----------------------------------------------------------------------------
// remove all mnemonics from a string
wxString wxGTKRemoveMnemonics(const wxString& label);
// convert a wx string with '&' to GTK+ string with '_'s
wxString wxConvertMnemonicsToGTK(const wxString& label);
// convert a wx string with '&' to indicate mnemonics as well as HTML entities
// to a GTK+ string with "&amp;" used instead of '&', i.e. suitable for use
// with GTK+ functions using markup strings
wxString wxConvertMnemonicsToGTKMarkup(const wxString& label);
// convert GTK+ string with '_'s to wx string with '&'s
wxString wxConvertMnemonicsFromGTK(const wxString& label);
#endif // wxUSE_CONTROLS || wxUSE_MENUS
#endif // _GTK_PRIVATE_MNEMONICS_H_

View File

@@ -0,0 +1,43 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/object.h
// Purpose: wxGtkObject class declaration
// Author: Vadim Zeitlin
// Created: 2008-08-27
// Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_OBJECT_H_
#define _WX_GTK_PRIVATE_OBJECT_H_
// ----------------------------------------------------------------------------
// Convenience class for calling g_object_unref() automatically
// ----------------------------------------------------------------------------
template <typename T>
class wxGtkObject
{
public:
wxGtkObject() = default;
explicit wxGtkObject(T *p) : m_ptr(p) { }
~wxGtkObject() { if ( m_ptr ) g_object_unref(m_ptr); }
operator T *() const { return m_ptr; }
T** Out()
{
wxASSERT_MSG( !m_ptr, wxS("Can't reuse the same object.") );
return &m_ptr;
}
private:
T* m_ptr = nullptr;
// copying could be implemented by using g_object_ref() but for now there
// is no need for it so don't implement it
wxDECLARE_NO_COPY_CLASS(wxGtkObject);
};
#endif // _WX_GTK_PRIVATE_OBJECT_H_

View File

@@ -0,0 +1,22 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/power.h
// Purpose: Private GTK-specific power management-related declarations.
// Author: Vadim Zeitlin
// Created: 2025-02-06
// Copyright: (c) 2025 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_POWER_H_
#define _WX_GTK_PRIVATE_POWER_H_
#include <glib.h>
// Power events are only supported under Unix with glib >= 2.26 as this is when
// GDBus support was added and GUnixFDList is only available in 2.30, so just
// test for it to keep things simple.
#if defined(__UNIX__) && GLIB_CHECK_VERSION(2, 30, 0)
#define wxHAS_GLIB_POWER_SUPPORT
#endif
#endif // _WX_GTK_PRIVATE_POWER_H_

View File

@@ -0,0 +1,113 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/string.h
// Purpose: wxGtkString class declaration
// Author: Vadim Zeitlin
// Created: 2006-10-19
// Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_STRING_H_
#define _WX_GTK_PRIVATE_STRING_H_
#include "wx/gtk/private/glibptr.h"
#include <utility>
#include <vector>
// ----------------------------------------------------------------------------
// Convenience class for g_freeing a gchar* on scope exit automatically
// ----------------------------------------------------------------------------
class wxGtkString : public wxGlibPtr<gchar>
{
public:
using Base = wxGlibPtr<gchar>;
explicit wxGtkString(const gchar *s) : Base(s) { }
wxGtkString(wxGtkString&& other) : Base(std::move(other)) { }
wxGtkString& operator=(wxGtkString&& other)
{
Base::operator=(std::move(other));
return *this;
}
// More string-like accessor.
const gchar *c_str() const { return get(); }
};
// ----------------------------------------------------------------------------
// list for sorting collated strings
// ----------------------------------------------------------------------------
#include "wx/string.h"
class wxGtkCollatableString
{
public:
wxGtkCollatableString( const wxString &label, const gchar *key )
: m_label(label), m_key(key)
{
}
wxString m_label;
wxGtkString m_key;
};
class wxGtkCollatedArrayString
{
public:
wxGtkCollatedArrayString() = default;
int Add( const wxString &new_label )
{
int index = 0;
wxGtkString new_key_lower(g_utf8_casefold( new_label.utf8_str(), -1));
gchar *new_key = g_utf8_collate_key( new_key_lower, -1);
wxGtkCollatableString new_str( new_label, new_key );
for (auto iter = m_list.begin(); iter != m_list.end(); ++iter)
{
const gchar* key = iter->m_key;
if (strcmp(key,new_key) >= 0)
{
m_list.insert( iter, std::move(new_str) );
return index;
}
index ++;
}
m_list.push_back( std::move(new_str) );
return index;
}
size_t GetCount()
{
return m_list.size();
}
wxString At( size_t index )
{
return m_list.at(index).m_label;
}
void Clear()
{
m_list.clear();
}
void RemoveAt( size_t index )
{
m_list.erase( m_list.begin() + index );
}
private:
std::vector<wxGtkCollatableString> m_list;
};
#endif // _WX_GTK_PRIVATE_STRING_H_

View File

@@ -0,0 +1,49 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/stylecontext.h
// Purpose: GtkStyleContext helper class
// Author: Paul Cornett
// Created: 2018-06-04
// Copyright: (c) 2018 Paul Cornett
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_STYLECONTEXT_H_
#define _WX_GTK_PRIVATE_STYLECONTEXT_H_
#ifdef __WXGTK3__
class wxGtkStyleContext
{
public:
explicit wxGtkStyleContext(double scale = 1);
~wxGtkStyleContext();
wxGtkStyleContext& Add(GType type, const char* objectName, ...) G_GNUC_NULL_TERMINATED;
wxGtkStyleContext& Add(const char* objectName);
wxGtkStyleContext& AddButton();
wxGtkStyleContext& AddCheckButton();
wxGtkStyleContext& AddHeaderbar();
wxGtkStyleContext& AddLabel();
wxGtkStyleContext& AddMenu();
wxGtkStyleContext& AddMenuItem();
wxGtkStyleContext& AddTextview(const char* child1 = nullptr, const char* child2 = nullptr);
wxGtkStyleContext& AddTooltip();
wxGtkStyleContext& AddTreeview();
#if GTK_CHECK_VERSION(3,20,0)
wxGtkStyleContext& AddTreeviewHeaderButton(int pos);
#endif // GTK >= 3.20
wxGtkStyleContext& AddWindow(const char* className2 = nullptr);
void Bg(wxColour& color, int state = GTK_STATE_FLAG_NORMAL) const;
void Fg(wxColour& color, int state = GTK_STATE_FLAG_NORMAL) const;
void Border(wxColour& color) const;
operator GtkStyleContext*() { return m_context; }
private:
GtkStyleContext* m_context;
GtkWidgetPath* const m_path;
const int m_scale;
wxDECLARE_NO_COPY_CLASS(wxGtkStyleContext);
};
#endif // __WXGTK3__
#endif // _WX_GTK_PRIVATE_STYLECONTEXT_H_

View File

@@ -0,0 +1,64 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/textmeasure.h
// Purpose: wxGTK-specific declaration of wxTextMeasure class
// Author: Manuel Martin
// Created: 2012-10-05
// Copyright: (c) 1997-2012 wxWidgets team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_TEXTMEASURE_H_
#define _WX_GTK_PRIVATE_TEXTMEASURE_H_
// ----------------------------------------------------------------------------
// wxTextMeasure
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxWindowDCImpl;
class wxTextMeasure : public wxTextMeasureBase
{
public:
explicit wxTextMeasure(const wxDC *dc, const wxFont *font = nullptr)
: wxTextMeasureBase(dc, font)
{
Init();
}
explicit wxTextMeasure(const wxWindow *win, const wxFont *font = nullptr)
: wxTextMeasureBase(win, font)
{
Init();
}
protected:
// Common part of both ctors.
void Init();
virtual void BeginMeasuring() override;
virtual void EndMeasuring() override;
virtual void DoGetTextExtent(const wxString& string,
wxCoord *width,
wxCoord *height,
wxCoord *descent = nullptr,
wxCoord *externalLeading = nullptr) override;
virtual bool DoGetPartialTextExtents(const wxString& text,
wxArrayInt& widths,
double scaleX) override;
// This class is only used for DC text measuring with GTK+ 2 as GTK+ 3 uses
// Cairo and not Pango for this. However it's still used even with GTK+ 3
// for window text measuring, so the context and the layout are still
// needed.
#ifndef __WXGTK3__
wxWindowDCImpl *m_wdc;
#endif // GTK+ < 3
PangoContext *m_context;
PangoLayout *m_layout;
wxDECLARE_NO_COPY_CLASS(wxTextMeasure);
};
#endif // _WX_GTK_PRIVATE_TEXTMEASURE_H_

View File

@@ -0,0 +1,40 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/threads.h
// Purpose: Wrappers for GDK threads support.
// Author: Vadim Zeitlin
// Created: 2022-09-23
// Copyright: (c) 2022 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_THREADS_H_
#define _WX_GTK_PRIVATE_THREADS_H_
// ----------------------------------------------------------------------------
// Redefine GDK functions to avoiding deprecation warnings
// ----------------------------------------------------------------------------
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
static inline void wx_gdk_threads_enter() { gdk_threads_enter(); }
#define gdk_threads_enter wx_gdk_threads_enter
static inline void wx_gdk_threads_leave() { gdk_threads_leave(); }
#define gdk_threads_leave wx_gdk_threads_leave
wxGCC_WARNING_RESTORE(deprecated-declarations)
// ----------------------------------------------------------------------------
// RAII wrapper for acquiring/leaving GDK lock in ctor/dtor
// ----------------------------------------------------------------------------
class wxGDKThreadsLock
{
public:
wxGDKThreadsLock() { gdk_threads_enter(); }
~wxGDKThreadsLock() { gdk_threads_leave(); }
wxDECLARE_NO_COPY_CLASS(wxGDKThreadsLock);
};
#endif // _WX_GTK_PRIVATE_THREADS_H_

View File

@@ -0,0 +1,35 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/timer.h
// Purpose: wxTimerImpl for wxGTK
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_TIMER_H_
#define _WX_GTK_PRIVATE_TIMER_H_
#if wxUSE_TIMER
#include "wx/private/timer.h"
//-----------------------------------------------------------------------------
// wxTimer
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxGTKTimerImpl : public wxTimerImpl
{
public:
wxGTKTimerImpl(wxTimer* timer) : wxTimerImpl(timer) { m_sourceId = 0; }
virtual bool Start( int millisecs = -1, bool oneShot = false ) override;
virtual void Stop() override;
virtual bool IsRunning() const override { return m_sourceId != 0; }
protected:
int m_sourceId;
};
#endif // wxUSE_TIMER
#endif // _WX_GTK_PRIVATE_TIMER_H_

View File

@@ -0,0 +1,75 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/tlwgeom.h
// Purpose: wxGTK-specific wxTLWGeometry class.
// Author: Vadim Zeitlin
// Created: 2018-04-29
// Copyright: (c) 2018 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_TLWGEOM_H_
#define _WX_GTK_PRIVATE_TLWGEOM_H_
class wxTLWGeometry : public wxTLWGeometryGeneric
{
typedef wxTLWGeometryGeneric BaseType;
public:
virtual bool Save(const Serializer& ser) const override
{
if ( !wxTLWGeometryGeneric::Save(ser) )
return false;
// Don't save the decoration sizes if we don't really have any values
// for them.
if ( m_decorSize.left || m_decorSize.right ||
m_decorSize.top || m_decorSize.bottom )
{
ser.SaveField("decor_l", m_decorSize.left);
ser.SaveField("decor_r", m_decorSize.right);
ser.SaveField("decor_t", m_decorSize.top);
ser.SaveField("decor_b", m_decorSize.bottom);
}
return true;
}
virtual bool Restore(Serializer& ser) override
{
if ( !wxTLWGeometryGeneric::Restore(ser) )
return false;
ser.RestoreField("decor_l", &m_decorSize.left);
ser.RestoreField("decor_r", &m_decorSize.right);
ser.RestoreField("decor_t", &m_decorSize.top);
ser.RestoreField("decor_b", &m_decorSize.bottom);
return true;
}
virtual bool GetFrom(const wxTopLevelWindow* tlw) override
{
if ( !wxTLWGeometryGeneric::GetFrom(tlw) )
return false;
m_decorSize = tlw->m_decorSize;
return true;
}
virtual bool ApplyTo(wxTopLevelWindow* tlw) override
{
// Don't overwrite the current decoration size if we already have it.
if ( !tlw->m_decorSize.left && !tlw->m_decorSize.right &&
!tlw->m_decorSize.top && !tlw->m_decorSize.bottom )
{
tlw->m_decorSize = m_decorSize;
}
return BaseType::ApplyTo(tlw);
}
private:
wxTopLevelWindow::DecorSize m_decorSize;
};
#endif // _WX_GTK_PRIVATE_TLWGEOM_H_

View File

@@ -0,0 +1,58 @@
/* ///////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/treeentry_gtk.h
// Purpose: GtkTreeEntry - a string/userdata combo for use with treeview
// Author: Ryan Norton
// Copyright: (c) 2006 Ryan Norton
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////// */
#ifndef _WX_GTK_TREE_ENTRY_H_
#define _WX_GTK_TREE_ENTRY_H_
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <gtk/gtk.h> /* for gpointer and gchar* etc. */
#define WX_TYPE_TREE_ENTRY wx_tree_entry_get_type()
#define WX_TREE_ENTRY(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, wx_tree_entry_get_type(), wxTreeEntry)
#define WX_IS_TREE_ENTRY(obj) G_TYPE_CHECK_INSTANCE_TYPE(obj, wx_tree_entry_get_type())
typedef struct _wxTreeEntry wxTreeEntry;
typedef void (*wxTreeEntryDestroy)(wxTreeEntry* entry, void* context);
struct _wxTreeEntry
{
GObject parent; /* object instance */
gchar* label; /* label - always copied by this object except on get */
gchar* collate_key; /* collate key used for string comparisons/sorting */
gpointer userdata; /* untouched userdata */
wxTreeEntryDestroy destroy_func; /* called upon destruction - use for freeing userdata etc. */
gpointer destroy_func_data; /* context passed to destroy_func */
};
wxTreeEntry* wx_tree_entry_new(void);
GType wx_tree_entry_get_type(void);
char* wx_tree_entry_get_collate_key(wxTreeEntry* entry);
char* wx_tree_entry_get_label(wxTreeEntry* entry);
void* wx_tree_entry_get_userdata(wxTreeEntry* entry);
void wx_tree_entry_set_label(wxTreeEntry* entry, const char* label);
void wx_tree_entry_set_userdata(wxTreeEntry* entry, void* userdata);
void wx_tree_entry_set_destroy_func(wxTreeEntry* entry,
wxTreeEntryDestroy destroy_func,
gpointer destroy_func_data);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _WX_GTK_TREE_ENTRY_H_ */

View File

@@ -0,0 +1,62 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/treeview.h
// Purpose: Private helpers for wxGTK controls using GtkTreeView
// Author: Vadim Zeitlin
// Created: 2016-02-06 (extracted from src/gtk/dataview.cpp)
// Copyright: (c) 2016 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _GTK_PRIVATE_TREEVIEW_H_
#define _GTK_PRIVATE_TREEVIEW_H_
// ----------------------------------------------------------------------------
// wxGtkTreePath: RAII wrapper for GtkTreePath
// ----------------------------------------------------------------------------
// Usually this object is initialized with the associated GtkTreePath
// immediately when it's constructed but it can also be changed later either by
// using Assign() or by getting the pointer to the internally stored pointer
// value using ByRef(). The latter should be avoided but is very convenient
// when using GTK functions with GtkTreePath output parameters.
class wxGtkTreePath
{
public:
// Ctor takes ownership of the given path and will free it if non-null.
wxGtkTreePath(GtkTreePath *path = nullptr) : m_path(path) { }
// Creates a tree path for the given string path.
wxGtkTreePath(const gchar *strpath)
: m_path(gtk_tree_path_new_from_string(strpath))
{
}
// Set the stored pointer if not done by ctor.
void Assign(GtkTreePath *path)
{
wxASSERT_MSG( !m_path, "shouldn't be already initialized" );
m_path = path;
}
// Return the pointer to the internally stored pointer. This should only be
// used to initialize the object by passing it to some GTK function.
GtkTreePath **ByRef()
{
wxASSERT_MSG( !m_path, "shouldn't be already initialized" );
return &m_path;
}
operator GtkTreePath *() const { return m_path; }
~wxGtkTreePath() { if ( m_path ) gtk_tree_path_free(m_path); }
private:
GtkTreePath *m_path;
wxDECLARE_NO_COPY_CLASS(wxGtkTreePath);
};
#endif // _GTK_PRIVATE_TREEVIEW_H_

View File

@@ -0,0 +1,48 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/value.h
// Purpose: Helper wrapper for working with GValue.
// Author: Vadim Zeitlin
// Created: 2015-03-05
// Copyright: (c) 2015 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_VALUE_H_
#define _WX_GTK_PRIVATE_VALUE_H_
// ----------------------------------------------------------------------------
// wxGtkValue: RAII wrapper for GValue
// ----------------------------------------------------------------------------
class wxGtkValue
{
public:
explicit wxGtkValue()
{
memset(&m_val, 0, sizeof(m_val));
}
// Initialize the value of the specified type.
explicit wxGtkValue(GType gtype)
{
memset(&m_val, 0, sizeof(m_val));
g_value_init(&m_val, gtype);
}
~wxGtkValue()
{
g_value_unset(&m_val);
}
// Unsafe but convenient access to the real value for GTK+ functions.
operator GValue*() { return &m_val; }
private:
GValue m_val;
// For now we just don't support copying at all for simplicity, it could be
// implemented later if needed.
wxDECLARE_NO_COPY_CLASS(wxGtkValue);
};
#endif // _WX_GTK_PRIVATE_VALUE_H_

View File

@@ -0,0 +1,87 @@
///////////////////////////////////////////////////////////////////////////////
// Name: gtk/private/variant.h
// Purpose: RAII wrapper for working with GVariant
// Author: Vadim Zeitlin
// Created: 2024-04-11
// Copyright: (c) 2024 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_VARIANT_H_
#define _WX_GTK_PRIVATE_VARIANT_H_
// ----------------------------------------------------------------------------
// wxGtkVariant: RAII wrapper for GVariant
// ----------------------------------------------------------------------------
class wxGtkVariant
{
public:
wxGtkVariant() = default;
explicit wxGtkVariant(GVariant* variant) : m_variant(variant) { }
wxGtkVariant(wxGtkVariant&& other) noexcept
: m_variant(other.m_variant)
{
other.m_variant = nullptr;
}
wxGtkVariant& operator=(wxGtkVariant&& other) noexcept
{
if ( this != &other )
{
m_variant = other.m_variant;
other.m_variant = nullptr;
}
return *this;
}
~wxGtkVariant()
{
if ( m_variant )
g_variant_unref(m_variant);
}
// Check if we have a valid GVariant.
explicit operator bool() const { return m_variant != nullptr; }
// Return the pointer to the internally stored pointer. This should only be
// used to initialize the object by passing it to some GTK function.
GVariant **ByRef()
{
wxASSERT_MSG( !m_variant, "shouldn't be already initialized" );
return &m_variant;
}
// Wrappers for a few functions used in our code.
guint32 GetUint32() const { return g_variant_get_uint32(m_variant); }
wxGtkVariant GetVariant() const { return wxGtkVariant{g_variant_get_variant(m_variant)}; }
// Wrapper for generic g_variant_get(): this is still as type-unsafe as the
// original C function.
template <typename... Args>
void Get(const gchar* format_string, Args*... args) const
{
g_variant_get(m_variant, format_string, args...);
}
// Yield ownership of the GVariant to the caller.
GVariant* Release()
{
GVariant* const variant = m_variant;
m_variant = nullptr;
return variant;
}
private:
GVariant* m_variant = nullptr;
// For now we just don't support copying at all for simplicity, it could be
// implemented later if needed.
wxDECLARE_NO_COPY_CLASS(wxGtkVariant);
};
#endif // _WX_GTK_PRIVATE_VARIANT_H_

View File

@@ -0,0 +1,71 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/webkit.h
// Purpose: wxWebKitGtk RAII wrappers declaration
// Author: Jose Lorenzo
// Created: 2017-08-21
// Copyright: (c) 2017 Jose Lorenzo <josee.loren@gmail.com>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_WEBKIT_H_
#define _WX_GTK_PRIVATE_WEBKIT_H_
#include "wx/buffer.h"
#include <webkit2/webkit2.h>
#include <JavaScriptCore/JSStringRef.h>
// ----------------------------------------------------------------------------
// RAII wrapper of WebKitJavascriptResult taking care of freeing it
// ----------------------------------------------------------------------------
class wxWebKitJavascriptResult
{
public:
explicit wxWebKitJavascriptResult(WebKitJavascriptResult *r)
: m_jsresult(r)
{
}
~wxWebKitJavascriptResult()
{
if ( m_jsresult != nullptr )
webkit_javascript_result_unref(m_jsresult);
}
operator WebKitJavascriptResult *() const { return m_jsresult; }
private:
WebKitJavascriptResult *m_jsresult;
wxDECLARE_NO_COPY_CLASS(wxWebKitJavascriptResult);
};
// ----------------------------------------------------------------------------
// RAII wrapper of JSStringRef, also providing conversion to wxString
// ----------------------------------------------------------------------------
class wxJSStringRef
{
public:
explicit wxJSStringRef(JSStringRef r) : m_jssref(r) { }
~wxJSStringRef() { JSStringRelease(m_jssref); }
wxString ToWxString() const
{
const size_t length = JSStringGetMaximumUTF8CStringSize(m_jssref);
wxCharBuffer str(length);
JSStringGetUTF8CString(m_jssref, str.data(), length);
return wxString::FromUTF8(str);
}
private:
JSStringRef m_jssref;
wxDECLARE_NO_COPY_CLASS(wxJSStringRef);
};
#endif // _WX_GTK_PRIVATE_WEBKIT_H_

View File

@@ -0,0 +1,15 @@
/////////////////////////////////////////////////////////////////////////////
// Name: include/wx/gtk/private/webview_webkit2_extension.h
// Purpose: Common elements for webview webkit2 extension
// Author: Scott Talbert
// Copyright: (c) 2017 Scott Talbert
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_WEBVIEW_WEBKIT2_EXTENSION_H_
#define _WX_GTK_PRIVATE_WEBVIEW_WEBKIT2_EXTENSION_H_
#define WXGTK_WEB_EXTENSION_OBJECT_PATH "/org/wxwidgets/wxGTK/WebExtension"
#define WXGTK_WEB_EXTENSION_INTERFACE "org.wxwidgets.wxGTK.WebExtension"
#endif // _WX_GTK_PRIVATE_WEBVIEW_WEBKIT2_EXTENSION_H_

View File

@@ -0,0 +1,37 @@
/* ///////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/win_gtk.h
// Purpose: native GTK+ widget for wxWindow
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////// */
#ifndef _WX_GTK_PIZZA_H_
#define _WX_GTK_PIZZA_H_
#define WX_PIZZA(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, wxPizza::type(), wxPizza)
#define WX_IS_PIZZA(obj) G_TYPE_CHECK_INSTANCE_TYPE(obj, wxPizza::type())
struct WXDLLIMPEXP_CORE wxPizza
{
// borders styles which can be used with wxPizza
enum { BORDER_STYLES =
wxBORDER_SIMPLE | wxBORDER_RAISED | wxBORDER_SUNKEN | wxBORDER_THEME };
static GtkWidget* New(long windowStyle = 0);
static GType type();
void move(GtkWidget* widget, int x, int y, int width, int height);
void put(GtkWidget* widget, int x, int y, int width, int height);
void scroll(int dx, int dy);
void get_border(GtkBorder& border);
void size_allocate_child(
GtkWidget* child, int x, int y, int width, int height, int parent_width = -1);
GtkFixed m_fixed;
GList* m_children;
int m_scroll_x;
int m_scroll_y;
int m_windowStyle;
};
#endif // _WX_GTK_PIZZA_H_

View File

@@ -0,0 +1,33 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/wrapgdk.h
// Purpose: Include GDK header for the appropriate window system
// Author: Vadim Zeitlin
// Created: 2024-07-17
// Copyright: (c) 2024 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_WRAPGDK_H_
#define _WX_GTK_PRIVATE_WRAPGDK_H_
#include "wx/gtk/private/wrapgtk.h"
#ifdef GDK_WINDOWING_WAYLAND
// Wayland headers included from gdkwayland.h may result in -Wundef due to
// __STDC_VERSION__ used there being undefined, suppress this.
wxGCC_WARNING_SUPPRESS(undef)
#include <gdk/gdkwayland.h>
wxGCC_WARNING_RESTORE(undef)
#endif // GDK_WINDOWING_WAYLAND
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#endif
#ifdef GDK_WINDOWING_WIN32
#include <gdk/gdkwin32.h>
#endif
#endif // _WX_GTK_PRIVATE_WRAPGDK_H_

View File

@@ -0,0 +1,21 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/private/wrapgtk.h
// Purpose: Include gtk/gtk.h without warnings and with compatibility
// Author: Vadim Zeitlin
// Created: 2018-05-20
// Copyright: (c) 2018 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_PRIVATE_WRAPGTK_H_
#define _WX_GTK_PRIVATE_WRAPGTK_H_
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
wxGCC_WARNING_SUPPRESS(parentheses)
#include <gtk/gtk.h>
wxGCC_WARNING_RESTORE(parentheses)
wxGCC_WARNING_RESTORE(deprecated-declarations)
#include "wx/gtk/private/gtk2-compat.h"
#endif // _WX_GTK_PRIVATE_WRAPGTK_H_

Some files were not shown because too many files have changed in this diff Show More