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,102 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/app.h
// Purpose: wxApp class
// Author: Julian Smart
// Created: 17/09/98
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_X11_APP_H_
#define _WX_X11_APP_H_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/gdicmn.h"
#include "wx/event.h"
// ----------------------------------------------------------------------------
// forward declarations
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxFrame;
class WXDLLIMPEXP_FWD_CORE wxWindow;
class WXDLLIMPEXP_FWD_CORE wxApp;
class WXDLLIMPEXP_FWD_CORE wxKeyEvent;
class WXDLLIMPEXP_FWD_BASE wxLog;
class WXDLLIMPEXP_FWD_CORE wxXVisualInfo;
// ----------------------------------------------------------------------------
// the wxApp class for wxX11 - see wxAppBase for more details
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxApp : public wxAppBase
{
public:
wxApp();
virtual ~wxApp();
// override base class (pure) virtuals
// -----------------------------------
virtual void WakeUpIdle();
virtual bool OnInitGui();
// implementation from now on
// --------------------------
// Processes an X event.
virtual bool ProcessXEvent(WXEvent* event);
public:
// Implementation
virtual bool Initialize(int& argc, wxChar **argv);
virtual void CleanUp();
WXWindow GetTopLevelWidget() const { return m_topLevelWidget; }
WXColormap GetMainColormap(WXDisplay* display);
long GetMaxRequestSize() const { return m_maxRequestSize; }
// This handler is called when a property change event occurs
virtual bool HandlePropertyChange(WXEvent *event);
// Values that can be passed on the command line.
// Returns -1, -1 if none specified.
const wxSize& GetInitialSize() const { return m_initialSize; }
bool GetShowIconic() const { return m_showIconic; }
// Global context for Pango layout. Either use X11
// or use Xft rendering according to GDK_USE_XFT
// environment variable
PangoContext* GetPangoContext();
wxXVisualInfo* GetVisualInfo(WXDisplay* WXUNUSED(display))
{
// this should be implemented correctly for wxBitmap to work
// with multiple display
return m_visualInfo;
}
virtual void* GetXVisualInfo() { return nullptr; }
public:
static long sm_lastMessageTime;
bool m_showIconic;
wxSize m_initialSize;
#if !wxUSE_NANOX
wxXVisualInfo* m_visualInfo;
#endif
protected:
WXWindow m_topLevelWidget;
WXColormap m_mainColormap;
long m_maxRequestSize;
wxDECLARE_DYNAMIC_CLASS(wxApp);
};
#endif // _WX_X11_APP_H_

View File

@@ -0,0 +1,133 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/bitmap.h
// Purpose: wxBitmap class
// Author: Julian Smart, Robert Roebling
// Created: 17/09/98
// Copyright: (c) Julian Smart, Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_BITMAP_H_
#define _WX_BITMAP_H_
#include "wx/palette.h"
#include "wx/gdiobj.h"
//-----------------------------------------------------------------------------
// wxMask
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxMask: public wxObject
{
public:
wxMask();
wxMask(const wxMask& mask);
wxMask( const wxBitmap& bitmap, const wxColour& colour );
wxMask( const wxBitmap& bitmap, int paletteIndex );
wxMask( const wxBitmap& bitmap );
virtual ~wxMask();
bool Create( const wxBitmap& bitmap, const wxColour& colour );
bool Create( const wxBitmap& bitmap, int paletteIndex );
bool Create( const wxBitmap& bitmap );
// implementation
WXPixmap GetBitmap() const { return m_bitmap; }
void SetBitmap( WXPixmap bitmap ) { m_bitmap = bitmap; }
WXDisplay *GetDisplay() const { return m_display; }
void SetDisplay( WXDisplay *display ) { m_display = display; }
private:
WXPixmap m_bitmap;
WXDisplay *m_display;
wxSize m_size;
private:
wxDECLARE_DYNAMIC_CLASS(wxMask);
};
//-----------------------------------------------------------------------------
// wxBitmap
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase
{
public:
wxBitmap() = default;
wxBitmap( int width, int height, int depth = -1 ) { Create( width, height, depth ); }
wxBitmap( const wxSize& sz, int depth = -1 ) { 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 );
static void InitStandardHandlers();
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); }
bool Create(int width, int height, const wxDC& WXUNUSED(dc))
{ return Create(width,height); }
bool Create(const void* data, wxBitmapType type,
int width, int height, int depth = -1);
// create the wxBitmap using a _copy_ of the pixmap
bool Create(WXPixmap pixmap);
int GetHeight() const;
int GetWidth() const;
int GetDepth() const;
#if wxUSE_IMAGE
wxBitmap( const wxImage& image, int depth = -1, double WXUNUSED(scale) = 1.0 ) { (void)CreateFromImage(image, depth); }
wxBitmap( const wxImage& image, const wxDC& WXUNUSED(dc) ) { (void)CreateFromImage(image); }
wxImage ConvertToImage() const;
bool CreateFromImage(const wxImage& image, int depth = -1);
#endif // wxUSE_IMAGE
wxMask *GetMask() const;
void SetMask( wxMask *mask );
wxBitmap GetSubBitmap( const wxRect& rect ) const;
bool SaveFile( const wxString &name, wxBitmapType type, const wxPalette *palette = nullptr ) const;
bool LoadFile( const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE );
wxPalette *GetPalette() const;
wxPalette *GetColourMap() const
{ return GetPalette(); }
virtual void SetPalette(const wxPalette& palette);
// implementation
// --------------
#if WXWIN_COMPATIBILITY_3_0
wxDEPRECATED(void SetHeight( int height ));
wxDEPRECATED(void SetWidth( int width ));
wxDEPRECATED(void SetDepth( int depth ));
#endif
void SetPixmap( WXPixmap pixmap );
void SetBitmap( WXPixmap bitmap );
WXPixmap GetPixmap() const;
WXPixmap GetBitmap() const;
WXPixmap GetDrawable() const;
WXDisplay *GetDisplay() const;
// This is provided only for compatibility with the other ports, there is
// no alpha support in X11 bitmaps.
bool HasAlpha() const { return false; }
protected:
virtual wxGDIRefData *CreateGDIRefData() const;
wxNODISCARD virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
private:
wxDECLARE_DYNAMIC_CLASS(wxBitmap);
};
#endif // _WX_BITMAP_H_

View File

@@ -0,0 +1,61 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/brush.h
// Purpose: wxBrush class
// Author: Julian Smart, Robert Roebling
// Created: 17/09/98
// Copyright: (c) Julian Smart, Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_BRUSH_H_
#define _WX_BRUSH_H_
#include "wx/gdiobj.h"
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxBrush;
class WXDLLIMPEXP_FWD_CORE wxColour;
class WXDLLIMPEXP_FWD_CORE wxBitmap;
//-----------------------------------------------------------------------------
// 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;
wxColour GetColour() const;
wxBitmap *GetStipple() const;
void SetColour( const wxColour& col );
void SetColour( unsigned char r, unsigned char g, unsigned char b );
void SetStyle( wxBrushStyle style );
void SetStipple( const wxBitmap& stipple );
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;
wxNODISCARD virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
wxDECLARE_DYNAMIC_CLASS(wxBrush);
};
#endif // _WX_BRUSH_H_

View File

@@ -0,0 +1,30 @@
/*
* Name: wx/x11/chkconf.h
* Purpose: Compiler-specific configuration checking
* Author: Julian Smart
* Modified by:
* Created: 01/02/97
* Copyright: (c) Julian Smart
* Licence: wxWindows licence
*/
/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
#ifndef _WX_X11_CHKCONF_H_
#define _WX_X11_CHKCONF_H_
/* wxPalette is always needed */
#if !wxUSE_PALETTE
# error "wxX11 requires wxUSE_PALETTE=1"
#endif
#if wxUSE_SOCKETS && !wxUSE_SELECT_DISPATCHER
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxSocket requires wxSelectDispatcher in wxX11"
# else
# undef wxUSE_SELECT_DISPATCHER
# define wxUSE_SELECT_DISPATCHER 1
# endif
#endif
#endif /* _WX_X11_CHKCONF_H_ */

View File

@@ -0,0 +1,76 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/clipbrd.h
// Purpose: Clipboard functionality.
// Author: Robert Roebling
// Created: 17/09/98
// Copyright: (c) Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_X11_CLIPBRD_H_
#define _WX_X11_CLIPBRD_H_
#if wxUSE_CLIPBOARD
#include "wx/object.h"
#include "wx/list.h"
#include "wx/dataobj.h"
#include "wx/control.h"
#include "wx/module.h"
// ----------------------------------------------------------------------------
// wxClipboard
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxClipboard : public wxClipboardBase
{
public:
wxClipboard();
virtual ~wxClipboard();
// open the clipboard before SetData() and GetData()
virtual bool Open();
// close the clipboard after SetData() and GetData()
virtual void Close();
// query whether the clipboard is opened
virtual bool IsOpened() const;
// set the clipboard data. all other formats will be deleted.
virtual bool SetData( wxDataObject *data );
// add to the clipboard data.
virtual bool AddData( wxDataObject *data );
// ask if data in correct format is available
virtual bool IsSupported( const wxDataFormat& format );
// fill data with data on the clipboard (if available)
virtual bool GetData( wxDataObject& data );
// clears wxTheClipboard and the system's clipboard if possible
virtual void Clear();
// implementation from now on
bool m_open;
bool m_ownsClipboard;
bool m_ownsPrimarySelection;
wxDataObject *m_data;
WXWindow m_clipboardWidget; /* for getting and offering data */
WXWindow m_targetsWidget; /* for getting list of supported formats */
bool m_waiting; /* querying data or formats is asynchronous */
bool m_formatSupported;
Atom m_targetRequested;
wxDataObject *m_receivedData;
private:
wxDECLARE_DYNAMIC_CLASS(wxClipboard);
};
#endif // wxUSE_CLIPBOARD
#endif // _WX_X11_CLIPBRD_H_

View File

@@ -0,0 +1,67 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/colour.h
// Purpose: wxColour class
// Author: Julian Smart, Robert Roebling
// Created: 17/09/98
// Copyright: (c) Julian Smart, Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_COLOUR_H_
#define _WX_COLOUR_H_
#include "wx/defs.h"
#include "wx/object.h"
#include "wx/string.h"
#include "wx/gdiobj.h"
#include "wx/palette.h"
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxDC;
class WXDLLIMPEXP_FWD_CORE wxPaintDC;
class WXDLLIMPEXP_FWD_CORE wxBitmap;
class WXDLLIMPEXP_FWD_CORE wxWindow;
class WXDLLIMPEXP_FWD_CORE wxColour;
//-----------------------------------------------------------------------------
// wxColour
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxWARN_UNUSED wxColour : public wxColourBase
{
public:
// constructors
// ------------
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
bool operator==(const wxColour& col) const;
bool operator!=(const wxColour& col) const { return !(*this == col); }
unsigned char Red() const;
unsigned char Green() const;
unsigned char Blue() const;
// Implementation part
void CalcPixel( WXColormap cmap );
unsigned long GetPixel() const;
WXColor *GetColor() const;
protected:
virtual wxGDIRefData *CreateGDIRefData() const;
wxNODISCARD virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
virtual void
InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
virtual bool FromString(const wxString& str);
private:
wxDECLARE_DYNAMIC_CLASS(wxColour);
};
#endif // _WX_COLOUR_H_

View File

@@ -0,0 +1,54 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/cursor.h
// Purpose: wxCursor class
// Author: Julian Smart
// Created: 17/09/98
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_CURSOR_H_
#define _WX_CURSOR_H_
#include "wx/colour.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
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);
// implementation
WXCursor GetCursor() const;
protected:
void InitFromStock(wxStockCursor);
virtual wxGDIRefData *CreateGDIRefData() const;
wxNODISCARD virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
private:
wxDECLARE_DYNAMIC_CLASS(wxCursor);
};
#endif // _WX_CURSOR_H_

View File

@@ -0,0 +1,63 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/dataform.h
// Purpose: declaration of the wxDataFormat class
// Author: Robert Roebling
// Created: 19.10.99 (extracted from motif/dataobj.h)
// Copyright: (c) 1999 Robert Roebling
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_X11_DATAFORM_H
#define _WX_X11_DATAFORM_H
class WXDLLIMPEXP_CORE wxDataFormat
{
public:
// the clipboard formats under Xt are Atoms
typedef Atom NativeFormat;
wxDataFormat();
wxDataFormat( wxDataFormatId type );
wxDataFormat( const wxString &id );
wxDataFormat( NativeFormat format );
wxDataFormat& operator=(NativeFormat format)
{ SetId(format); return *this; }
// comparison (must have both versions)
bool operator==(NativeFormat format) const
{ return m_format == (NativeFormat)format; }
bool operator!=(NativeFormat format) const
{ return m_format != (NativeFormat)format; }
bool operator==(wxDataFormatId format) const
{ return m_type == (wxDataFormatId)format; }
bool operator!=(wxDataFormatId format) const
{ return m_type != (wxDataFormatId)format; }
// 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;
private:
wxDataFormatId m_type;
NativeFormat m_format;
void PrepareFormats();
void SetType( wxDataFormatId type );
};
#endif // _WX_X11_DATAFORM_H

View File

@@ -0,0 +1,29 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/dataobj.h
// Purpose: declaration of the wxDataObject class for X11
// Author: Julian Smart
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_X11_DATAOBJ_H_
#define _WX_X11_DATAOBJ_H_
// ----------------------------------------------------------------------------
// wxDataObject is the same as wxDataObjectBase under X11
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDataObject : public wxDataObjectBase
{
public:
wxDataObject();
#ifdef __DARWIN__
virtual ~wxDataObject() = default;
#endif
virtual bool IsSupportedFormat( const wxDataFormat& format, Direction dir = Get ) const;
};
#endif //_WX_X11_DATAOBJ_H_

View File

@@ -0,0 +1,92 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/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_X11_DATAOBJ2_H_
#define _WX_X11_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);
// implement base class pure virtuals
// ----------------------------------
virtual size_t GetDataSize() const { return m_pngSize; }
virtual bool GetDataHere(void *buf) const;
virtual bool SetData(size_t len, const void *buf);
// Must provide overloads to avoid hiding them (and warnings about it)
virtual size_t GetDataSize(const wxDataFormat&) const
{
return GetDataSize();
}
virtual bool GetDataHere(const wxDataFormat&, void *buf) const
{
return GetDataHere(buf);
}
virtual bool SetData(const wxDataFormat&, size_t len, const void *buf)
{
return SetData(len, buf);
}
protected:
void Init() { m_pngData = nullptr; m_pngSize = 0; }
void Clear() { free(m_pngData); }
void ClearAll() { Clear(); Init(); }
size_t m_pngSize;
void *m_pngData;
void DoConvertToPng();
};
// ----------------------------------------------------------------------------
// 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;
virtual bool GetDataHere(void *buf) const;
virtual bool SetData(size_t len, const void *buf);
// Must provide overloads to avoid hiding them (and warnings about it)
virtual size_t GetDataSize(const wxDataFormat&) const
{
return GetDataSize();
}
virtual bool GetDataHere(const wxDataFormat&, void *buf) const
{
return GetDataHere(buf);
}
virtual bool SetData(const wxDataFormat&, size_t len, const void *buf)
{
return SetData(len, buf);
}
};
#endif // _WX_X11_DATAOBJ2_H_

View File

@@ -0,0 +1,51 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/dc.h
// Purpose: wxDC class
// Author: Julian Smart
// Created: 17/09/98
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DC_H_
#define _WX_DC_H_
#include "wx/pen.h"
#include "wx/brush.h"
#include "wx/icon.h"
#include "wx/font.h"
#include "wx/gdicmn.h"
//-----------------------------------------------------------------------------
// wxDC
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxX11DCImpl : public wxDCImpl
{
public:
wxX11DCImpl( wxDC *owner );
virtual ~wxX11DCImpl() = default;
virtual wxSize GetPPI() const;
protected:
virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
wxCoord width, wxCoord height);
virtual void DoGetSizeMM(int* width, int* height) const;
// implementation
wxCoord XDEV2LOG(wxCoord x) const { return DeviceToLogicalX(x); }
wxCoord XDEV2LOGREL(wxCoord x) const { return DeviceToLogicalXRel(x); }
wxCoord YDEV2LOG(wxCoord y) const { return DeviceToLogicalY(y); }
wxCoord YDEV2LOGREL(wxCoord y) const { return DeviceToLogicalYRel(y); }
wxCoord XLOG2DEV(wxCoord x) const { return LogicalToDeviceX(x); }
wxCoord XLOG2DEVREL(wxCoord x) const { return LogicalToDeviceXRel(x); }
wxCoord YLOG2DEV(wxCoord y) const { return LogicalToDeviceY(y); }
wxCoord YLOG2DEVREL(wxCoord y) const { return LogicalToDeviceYRel(y); }
private:
wxDECLARE_CLASS(wxX11DCImpl);
};
#endif
// _WX_DC_H_

View File

@@ -0,0 +1,181 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/dcclient.h
// Purpose: wxClientDC, wxPaintDC and wxWindowDC classes
// Author: Julian Smart
// Created: 17/09/98
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DCCLIENT_H_
#define _WX_DCCLIENT_H_
#include "wx/dc.h"
#include "wx/dcclient.h"
#include "wx/x11/dc.h"
#include "wx/region.h"
// -----------------------------------------------------------------------------
// fwd declarations
// -----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxWindow;
//-----------------------------------------------------------------------------
// wxWindowDCImpl
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxWindowDCImpl : public wxX11DCImpl
{
public:
wxWindowDCImpl( wxDC *owner );
wxWindowDCImpl( wxDC *owner, wxWindow *win );
virtual ~wxWindowDCImpl();
virtual bool CanDrawBitmap() const { return true; }
virtual bool CanGetTextExtent() const { return true; }
protected:
virtual void DoGetSize(int *width, int *height) const;
virtual bool DoFloodFill( wxCoord x, wxCoord y, const wxColour& col,
wxFloodFillStyle style = wxFLOOD_SURFACE );
virtual bool DoGetPixel( wxCoord x, wxCoord y, wxColour *col ) const;
virtual void DoDrawPoint(wxCoord x, wxCoord y);
virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
virtual void DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y );
virtual void DoDrawBitmap( const wxBitmap &bitmap, wxCoord x, wxCoord y,
bool useMask = false );
virtual void DoDrawArc(wxCoord x1, wxCoord y1,
wxCoord x2, wxCoord y2,
wxCoord xc, wxCoord yc);
virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
double sa, double ea);
virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
wxCoord width, wxCoord height,
double radius);
virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
virtual void DoCrossHair(wxCoord x, wxCoord y);
virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
virtual void DoDrawRotatedText(const wxString &text, wxCoord x, wxCoord y, double angle);
virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc,
wxRasterOperationMode rop = wxCOPY, bool useMask = false,
wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
wxCoord width, wxCoord height);
virtual void DoSetDeviceClippingRegion(const wxRegion& region);
virtual void DoDrawLines(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset);
virtual void DoDrawPolygon(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
public:
virtual void Clear();
virtual void SetFont(const wxFont& font);
virtual void SetPen(const wxPen& pen);
virtual void SetBrush(const wxBrush& brush);
virtual void SetBackground(const wxBrush& brush);
virtual void SetBackgroundMode(int mode);
virtual void SetPalette(const wxPalette& palette);
virtual void SetLogicalFunction( wxRasterOperationMode function );
virtual void SetTextForeground(const wxColour& colour);
virtual void SetTextBackground(const wxColour& colour);
virtual wxCoord GetCharHeight() const;
virtual wxCoord GetCharWidth() const;
virtual int GetDepth() const;
virtual wxSize GetPPI() const;
virtual void DestroyClippingRegion();
WXWindow GetX11Window() const { return m_x11window; }
virtual void ComputeScaleAndOrigin();
#if wxUSE_CAIRO
virtual void* GetCairoContext() const override;
#endif
protected:
// implementation
// --------------
virtual void DoGetTextExtent(const wxString& string,
wxCoord *x, wxCoord *y,
wxCoord *descent = nullptr,
wxCoord *externalLeading = nullptr,
const wxFont *theFont = nullptr) const;
void Init();
WXDisplay *m_display;
WXWindow m_x11window;
WXGC m_penGC;
WXGC m_brushGC;
WXGC m_textGC;
WXGC m_bgGC;
WXColormap m_cmap;
bool m_isMemDC;
bool m_isScreenDC;
wxRegion m_currentClippingRegion;
wxRegion m_paintClippingRegion;
PangoContext *m_context;
PangoFontDescription *m_fontdesc;
void SetUpDC();
void Destroy();
private:
wxDECLARE_CLASS(wxWindowDCImpl);
};
//-----------------------------------------------------------------------------
// wxClientDC
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxClientDCImpl : public wxWindowDCImpl
{
public:
wxClientDCImpl( wxDC *owner ) : wxWindowDCImpl( owner ) { }
wxClientDCImpl( wxDC *owner, wxWindow *win );
static bool
CanBeUsedForDrawing(const wxWindow* WXUNUSED(window)) { return true; }
protected:
virtual void DoGetSize(int *width, int *height) const;
private:
wxDECLARE_CLASS(wxClientDCImpl);
};
//-----------------------------------------------------------------------------
// wxPaintDC
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxPaintDCImpl : public wxClientDCImpl
{
public:
wxPaintDCImpl( wxDC *owner ) : wxClientDCImpl( owner ) { }
wxPaintDCImpl( wxDC *owner, wxWindow *win );
private:
wxDECLARE_CLASS(wxPaintDCImpl);
};
#endif
// _WX_DCCLIENT_H_

View File

@@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/dcmemory.h
// Purpose: wxMemoryDC class
// Author: Julian Smart
// Created: 17/09/98
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DCMEMORY_H_
#define _WX_DCMEMORY_H_
#include "wx/dc.h"
#include "wx/dcmemory.h"
#include "wx/x11/dcclient.h"
class WXDLLIMPEXP_CORE wxMemoryDCImpl : public wxWindowDCImpl
{
public:
wxMemoryDCImpl( wxDC* owner );
wxMemoryDCImpl( wxDC* owner, wxBitmap& bitmap);
wxMemoryDCImpl( wxDC* owner, wxDC *dc );
virtual ~wxMemoryDCImpl();
virtual const wxBitmap& GetSelectedBitmap() const;
virtual wxBitmap& GetSelectedBitmap();
// implementation
wxBitmap m_selected;
protected:
virtual void DoGetSize( int *width, int *height ) const;
virtual void DoSelect(const wxBitmap& bitmap);
private:
void Init();
private:
wxDECLARE_CLASS(wxMemoryDCImpl);
};
#endif
// _WX_DCMEMORY_H_

View File

@@ -0,0 +1,27 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/dcprint.h
// Purpose: wxPrinterDC class
// Author: Julian Smart
// Created: 17/09/98
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DCPRINT_H_
#define _WX_DCPRINT_H_
#include "wx/dc.h"
class WXDLLIMPEXP_CORE wxPrinterDC: public wxDC
{
public:
wxDECLARE_CLASS(wxPrinterDC);
// Create a printer DC
wxPrinterDC(const wxString& driver, const wxString& device, const wxString& output, bool interactive = TRUE, wxPrintOrientation orientation = wxPORTRAIT);
virtual ~wxPrinterDC();
};
#endif
// _WX_DCPRINT_H_

View File

@@ -0,0 +1,35 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/dcscreen.h
// Purpose: wxScreenDC class
// Author: Julian Smart
// Created: 17/09/98
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DCSCREEN_H_
#define _WX_DCSCREEN_H_
#include "wx/dcclient.h"
#include "wx/x11/dcclient.h"
//-----------------------------------------------------------------------------
// wxScreenDC
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxScreenDCImpl : public wxPaintDCImpl
{
public:
wxScreenDCImpl( wxDC *owner);
virtual ~wxScreenDCImpl();
protected:
virtual void DoGetSize(int *width, int *height) const;
private:
wxDECLARE_CLASS(wxScreenDCImpl);
};
#endif
// _WX_DCSCREEN_H_

View File

@@ -0,0 +1,172 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/dnd.h
// Purpose: declaration of wxDropTarget, wxDropSource classes
// Author: Julian Smart
// Copyright: (c) 1998 Vadim Zeitlin, Robert Roebling, Julian Smart
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_DND_H_
#define _WX_DND_H_
#include "wx/defs.h"
#if wxUSE_DRAG_AND_DROP
#include "wx/object.h"
#include "wx/string.h"
#include "wx/dataobj.h"
#include "wx/cursor.h"
//-------------------------------------------------------------------------
// classes
//-------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxWindow;
class WXDLLIMPEXP_FWD_CORE wxDropTarget;
class WXDLLIMPEXP_FWD_CORE wxTextDropTarget;
class WXDLLIMPEXP_FWD_CORE wxFileDropTarget;
class WXDLLIMPEXP_FWD_CORE wxPrivateDropTarget;
class WXDLLIMPEXP_FWD_CORE wxDropSource;
//-------------------------------------------------------------------------
// wxDropTarget
//-------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxDropTarget: public wxObject
{
public:
wxDropTarget();
virtual ~wxDropTarget();
virtual void OnEnter() { }
virtual void OnLeave() { }
virtual bool OnDrop( long x, long y, const void *data, size_t size ) = 0;
// Override these to indicate what kind of data you support:
virtual size_t GetFormatCount() const = 0;
virtual wxDataFormat GetFormat(size_t n) const = 0;
// implementation
};
//-------------------------------------------------------------------------
// wxTextDropTarget
//-------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxTextDropTarget: public wxDropTarget
{
public:
wxTextDropTarget() = default;
virtual bool OnDrop( long x, long y, const void *data, size_t size );
virtual bool OnDropText( long x, long y, const char *psz );
protected:
virtual size_t GetFormatCount() const;
virtual wxDataFormat GetFormat(size_t n) const;
};
//-------------------------------------------------------------------------
// wxPrivateDropTarget
//-------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxPrivateDropTarget: public wxDropTarget
{
public:
wxPrivateDropTarget();
// you have to override OnDrop to get at the data
// the string ID identifies the format of clipboard or DnD data. a word
// processor would e.g. add a wxTextDataObject and a wxPrivateDataObject
// to the clipboard - the latter with the Id "WXWORD_FORMAT".
void SetId( const wxString& id )
{ m_id = id; }
wxString GetId()
{ return m_id; }
private:
virtual size_t GetFormatCount() const;
virtual wxDataFormat GetFormat(size_t n) const;
wxString m_id;
};
// ----------------------------------------------------------------------------
// A drop target which accepts files (dragged from File Manager or Explorer)
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxFileDropTarget: public wxDropTarget
{
public:
wxFileDropTarget() = default;
virtual bool OnDrop( long x, long y, const void *data, size_t size );
virtual bool OnDropFiles( long x, long y,
size_t nFiles, const char * const aszFiles[] );
protected:
virtual size_t GetFormatCount() const;
virtual wxDataFormat GetFormat(size_t n) const;
};
//-------------------------------------------------------------------------
// wxDropSource
//-------------------------------------------------------------------------
enum wxDragResult
{
wxDragError, // error prevented the d&d operation from completing
wxDragNone, // drag target didn't accept the data
wxDragCopy, // the data was successfully copied
wxDragMove, // the data was successfully moved
wxDragCancel // the operation was cancelled by user (not an error)
};
class WXDLLIMPEXP_CORE wxDropSource: public wxObject
{
public:
wxDropSource( wxWindow *win );
wxDropSource( wxDataObject &data, wxWindow *win );
virtual ~wxDropSource(void);
void SetData( wxDataObject &data );
wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly);
virtual bool GiveFeedback( wxDragResult WXUNUSED(effect), bool WXUNUSED(bScrolling) ) { return TRUE; }
// implementation
#if 0
void RegisterWindow(void);
void UnregisterWindow(void);
wxWindow *m_window;
wxDragResult m_retValue;
wxDataObject *m_data;
wxCursor m_defaultCursor;
wxCursor m_goaheadCursor;
#endif
};
#endif
// wxUSE_DRAG_AND_DROP
#endif
//_WX_DND_H_

View File

@@ -0,0 +1,138 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/font.h
// Purpose: wxFont class
// Author: Julian Smart
// Created: 17/09/98
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_FONT_H_
#define _WX_FONT_H_
class wxXFont;
// Font
class WXDLLIMPEXP_CORE wxFont : public wxFontBase
{
public:
// ctors and such
wxFont() = default;
wxFont(const wxFontInfo& info)
{
Create(info.GetPointSize(),
info.GetFamily(),
info.GetStyle(),
info.GetWeight(),
info.IsUnderlined(),
info.GetFaceName(),
info.GetEncoding());
if ( info.IsUsingSizeInPixels() )
SetPixelSize(info.GetPixelSize());
}
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);
wxFont(const wxNativeFontInfo& info);
wxFont(const wxString &nativeInfoString)
{
Create(nativeInfoString);
}
bool Create(const wxString& fontname,
wxFontEncoding fontenc = wxFONTENCODING_DEFAULT);
// DELETEME: no longer seems to be implemented.
// bool Create(const wxNativeFontInfo& fontinfo);
// implement base class pure virtuals
virtual double GetFractionalPointSize() const;
virtual wxFontStyle GetStyle() const;
virtual int GetNumericWeight() const;
virtual bool GetUnderlined() const;
virtual bool GetStrikethrough() const override;
virtual wxString GetFaceName() const;
virtual wxFontEncoding GetEncoding() const;
virtual const wxNativeFontInfo *GetNativeFontInfo() const;
virtual bool IsFixedWidth() const;
virtual void SetFractionalPointSize(double pointSize);
virtual void SetFamily(wxFontFamily family);
virtual void SetStyle(wxFontStyle style);
virtual void SetNumericWeight(int weight);
virtual bool SetFaceName(const wxString& faceName);
virtual void SetUnderlined(bool underlined);
virtual void SetStrikethrough(bool strikethrough) override;
virtual void SetEncoding(wxFontEncoding encoding);
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);
}
// Implementation
// 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 SetPangoAttrs(PangoLayout* layout) const;
protected:
virtual wxGDIRefData *CreateGDIRefData() const;
wxNODISCARD virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
virtual void DoSetNativeFontInfo( const wxNativeFontInfo& info );
virtual wxFontFamily DoGetFamily() const;
void Unshare();
private:
wxDECLARE_DYNAMIC_CLASS(wxFont);
};
#endif
// _WX_FONT_H_

View File

@@ -0,0 +1,69 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/glcanvas.h
// Purpose: wxGLCanvas, for using OpenGL with X11
// Uses the GLX extension.
// Author: Julian Smart and Wolfram Gloger
// Created: 1995, 1999
// Copyright: (c) Julian Smart, Wolfram Gloger
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GLCANVAS_H_
#define _WX_GLCANVAS_H_
#include "wx/unix/glx11.h"
class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasX11
{
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);
// implement wxGLCanvasX11 methods
// --------------------------------
virtual unsigned long GetXWindow() const;
protected:
virtual int GetColourIndex(const wxColour& col);
wxDECLARE_CLASS(wxGLCanvas);
};
#endif // _WX_GLCANVAS_H_

View File

@@ -0,0 +1,87 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/joystick.h
// Purpose: wxJoystick class
// Author: Julian Smart
// Created: 17/09/98
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_JOYSTICK_H_
#define _WX_JOYSTICK_H_
#include "wx/event.h"
class WXDLLIMPEXP_ADV wxJoystick: public wxObject
{
wxDECLARE_DYNAMIC_CLASS(wxJoystick);
public:
/*
* Public interface
*/
wxJoystick(int joystick = wxJOYSTICK1) { m_joystick = joystick; }
// Attributes
////////////////////////////////////////////////////////////////////////////
wxPoint GetPosition() const;
int GetZPosition() const;
int GetButtonState() const;
int GetPOVPosition() const;
int GetPOVCTSPosition() const;
int GetRudderPosition() const;
int GetUPosition() const;
int GetVPosition() const;
int GetMovementThreshold() const;
void SetMovementThreshold(int threshold) ;
// Capabilities
////////////////////////////////////////////////////////////////////////////
bool IsOk() const; // Checks that the joystick is functioning
static int GetNumberJoysticks() ;
int GetManufacturerId() const ;
int GetProductId() const ;
wxString GetProductName() const ;
int GetXMin() const;
int GetYMin() const;
int GetZMin() const;
int GetXMax() const;
int GetYMax() const;
int GetZMax() const;
int GetNumberButtons() const;
int GetNumberAxes() const;
int GetMaxButtons() const;
int GetMaxAxes() const;
int GetPollingMin() const;
int GetPollingMax() const;
int GetRudderMin() const;
int GetRudderMax() const;
int GetUMin() const;
int GetUMax() const;
int GetVMin() const;
int GetVMax() const;
bool HasRudder() const;
bool HasZ() const;
bool HasU() const;
bool HasV() const;
bool HasPOV() const;
bool HasPOV4Dir() const;
bool HasPOVCTS() const;
// Operations
////////////////////////////////////////////////////////////////////////////
// pollingFreq = 0 means that movement events are sent when above the threshold.
// If pollingFreq > 0, events are received every this many milliseconds.
bool SetCapture(wxWindow* win, int pollingFreq = 0);
bool ReleaseCapture();
protected:
int m_joystick;
};
#endif
// _WX_JOYSTICK_H_

View File

@@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/minifram.h
// Purpose: wxMiniFrame class. A small frame for e.g. floating toolbars.
// If there is no equivalent on your platform, just make it a
// normal frame.
// Author: Julian Smart
// Created: 17/09/98
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MINIFRAM_H_
#define _WX_MINIFRAM_H_
#include "wx/frame.h"
class WXDLLIMPEXP_CORE wxMiniFrame: public wxFrame {
wxDECLARE_DYNAMIC_CLASS(wxMiniFrame);
public:
inline wxMiniFrame() = default;
inline wxMiniFrame(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE|wxTINY_CAPTION,
const wxString& name = wxASCII_STR(wxFrameNameStr))
{
// Use wxFrame constructor in absence of more specific code.
Create(parent, id, title, pos, size, style, name);
}
virtual ~wxMiniFrame() = default;
protected:
};
#endif
// _WX_MINIFRAM_H_

View File

@@ -0,0 +1,6 @@
/*
* Xlib compatibility
*/
/* Nothing yet */

View File

@@ -0,0 +1,356 @@
/*
* Xlib compatibility
*/
#ifndef _DUMMY_XLIBH_
#define _DUMMY_XLIBH_
/* Move away the typedef in XtoNX.h */
#define XFontStruct XFontStruct1
#include <XtoNX.h>
#undef XFontStruct
#undef XCharStruct
/* Data types */
typedef GR_PALETTE* Colormap;
typedef GR_DRAW_ID Drawable ;
typedef int Status;
typedef unsigned long VisualID;
typedef int Bool;
typedef long XID;
typedef GR_SCANCODE KeySym;
typedef GR_EVENT_KEYSTROKE XKeyEvent;
typedef struct {
GR_FONT_INFO info;
GR_FONT_ID fid;
} XFontStruct;
typedef struct {
short lbearing; /* origin to left edge of raster */
short rbearing; /* origin to right edge of raster */
short width; /* advance to next char's origin */
short ascent; /* baseline to top edge of raster */
short descent; /* baseline to bottom edge of raster */
unsigned short attributes; /* per char flags (not predefined) */
} XCharStruct;
/* Configure window value mask bits */
#define CWX (1<<0)
#define CWY (1<<1)
#define CWWidth (1<<2)
#define CWHeight (1<<3)
#define CWBorderWidth (1<<4)
#define CWSibling (1<<5)
#define CWStackMode (1<<6)
/* Values */
typedef struct {
int x, y;
int width, height;
int border_width;
Window sibling;
int stack_mode;
} XWindowChanges;
/* typedef unsigned long Time; */
#define Success 0
#define GrabSuccess Success
#define GrabNotViewable (Success+1)
#define InputOutput 1
#define InputOnly 2
#define IsUnmapped 0
#define IsUnviewable 1
#define IsViewable 2
/* Is this right? */
#define PropertyChangeMask GR_EVENT_MASK_SELECTION_CHANGED
#define GraphicsExpose GR_EVENT_TYPE_EXPOSURE
#define GraphicsExposeMask GR_EVENT_MASK_EXPOSURE
#define ColormapChangeMask 0
#define FillSolid 0
#define LineSolid 0
#define LineOnOffDash 0
#define CapNotLast 0
#define CapRound 0
#define CapProjecting 0
#define CapButt 0
#define JoinRound 0
#define JoinBevel 0
#define JoinMiter 0
#define IncludeInferiors 0
#define ClipByChildren 0
#define DoRed 0
#define DoGreen 0
#define DoBlue 0
#define NoEventMask GR_EVENT_MASK_NONE
#define RevertToParent 0
#define CurrentTime 0
#define GrabModeAsync 0
#define GXcopy GR_MODE_COPY
#define GXclear GR_MODE_CLEAR
#ifndef GXxor
#define GXxor GR_MODE_OR
#endif
#define GXinvert GR_MODE_INVERT
#define GXorReverse GR_MODE_ORREVERSE
#define GXandReverse GR_MODE_ANDREVERSE
#define GXand GR_MODE_AND
#define GXor GR_MODE_OR
#define GXandInverted GR_MODE_ANDINVERTED
#define GXnoop GR_MODE_NOOP
#define GXnor GR_MODE_NOR
#define GXequiv GR_MODE_EQUIV
#define GXcopyInverted GR_MODE_COPYINVERTED
#define GXorInverted GR_MODE_ORINVERTED
#define GXnand GR_MODE_NAND
#define GXset GR_MODE_SET
#define XSynchronize(display,sync)
#define XDefaultRootWindow(d) GR_ROOT_WINDOW_ID
#define RootWindowOfScreen(s) GR_ROOT_WINDOW_ID
#define XFreePixmap(d, p) GrDestroyWindow(p)
#define XFreeCursor(d, c) GrDestroyCursor(c)
#define XFreeGC(d, gc) GrDestroyGC(gc)
#define XSetBackground(d, gc, c) GrSetGCBackground(gc, c)
#define DefaultVisual(d, s) (NULL)
#define DefaultColormap(d, s) DefaultColormapOfScreen(NULL)
#define DefaultScreenOfDisplay(d) 0
#define XSetFillStyle(d, gc, s) wxNoop()
#define XSetLineAttributes(d, gc, a, b, c, e) wxNoop()
#define XSetClipMask(d, gc, m) wxNoop()
#define XSetTSOrigin(d, gc, x, y) wxNoop()
#define XFillArc(d, w, gc, x, y, rx, ry, a1, a2) GrArcAngle(w, gc, x, y, rx, ry, a1, a2, GR_PIE)
#define XDrawArc(d, w, gc, x, y, rx, ry, a1, a2) GrArcAngle(w, gc, x, y, rx, ry, a1, a2, GR_ARC)
#define XDrawPoint(d, w, gc, x, y) GrPoint(w, gc, x, y)
#define XFillPolygon(d, w, gc, p, n, s, m) GrFillPoly(w, gc, n, p)
#define XDrawRectangle(d, w, gc, x, y, width, height) GrRect(w, gc, x, y, width, height)
#define XSetClipOrigin(d, gc, x, y) GrSetGCClipOrigin(gc, x, y)
#define XSetRegion(d, gc, r) GrSetGCRegion(gc, r)
#define XSetTile(d, gc, p) wxNoop()
#define XSetStipple(d, gc, p) wxNoop()
#define XSetSubwindowMode(d, gc, mode) wxNoop()
#define XFreeColormap(d, cmap) wxNoop()
#define XSetTransientForHint(d, w, p) wxNoop()
#define XUnionRegion(sr1,sr2,r) GrUnionRegion(r,sr1,sr2)
#define XIntersectRegion(sr1,sr2,r) GrIntersectRegion(r,sr1,sr2)
#define XEqualRegion(r1, r2) GrEqualRegion(r1, r2)
#define XEmptyRegion(r) GrEmptyRegion(r)
#define XOffsetRegion(r, x, y) GrOffsetRegion(r, x, y)
#define XClipBox(r, rect) GrGetRegionBox(r, rect)
#define XPointInRegion(r, x, y) GrPointInRegion(r, x, y)
#define XXorRegion(sr1, sr2, r) GrXorRegion(r, sr1, sr2)
/* TODO: Cannot find equivalent for this. */
#define XIconifyWindow(d, w, s) 0
#define XCreateWindowWithColor(d,p,x,y,w,h,bw,depth,cl,vis,backColor,foreColor) \
GrNewWindow(p,x,y,w,h,bw,backColor,foreColor)
#define XLookupString(event, buf, len, sym, status) (*sym = (event)->scancode)
#define XBell(a, b) GrBell()
#define DisplayWidthMM(d, s) 100
#define DisplayHeightMM(d, s) 100
/* These defines are wrongly defined in XtoNX.h, IMHO,
* since they reference a static global.
* Redefined as functions, below.
*/
#undef DisplayWidth
#undef DisplayHeight
#undef DefaultDepth
/*
* Data structure used by color operations
*/
typedef struct {
unsigned long pixel;
unsigned short red, green, blue;
char flags; /* do_red, do_green, do_blue */
char pad;
} XColor;
typedef struct {
int type;
Display *display; /* Display the event was read from */
XID resourceid; /* resource id */
unsigned long serial; /* serial number of failed request */
unsigned char error_code; /* error code of failed request */
unsigned char request_code; /* Major op-code of failed request */
unsigned char minor_code; /* Minor op-code of failed request */
} XErrorEvent;
/*
* Visual structure; contains information about colormapping possible.
*/
typedef struct {
void *ext_data; /* hook for extension to hang data */
VisualID visualid; /* visual id of this visual */
#if defined(__cplusplus) || defined(c_plusplus)
int c_class; /* C++ class of screen (monochrome, etc.) */
#else
int class; /* class of screen (monochrome, etc.) */
#endif
unsigned long red_mask, green_mask, blue_mask; /* mask values */
int bits_per_rgb; /* log base 2 of distinct color values */
int map_entries; /* color map entries */
} Visual;
/*
* Depth structure; contains information for each possible depth.
*/
typedef struct {
int depth; /* this depth (Z) of the depth */
int nvisuals; /* number of Visual types at this depth */
Visual *visuals; /* list of visuals possible at this depth */
} Depth;
/*
* Information about the screen. The contents of this structure are
* implementation dependent. A Screen should be treated as opaque
* by application code.
*/
struct _XDisplay; /* Forward declare before use for C++ */
typedef struct {
void *ext_data; /* hook for extension to hang data */
struct _XDisplay *display; /* back pointer to display structure */
Window root; /* Root window id. */
int width, height; /* width and height of screen */
int mwidth, mheight; /* width and height of in millimeters */
int ndepths; /* number of depths possible */
Depth *depths; /* list of allowable depths on the screen */
int root_depth; /* bits per pixel */
Visual *root_visual; /* root visual */
GC default_gc; /* GC for the root root visual */
Colormap cmap; /* default color map */
unsigned long white_pixel;
unsigned long black_pixel; /* White and Black pixel values */
int max_maps, min_maps; /* max and min color maps */
int backing_store; /* Never, WhenMapped, Always */
Bool save_unders;
long root_input_mask; /* initial root input mask */
} Screen;
typedef struct {
int x, y; /* location of window */
int width, height; /* width and height of window */
int border_width; /* border width of window */
int depth; /* depth of window */
Visual *visual; /* the associated visual structure */
Window root; /* root of screen containing window */
int _class; /* InputOutput, InputOnly*/
int bit_gravity; /* one of the bit gravity values */
int win_gravity; /* one of the window gravity values */
int backing_store; /* NotUseful, WhenMapped, Always */
unsigned long backing_planes;/* planes to be preserved if possible */
unsigned long backing_pixel;/* value to be used when restoring planes */
Bool save_under; /* boolean, should bits under be saved? */
Colormap colormap; /* color map to be associated with window */
Bool map_installed; /* boolean, is color map currently installed*/
int map_state; /* IsUnmapped, IsUnviewable, IsViewable */
long all_event_masks; /* set of events all people have interest in*/
long your_event_mask; /* my event mask */
long do_not_propagate_mask;/* set of events that should not propagate */
Bool override_redirect; /* boolean value for override-redirect */
Screen *screen; /* back pointer to correct screen */
} XWindowAttributes;
typedef int (*XErrorHandler) (/* WARNING, this type not in Xlib spec */
Display* /* display */,
XErrorEvent* /* error_event */
);
/* events*/
/* What should this be? */
#if 0
#ifndef ResizeRequest
#define ResizeRequest ??
#endif
#endif
#ifndef MotionNotify
#define MotionNotify GR_EVENT_TYPE_MOUSE_POSITION
#define PointerMotionMask GR_EVENT_MASK_MOUSE_POSITION
#endif
#define ButtonMotionMask GR_EVENT_MASK_MOUSE_POSITION
#define KeymapStateMask 0
#define StructureNotifyMask GR_EVENT_MASK_UPDATE
#ifdef ConfigureNotify
/* XtoNX.h gets it wrong */
#undef ConfigureNotify
#endif
#define ConfigureNotify GR_EVENT_TYPE_UPDATE
#ifndef FocusIn
#define FocusIn GR_EVENT_TYPE_FOCUS_IN
#define FocusOut GR_EVENT_TYPE_FOCUS_OUT
#define FocusChangeMask GR_EVENT_MASK_FOCUS_IN|GR_EVENT_MASK_FOCUS_OUT
#endif
/* Fuunctions */
#ifdef __cplusplus
extern "C" {
#endif
Display *XOpenDisplay(char *name);
Colormap DefaultColormapOfScreen(Screen* /* screen */) ;
int XSetGraphicsExposures( Display* /* display */, GC /* gc */, Bool /* graphics_exposures */) ;
int XWarpPointer( Display* /* display */, Window /* srcW */, Window /* destW */,
int /* srcX */, int /* srcY */,
unsigned int /* srcWidth */,
unsigned int /* srcHeight */,
int destX, int destY);
int XSetInputFocus(Display* /* display */, Window focus, int /* revert_to */, Time /* time */) ;
int XGetInputFocus(Display* /* display */, Window* /* focus_return */, int* /* revert_to_return */) ;
int XGrabPointer(Display* /* display */, Window /* grab_window */,
Bool /* owner_events */, unsigned int /* event_mask */,
int /* pointer_mode */, int /* keyboard_mode */,
Window /* confine_to */, Cursor /* cursor */, Time /* time */) ;
int XUngrabPointer(Display* /* display */, Time /* time */) ;
int XCopyArea(Display* /* display */, Drawable src, Drawable dest, GC gc,
int src_x, int src_y, unsigned int width, unsigned int height,
int dest_x, int dest_y) ;
int XCopyPlane(Display* /* display */, Drawable src, Drawable dest, GC gc,
int src_x, int src_y, unsigned int width, unsigned int height,
int dest_x, int dest_y, unsigned long /* plane */) ;
XErrorHandler XSetErrorHandler (XErrorHandler /* handler */);
Screen *XScreenOfDisplay(Display* /* display */,
int /* screen_number */);
int DisplayWidth(Display* /* display */, int /* screen */);
int DisplayHeight(Display* /* display */, int /* screen */);
int DefaultDepth(Display* /* display */, int /* screen */);
int XAllocColor(Display* /* display */, Colormap /* cmap */,
XColor* color);
int XParseColor(Display* display, Colormap cmap,
const char* cname, XColor* color);
int XDrawLine(Display* display, Window win, GC gc,
int x1, int y1, int x2, int y2);
int XTextExtents( XFontStruct* font, char* s, int len, int* direction,
int* ascent, int* descent2, XCharStruct* overall);
int XPending(Display *d);
XFontStruct* XLoadQueryFont(Display* display, const char* fontSpec);
int XFreeFont(Display* display, XFontStruct* fontStruct);
int XQueryColor(Display* display, Colormap cmap, XColor* color);
Status XGetWindowAttributes(Display* display, Window w,
XWindowAttributes* window_attributes);
int XConfigureWindow(Display* display, Window w, int mask, XWindowChanges* changes);
int XTranslateCoordinates(Display* display, Window srcWindow, Window destWindow, int srcX, int srcY, int* destX, int* destY, Window* childReturn);
void wxNoop();
#ifdef __cplusplus
}
#endif
#define XMaxRequestSize(display) 16384
#endif
/* _DUMMY_XLIBH_ */

View File

@@ -0,0 +1,5 @@
/*
* Xlib compatibility
*/
/* Nothing yet */

View File

@@ -0,0 +1,73 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/palette.h
// Purpose: wxPalette class
// Author: Julian Smart
// Created: 17/09/98
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PALETTE_H_
#define _WX_PALETTE_H_
#include "wx/list.h"
class WXDLLIMPEXP_FWD_CORE wxPalette;
// Palette for one display
class wxXPalette : public wxObject
{
wxDECLARE_DYNAMIC_CLASS(wxXPalette);
public:
wxXPalette();
WXDisplay* m_display;
int m_pix_array_n;
unsigned char* m_red;
unsigned char* m_green;
unsigned char* m_blue;
unsigned long* m_pix_array;
WXColormap m_cmap;
bool m_destroyable;
};
class WXDLLIMPEXP_CORE wxPaletteRefData: public wxGDIRefData
{
friend class WXDLLIMPEXP_FWD_CORE wxPalette;
public:
wxPaletteRefData();
virtual ~wxPaletteRefData();
protected:
wxList m_palettes;
};
#define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
class WXDLLIMPEXP_CORE wxPalette : public wxPaletteBase
{
wxDECLARE_DYNAMIC_CLASS(wxPalette);
public:
wxPalette();
wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
int GetPixel(unsigned char red, unsigned char green, unsigned char blue) const;
bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const;
// X-specific
WXColormap GetXColormap(WXDisplay* display = nullptr) const;
bool TransferBitmap(void *data, int depth, int size);
bool TransferBitmap8(unsigned char *data, unsigned long size, void *dest, unsigned int bpp);
unsigned long *GetXPixArray(WXDisplay* display, int *pix_array_n);
void PutXColormap(WXDisplay* display, WXColormap cmap, bool destroyable);
virtual int GetColoursCount() const override;
protected:
virtual wxGDIRefData *CreateGDIRefData() const;
wxNODISCARD virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
};
#endif // _WX_PALETTE_H_

View File

@@ -0,0 +1,76 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/pen.h
// Purpose: wxPen class
// Author: Julian Smart
// Created: 17/09/98
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PEN_H_
#define _WX_PEN_H_
#include "wx/gdicmn.h"
#include "wx/gdiobj.h"
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxPen;
class WXDLLIMPEXP_FWD_CORE wxColour;
class WXDLLIMPEXP_FWD_CORE wxBitmap;
typedef char wxX11Dash;
//-----------------------------------------------------------------------------
// wxPen
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxPen: public wxPenBase
{
public:
wxPen() = default;
wxPen( const wxColour &colour, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID );
wxPen( const wxBitmap &stipple, int width );
wxPen( const wxPenInfo& info );
bool operator == ( const wxPen& pen ) const;
bool operator != (const wxPen& pen) const { return !(*this == pen); }
void SetColour( const wxColour &colour );
void SetColour( unsigned char red, unsigned char green, unsigned char blue );
void SetCap( wxPenCap capStyle );
void SetJoin( wxPenJoin joinStyle );
void SetStyle( wxPenStyle style );
void SetWidth( int width );
void SetDashes( int number_of_dashes, const wxDash *dash );
void SetStipple( const wxBitmap& stipple );
wxColour GetColour() const;
wxPenCap GetCap() const;
wxPenJoin GetJoin() const;
wxPenStyle GetStyle() const;
int GetWidth() const;
int GetDashes(wxDash **ptr) const;
int GetDashCount() const;
wxDash* GetDash() const;
wxBitmap* GetStipple() const;
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;
wxNODISCARD virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
wxDECLARE_DYNAMIC_CLASS(wxPen);
};
#endif // _WX_PEN_H_

View File

@@ -0,0 +1,45 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/popupwin.h
// Purpose:
// Author: Robert Roebling
// Created:
// Copyright: (c) 2001 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __GTKPOPUPWINH__
#define __GTKPOPUPWINH__
#include "wx/defs.h"
#include "wx/panel.h"
#include "wx/icon.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 );
protected:
virtual void DoMoveWindow(int x, int y, int width, int height);
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO);
private:
wxDECLARE_EVENT_TABLE();
wxDECLARE_DYNAMIC_CLASS(wxPopupWindow);
};
#endif // __GTKPOPUPWINDOWH__

View File

@@ -0,0 +1,50 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/print.h
// Purpose: wxPrinter, wxPrintPreview classes
// Author: Julian Smart
// Created: 17/09/98
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PRINT_H_
#define _WX_PRINT_H_
#include "wx/prntbase.h"
/*
* Represents the printer: manages printing a wxPrintout object
*/
class WXDLLIMPEXP_CORE wxPrinter: public wxPrinterBase
{
wxDECLARE_DYNAMIC_CLASS(wxPrinter);
public:
wxPrinter(wxPrintData *data = nullptr);
virtual ~wxPrinter();
virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = TRUE);
virtual bool PrintDialog(wxWindow *parent);
virtual bool Setup(wxWindow *parent);
};
/*
* wxPrintPreview
* Programmer creates an object of this class to preview a wxPrintout.
*/
class WXDLLIMPEXP_CORE wxPrintPreview: public wxPrintPreviewBase
{
wxDECLARE_CLASS(wxPrintPreview);
public:
wxPrintPreview(wxPrintout *printout, wxPrintout *printoutForPrinting = nullptr, wxPrintData *data = nullptr);
virtual ~wxPrintPreview();
virtual bool Print(bool interactive);
virtual void DetermineScaling();
};
#endif
// _WX_PRINT_H_

View File

@@ -0,0 +1,69 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/private.h
// Purpose: Private declarations for X11 port
// Author: Julian Smart
// Created: 17/09/98
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PRIVATE_H_
#define _WX_PRIVATE_H_
#include "wx/defs.h"
#include "wx/utils.h"
#if defined( __cplusplus ) && defined( __VMS )
#pragma message disable nosimpint
#endif
#include "X11/Xlib.h"
#include "X11/Xatom.h"
#include "X11/Xutil.h"
#if defined( __cplusplus ) && defined( __VMS )
#pragma message enable nosimpint
#endif
// Include common declarations
#include "wx/x11/privx.h"
#include <pango/pango.h>
#include <unordered_map>
class WXDLLIMPEXP_FWD_CORE wxMouseEvent;
class WXDLLIMPEXP_FWD_CORE wxKeyEvent;
class WXDLLIMPEXP_FWD_CORE wxWindow;
// ----------------------------------------------------------------------------
// we maintain a hash table which contains the mapping from Widget to wxWindow
// corresponding to the window for this widget
// ----------------------------------------------------------------------------
using wxWindowHash = std::unordered_map<Window, wxWindow*>;
// these hashes are defined in app.cpp
extern wxWindowHash *wxWidgetHashTable;
extern wxWindowHash *wxClientWidgetHashTable;
extern void wxDeleteWindowFromTable(Window w);
extern wxWindow *wxGetWindowFromTable(Window w);
extern bool wxAddWindowToTable(Window w, wxWindow *win);
extern void wxDeleteClientWindowFromTable(Window w);
extern wxWindow *wxGetClientWindowFromTable(Window w);
extern bool wxAddClientWindowToTable(Window w, wxWindow *win);
// ----------------------------------------------------------------------------
// TranslateXXXEvent() functions - translate X event to wxWindow one
// ----------------------------------------------------------------------------
extern bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Window window, XEvent *xevent);
extern bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Window window, XEvent *xevent, bool isAscii = FALSE);
extern Window wxGetWindowParent(Window window);
// Set the window manager decorations according to the
// given wxWidgets style
bool wxSetWMDecorations(Window w, long style);
bool wxMWMIsRunning(Window w);
#endif
// _WX_PRIVATE_H_

View File

@@ -0,0 +1,24 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/private/wrapxkb.h
// Purpose: Private header wrapping X11/XKBlib.h inclusion.
// Author: Vadim Zeitlin
// Created: 2012-05-07
// Copyright: (c) 2012 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _X11_PRIVATE_WRAPXKB_H_
#define _X11_PRIVATE_WRAPXKB_H_
#ifdef HAVE_X11_XKBLIB_H
/* under HP-UX and Solaris 2.6, at least, XKBlib.h defines structures with
* field named "explicit" - which is, of course, an error for a C++
* compiler. To be on the safe side, just redefine it everywhere. */
#define explicit __wx_explicit
#include <X11/XKBlib.h>
#undef explicit
#endif // HAVE_X11_XKBLIB_H
#endif // _X11_PRIVATE_WRAPXKB_H_

View File

@@ -0,0 +1,168 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/privx.h
// Purpose: Private declarations for wxX11
// Author: Julian Smart
// Created: 17/09/98
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PRIVX_H_
#define _WX_PRIVX_H_
#include "wx/defs.h"
#include "wx/utils.h"
#include "wx/colour.h"
#if defined( __cplusplus ) && defined( __VMS )
#pragma message disable nosimpint
#endif
#include "X11/Xlib.h"
#include "X11/Xatom.h"
#include "X11/Xutil.h"
#if defined( __cplusplus ) && defined( __VMS )
#pragma message enable nosimpint
#endif
class WXDLLIMPEXP_FWD_CORE wxMouseEvent;
class WXDLLIMPEXP_FWD_CORE wxKeyEvent;
class WXDLLIMPEXP_FWD_CORE wxWindow;
class WXDLLIMPEXP_FWD_CORE wxRegion;
// ----------------------------------------------------------------------------
// key events related functions
// ----------------------------------------------------------------------------
WXPixel wxGetBestMatchingPixel(Display *display, XColor *desiredColor, Colormap cmap);
Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap );
extern XColor g_itemColors[];
extern int wxComputeColours (Display *display, const wxColour * back, const wxColour * fore);
// For convenience
inline Display* wxGlobalDisplay() { return (Display*) wxGetDisplay(); }
#define wxMAX_RGB 0xff
#define wxMAX_SV 1000
#define wxSIGN(x) ((x < 0) ? -x : x)
#define wxH_WEIGHT 4
#define wxS_WEIGHT 1
#define wxV_WEIGHT 2
typedef struct wx_hsv {
int h,s,v;
} wxHSV;
#define wxMax3(x,y,z) ((x > y) ? ((x > z) ? x : z) : ((y > z) ? y : z))
#define wxMin3(x,y,z) ((x < y) ? ((x < z) ? x : z) : ((y < z) ? y : z))
void wxHSVToXColor(wxHSV *hsv,XColor *xcolor);
void wxXColorToHSV(wxHSV *hsv,XColor *xcolor);
void wxAllocNearestColor(Display *display,Colormap colormap,XColor *xcolor);
void wxAllocColor(Display *display,Colormap colormap,XColor *xcolor);
// For debugging
wxString wxGetXEventName(XEvent& event);
#if wxUSE_NANOX
#define XEventGetWindow(event) event->general.wid
#define XEventGetType(event) event->general.type
#define XConfigureEventGetX(event) ((int) event->update.x)
#define XConfigureEventGetY(event) ((int) event->update.y)
#define XConfigureEventGetWidth(event) ((int) event->update.width)
#define XConfigureEventGetHeight(event) ((int) event->update.height)
#define XExposeEventGetX(event) event->exposure.x
#define XExposeEventGetY(event) event->exposure.y
#define XExposeEventGetWidth(event) event->exposure.width
#define XExposeEventGetHeight(event) event->exposure.height
#define XButtonEventGetTime(event) (wxGetLocalTime())
#define XButtonEventLChanged(event) (event->button.changebuttons & GR_BUTTON_L)
#define XButtonEventMChanged(event) (event->button.changebuttons & GR_BUTTON_M)
#define XButtonEventRChanged(event) (event->button.changebuttons & GR_BUTTON_R)
#define XButtonEventLIsDown(x) ((x)->button.buttons & GR_BUTTON_L)
#define XButtonEventMIsDown(x) ((x)->button.buttons & GR_BUTTON_M)
#define XButtonEventRIsDown(x) ((x)->button.buttons & GR_BUTTON_R)
#define XButtonEventShiftIsDown(x) (x->button.modifiers & MWKMOD_SHIFT)
#define XButtonEventCtrlIsDown(x) (x->button.modifiers & MWKMOD_CTRL)
#define XButtonEventAltIsDown(x) (x->button.modifiers & MWKMOD_ALT)
#define XButtonEventMetaIsDown(x) (x->button.modifiers & MWKMOD_META)
#define XButtonEventGetX(event) (event->button.x)
#define XButtonEventGetY(event) (event->button.y)
#define XKeyEventGetTime(event) (wxGetLocalTime())
#define XKeyEventGetX(event) (event->keystroke.x)
#define XKeyEventGetY(event) (event->keystroke.y)
#define XKeyEventShiftIsDown(x) (x->keystroke.modifiers & MWKMOD_SHIFT)
#define XKeyEventCtrlIsDown(x) (x->keystroke.modifiers & MWKMOD_CTRL)
#define XKeyEventAltIsDown(x) (x->keystroke.modifiers & MWKMOD_ALT)
#define XKeyEventMetaIsDown(x) (x->keystroke.modifiers & MWKMOD_META)
#define XFontStructGetAscent(f) f->info.baseline
#else
#define XEventGetWindow(event) event->xany.window
#define XEventGetType(event) event->xany.type
#define XConfigureEventGetX(event) event->xconfigure.x
#define XConfigureEventGetY(event) event->xconfigure.y
#define XConfigureEventGetWidth(event) event->xconfigure.width
#define XConfigureEventGetHeight(event) event->xconfigure.height
#define XExposeEventGetX(event) event->xexpose.x
#define XExposeEventGetY(event) event->xexpose.y
#define XExposeEventGetWidth(event) event->xexpose.width
#define XExposeEventGetHeight(event) event->xexpose.height
#define XButtonEventGetTime(event) (event->xbutton.time)
#define XButtonEventLChanged(event) (event->xbutton.button == Button1)
#define XButtonEventMChanged(event) (event->xbutton.button == Button2)
#define XButtonEventRChanged(event) (event->xbutton.button == Button3)
#define XButtonEventLIsDown(x) ((x)->xbutton.state & Button1Mask)
#define XButtonEventMIsDown(x) ((x)->xbutton.state & Button2Mask)
#define XButtonEventRIsDown(x) ((x)->xbutton.state & Button3Mask)
#define XButtonEventShiftIsDown(x) (x->xbutton.state & ShiftMask)
#define XButtonEventCtrlIsDown(x) (x->xbutton.state & ControlMask)
#define XButtonEventAltIsDown(x) (x->xbutton.state & Mod3Mask)
#define XButtonEventMetaIsDown(x) (x->xbutton.state & Mod1Mask)
#define XButtonEventGetX(event) (event->xbutton.x)
#define XButtonEventGetY(event) (event->xbutton.y)
#define XKeyEventGetTime(event) (event->xkey.time)
#define XKeyEventShiftIsDown(x) (x->xkey.state & ShiftMask)
#define XKeyEventCtrlIsDown(x) (x->xkey.state & ControlMask)
#define XKeyEventAltIsDown(x) (x->xkey.state & Mod3Mask)
#define XKeyEventMetaIsDown(x) (x->xkey.state & Mod1Mask)
#define XKeyEventGetX(event) (event->xkey.x)
#define XKeyEventGetY(event) (event->xkey.y)
#define XFontStructGetAscent(f) f->ascent
#endif
// ----------------------------------------------------------------------------
// Misc functions
// ----------------------------------------------------------------------------
bool wxDoSetShape( Display* xdisplay, Window xwindow, const wxRegion& region );
class WXDLLIMPEXP_CORE wxXVisualInfo
{
public:
wxXVisualInfo();
~wxXVisualInfo();
void Init( Display* dpy, XVisualInfo* visualInfo );
int m_visualType; // TrueColor, DirectColor etc.
int m_visualDepth;
int m_visualColormapSize;
void *m_visualColormap;
int m_visualScreen;
unsigned long m_visualRedMask;
unsigned long m_visualGreenMask;
unsigned long m_visualBlueMask;
int m_visualRedShift;
int m_visualGreenShift;
int m_visualBlueShift;
int m_visualRedPrec;
int m_visualGreenPrec;
int m_visualBluePrec;
unsigned char *m_colorCube;
};
bool wxFillXVisualInfo( wxXVisualInfo* vi, Display* dpy );
#endif // _WX_PRIVX_H_

View File

@@ -0,0 +1,121 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/region.h
// Purpose: wxRegion class
// Author: Julian Smart
// Created: 17/09/98
// Copyright: (c) Julian Smart, Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_REGION_H_
#define _WX_REGION_H_
#include "wx/list.h"
// ----------------------------------------------------------------------------
// wxRegion
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxRegion : public wxRegionBase
{
public:
wxRegion() = default;
wxRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h )
{
InitRect(x, y, w, h);
}
wxRegion( const wxPoint& topLeft, const wxPoint& bottomRight )
{
InitRect(topLeft.x, topLeft.y,
bottomRight.x - topLeft.x, bottomRight.y - topLeft.y);
}
wxRegion( const wxRect& rect )
{
InitRect(rect.x, rect.y, rect.width, rect.height);
}
wxRegion( size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
wxRegion( const wxBitmap& bmp)
{
Union(bmp);
}
wxRegion( const wxBitmap& bmp,
const wxColour& transColour, int tolerance = 0)
{
Union(bmp, transColour, tolerance);
}
virtual ~wxRegion();
// wxRegionBase methods
virtual void Clear();
virtual bool IsEmpty() const;
public:
WXRegion *GetX11Region() const;
protected:
virtual wxGDIRefData *CreateGDIRefData() const;
wxNODISCARD virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
// wxRegionBase pure virtuals
virtual bool DoIsEqual(const wxRegion& region) const;
virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const;
virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const;
virtual wxRegionContain DoContainsRect(const wxRect& rect) const;
virtual bool DoOffset(wxCoord x, wxCoord y);
virtual bool DoUnionWithRect(const wxRect& rect);
virtual bool DoUnionWithRegion(const wxRegion& region);
virtual bool DoIntersect(const wxRegion& region);
virtual bool DoSubtract(const wxRegion& region);
virtual bool DoXor(const wxRegion& region);
// common part of ctors for a rectangle region
void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
private:
wxDECLARE_DYNAMIC_CLASS(wxRegion);
};
// ----------------------------------------------------------------------------
// wxRegionIterator: decomposes a region into rectangles
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxRegionIterator: public wxObject
{
public:
wxRegionIterator();
wxRegionIterator(const wxRegion& region);
void Reset() { m_current = 0u; }
void Reset(const wxRegion& region);
operator bool () const;
bool HaveRects() const;
void operator ++ ();
void operator ++ (int);
wxCoord GetX() const;
wxCoord GetY() const;
wxCoord GetW() const;
wxCoord GetWidth() const { return GetW(); }
wxCoord GetH() const;
wxCoord GetHeight() const { return GetH(); }
wxRect GetRect() const;
private:
size_t m_current;
wxRegion m_region;
private:
wxDECLARE_DYNAMIC_CLASS(wxRegionIterator);
};
#endif
// _WX_REGION_H_

View File

@@ -0,0 +1,65 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/reparent.h
// Purpose: Reparenting classes
// Author: Julian Smart
// Created: 2002-03-09
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_REPARENT_H_
#define _WX_REPARENT_H_
#include "wx/window.h"
/*
* This class helps to reparent a specific window
*/
class WXDLLIMPEXP_FWD_CORE wxAdoptedWindow;
class WXDLLIMPEXP_CORE wxReparenter: public wxObject
{
public:
wxReparenter() = default;
// We assume that toReparent has had its X window set
// appropriately. toReparent is typically a wxAdoptedWindow.
bool Reparent(wxWindow* newParent, wxAdoptedWindow* toReparent);
// Wait for an appropriate window to be created.
// If exactMatch is FALSE, a substring match is OK.
// If windowName is empty, then wait for the next overrideRedirect window.
bool WaitAndReparent(wxWindow* newParent, wxAdoptedWindow* toReparent,
const wxString& windowName = wxEmptyString,
bool exactMatch = TRUE);
protected:
bool ProcessXEvent(WXEvent* event);
WXWindow FindAClientWindow(WXWindow window, const wxString& name);
static bool sm_done;
static wxAdoptedWindow* sm_toReparent;
static wxWindow* sm_newParent;
static wxString sm_name;
static bool sm_exactMatch;
};
/*
* A window that adopts its handle from the native
* toolkit. It has no parent until reparented.
*/
class WXDLLIMPEXP_CORE wxAdoptedWindow: public wxWindow
{
public:
wxAdoptedWindow();
wxAdoptedWindow(WXWindow window);
virtual ~wxAdoptedWindow();
void SetHandle(WXWindow window) { m_mainWindow = window; m_clientWindow = window; }
WXWindow GetHandle() const { return X11GetMainWindow(); }
};
#endif
// _WX_REPARENT_H_

View File

@@ -0,0 +1,385 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/textctrl.h
// Purpose:
// Author: Robert Roebling
// Created: 01/02/97
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __X11TEXTCTRLH__
#define __X11TEXTCTRLH__
// Set to 1 to use wxUniv's implementation, 0
// to use wxX11's.
#define wxUSE_UNIV_TEXTCTRL 1
#if wxUSE_UNIV_TEXTCTRL
#include "wx/univ/textctrl.h"
#else
#include "wx/scrolwin.h"
#include "wx/arrstr.h"
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_FWD_CORE wxTextCtrl;
//-----------------------------------------------------------------------------
// helpers
//-----------------------------------------------------------------------------
enum wxSourceUndo
{
wxSOURCE_UNDO_LINE,
wxSOURCE_UNDO_ENTER,
wxSOURCE_UNDO_BACK,
wxSOURCE_UNDO_INSERT_LINE,
wxSOURCE_UNDO_DELETE,
wxSOURCE_UNDO_PASTE
};
class wxSourceUndoStep: public wxObject
{
public:
wxSourceUndoStep( wxSourceUndo type, int y1, int y2, wxTextCtrl *owner );
void Undo();
wxSourceUndo m_type;
int m_y1;
int m_y2;
int m_cursorX;
int m_cursorY;
wxTextCtrl *m_owner;
wxString m_text;
wxArrayString m_lines;
};
class wxSourceLine
{
public:
wxSourceLine( const wxString &text = wxEmptyString )
{
m_text = text;
}
wxString m_text;
};
WX_DECLARE_OBJARRAY(wxSourceLine, wxSourceLineArray);
enum wxSourceLanguage
{
wxSOURCE_LANG_NONE,
wxSOURCE_LANG_CPP,
wxSOURCE_LANG_PERL,
wxSOURCE_LANG_PYTHON
};
//-----------------------------------------------------------------------------
// wxTextCtrl
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxTextCtrl: public wxTextCtrlBase, public wxScrollHelper
{
public:
wxTextCtrl() { Init(); }
wxTextCtrl(wxWindow *parent,
wxWindowID id,
const wxString &value = wxEmptyString,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString &name = wxASCII_STR(wxTextCtrlNameStr));
virtual ~wxTextCtrl();
bool Create(wxWindow *parent,
wxWindowID id,
const wxString &value = wxEmptyString,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString &name = wxASCII_STR(wxTextCtrlNameStr));
// required for scrolling with wxScrollHelper
// ------------------------------------------
virtual void PrepareDC(wxDC& dc) { DoPrepareDC(dc); }
// implement base class pure virtuals
// ----------------------------------
virtual void ChangeValue(const wxString &value);
virtual int GetLineLength(long lineNo) const;
virtual wxString GetLineText(long lineNo) const;
virtual int GetNumberOfLines() const;
virtual bool IsModified() const;
virtual bool IsEditable() const;
// more readable flag testing methods
// ----------------------------------
bool IsPassword() const { return (GetWindowStyle() & wxTE_PASSWORD) != 0; }
bool WrapLines() const { return false; }
// If the return values from and to are the same, there is no selection.
virtual void GetSelection(long* from, long* to) const;
// operations
// ----------
// editing
virtual void Clear();
virtual void Replace(long from, long to, const wxString& value);
virtual void Remove(long from, long to);
// clears the dirty flag
virtual void DiscardEdits();
virtual void SetMaxLength(unsigned long len);
// writing text inserts it at the current position, appending always
// inserts it at the end
virtual void WriteText(const wxString& text);
virtual void AppendText(const wxString& text);
// apply text attribute to the range of text (only works with richedit
// controls)
virtual bool SetStyle(long start, long end, const wxTextAttr& style);
// translate between the position (which is just an index in the text ctrl
// considering all its contents as a single strings) and (x, y) coordinates
// which represent column and line.
virtual long XYToPosition(long x, long y) const;
virtual bool PositionToXY(long pos, long *x, long *y) const;
virtual void ShowPosition(long pos);
// Clipboard operations
virtual void Copy();
virtual void Cut();
virtual void Paste();
// Undo/redo
virtual void Undo();
virtual void Redo() {}
virtual bool CanUndo() const { return (m_undos.GetCount() > 0); }
virtual bool CanRedo() const { return false; }
// Insertion point
virtual void SetInsertionPoint(long pos);
virtual void SetInsertionPointEnd();
virtual long GetInsertionPoint() const;
virtual wxTextPos GetLastPosition() const;
virtual void SetSelection(long from, long to);
virtual void SetEditable(bool editable);
virtual bool Enable( bool enable = true );
void OnCut(wxCommandEvent& event);
void OnCopy(wxCommandEvent& event);
void OnPaste(wxCommandEvent& event);
void OnUndo(wxCommandEvent& event);
void OnRedo(wxCommandEvent& event);
void OnUpdateCut(wxUpdateUIEvent& event);
void OnUpdateCopy(wxUpdateUIEvent& event);
void OnUpdatePaste(wxUpdateUIEvent& event);
void OnUpdateUndo(wxUpdateUIEvent& event);
void OnUpdateRedo(wxUpdateUIEvent& event);
bool SetFont(const wxFont& font);
bool SetForegroundColour(const wxColour& colour);
bool SetBackgroundColour(const wxColour& colour);
void SetModified() { m_modified = true; }
// textctrl specific scrolling
virtual bool ScrollLines(int lines);
virtual bool ScrollPages(int pages);
// not part of the wxTextCtrl API from now on..
void SetLanguage( wxSourceLanguage lang = wxSOURCE_LANG_NONE );
void Delete();
void DeleteLine();
void Indent();
void Unindent();
bool HasSelection();
void ClearSelection();
int GetCursorX() { return m_cursorX; }
int GetCursorY() { return m_cursorY; }
bool IsModified() { return m_modified; }
bool OverwriteMode() { return m_overwrite; }
// implementation from now on...
int PosToPixel( int line, int pos );
int PixelToPos( int line, int pixel );
void SearchForBrackets();
void DoChar( char c );
void DoBack();
void DoDelete();
void DoReturn();
void DoDClick();
wxString GetNextToken( wxString &line, size_t &pos );
void DrawLinePart( wxDC &dc, int x, int y, const wxString &toDraw, const wxString &origin, const wxColour &colour);
void DrawLine( wxDC &dc, int x, int y, const wxString &line, int lineNum );
void OnPaint( wxPaintEvent &event );
void OnEraseBackground( wxEraseEvent &event );
void OnMouse( wxMouseEvent &event );
void OnChar( wxKeyEvent &event );
void OnSetFocus( wxFocusEvent& event );
void OnKillFocus( wxFocusEvent& event );
void OnInternalIdle();
void RefreshLine( int n );
void RefreshDown( int n );
void MoveCursor( int new_x, int new_y, bool shift = false, bool centre = false );
void MyAdjustScrollbars();
protected:
// common part of all ctors
void Init();
virtual wxSize DoGetBestSize() const;
virtual void DoSetValue(const wxString& value, int flags = 0);
friend class wxSourceUndoStep;
wxSourceLineArray m_lines;
wxFont m_sourceFont;
wxColour m_sourceColour;
wxColour m_commentColour;
wxColour m_stringColour;
int m_cursorX;
int m_cursorY;
int m_selStartX,m_selStartY;
int m_selEndX,m_selEndY;
int m_lineHeight;
int m_charWidth;
int m_longestLine;
bool m_overwrite;
bool m_modified;
bool m_editable;
bool m_ignoreInput;
wxArrayString m_keywords;
wxColour m_keywordColour;
wxArrayString m_defines;
wxColour m_defineColour;
wxArrayString m_variables;
wxColour m_variableColour;
wxSourceLanguage m_lang;
wxList m_undos;
bool m_capturing;
int m_bracketX;
int m_bracketY;
private:
wxDECLARE_EVENT_TABLE();
wxDECLARE_DYNAMIC_CLASS(wxTextCtrl);
};
//-----------------------------------------------------------------------------
// this is superfluous here but helps to compile
//-----------------------------------------------------------------------------
// cursor movement and also selection and delete operations
#define wxACTION_TEXT_GOTO wxT("goto") // to pos in numArg
#define wxACTION_TEXT_FIRST wxT("first") // go to pos 0
#define wxACTION_TEXT_LAST wxT("last") // go to last pos
#define wxACTION_TEXT_HOME wxT("home")
#define wxACTION_TEXT_END wxT("end")
#define wxACTION_TEXT_LEFT wxT("left")
#define wxACTION_TEXT_RIGHT wxT("right")
#define wxACTION_TEXT_UP wxT("up")
#define wxACTION_TEXT_DOWN wxT("down")
#define wxACTION_TEXT_WORD_LEFT wxT("wordleft")
#define wxACTION_TEXT_WORD_RIGHT wxT("wordright")
#define wxACTION_TEXT_PAGE_UP wxT("pageup")
#define wxACTION_TEXT_PAGE_DOWN wxT("pagedown")
// clipboard operations
#define wxACTION_TEXT_COPY wxT("copy")
#define wxACTION_TEXT_CUT wxT("cut")
#define wxACTION_TEXT_PASTE wxT("paste")
// insert text at the cursor position: the text is in strArg of PerformAction
#define wxACTION_TEXT_INSERT wxT("insert")
// if the action starts with either of these prefixes and the rest of the
// string is one of the movement commands, it means to select/delete text from
// the current cursor position to the new one
#define wxACTION_TEXT_PREFIX_SEL wxT("sel")
#define wxACTION_TEXT_PREFIX_DEL wxT("del")
// mouse selection
#define wxACTION_TEXT_ANCHOR_SEL wxT("anchorsel")
#define wxACTION_TEXT_EXTEND_SEL wxT("extendsel")
#define wxACTION_TEXT_SEL_WORD wxT("wordsel")
#define wxACTION_TEXT_SEL_LINE wxT("linesel")
// undo or redo
#define wxACTION_TEXT_UNDO wxT("undo")
#define wxACTION_TEXT_REDO wxT("redo")
// ----------------------------------------------------------------------------
// wxTextCtrl types
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxStdTextCtrlInputHandler : public wxStdInputHandler
{
public:
wxStdTextCtrlInputHandler(wxInputHandler *inphand) : wxStdInputHandler(inphand) {}
virtual bool HandleKey(wxInputConsumer *consumer,
const wxKeyEvent& event,
bool pressed) { return false; }
virtual bool HandleMouse(wxInputConsumer *consumer, const wxMouseEvent& event) { return false; }
virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event) { return false; }
virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event) { return false; }
protected:
// get the position of the mouse click
static wxTextPos HitTest(const wxTextCtrl *text, const wxPoint& pos) { return 0; }
// capture data
wxTextCtrl *m_winCapture;
};
#endif
// wxUSE_UNIV_TEXTCTRL
#endif // __X11TEXTCTRLH__

View File

@@ -0,0 +1,115 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/toplevel.h
// Purpose: wxTopLevelWindowX11 is the X11 implementation of wxTLW
// Author: Julian Smart
// Created: 20.09.01
// Copyright: (c) 2002 Julian Smart
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_X11_TOPLEVEL_H_
#define _WX_X11_TOPLEVEL_H_
// ----------------------------------------------------------------------------
// wxTopLevelWindowX11
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxTopLevelWindowX11 : public wxTopLevelWindowBase
{
public:
// constructors and such
wxTopLevelWindowX11() { Init(); }
wxTopLevelWindowX11(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();
(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,
const wxString& name = wxASCII_STR(wxFrameNameStr));
virtual ~wxTopLevelWindowX11();
// implement base class pure virtuals
virtual void Maximize(bool maximize = true);
virtual bool IsMaximized() const;
virtual void Iconize(bool iconize = true);
virtual bool IsIconized() const;
virtual void SetIcons(const wxIconBundle& icons);
virtual void Restore();
virtual bool Show( bool show = true );
virtual bool ShowFullScreen( bool show, long style = wxFULLSCREEN_ALL );
virtual bool IsFullScreen() const { return m_fsIsShowing; }
virtual void SetTitle( const wxString& title);
virtual wxString GetTitle() const;
// implementation
void SetNeedResizeInIdle( bool set = true )
{ m_needResizeInIdle = set; }
void SetConfigureGeometry( int x, int y, int width, int height )
{ m_x = x; m_y = y; m_width = width; m_height = height; }
virtual bool SetShape(const wxRegion& region);
// For implementation purposes - sometimes decorations make the
// client area smaller
virtual wxPoint GetClientAreaOrigin() const;
virtual void OnInternalIdle();
protected:
// common part of all ctors
void Init();
// set the icon for the window
void DoSetIcon( const wxIcon& icon );
// For implementation of delayed resize events
bool m_needResizeInIdle;
virtual void DoGetClientSize( int *width, int *height ) const;
virtual void DoGetSize( int *width, int *height ) const;
virtual void DoSetClientSize(int width, int height);
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO);
virtual void DoGetPosition( int *x, int *y ) const;
// Is the frame currently iconized?
bool m_iconized;
// Should the frame be maximized when it will be shown? set by Maximize()
// when it is called while the frame is hidden
bool m_maximizeOnShow;
// Data to save/restore when calling ShowFullScreen
long m_fsStyle; // Passed to ShowFullScreen
wxRect m_fsOldSize;
bool m_fsIsMaximized;
bool m_fsIsShowing;
wxString m_title;
// Geometry
int m_x,m_y,m_width,m_height;
};
// list of all frames and modeless dialogs
//extern WXDLLIMPEXP_DATA_CORE(wxWindowList) wxModelessWindows;
#endif // _WX_X11_TOPLEVEL_H_

View File

@@ -0,0 +1,220 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/x11/window.h
// Purpose: wxWindow class
// Author: Julian Smart
// Created: 17/09/98
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_WINDOW_H_
#define _WX_WINDOW_H_
#include "wx/region.h"
// ----------------------------------------------------------------------------
// wxWindow class for X11 - see also wxWindowBase
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxWindowX11 : public wxWindowBase
{
friend class WXDLLIMPEXP_FWD_CORE wxDC;
friend class WXDLLIMPEXP_FWD_CORE wxWindowDC;
public:
wxWindowX11() { Init(); }
wxWindowX11(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxASCII_STR(wxPanelNameStr))
{
Init();
Create(parent, id, pos, size, style, name);
}
virtual ~wxWindowX11();
bool Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxASCII_STR(wxPanelNameStr));
virtual void Raise();
virtual void Lower();
// SetLabel(), which does nothing in wxWindow
virtual void SetLabel(const wxString& label) override { m_Label = label; }
virtual wxString GetLabel() const override { return m_Label; }
virtual bool Show( bool show = true );
virtual bool Enable( bool enable = true );
virtual void SetFocus();
virtual void WarpPointer(int x, int y);
virtual void Refresh( bool eraseBackground = true,
const wxRect *rect = nullptr );
virtual void Update();
virtual bool SetBackgroundColour( const wxColour &colour );
virtual bool SetForegroundColour( const wxColour &colour );
virtual bool SetCursor( const wxCursor &cursor );
virtual bool SetFont( const wxFont &font );
virtual int GetCharHeight() const;
virtual int GetCharWidth() const;
virtual void ScrollWindow( int dx, int dy, const wxRect* rect = nullptr );
#if wxUSE_DRAG_AND_DROP
virtual void SetDropTarget( wxDropTarget *dropTarget );
#endif // wxUSE_DRAG_AND_DROP
// Accept files for dragging
virtual void DragAcceptFiles(bool accept);
// Get the unique identifier of a window
virtual WXWindow GetHandle() const { return X11GetMainWindow(); }
// implementation from now on
// --------------------------
// accessors
// ---------
// Get main X11 window
virtual WXWindow X11GetMainWindow() const;
// Get X11 window representing the client area
virtual WXWindow GetClientAreaWindow() const;
void SetLastClick(int button, long timestamp)
{ m_lastButton = button; m_lastTS = timestamp; }
int GetLastClickedButton() const { return m_lastButton; }
long GetLastClickTime() const { return m_lastTS; }
// Gives window a chance to do something in response to a size message, e.g.
// arrange status bar, toolbar etc.
virtual bool PreResize();
// Generates paint events from m_updateRegion
void SendPaintEvents();
// Generates paint events from flag
void SendNcPaintEvents();
// Generates erase events from m_clearRegion
void SendEraseEvents();
// Clip to paint region?
bool GetClipPaintRegion() { return m_clipPaintRegion; }
// Return clear region
wxRegion &GetClearRegion() { return m_clearRegion; }
void NeedUpdateNcAreaInIdle( bool update = true ) { m_updateNcArea = update; }
// Inserting into main window instead of client
// window. This is mostly for a wxWindow's own
// scrollbars.
void SetInsertIntoMain( bool insert = true ) { m_insertIntoMain = insert; }
bool GetInsertIntoMain() { return m_insertIntoMain; }
// sets the fore/background colour for the given widget
static void DoChangeForegroundColour(WXWindow widget, wxColour& foregroundColour);
static void DoChangeBackgroundColour(WXWindow widget, wxColour& backgroundColour, bool changeArmColour = false);
// I don't want users to override what's done in idle so everything that
// has to be done in idle time in order for wxX11 to work is done in
// OnInternalIdle
virtual void OnInternalIdle();
protected:
// Responds to colour changes: passes event on to children.
void OnSysColourChanged(wxSysColourChangedEvent& event);
// For double-click detection
long m_lastTS; // last timestamp
int m_lastButton; // last pressed button
protected:
WXWindow m_mainWindow;
WXWindow m_clientWindow;
bool m_insertIntoMain;
bool m_winCaptured;
wxRegion m_clearRegion;
bool m_clipPaintRegion;
bool m_updateNcArea;
bool m_needsInputFocus; // Input focus set in OnIdle
// implement the base class pure virtuals
virtual void DoGetTextExtent(const wxString& string,
int *x, int *y,
int *descent = nullptr,
int *externalLeading = nullptr,
const wxFont *font = nullptr) const;
virtual void DoClientToScreen( int *x, int *y ) const;
virtual void DoScreenToClient( int *x, int *y ) const;
virtual void DoGetPosition( int *x, int *y ) const;
virtual void DoGetSize( int *width, int *height ) const;
virtual void DoGetClientSize( int *width, int *height ) const;
virtual void DoSetSize(int x, int y,
int width, int height,
int sizeFlags = wxSIZE_AUTO);
virtual void DoSetClientSize(int width, int height);
virtual void DoMoveWindow(int x, int y, int width, int height);
virtual void DoSetSizeHints(int minW, int minH,
int maxW, int maxH,
int incW, int incH);
virtual void DoCaptureMouse();
virtual void DoReleaseMouse();
virtual void KillFocus();
#if wxUSE_TOOLTIPS
virtual void DoSetToolTip( wxToolTip *tip );
#endif // wxUSE_TOOLTIPS
private:
// common part of all ctors
void Init();
wxString m_Label;
wxDECLARE_DYNAMIC_CLASS(wxWindowX11);
wxDECLARE_NO_COPY_CLASS(wxWindowX11);
wxDECLARE_EVENT_TABLE();
};
// ----------------------------------------------------------------------------
// A little class to switch off `size optimization' while an instance of the
// object exists: this may be useful to temporarily disable the optimisation
// which consists to do nothing when the new size is equal to the old size -
// although quite useful usually to avoid flicker, sometimes it leads to
// undesired effects.
//
// Usage: create an instance of this class on the stack to disable the size
// optimisation, it will be re-enabled as soon as the object goes out from scope.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxNoOptimize
{
public:
wxNoOptimize() { ms_count++; }
~wxNoOptimize() { ms_count--; }
static bool CanOptimize() { return ms_count == 0; }
protected:
static int ms_count;
};
#endif // _WX_WINDOW_H_