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 7228269764
9653 changed files with 4034514 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/accel.h
// Purpose: wxAcceleratorTable class
// Author: Peter Most, Javier Torres, Mariano Reingart
// Copyright: (c) 2009 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_ACCEL_H_
#define _WX_QT_ACCEL_H_
/* wxQt accelerators implementation:
*
* Storing:
* QShortcuts are stored in wxWindow (m_qtShortcuts) to allow to delete them
* when the accelerator table is changed, and also because we need to specify
* a not-null parent from them, which is unknown at the moment of creating the
* accelerator table. So, the accelerator table only contains a list of
* wxAcceleratorEntries, which are converted to a list of QShortcuts when
* the table is fixed to a wxWindow.
*
* Passing keypresses to accelerators:
* The accelerators are implemented using QShortcut's. As there is no easy way
* to call them, we must pass all keypress events through the QApplication
* notify() function (which is the one that checks if the keypress match any
* shortcut.
*
* Executing commands when a QShortcut is triggered:
* Each QShortcut has a property ("wxQt_Command") set with the number of the
* wx command it is associated to. Then, its activated() signal is connected to
* a small handler (wxQtShortcutHandler in window_qt.h) which calls the main
* handler (wxWindow::QtHandleShortcut) passing the command extracted from the
* QShortcut. This handler will finally create and send the appropriate wx
* event to the window. */
#include "wx/vector.h"
class QShortcut;
template < class T > class QList;
class WXDLLIMPEXP_CORE wxAcceleratorTable : public wxObject
{
public:
wxAcceleratorTable();
wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]);
// Implementation
wxVector<QShortcut*> ConvertShortcutTable( QWidget *parent ) const;
bool Ok() const { return IsOk(); }
bool IsOk() const;
protected:
// ref counting code
virtual wxObjectRefData *CreateRefData() const override;
wxNODISCARD virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const override;
private:
wxDECLARE_DYNAMIC_CLASS(wxAcceleratorTable);
};
#endif // _WX_QT_ACCEL_H_

View File

@@ -0,0 +1,52 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/anybutton.h
// Purpose: wxQT wxAnyButton class declaration
// Author: Mariano Reingart
// Copyright: (c) 2014 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_ANYBUTTON_H_
#define _WX_QT_ANYBUTTON_H_
class QPushButton;
//-----------------------------------------------------------------------------
// wxAnyButton
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxAnyButton : public wxAnyButtonBase
{
public:
wxAnyButton() = default;
// implementation
// --------------
virtual void SetLabel( const wxString &label ) override;
virtual wxString GetLabel() const override;
// implementation only
void QtUpdateState();
virtual int QtGetEventType() const = 0;
QPushButton* GetQPushButton() const;
protected:
virtual wxBitmap DoGetBitmap(State state) const override;
virtual void DoSetBitmap(const wxBitmapBundle& bitmap, State which) override;
void QtCreate(wxWindow *parent);
void QtSetBitmap( const wxBitmapBundle &bitmap );
private:
State QtGetCurrentState() const;
typedef wxAnyButtonBase base_type;
wxBitmapBundle m_bitmaps[State_Max];
wxDECLARE_NO_COPY_CLASS(wxAnyButton);
};
#endif // _WX_QT_ANYBUTTON_H_

View File

@@ -0,0 +1,29 @@
/////////////////////////////////////////////////////////////////////////////
// Name: app.h
// Purpose: wxApp class
// Author: Peter Most, Mariano Reingart
// Copyright: (c) 2009 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_APP_H_
#define _WX_QT_APP_H_
#include <memory>
class QApplication;
class WXDLLIMPEXP_CORE wxApp : public wxAppBase
{
public:
wxApp();
~wxApp();
virtual bool Initialize(int& argc, wxChar **argv) override;
private:
std::unique_ptr<QApplication> m_qtApplication;
wxDECLARE_DYNAMIC_CLASS_NO_COPY( wxApp );
};
#endif // _WX_QT_APP_H_

View File

@@ -0,0 +1,142 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/bitmap.h
// Author: Peter Most, Javier Torres, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_BITMAP_H_
#define _WX_QT_BITMAP_H_
class QImage;
class QPixmap;
class QBitmap;
class WXDLLIMPEXP_CORE wxBitmap : public wxBitmapBase
{
public:
wxBitmap();
wxBitmap(QPixmap pix);
wxBitmap(const char bits[], int width, int height, int depth = 1);
wxBitmap(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
wxBitmap(const wxSize& sz, int depth = wxBITMAP_SCREEN_DEPTH);
wxBitmap(int width, int height, const wxDC& dc);
wxBitmap(const char* const* bits);
wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_XPM);
#if wxUSE_IMAGE
wxBitmap(const wxImage& image, int depth = wxBITMAP_SCREEN_DEPTH, double scale = 1.0);
wxBitmap(const wxImage& image, const wxDC& dc);
#endif // wxUSE_IMAGE
// Convert from wxIcon / wxCursor
wxBitmap(const wxIcon& icon) { CopyFromIcon(icon); }
explicit wxBitmap(const wxCursor& cursor);
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;
bool Create(int width, int height, const wxDC& dc);
virtual void SetScaleFactor(double scale) override;
virtual double GetScaleFactor() const override;
virtual int GetHeight() const override;
virtual int GetWidth() const override;
virtual int GetDepth() const override;
#if wxUSE_IMAGE
virtual wxImage ConvertToImage() const override;
#endif // wxUSE_IMAGE
virtual wxMask *GetMask() const override;
virtual void SetMask(wxMask *mask) override;
virtual wxBitmap GetSubBitmap(const wxRect& rect) const override;
virtual bool SaveFile(const wxString &name, wxBitmapType type,
const wxPalette *palette = nullptr) const override;
virtual bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_DEFAULT_TYPE) override;
#if wxUSE_PALETTE
virtual wxPalette *GetPalette() const override;
virtual void SetPalette(const wxPalette& palette) override;
#endif // wxUSE_PALETTE
// implementation:
#if WXWIN_COMPATIBILITY_3_0
wxDEPRECATED(virtual void SetHeight(int height) override);
wxDEPRECATED(virtual void SetWidth(int width) override);
wxDEPRECATED(virtual void SetDepth(int depth) override);
#endif
void *GetRawData(wxPixelDataBase& data, int bpp);
void UngetRawData(wxPixelDataBase& data);
// these functions are internal and shouldn't be used, they risk to
// disappear in the future
bool HasAlpha() const override;
// Blend mask with alpha channel and remove the mask
void QtBlendMaskWithAlpha();
QPixmap *GetHandle() const;
protected:
virtual wxGDIRefData *CreateGDIRefData() const override;
wxNODISCARD virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const override;
virtual bool DoCreate(const wxSize& sz, double scale, int depth) override;
private:
#if wxUSE_IMAGE
void InitFromImage(const wxImage& image, int depth, double WXUNUSED(scale));
#endif
wxDECLARE_DYNAMIC_CLASS(wxBitmap);
};
class WXDLLIMPEXP_CORE wxMask : public wxMaskBase
{
public:
wxMask();
// Copy constructor
wxMask(const wxMask &mask);
wxMask& operator=(const wxMask &mask);
// Construct a mask from a bitmap and a colour indicating the transparent
// area
wxMask(const wxBitmap& bitmap, const wxColour& colour);
// Construct a mask from a bitmap and a palette index indicating the
// transparent area
wxMask(const wxBitmap& bitmap, int paletteIndex);
// Construct a mask from a mono bitmap (copies the bitmap).
wxMask(const wxBitmap& bitmap);
virtual ~wxMask();
// Construct a mask from QBitmap, takes ownership.
explicit wxMask(QBitmap* qtBitmap);
wxBitmap GetBitmap() const;
// Implementation
QBitmap *GetHandle() const;
protected:
// this function is called from Create() to free the existing mask data
void FreeData() override;
// by the public wrappers
bool InitFromColour(const wxBitmap& bitmap, const wxColour& colour) override;
bool InitFromMonoBitmap(const wxBitmap& bitmap) override;
protected:
wxDECLARE_DYNAMIC_CLASS(wxMask);
private:
QBitmap *m_qtBitmap;
};
#endif // _WX_QT_BITMAP_H_

View File

@@ -0,0 +1,45 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/bmpbuttn.h
// Author: Peter Most
// Copyright: (c) Peter Most
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_BMPBUTTN_H_
#define _WX_QT_BMPBUTTN_H_
class WXDLLIMPEXP_CORE wxBitmapButton : public wxBitmapButtonBase
{
public:
wxBitmapButton() = default;
wxBitmapButton(wxWindow *parent,
wxWindowID id,
const wxBitmapBundle& bitmap,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxButtonNameStr));
bool Create(wxWindow *parent,
wxWindowID id,
const wxBitmapBundle& bitmap,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxButtonNameStr));
bool CreateCloseButton(wxWindow* parent,
wxWindowID winid,
const wxString& name = wxString());
protected:
wxDECLARE_DYNAMIC_CLASS(wxBitmapButton);
private:
// We re-use wxButton
};
#endif // _WX_QT_BMPBUTTN_H_

View File

@@ -0,0 +1,49 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/brush.h
// Author: Peter Most, Javier Torres, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_BRUSH_H_
#define _WX_QT_BRUSH_H_
class QBrush;
class WXDLLIMPEXP_CORE wxBrush : public wxBrushBase
{
public:
wxBrush();
wxBrush(const wxColour& col, wxBrushStyle style = wxBRUSHSTYLE_SOLID);
wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants")
wxBrush(const wxColour& col, int style);
wxBrush(const wxBitmap& stipple);
virtual void SetColour(const wxColour& col) override;
virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) override;
virtual void SetStyle(wxBrushStyle style) override;
virtual void SetStipple(const wxBitmap& stipple) override;
bool operator==(const wxBrush& brush) const;
bool operator!=(const wxBrush& brush) const { return !(*this == brush); }
virtual wxColour GetColour() const override;
virtual wxBrushStyle GetStyle() const override;
virtual wxBitmap *GetStipple() const override;
wxDEPRECATED_MSG("use wxBRUSHSTYLE_XXX constants")
void SetStyle(int style) { SetStyle((wxBrushStyle)style); }
QBrush GetHandle() const;
protected:
virtual wxGDIRefData *CreateGDIRefData() const override;
wxNODISCARD virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const override;
private:
wxDECLARE_DYNAMIC_CLASS(wxBrush);
};
#endif // _WX_QT_BRUSH_H_

View File

@@ -0,0 +1,50 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/button.h
// Author: Peter Most, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_BUTTON_H_
#define _WX_QT_BUTTON_H_
#include "wx/control.h"
#include "wx/button.h"
class WXDLLIMPEXP_CORE wxButton : public wxButtonBase
{
public:
wxButton() = default;
wxButton(wxWindow *parent, wxWindowID id,
const wxString& label = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxButtonNameStr));
bool Create(wxWindow *parent, wxWindowID id,
const wxString& label = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxButtonNameStr));
virtual wxWindow *SetDefault() override;
// implementation only
virtual int QtGetEventType() const override { return wxEVT_BUTTON; }
protected:
virtual bool DoGetAuthNeeded() const override;
virtual void DoSetAuthNeeded(bool show) override;
// true if the UAC symbol is shown. Always false under non-Windows platforms.
bool m_authNeeded = false;
private:
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxButton);
};
#endif // _WX_QT_BUTTON_H_

View File

@@ -0,0 +1,93 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/calctrl.h
// Purpose: wxCalendarCtrl control implementation for wxQt
// Author: Kolya Kosenko
// Created: 2010-05-12
// Copyright: (c) 2010 Kolya Kosenko
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_CALCTRL_H_
#define _WX_QT_CALCTRL_H_
#include "wx/calctrl.h"
class QCalendarWidget;
class WXDLLIMPEXP_ADV wxCalendarCtrl : public wxCalendarCtrlBase
{
public:
wxCalendarCtrl() { Init(); }
wxCalendarCtrl(wxWindow *parent,
wxWindowID id,
const wxDateTime& date = wxDefaultDateTime,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCAL_SHOW_HOLIDAYS,
const wxString& name = wxASCII_STR(wxCalendarNameStr))
{
Init();
Create(parent, id, date, pos, size, style, name);
}
virtual ~wxCalendarCtrl();
bool Create(wxWindow *parent,
wxWindowID id,
const wxDateTime& date = wxDefaultDateTime,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCAL_SHOW_HOLIDAYS,
const wxString& name = wxASCII_STR(wxCalendarNameStr));
virtual bool SetDate(const wxDateTime& date) override;
virtual wxDateTime GetDate() const override;
virtual bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime,
const wxDateTime& upperdate = wxDefaultDateTime) override;
virtual bool GetDateRange(wxDateTime *lowerdate, wxDateTime *upperdate) const override;
virtual bool EnableMonthChange(bool enable = true) override;
virtual void Mark(size_t day, bool mark) override;
// holidays colours
virtual void SetHoliday(size_t day) override;
virtual void SetHolidayColours(const wxColour& colFg, const wxColour& colBg) override;
virtual const wxColour& GetHolidayColourFg() const override { return m_colHolidayFg; }
virtual const wxColour& GetHolidayColourBg() const override { return m_colHolidayBg; }
// header colours
virtual void SetHeaderColours(const wxColour& colFg, const wxColour& colBg) override;
virtual const wxColour& GetHeaderColourFg() const override { return m_colHeaderFg; }
virtual const wxColour& GetHeaderColourBg() const override { return m_colHeaderBg; }
// day attributes
virtual wxCalendarDateAttr *GetAttr(size_t day) const override;
virtual void SetAttr(size_t day, wxCalendarDateAttr *attr) override;
virtual void ResetAttr(size_t day) override { SetAttr(day, nullptr); }
virtual void SetWindowStyleFlag(long style) override;
using wxCalendarCtrlBase::GenerateAllChangeEvents;
QCalendarWidget* GetQCalendarWidget() const;
protected:
virtual void RefreshHolidays() override;
private:
void Init();
void UpdateStyle();
wxColour m_colHeaderFg,
m_colHeaderBg,
m_colHolidayFg,
m_colHolidayBg;
wxCalendarDateAttr *m_attrs[31];
wxDECLARE_DYNAMIC_CLASS(wxCalendarCtrl);
};
#endif // _WX_QT_CALCTRL_H_

View File

@@ -0,0 +1,48 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/checkbox.h
// Author: Peter Most, Sean D'Epagnier, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_CHECKBOX_H_
#define _WX_QT_CHECKBOX_H_
class QCheckBox;
class WXDLLIMPEXP_CORE wxCheckBox : public wxCheckBoxBase
{
public:
wxCheckBox() = default;
wxCheckBox( wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxCheckBoxNameStr));
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxCheckBoxNameStr) );
virtual void SetValue(bool value) override;
virtual bool GetValue() const override;
virtual void SetLabel(const wxString& label) override;
virtual wxString GetLabel() const override;
QCheckBox* GetQCheckBox() const;
protected:
virtual void DoSet3StateValue(wxCheckBoxState state) override;
virtual wxCheckBoxState DoGet3StateValue() const override;
wxDECLARE_DYNAMIC_CLASS(wxCheckBox);
};
#endif // _WX_QT_CHECKBOX_H_

View File

@@ -0,0 +1,56 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/checklst.h
// Author: Peter Most, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_CHECKLST_H_
#define _WX_QT_CHECKLST_H_
class WXDLLIMPEXP_CORE wxCheckListBox : public wxCheckListBoxBase
{
public:
wxCheckListBox() = default;
wxCheckListBox(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int nStrings = 0,
const wxString *choices = nullptr,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxListBoxNameStr));
wxCheckListBox(wxWindow *parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxListBoxNameStr));
virtual ~wxCheckListBox();
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = nullptr,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxListBoxNameStr));
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxListBoxNameStr));
virtual bool IsChecked(unsigned int item) const override;
virtual void Check(unsigned int item, bool check = true) override;
wxDECLARE_DYNAMIC_CLASS(wxCheckListBox);
};
#endif // _WX_QT_CHECKLST_H_

View File

@@ -0,0 +1,79 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/choice.h
// Author: Peter Most, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_CHOICE_H_
#define _WX_QT_CHOICE_H_
class QComboBox;
class WXDLLIMPEXP_CORE wxChoice : public wxChoiceBase
{
public:
wxChoice() = default;
wxChoice( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = nullptr,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxChoiceNameStr) );
wxChoice( wxWindow *parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxChoiceNameStr) );
bool Create( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = nullptr,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxChoiceNameStr) );
bool Create( wxWindow *parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxChoiceNameStr) );
virtual wxSize DoGetBestSize() const override;
virtual unsigned int GetCount() const override;
virtual wxString GetString(unsigned int n) const override;
virtual void SetString(unsigned int n, const wxString& s) override;
virtual void SetSelection(int n) override;
virtual int GetSelection() const override;
QComboBox* GetQComboBox() const;
protected:
virtual int DoInsertItems(const wxArrayStringsAdapter & items,
unsigned int pos,
void **clientData,
wxClientDataType type) override;
virtual int DoInsertOneItem(const wxString& item, unsigned int pos) override;
virtual void DoSetItemClientData(unsigned int n, void *clientData) override;
virtual void *DoGetItemClientData(unsigned int n) const override;
virtual void DoClear() override;
virtual void DoDeleteOneItem(unsigned int pos) override;
void QtInitSort(QComboBox *combo);
wxDECLARE_DYNAMIC_CLASS(wxChoice);
};
#endif // _WX_QT_CHOICE_H_

View File

@@ -0,0 +1,44 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/toolbar.h
// Author: Sean D'Epagnier
// Copyright: (c) Sean D'Epagnier 2014
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_CLIPBRD_H_
#define _WX_QT_CLIPBRD_H_
#include "wx/weakref.h"
class QtClipBoardSignalHandler;
class WXDLLIMPEXP_CORE wxClipboard : public wxClipboardBase
{
public:
wxClipboard();
~wxClipboard();
virtual bool Open() override;
virtual void Close() override;
virtual bool IsOpened() const override;
virtual bool AddData( wxDataObject *data ) override;
virtual bool SetData( wxDataObject *data ) override;
virtual bool GetData( wxDataObject& data ) override;
virtual void Clear() override;
virtual bool IsSupported( const wxDataFormat& format ) override;
virtual bool IsSupportedAsync(wxEvtHandler *sink) override;
private:
friend class QtClipBoardSignalHandler;
int Mode();
QtClipBoardSignalHandler *m_SignalHandler;
wxEvtHandlerRef m_sink;
bool m_open;
wxDECLARE_DYNAMIC_CLASS(wxClipboard);
};
#endif // _WX_QT_CLIPBRD_H_

View File

@@ -0,0 +1,51 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/clrpicker.h
// Author: Peter Most
// Copyright: (c) Peter Most
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_CLRPICKER_H_
#define _WX_QT_CLRPICKER_H_
#include "wx/generic/clrpickerg.h"
// TODO: A QtColorPicker is available from
// http://qt.nokia.com/products/appdev/add-on-products/catalog/4/Widgets/qtcolorpicker/
// How to integrate into wxWidgets:
//
// class WXDLLIMPEXP_CORE wxColourPickerWidget : public wxButton, public wxColourPickerWidgetBase
// TODO: For now we reuse the existing wxGenericColourButton but this should be
// changed to use the above mentioned color picker.
class WXDLLIMPEXP_CORE wxColourPickerWidget : public wxGenericColourButton
{
public:
wxColourPickerWidget() = default;
wxColourPickerWidget(wxWindow *parent,
wxWindowID id,
const wxColour& initial = *wxBLACK,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCLRBTN_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxColourPickerWidgetNameStr));
bool Create(wxWindow *parent,
wxWindowID id,
const wxColour& initial = *wxBLACK,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCLRBTN_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxColourPickerWidgetNameStr));
protected:
virtual void UpdateColour() override;
private:
};
#endif // _WX_QT_CLRPICKER_H_

View File

@@ -0,0 +1,35 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/colordlg.h
// Author: Sean D'Epagnier
// Copyright: (c) Sean D'Epagnier 2014
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_COLORDLG_H_
#define _WX_QT_COLORDLG_H_
#include "wx/dialog.h"
class QColorDialog;
class WXDLLIMPEXP_CORE wxColourDialog : public wxDialog
{
public:
wxColourDialog() = default;
explicit wxColourDialog(wxWindow *parent,
const wxColourData *data = nullptr) { Create(parent, data); }
bool Create(wxWindow *parent, const wxColourData *data = nullptr);
wxColourData &GetColourData();
private:
QColorDialog *GetQColorDialog() const;
wxColourData m_data;
wxDECLARE_DYNAMIC_CLASS(wxColourDialog);
};
#endif // _WX_QT_COLORDLG_H_

View File

@@ -0,0 +1,46 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/colour.h
// Purpose: wxColour class implementation for wxQt
// Author: Kolya Kosenko
// Created: 2010-05-12
// Copyright: (c) 2010 Kolya Kosenko
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_COLOUR_H_
#define _WX_QT_COLOUR_H_
class QColor;
class WXDLLIMPEXP_CORE wxWARN_UNUSED wxColour : public wxColourBase
{
public:
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
wxColour(const QColor& color);
virtual bool IsOk() const override { return m_valid; }
ChannelType Red() const override { return m_red; }
ChannelType Green() const override { return m_green; }
ChannelType Blue() const override { return m_blue; }
ChannelType Alpha() const override { return m_alpha; }
bool operator==(const wxColour& color) const;
bool operator!=(const wxColour& color) const;
int GetPixel() const;
QColor GetQColor() const;
protected:
void Init();
virtual void InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a) override;
private:
ChannelType m_red, m_green, m_blue, m_alpha;
bool m_valid;
wxDECLARE_DYNAMIC_CLASS(wxColour);
};
#endif // _WX_QT_COLOUR_H_

View File

@@ -0,0 +1,101 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/combobox.h
// Author: Peter Most, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_COMBOBOX_H_
#define _WX_QT_COMBOBOX_H_
#include "wx/choice.h"
class WXDLLIMPEXP_CORE wxComboBox : public wxChoice, public wxTextEntry
{
public:
wxComboBox() = default;
wxComboBox(wxWindow *parent,
wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = nullptr,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxComboBoxNameStr));
wxComboBox(wxWindow *parent, wxWindowID id,
const wxString& value,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxComboBoxNameStr));
bool Create(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = nullptr,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxComboBoxNameStr));
bool Create(wxWindow *parent, wxWindowID id,
const wxString& value,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxComboBoxNameStr));
virtual void SetSelection(int n) override;
virtual void SetSelection(long from, long to) override;
virtual int GetSelection() const override { return wxChoice::GetSelection(); }
virtual void GetSelection(long *from, long *to) const override;
virtual wxString GetStringSelection() const override
{
return wxItemContainer::GetStringSelection();
}
virtual void Clear() override;
// See wxComboBoxBase discussion of IsEmpty().
bool IsListEmpty() const { return wxItemContainer::IsEmpty(); }
bool IsTextEmpty() const { return wxTextEntry::IsEmpty(); }
virtual void SetValue(const wxString& value) override;
virtual void ChangeValue(const wxString& value) override;
virtual void AppendText(const wxString &value) override;
virtual void Replace(long from, long to, const wxString &value) override;
virtual void WriteText(const wxString &value) override;
virtual void SetInsertionPoint(long insertion) override;
virtual long GetInsertionPoint() const override;
virtual bool IsEditable() const override;
virtual void SetEditable(bool editable) override;
virtual void Popup();
virtual void Dismiss();
virtual const wxTextEntry* WXGetTextEntry() const override { return this; }
virtual bool QtHandleFocusEvent(QWidget *handler, QFocusEvent *event) override;
protected:
// From wxTextEntry:
virtual wxString DoGetValue() const override;
private:
bool IsReadOnly() const;
// From wxTextEntry:
virtual wxWindow *GetEditableWindow() override { return this; }
wxDECLARE_DYNAMIC_CLASS(wxComboBox);
};
#endif // _WX_QT_COMBOBOX_H_

View File

@@ -0,0 +1,34 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/control.h
// Author: Peter Most, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_CONTROL_H_
#define _WX_QT_CONTROL_H_
class WXDLLIMPEXP_CORE wxControl : public wxControlBase
{
public:
wxControl() = default;
wxControl(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxControlNameStr));
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxControlNameStr));
virtual wxSize DoGetBestSize() const override;
private:
wxDECLARE_DYNAMIC_CLASS(wxControl);
};
#endif // _WX_QT_CONTROL_H_

View File

@@ -0,0 +1,22 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/ctrlsub.h
// Author: Peter Most
// Copyright: (c) Peter Most
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_CTRLSUB_H_
#define _WX_QT_CTRLSUB_H_
class WXDLLIMPEXP_CORE wxControlWithItems : public wxControlWithItemsBase
{
public:
wxControlWithItems();
protected:
private:
wxDECLARE_ABSTRACT_CLASS(wxControlWithItems);
};
#endif // _WX_QT_CTRLSUB_H_

View File

@@ -0,0 +1,51 @@
/////////////////////////////////////////////////////////////////////////////
// Name: cursor.h
// Author: Sean D'Epagnier
// Copyright: (c) Sean D'Epagnier 2014
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_CURSOR_H_
#define _WX_QT_CURSOR_H_
#include "wx/image.h"
class QCursor;
class WXDLLIMPEXP_CORE wxCursor : public wxCursorBase
{
public:
wxCursor() = default;
wxCursor(wxStockCursor id) { InitFromStock(id); }
wxCursor(const wxBitmap& bitmap, const wxPoint& hotSpot)
: wxCursor(bitmap, hotSpot.x, hotSpot.y) { }
wxCursor(const wxBitmap& bitmap, int hotSpotX = 0, int hotSpotY = 0);
#if wxUSE_IMAGE
wxCursor( const wxImage & image );
wxCursor(const char* const* xpmData);
#endif // wxUSE_IMAGE
wxCursor(const wxString& name, wxBitmapType type, const wxPoint& hotSpot)
: wxCursor(name, type, hotSpot.x, hotSpot.y) { }
wxCursor(const wxString& name,
wxBitmapType type = wxCURSOR_DEFAULT_TYPE,
int hotSpotX = 0, int hotSpotY = 0);
virtual wxPoint GetHotSpot() const override;
QCursor &GetHandle() const;
protected:
void InitFromStock( wxStockCursor cursorId );
void InitFromBitmap(const wxBitmap& bmp, int hotSpotX, int hotSpotY);
#if wxUSE_IMAGE
void InitFromImage( const wxImage & image );
#endif
private:
void Init();
virtual wxGDIRefData *CreateGDIRefData() const override;
wxNODISCARD virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const override;
wxDECLARE_DYNAMIC_CLASS(wxCursor);
};
#endif // _WX_QT_CURSOR_H_

View File

@@ -0,0 +1,41 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/dataform.h
// Author: Sean D'Epagnier
// Copyright: (c) Sean D'Epagnier 2014
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_DATAFORM_H_
#define _WX_QT_DATAFORM_H_
class WXDLLIMPEXP_CORE wxDataFormat
{
public:
wxDataFormat(wxDataFormatId formatId = wxDF_INVALID);
wxDataFormat(const wxString &id);
// Standard methods
const wxString& GetId() const;
void SetId(const wxString& id);
wxDataFormatId GetType() const;
void SetType(wxDataFormatId type);
bool operator==(wxDataFormatId format) const;
bool operator!=(wxDataFormatId format) const;
bool operator==(const wxDataFormat& format) const;
bool operator!=(const wxDataFormat& format) const;
// Direct access to the underlying mime type.
// Equivalent to "id", except "id" is supposed to be
// invalid for standard types, whereas this should
// always be valid (if meaningful).
const wxString& GetMimeType() const;
void SetMimeType(const wxString& mimeType);
private:
wxString m_mimeType;
wxDataFormatId m_formatId;
};
#endif // _WX_QT_DATAFORM_H_

View File

@@ -0,0 +1,35 @@
/////////////////////////////////////////////////////////////////////////////
// Name: src/qt/dataobj.h
// Author: Peter Most
// Copyright: (c) Peter Most
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_DATAOBJ_H_
#define _WX_QT_DATAOBJ_H_
// ----------------------------------------------------------------------------
// wxDataObject is the same as wxDataObjectBase under wxQT
// ----------------------------------------------------------------------------
class QMimeData;
class WXDLLIMPEXP_CORE wxDataObject : public wxDataObjectBase
{
public:
wxDataObject();
virtual ~wxDataObject();
virtual bool IsSupportedFormat( const wxDataFormat& format, Direction dir = Get ) const;
// Adds object's data to Qt mime data appropriately for type
virtual void QtAddDataTo(QMimeData &mimeData) const;
// Sets object's data from Qt mime data appropriately for type
virtual bool QtSetDataFrom(const QMimeData &mimeData);
private:
// Sets object's data from Qt mime data in specific format
virtual void QtSetDataSingleFormat(const QMimeData &mimeData, const wxDataFormat &format);
};
#endif // _WX_QT_DATAOBJ_H_

View File

@@ -0,0 +1,37 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/dataobj2.h
// Author: Peter Most
// Copyright: (c) Peter Most
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_DATAOBJ2_H_
#define _WX_QT_DATAOBJ2_H_
class WXDLLIMPEXP_CORE wxBitmapDataObject : public wxBitmapDataObjectBase
{
public:
wxBitmapDataObject();
wxBitmapDataObject(const wxBitmap& bitmap);
// Overridden to set image data directly, which Qt will write to clipboard in many formats
void QtAddDataTo(QMimeData &mimeData) const override;
// Overridden to retrieve image data from any format that Qt can read from clipboard
bool QtSetDataFrom(const QMimeData &mimeData) override;
protected:
private:
};
class WXDLLIMPEXP_CORE wxFileDataObject : public wxFileDataObjectBase
{
public:
wxFileDataObject();
void AddFile( const wxString &filename );
};
#endif // _WX_QT_DATAOBJ2_H_

View File

@@ -0,0 +1,141 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/dataview.h
// Author: Peter Most
// Copyright: (c) Peter Most
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_DATAVIEW_H_
#define _WX_QT_DATAVIEW_H_
class WXDLLIMPEXP_ADV wxDataViewColumn: public wxDataViewColumnBase
{
public:
wxDataViewColumn( const wxString &title, wxDataViewRenderer *renderer,
unsigned int model_column, int width = wxDVC_DEFAULT_WIDTH,
wxAlignment align = wxALIGN_CENTER,
int flags = wxDATAVIEW_COL_RESIZABLE );
wxDataViewColumn( const wxBitmapBundle &bitmap, wxDataViewRenderer *renderer,
unsigned int model_column, int width = wxDVC_DEFAULT_WIDTH,
wxAlignment align = wxALIGN_CENTER,
int flags = wxDATAVIEW_COL_RESIZABLE );
// setters:
virtual void SetTitle( const wxString &title );
virtual void SetBitmap( const wxBitmapBundle &bitmap );
virtual void SetOwner( wxDataViewCtrl *owner );
virtual void SetAlignment( wxAlignment align );
virtual void SetSortable( bool sortable );
virtual void SetSortOrder( bool ascending );
virtual void SetAsSortKey(bool sort = true);
virtual void SetResizeable( bool resizeable );
virtual void SetHidden( bool hidden );
virtual void SetMinWidth( int minWidth );
virtual void SetWidth( int width );
virtual void SetReorderable( bool reorderable );
virtual void SetFlags(int flags);
// getters:
virtual wxString GetTitle() const;
virtual wxAlignment GetAlignment() const;
virtual bool IsSortable() const;
virtual bool IsSortOrderAscending() const;
virtual bool IsSortKey() const;
virtual bool IsResizeable() const;
virtual bool IsHidden() const;
virtual int GetWidth() const;
virtual int GetMinWidth() const;
virtual bool IsReorderable() const;
virtual int GetFlags() const;
};
class WXDLLIMPEXP_ADV wxDataViewCtrl: public wxDataViewCtrlBase
{
public:
wxDataViewCtrl() = default;
wxDataViewCtrl( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator );
virtual ~wxDataViewCtrl();
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator );
virtual bool AssociateModel( wxDataViewModel *model );
virtual bool PrependColumn( wxDataViewColumn *col );
virtual bool AppendColumn( wxDataViewColumn *col );
virtual bool InsertColumn( unsigned int pos, wxDataViewColumn *col );
virtual unsigned int GetColumnCount() const;
virtual wxDataViewColumn* GetColumn( unsigned int pos ) const;
virtual bool DeleteColumn( wxDataViewColumn *column );
virtual bool ClearColumns();
virtual int GetColumnPosition( const wxDataViewColumn *column ) const;
virtual wxDataViewColumn *GetSortingColumn() const;
virtual wxDataViewItem GetSelection() const;
virtual int GetSelections( wxDataViewItemArray & sel ) const;
virtual void SetSelections( const wxDataViewItemArray & sel );
virtual void Select( const wxDataViewItem & item );
virtual void Unselect( const wxDataViewItem & item );
virtual bool IsSelected( const wxDataViewItem & item ) const;
virtual void SelectAll();
virtual void UnselectAll();
virtual void EnsureVisible( const wxDataViewItem& item,
const wxDataViewColumn *column = nullptr );
virtual void HitTest( const wxPoint &point,
wxDataViewItem &item,
wxDataViewColumn *&column ) const;
virtual wxRect GetItemRect( const wxDataViewItem &item,
const wxDataViewColumn *column = nullptr ) const;
virtual void Collapse( const wxDataViewItem & item );
virtual bool IsExpanded( const wxDataViewItem & item ) const;
virtual bool EnableDragSource( const wxDataFormat &format );
virtual bool DoEnableDropTarget( const wxVector<wxDataFormat>& formats );
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
wxWindow *GetMainWindow() { return (wxWindow*) this; }
virtual void OnInternalIdle();
protected:
virtual void DoSetExpanderColumn();
virtual void DoSetIndent();
virtual void DoExpand( const wxDataViewItem & item, bool expandChildren );
private:
virtual wxDataViewItem DoGetCurrentItem() const;
virtual void DoSetCurrentItem(const wxDataViewItem& item);
};
#endif // _WX_QT_DATAVIEW_H_

View File

@@ -0,0 +1,58 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/datectrl.h
// Purpose: wxDatePickerCtrl for Qt
// Author: Ali Kettab
// Created: 2023-10-12
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_DATECTRL_H_
#define _WX_QT_DATECTRL_H_
class QDateEdit;
// ----------------------------------------------------------------------------
// wxDatePickerCtrl
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxDatePickerCtrl : public wxDatePickerCtrlBase
{
public:
// ctors
wxDatePickerCtrl() = default;
wxDatePickerCtrl(wxWindow *parent,
wxWindowID id,
const wxDateTime& dt = wxDefaultDateTime,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxDatePickerCtrlNameStr)
{
Create(parent, id, dt, pos, size, style, validator, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxDateTime& dt = wxDefaultDateTime,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDP_DEFAULT | wxDP_SHOWCENTURY,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxDatePickerCtrlNameStr);
// Override this one to add date-specific (and time-ignoring) checks.
virtual void SetValue(const wxDateTime& dt) override;
virtual wxDateTime GetValue() const override;
// Implement the base class pure virtuals.
virtual void SetRange(const wxDateTime& dt1, const wxDateTime& dt2) override;
virtual bool GetRange(wxDateTime *dt1, wxDateTime *dt2) const override;
QDateEdit* GetQDateEdit() const;
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDatePickerCtrl);
};
#endif // _WX_QT_DATECTRL_H_

View File

@@ -0,0 +1,148 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/dc.h
// Author: Peter Most, Javier Torres, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_DC_H_
#define _WX_QT_DC_H_
class QPainter;
class QImage;
class WXDLLIMPEXP_FWD_CORE wxRegion;
class WXDLLIMPEXP_CORE wxQtDCImpl : public wxDCImpl
{
public:
wxQtDCImpl( wxDC *owner );
~wxQtDCImpl();
virtual bool CanDrawBitmap() const override;
virtual bool CanGetTextExtent() const override;
virtual void DoGetSize(int *width, int *height) const override;
virtual void DoGetSizeMM(int* width, int* height) const override;
virtual int GetDepth() const override;
virtual wxSize GetPPI() const override;
virtual void SetFont(const wxFont& font) override;
virtual void SetPen(const wxPen& pen) override;
virtual void SetBrush(const wxBrush& brush) override;
virtual void SetBackground(const wxBrush& brush) override;
virtual void SetBackgroundMode(int mode) override;
#if wxUSE_PALETTE
virtual void SetPalette(const wxPalette& palette) override;
#endif // wxUSE_PALETTE
virtual void SetLogicalFunction(wxRasterOperationMode function) override;
virtual wxCoord GetCharHeight() const override;
virtual wxCoord GetCharWidth() const override;
virtual void DoGetTextExtent(const wxString& string,
wxCoord *x, wxCoord *y,
wxCoord *descent = nullptr,
wxCoord *externalLeading = nullptr,
const wxFont *theFont = nullptr) const override;
virtual void Clear() override;
void UpdateClipBox();
virtual bool DoGetClippingRect(wxRect& rect) const override;
virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
wxCoord width, wxCoord height) override;
virtual void DoSetDeviceClippingRegion(const wxRegion& region) override;
virtual void DestroyClippingRegion() override;
virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
wxFloodFillStyle style = wxFLOOD_SURFACE) override;
virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const override;
virtual void DoDrawPoint(wxCoord x, wxCoord y) override;
virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) override;
virtual void DoDrawArc(wxCoord x1, wxCoord y1,
wxCoord x2, wxCoord y2,
wxCoord xc, wxCoord yc) override;
virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
double sa, double ea) override;
virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) override;
virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
wxCoord width, wxCoord height,
double radius) override;
virtual void DoDrawEllipse(wxCoord x, wxCoord y,
wxCoord width, wxCoord height) override;
virtual void DoCrossHair(wxCoord x, wxCoord y) override;
virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) override;
virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
bool useMask = false) override;
virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) override;
virtual void DoDrawRotatedText(const wxString& text,
wxCoord x, wxCoord y, double angle) override;
virtual bool DoBlit(wxCoord xdest, wxCoord ydest,
wxCoord width, wxCoord height,
wxDC *source,
wxCoord xsrc, wxCoord ysrc,
wxRasterOperationMode rop = wxCOPY,
bool useMask = false,
wxCoord xsrcMask = wxDefaultCoord,
wxCoord ysrcMask = wxDefaultCoord) override;
virtual void DoDrawLines(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset ) override;
virtual void DoDrawPolygon(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE) override;
virtual void DoDrawPolyPolygon(int n, const int count[], const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle) override;
// Use Qt transformations, as they automatically scale pen widths, text...
virtual void ComputeScaleAndOrigin() override;
void QtPreparePainter();
virtual void* GetHandle() const override { return (void*) m_qtPainter; }
protected:
virtual QPixmap *GetQPixmap() { return m_qtPixmap; }
QPainter *m_qtPainter;
QPixmap *m_qtPixmap;
wxRegion m_clippingRegion;
bool m_isClipBoxValid = false;
private:
enum wxQtRasterColourOp
{
wxQtNONE,
wxQtWHITE,
wxQtBLACK,
wxQtINVERT
};
wxQtRasterColourOp m_rasterColourOp;
QColor *m_qtPenColor;
QColor *m_qtBrushColor;
void ApplyRasterColourOp();
wxDECLARE_CLASS(wxQtDCImpl);
wxDECLARE_NO_COPY_CLASS(wxQtDCImpl);
};
#endif // _WX_QT_DC_H_

View File

@@ -0,0 +1,67 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/dcclient.h
// Author: Peter Most, Javier Torres, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_DCCLIENT_H_
#define _WX_QT_DCCLIENT_H_
#include "wx/qt/dc.h"
#include <memory>
class QPicture;
class WXDLLIMPEXP_CORE wxWindowDCImpl : public wxQtDCImpl
{
public:
wxWindowDCImpl( wxDC *owner );
wxWindowDCImpl( wxDC *owner, wxWindow *win );
~wxWindowDCImpl();
virtual void DoGetSize(int *width, int *height) const override;
protected:
std::unique_ptr<QPicture> m_pict;
// @true if m_qtPainter is owned by the window, @false otherwise (default).
bool m_isWindowPainter = false;
private:
wxDECLARE_CLASS(wxWindowDCImpl);
wxDECLARE_NO_COPY_CLASS(wxWindowDCImpl);
};
class WXDLLIMPEXP_CORE wxClientDCImpl : public wxWindowDCImpl
{
public:
wxClientDCImpl( wxDC *owner );
wxClientDCImpl( wxDC *owner, wxWindow *win );
virtual void DoGetSize(int *width, int *height) const override;
static bool
CanBeUsedForDrawing(const wxWindow* WXUNUSED(window)) { return false; }
private:
wxDECLARE_CLASS(wxClientDCImpl);
wxDECLARE_NO_COPY_CLASS(wxClientDCImpl);
};
class WXDLLIMPEXP_CORE wxPaintDCImpl : public wxWindowDCImpl
{
public:
wxPaintDCImpl( wxDC *owner );
wxPaintDCImpl( wxDC *owner, wxWindow *win );
private:
wxDECLARE_CLASS(wxPaintDCImpl);
wxDECLARE_NO_COPY_CLASS(wxPaintDCImpl);
};
#endif // _WX_QT_DCCLIENT_H_

View File

@@ -0,0 +1,34 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/dcmemory.h
// Author: Peter Most, Javier Torres, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_DCMEMORY_H_
#define _WX_QT_DCMEMORY_H_
#include "wx/qt/dcclient.h"
class WXDLLIMPEXP_CORE wxMemoryDCImpl : public wxQtDCImpl
{
public:
wxMemoryDCImpl( wxMemoryDC *owner );
wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap );
wxMemoryDCImpl( wxMemoryDC *owner, wxDC *dc );
~wxMemoryDCImpl();
virtual wxBitmap DoGetAsBitmap(const wxRect *subrect) const override;
virtual void DoSelect(const wxBitmap& bitmap) override;
virtual const wxBitmap& GetSelectedBitmap() const override;
virtual wxBitmap& GetSelectedBitmap() override;
private:
wxBitmap m_selected;
wxDECLARE_CLASS(wxMemoryDCImpl);
wxDECLARE_NO_COPY_CLASS(wxMemoryDCImpl);
};
#endif // _WX_QT_DCMEMORY_H_

View File

@@ -0,0 +1,106 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/dcprint.h
// Author: Peter Most
// Copyright: (c) Peter Most
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_DCPRINT_H_
#define _WX_QT_DCPRINT_H_
#include "wx/dc.h"
class WXDLLIMPEXP_CORE wxPrinterDCImpl : public wxDCImpl
{
public:
wxPrinterDCImpl( wxPrinterDC *, const wxPrintData & );
virtual bool CanDrawBitmap() const override;
virtual bool CanGetTextExtent() const override;
virtual void DoGetSize(int *width, int *height) const override;
virtual void DoGetSizeMM(int* width, int* height) const override;
virtual int GetDepth() const override;
virtual wxSize GetPPI() const override;
virtual void SetFont(const wxFont& font) override;
virtual void SetPen(const wxPen& pen) override;
virtual void SetBrush(const wxBrush& brush) override;
virtual void SetBackground(const wxBrush& brush) override;
virtual void SetBackgroundMode(int mode) override;
#if wxUSE_PALETTE
virtual void SetPalette(const wxPalette& palette) override;
#endif // wxUSE_PALETTE
virtual void SetLogicalFunction(wxRasterOperationMode function) override;
virtual wxCoord GetCharHeight() const override;
virtual wxCoord GetCharWidth() const override;
virtual void DoGetTextExtent(const wxString& string,
wxCoord *x, wxCoord *y,
wxCoord *descent = nullptr,
wxCoord *externalLeading = nullptr,
const wxFont *theFont = nullptr) const override;
virtual void Clear() override;
virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
wxCoord width, wxCoord height) override;
virtual void DoSetDeviceClippingRegion(const wxRegion& region) override;
virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
wxFloodFillStyle style = wxFLOOD_SURFACE) override;
virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const override;
virtual void DoDrawPoint(wxCoord x, wxCoord y) override;
virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2) override;
virtual void DoDrawArc(wxCoord x1, wxCoord y1,
wxCoord x2, wxCoord y2,
wxCoord xc, wxCoord yc) override;
virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
double sa, double ea) override;
virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) override;
virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
wxCoord width, wxCoord height,
double radius) override;
virtual void DoDrawEllipse(wxCoord x, wxCoord y,
wxCoord width, wxCoord height) override;
virtual void DoCrossHair(wxCoord x, wxCoord y) override;
virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) override;
virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
bool useMask = false) override;
virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y) override;
virtual void DoDrawRotatedText(const wxString& text,
wxCoord x, wxCoord y, double angle) override;
virtual bool DoBlit(wxCoord xdest, wxCoord ydest,
wxCoord width, wxCoord height,
wxDC *source,
wxCoord xsrc, wxCoord ysrc,
wxRasterOperationMode rop = wxCOPY,
bool useMask = false,
wxCoord xsrcMask = wxDefaultCoord,
wxCoord ysrcMask = wxDefaultCoord) override;
virtual void DoDrawLines(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset ) override;
virtual void DoDrawPolygon(int n, const wxPoint points[],
wxCoord xoffset, wxCoord yoffset,
wxPolygonFillMode fillStyle = wxODDEVEN_RULE) override;
private:
wxDECLARE_CLASS(wxPrinterDCImpl);
wxDECLARE_NO_COPY_CLASS(wxPrinterDCImpl);
};
#endif // _WX_QT_DCPRINT_H_

View File

@@ -0,0 +1,27 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/dcscreen.h
// Author: Sean D'Epagnier
// Copyright: (c) Sean D'Epagnier
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_DCSCREEN_H_
#define _WX_QT_DCSCREEN_H_
#include "wx/qt/dcclient.h"
class WXDLLIMPEXP_CORE wxScreenDCImpl : public wxWindowDCImpl
{
public:
wxScreenDCImpl( wxScreenDC *owner );
~wxScreenDCImpl();
protected:
virtual void DoGetSize(int *width, int *height) const override;
virtual QPixmap *GetQPixmap() override;
wxDECLARE_ABSTRACT_CLASS(wxScreenDCImpl);
};
#endif // _WX_QT_DCSCREEN_H_

View File

@@ -0,0 +1,17 @@
/*
* Name: wx/qt/defs.h
* Author: Peter Most
* Copyright: (c) Peter Most
* Licence: wxWindows licence
*/
#ifndef _WX_QT_DEFS_H_
#define _WX_QT_DEFS_H_
#ifdef __cplusplus
typedef class QWidget *WXWidget;
#endif
#endif /* _WX_QT_DEFS_H_ */

View File

@@ -0,0 +1,48 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/dialog.h
// Author: Peter Most, Javier Torres, Mariano Reingart, Sean D'Epagnier
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_DIALOG_H_
#define _WX_QT_DIALOG_H_
#include "wx/dialog.h"
class QDialog;
class WXDLLIMPEXP_CORE wxDialog : public wxDialogBase
{
public:
wxDialog() = default;
wxDialog( wxWindow *parent, wxWindowID id,
const wxString &title,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE,
const wxString &name = wxASCII_STR(wxDialogNameStr) );
virtual ~wxDialog();
bool Create( wxWindow *parent, wxWindowID id,
const wxString &title,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE,
const wxString &name = wxASCII_STR(wxDialogNameStr) );
virtual int ShowModal() override;
virtual void EndModal(int retCode) override;
virtual bool IsModal() const override;
virtual bool Show(bool show = true) override;
QDialog *GetDialogHandle() const;
private:
wxDECLARE_DYNAMIC_CLASS( wxDialog );
};
#endif // _WX_QT_DIALOG_H_

View File

@@ -0,0 +1,46 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/dirdlg.h
// Author: Sean D'Epagnier
// Copyright: (c) 2014 Sean D'Epagnier
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_DIRDLG_H_
#define _WX_QT_DIRDLG_H_
class QFileDialog;
class WXDLLIMPEXP_CORE wxDirDialog : public wxDirDialogBase
{
public:
wxDirDialog() = default;
wxDirDialog(wxWindow *parent,
const wxString& message = wxASCII_STR(wxDirSelectorPromptStr),
const wxString& defaultPath = wxEmptyString,
long style = wxDD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const wxString& name = wxASCII_STR(wxDirDialogNameStr));
bool Create(wxWindow *parent,
const wxString& message = wxASCII_STR(wxDirSelectorPromptStr),
const wxString& defaultPath = wxEmptyString,
long style = wxDD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const wxString& name = wxASCII_STR(wxDirDialogNameStr));
public: // overrides from wxGenericDirDialog
wxString GetPath() const override;
void SetPath(const wxString& path) override;
private:
virtual QFileDialog *GetQFileDialog() const;
wxDECLARE_DYNAMIC_CLASS(wxDirDialog);
};
#endif // _WX_QT_DIRDLG_H_

View File

@@ -0,0 +1,58 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/dnd.h
// Author: Peter Most
// Copyright: (c) Peter Most
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_DND_H_
#define _WX_QT_DND_H_
#ifdef __WINDOWS__
#define wxDROP_ICON(name) wxCursor(#name)
#else
#define wxDROP_ICON(name) wxCursor(name##_xpm)
#endif
class WXDLLIMPEXP_CORE wxDropTarget : public wxDropTargetBase
{
public:
wxDropTarget(wxDataObject *dataObject = nullptr);
virtual ~wxDropTarget();
virtual bool OnDrop(wxCoord x, wxCoord y) override;
virtual wxDragResult OnData(wxCoord x,
wxCoord y,
wxDragResult def) override;
virtual bool GetData() override;
wxDataFormat GetMatchingPair();
void ConnectTo(QWidget* widget);
void Disconnect();
private:
class Impl;
Impl* m_pImpl;
};
class WXDLLIMPEXP_CORE wxDropSource: public wxDropSourceBase
{
public:
wxDropSource(wxWindow *win = nullptr,
const wxCursorBundle& copy = {},
const wxCursorBundle& move = {},
const wxCursorBundle& none = {});
wxDropSource(wxDataObject& data,
wxWindow *win,
const wxCursorBundle& copy = {},
const wxCursorBundle& move = {},
const wxCursorBundle& none = {});
virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly) override;
private:
wxWindow* m_parentWindow;
};
#endif // _WX_QT_DND_H_

View File

@@ -0,0 +1,32 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/dvrenderer.h
// Author: Peter Most
// Copyright: (c) Peter Most
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_DVRENDERER_H_
#define _WX_QT_DVRENDERER_H_
// ----------------------------------------------------------------------------
// wxDataViewRenderer
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxDataViewRenderer: public wxDataViewRendererBase
{
public:
wxDataViewRenderer( const wxString &varianttype,
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT );
virtual void SetMode( wxDataViewCellMode mode );
virtual wxDataViewCellMode GetMode() const;
virtual void SetAlignment( int align );
virtual int GetAlignment() const;
virtual void EnableEllipsize(wxEllipsizeMode mode = wxELLIPSIZE_MIDDLE);
virtual wxEllipsizeMode GetEllipsizeMode() const;
};
#endif // _WX_QT_DVRENDERER_H_

View File

@@ -0,0 +1,192 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/dvrenderers.h
// Author: Peter Most
// Copyright: (c) Peter Most
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_DVRENDERERS_H_
#define _WX_QT_DVRENDERERS_H_
// ---------------------------------------------------------
// wxDataViewTextRenderer
// ---------------------------------------------------------
class WXDLLIMPEXP_ADV wxDataViewTextRenderer: public wxDataViewRenderer
{
public:
static wxString GetDefaultType() { return wxS("string"); }
wxDataViewTextRenderer( const wxString &varianttype = GetDefaultType(),
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT );
bool SetValue( const wxVariant &value );
bool GetValue( wxVariant &value ) const;
void SetAlignment( int align );
};
// ---------------------------------------------------------
// wxDataViewBitmapRenderer
// ---------------------------------------------------------
class WXDLLIMPEXP_ADV wxDataViewBitmapRenderer: public wxDataViewRenderer
{
public:
static wxString GetDefaultType() { return wxS("wxBitmapBundle"); }
wxDataViewBitmapRenderer( const wxString &varianttype = GetDefaultType(),
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT );
bool SetValue( const wxVariant &value );
bool GetValue( wxVariant &value ) const;
bool IsCompatibleVariantType(const wxString& variantType) const;
};
// ---------------------------------------------------------
// wxDataViewToggleRenderer
// ---------------------------------------------------------
class WXDLLIMPEXP_ADV wxDataViewToggleRenderer: public wxDataViewRenderer
{
public:
static wxString GetDefaultType() { return wxS("bool"); }
wxDataViewToggleRenderer( const wxString &varianttype = GetDefaultType(),
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT );
bool SetValue( const wxVariant &value );
bool GetValue( wxVariant &value ) const;
};
// ---------------------------------------------------------
// wxDataViewCustomRenderer
// ---------------------------------------------------------
class WXDLLIMPEXP_ADV wxDataViewCustomRenderer: public wxDataViewRenderer
{
public:
static wxString GetDefaultType() { return wxS("string"); }
wxDataViewCustomRenderer( const wxString &varianttype = GetDefaultType(),
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT,
bool no_init = false );
virtual ~wxDataViewCustomRenderer();
virtual bool Render( wxRect cell, wxDC *dc, int state ) = 0;
void RenderText( const wxString &text, int xoffset, wxRect cell, wxDC *dc, int state );
virtual wxSize GetSize() const = 0;
virtual bool Activate( wxRect WXUNUSED(cell),
wxDataViewModel *WXUNUSED(model), const wxDataViewItem &WXUNUSED(item), unsigned int WXUNUSED(col) )
{ return false; }
virtual bool LeftClick( wxPoint WXUNUSED(cursor), wxRect WXUNUSED(cell),
wxDataViewModel *WXUNUSED(model), const wxDataViewItem &WXUNUSED(item), unsigned int WXUNUSED(col) )
{ return false; }
virtual bool StartDrag( wxPoint WXUNUSED(cursor), wxRect WXUNUSED(cell),
wxDataViewModel *WXUNUSED(model), const wxDataViewItem &WXUNUSED(item), unsigned int WXUNUSED(col) )
{ return false; }
// Create DC on request
virtual wxDC *GetDC();
};
// ---------------------------------------------------------
// wxDataViewProgressRenderer
// ---------------------------------------------------------
class WXDLLIMPEXP_ADV wxDataViewProgressRenderer: public wxDataViewCustomRenderer
{
public:
static wxString GetDefaultType() { return wxS("long"); }
wxDataViewProgressRenderer( const wxString &label = wxEmptyString,
const wxString &varianttype = GetDefaultType(),
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT );
virtual ~wxDataViewProgressRenderer();
bool SetValue( const wxVariant &value );
bool GetValue( wxVariant &value ) const;
virtual bool Render( wxRect cell, wxDC *dc, int state );
virtual wxSize GetSize() const;
};
// ---------------------------------------------------------
// wxDataViewIconTextRenderer
// ---------------------------------------------------------
class WXDLLIMPEXP_ADV wxDataViewIconTextRenderer: public wxDataViewCustomRenderer
{
public:
static wxString GetDefaultType() { return wxS("wxDataViewIconText"); }
wxDataViewIconTextRenderer( const wxString &varianttype = GetDefaultType(),
wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
int align = wxDVR_DEFAULT_ALIGNMENT );
virtual ~wxDataViewIconTextRenderer();
bool SetValue( const wxVariant &value );
bool GetValue( wxVariant &value ) const;
virtual bool Render( wxRect cell, wxDC *dc, int state );
virtual wxSize GetSize() const;
virtual bool HasEditorCtrl() const { return true; }
virtual wxControl* CreateEditorCtrl( wxWindow *parent, wxRect labelRect, const wxVariant &value );
virtual bool GetValueFromEditorCtrl( wxControl* editor, wxVariant &value );
};
// ---------------------------------------------------------
// wxDataViewDateRenderer
// ---------------------------------------------------------
class WXDLLIMPEXP_ADV wxDataViewDateRenderer: public wxDataViewCustomRenderer
{
public:
static wxString GetDefaultType() { return wxS("datetime"); }
wxDataViewDateRenderer( const wxString &varianttype = GetDefaultType(),
wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
int align = wxDVR_DEFAULT_ALIGNMENT );
bool SetValue( const wxVariant &value );
bool GetValue( wxVariant &value ) const;
virtual bool Render( wxRect cell, wxDC *dc, int state );
virtual wxSize GetSize() const;
virtual bool Activate( wxRect cell,
wxDataViewModel *model, const wxDataViewItem &item, unsigned int col );
};
// -------------------------------------
// wxDataViewChoiceRenderer
// -------------------------------------
class WXDLLIMPEXP_ADV wxDataViewChoiceRenderer: public wxDataViewCustomRenderer
{
public:
wxDataViewChoiceRenderer( const wxArrayString &choices,
wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
int alignment = wxDVR_DEFAULT_ALIGNMENT );
virtual bool Render( wxRect rect, wxDC *dc, int state );
virtual wxSize GetSize() const;
virtual bool SetValue( const wxVariant &value );
virtual bool GetValue( wxVariant &value ) const;
void SetAlignment( int align );
};
#endif // _WX_QT_DVRENDERERS_H_

View File

@@ -0,0 +1,61 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/evtloop.h
// Author: Peter Most, Javier Torres, Mariano Reingart, Sean D'Epagnier
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_EVTLOOP_H_
#define _WX_QT_EVTLOOP_H_
class wxQtIdleTimer;
class QEventLoop;
class WXDLLIMPEXP_CORE wxQtEventLoopBase : public wxEventLoopBase
{
public:
wxQtEventLoopBase();
~wxQtEventLoopBase();
virtual int DoRun() override;
virtual void DoStop(int rc) override;
virtual bool Pending() const override;
virtual bool Dispatch() override;
virtual int DispatchTimeout(unsigned long timeout) override;
virtual void WakeUp() override;
virtual void DoYieldFor(long eventsToProcess) override;
void ScheduleIdleCheck();
// Non-blocking Dispatch() version:
// Returns true if an event was processed, otherwise returns false.
// This function is added to address code like:
//
// while (evtloop->Pending())
// evtloop->Dispatch();
//
// which can simply replaced with:
//
// while (evtloop->QtDispatch())
// ;
bool QtDispatch() const;
private:
QEventLoop *m_qtEventLoop;
wxObjectDataPtr<wxQtIdleTimer> m_qtIdleTimer;
wxDECLARE_NO_COPY_CLASS(wxQtEventLoopBase);
};
#if wxUSE_GUI
class WXDLLIMPEXP_CORE wxGUIEventLoop : public wxQtEventLoopBase
{
public:
wxGUIEventLoop();
};
#endif // wxUSE_GUI
#endif // _WX_QT_EVTLOOP_H_

View File

@@ -0,0 +1,58 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/filedlg.h
// Author: Sean D'Epagnier
// Copyright: (c) 2014 Sean D'Epagnier
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_FILEDLG_H_
#define _WX_QT_FILEDLG_H_
class QFileDialog;
class WXDLLIMPEXP_CORE wxFileDialog : public wxFileDialogBase
{
public:
wxFileDialog() = default;
wxFileDialog(wxWindow *parent,
const wxString& message = wxASCII_STR(wxFileSelectorPromptStr),
const wxString& defaultDir = wxEmptyString,
const wxString& defaultFile = wxEmptyString,
const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr),
long style = wxFD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& sz = wxDefaultSize,
const wxString& name = wxASCII_STR(wxFileDialogNameStr));
bool Create(wxWindow *parent,
const wxString& message = wxASCII_STR(wxFileSelectorPromptStr),
const wxString& defaultDir = wxEmptyString,
const wxString& defaultFile = wxEmptyString,
const wxString& wildCard = wxASCII_STR(wxFileSelectorDefaultWildcardStr),
long style = wxFD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& sz = wxDefaultSize,
const wxString& name = wxASCII_STR(wxFileDialogNameStr));
virtual wxString GetPath() const override;
virtual void GetPaths(wxArrayString& paths) const override;
virtual wxString GetFilename() const override;
virtual void GetFilenames(wxArrayString& files) const override;
virtual int GetFilterIndex() const override;
virtual void SetMessage(const wxString& message) override;
virtual void SetPath(const wxString& path) override;
virtual void SetDirectory(const wxString& dir) override;
virtual void SetFilename(const wxString& name) override;
virtual void SetWildcard(const wxString& wildCard) override;
virtual void SetFilterIndex(int filterIndex) override;
virtual bool SupportsExtraControl() const override { return true; }
virtual QFileDialog *GetQFileDialog() const;
private:
wxDECLARE_DYNAMIC_CLASS(wxFileDialog);
};
#endif // _WX_QT_FILEDLG_H_

View File

@@ -0,0 +1,90 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/font.h
// Author: Peter Most, Javier Torres, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_FONT_H_
#define _WX_QT_FONT_H_
class QFont;
class WXDLLIMPEXP_CORE wxFont : public wxFontBase
{
public:
wxFont();
wxFont(const wxFontInfo& info);
wxFont(const wxString& nativeFontInfoString);
wxFont(const wxNativeFontInfo& info);
wxFont(const QFont& font);
wxFont(int size,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
wxFont(const wxSize& pixelSize,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
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);
bool Create(wxSize size,
wxFontFamily family,
wxFontStyle style,
wxFontWeight weight,
bool underlined = false,
const wxString& face = wxEmptyString,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
// accessors: get the font characteristics
virtual int GetPointSize() const override;
virtual double GetFractionalPointSize() const override;
virtual wxSize GetPixelSize() const override;
virtual wxFontStyle GetStyle() const override;
virtual int GetNumericWeight() const override;
virtual bool GetUnderlined() const override;
virtual wxString GetFaceName() const override;
virtual wxFontEncoding GetEncoding() const override;
virtual const wxNativeFontInfo *GetNativeFontInfo() const override;
virtual bool GetStrikethrough() const override;
// change the font characteristics
virtual void SetFractionalPointSize(double pointSize) override;
virtual void SetPixelSize(const wxSize& pixelSize) override;
virtual void SetFamily( wxFontFamily family ) override;
virtual void SetStyle( wxFontStyle style ) override;
virtual void SetNumericWeight(int weight) override;
virtual bool SetFaceName(const wxString& facename) override;
virtual void SetUnderlined( bool underlined ) override;
virtual void SetStrikethrough(bool strikethrough) override;
virtual void SetEncoding(wxFontEncoding encoding) override;
wxDECLARE_COMMON_FONT_METHODS();
virtual QFont GetHandle() const;
protected:
virtual wxGDIRefData *CreateGDIRefData() const override;
wxNODISCARD virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const override;
virtual wxFontFamily DoGetFamily() const override;
virtual void DoSetNativeFontInfo(const wxNativeFontInfo& info) override;
wxDECLARE_DYNAMIC_CLASS(wxFont);
};
#endif // _WX_QT_FONT_H_

View File

@@ -0,0 +1,30 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/fontdlg.h
// Author: Peter Most
// Copyright: (c) Peter Most
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_FONTDLG_H_
#define _WX_QT_FONTDLG_H_
class QFontDialog;
class WXDLLIMPEXP_CORE wxFontDialog : public wxFontDialogBase
{
public:
wxFontDialog() = default;
wxFontDialog(wxWindow *parent) { Create(parent); }
wxFontDialog(wxWindow *parent, const wxFontData& data) { Create(parent, data); }
protected:
bool DoCreate(wxWindow *parent) override;
private:
wxFontData m_data;
wxDECLARE_DYNAMIC_CLASS(wxFontDialog);
};
#endif // _WX_QT_FONTDLG_H_

View File

@@ -0,0 +1,73 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/frame.h
// Purpose: wxFrame class interface
// Author: Peter Most
// Created: 09.08.09
// Copyright: (c) Peter Most
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_FRAME_H_
#define _WX_QT_FRAME_H_
#include "wx/frame.h"
class QMainWindow;
class QToolBar;
class WXDLLIMPEXP_CORE wxFrame : public wxFrameBase
{
public:
wxFrame() = default;
wxFrame(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxASCII_STR(wxFrameNameStr))
{
Create( parent, id, title, pos, size, style, name );
}
virtual ~wxFrame();
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 void SetMenuBar(wxMenuBar *menubar) override;
#if wxUSE_STATUSBAR
virtual void SetStatusBar(wxStatusBar *statusBar ) override;
#endif // wxUSE_STATUSBAR
#if wxUSE_TOOLBAR
virtual void SetToolBar(wxToolBar *toolbar) override;
#endif // wxUSE_TOOLBAR
virtual void SetWindowStyleFlag( long style ) override;
virtual void AddChild( wxWindowBase *child ) override;
virtual void RemoveChild( wxWindowBase *child ) override;
QMainWindow *GetQMainWindow() const;
protected:
virtual wxPoint GetClientAreaOrigin() const override;
virtual QWidget* QtGetParentWidget() const override;
private:
// Currently active native toolbar.
QToolBar* m_qtToolBar = nullptr;
wxDECLARE_DYNAMIC_CLASS(wxFrame);
};
#endif // _WX_QT_FRAME_H_

View File

@@ -0,0 +1,48 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/gauge.h
// Author: Peter Most, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_GAUGE_H_
#define _WX_QT_GAUGE_H_
class QProgressBar;
class WXDLLIMPEXP_CORE wxGauge : public wxGaugeBase
{
public:
wxGauge() = default;
wxGauge(wxWindow *parent,
wxWindowID id,
int range,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxGA_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxGaugeNameStr));
bool Create(wxWindow *parent,
wxWindowID id,
int range,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxGA_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxGaugeNameStr));
// set/get the control range
virtual void SetRange(int range) override;
virtual int GetRange() const override;
virtual void SetValue(int pos) override;
virtual int GetValue() const override;
QProgressBar* GetQProgressBar() const;
wxDECLARE_DYNAMIC_CLASS(wxGauge);
};
#endif // _WX_QT_GAUGE_H_

View File

@@ -0,0 +1,92 @@
/////////////////////////////////////////////////////////////////////////////
// Name: include/wx/qt/glcanvas.cpp
// Author: Sean D'Epagnier
// Copyright: (c) Sean D'Epagnier 2014
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GLCANVAS_H_
#define _WX_GLCANVAS_H_
#include <GL/gl.h>
class QOpenGLWidget;
class QOpenGLContext;
class QSurfaceFormat;
class WXDLLIMPEXP_GL wxGLContext : public wxGLContextBase
{
public:
wxGLContext(wxGLCanvas *win,
const wxGLContext *other = nullptr,
const wxGLContextAttrs *ctxAttrs = nullptr);
/// virtual ~wxGLContext();
virtual bool SetCurrent(const wxGLCanvas& win) const override;
private:
QOpenGLContext* m_glContext = nullptr;
wxDECLARE_CLASS(wxGLContext);
};
// ----------------------------------------------------------------------------
// wxGLCanvas: OpenGL output window
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_GL wxGLCanvas : public wxGLCanvasBase
{
public:
wxGLCanvas() = default;
explicit // avoid implicitly converting a wxWindow* to wxGLCanvas
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
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);
~wxGLCanvas();
bool Create(wxWindow *parent,
const wxGLAttributes& dispAttrs,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxGLCanvasName,
const wxPalette& palette = wxNullPalette);
bool Create(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxGLCanvasName,
const int *attribList = nullptr,
const wxPalette& palette = wxNullPalette);
virtual bool SwapBuffers() override;
virtual bool QtCanPaintWithoutActivePainter() const override;
static bool ConvertWXAttrsToQtGL(const wxGLAttributes &glattrs, const wxGLContextAttrs ctxAttrs, QSurfaceFormat &format);
private:
wxDECLARE_CLASS(wxGLCanvas);
};
#endif // _WX_GLCANVAS_H_

View File

@@ -0,0 +1,103 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/listbox.h
// Author: Peter Most, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_LISTBOX_H_
#define _WX_QT_LISTBOX_H_
class QListWidget;
class QModelIndex;
class WXDLLIMPEXP_CORE wxListBox : public wxListBoxBase
{
public:
wxListBox() = default;
wxListBox(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = nullptr,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxListBoxNameStr));
wxListBox(wxWindow *parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxListBoxNameStr));
virtual ~wxListBox();
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = nullptr,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxListBoxNameStr));
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxListBoxNameStr));
virtual bool IsSelected(int n) const override;
virtual int GetSelections(wxArrayInt& aSelections) const override;
virtual unsigned int GetCount() const override;
virtual wxString GetString(unsigned int n) const override;
virtual void SetString(unsigned int n, const wxString& s) override;
virtual int GetSelection() const override;
virtual void EnsureVisible(int item) override;
virtual int GetTopItem() const override;
virtual int GetCountPerPage() const override;
void QtSendEvent(wxEventType evtType, int rowIndex, bool selected);
QListWidget* GetQListWidget() const;
protected:
virtual void DoSetFirstItem(int n) override;
virtual void DoSetSelection(int n, bool select) override;
virtual int DoInsertItems(const wxArrayStringsAdapter & items,
unsigned int pos,
void **clientData,
wxClientDataType type) override;
virtual int DoInsertOneItem(const wxString& item, unsigned int pos) override;
virtual void DoSetItemClientData(unsigned int n, void *clientData) override;
virtual void *DoGetItemClientData(unsigned int n) const override;
virtual void DoClear() override;
virtual void DoDeleteOneItem(unsigned int pos) override;
virtual int DoListHitTest(const wxPoint& point) const override;
#if wxUSE_CHECKLISTBOX
bool m_hasCheckBoxes = false;
#endif // wxUSE_CHECKLISTBOX
private:
// Common part of both Create() overloads.
void DoCreate(wxWindow* parent, long style);
void UnSelectAll();
wxDECLARE_DYNAMIC_CLASS(wxListBox);
};
#endif // _WX_QT_LISTBOX_H_

View File

@@ -0,0 +1,291 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/listctrl.h
// Author: Mariano Reingart, Peter Most
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_LISTCTRL_H_
#define _WX_QT_LISTCTRL_H_
#include "wx/textctrl.h"
class wxQtListTreeWidget;
class wxQtListModel;
class wxQtVirtualListModel;
class WXDLLIMPEXP_CORE wxListCtrl: public wxListCtrlBase
{
public:
wxListCtrl() = default;
wxListCtrl(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxLC_ICON,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxListCtrlNameStr));
bool Create(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxLC_ICON,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxListCtrlNameStr));
virtual ~wxListCtrl();
// Attributes
////////////////////////////////////////////////////////////////////////////
// Set the control colours
bool SetForegroundColour(const wxColour& col) override;
bool SetBackgroundColour(const wxColour& col) override;
// Gets information about this column
bool GetColumn(int col, wxListItem& info) const override;
// Sets information about this column
bool SetColumn(int col, const wxListItem& info) override;
// Gets the column width
int GetColumnWidth(int col) const override;
// Sets the column width
bool SetColumnWidth(int col, int width) override;
// Gets the column order from its index or index from its order
int GetColumnOrder(int col) const override;
int GetColumnIndexFromOrder(int order) const override;
// Gets the column order for all columns
wxArrayInt GetColumnsOrder() const override;
// Sets the column order for all columns
bool SetColumnsOrder(const wxArrayInt& orders) override;
// Gets the number of items that can fit vertically in the
// visible area of the list control (list or report view)
// or the total number of items in the list control (icon
// or small icon view)
int GetCountPerPage() const;
// return the total area occupied by all the items (icon/small icon only)
wxRect GetViewRect() const;
// Gets the edit control for editing labels.
wxTextCtrl* GetEditControl() const;
// Gets information about the item
bool GetItem(wxListItem& info) const;
// Sets information about the item
bool SetItem(wxListItem& info);
// Sets a string field at a particular column
long SetItem(long index, int col, const wxString& label, int imageId = -1);
// Gets the item state
int GetItemState(long item, long stateMask) const;
// Sets the item state
bool SetItemState(long item, long state, long stateMask);
// Sets the item image
bool SetItemImage(long item, int image, int selImage = -1);
bool SetItemColumnImage(long item, long column, int image);
// Gets the item text
wxString GetItemText(long item, int col = 0) const;
// Sets the item text
void SetItemText(long item, const wxString& str);
// Gets the item data
wxUIntPtr GetItemData(long item) const;
// Sets the item data
bool SetItemPtrData(long item, wxUIntPtr data);
bool SetItemData(long item, long data);
// Gets the item rectangle
bool GetItemRect(long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const;
// Gets the subitem rectangle in report mode
bool GetSubItemRect(long item, long subItem, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const;
// Gets the item position
bool GetItemPosition(long item, wxPoint& pos) const;
// Sets the item position
bool SetItemPosition(long item, const wxPoint& pos);
// Gets the number of items in the list control
int GetItemCount() const override;
// Gets the number of columns in the list control
int GetColumnCount() const override;
// get the horizontal and vertical components of the item spacing
wxSize GetItemSpacing() const;
// Foreground colour of an item.
void SetItemTextColour( long item, const wxColour& col);
wxColour GetItemTextColour( long item ) const;
// Background colour of an item.
void SetItemBackgroundColour( long item, const wxColour &col);
wxColour GetItemBackgroundColour( long item ) const;
// Font of an item.
void SetItemFont( long item, const wxFont &f);
wxFont GetItemFont( long item ) const;
// Gets the number of selected items in the list control
int GetSelectedItemCount() const;
// Gets the text colour of the listview
wxColour GetTextColour() const;
// Sets the text colour of the listview
void SetTextColour(const wxColour& col);
// Gets the index of the topmost visible item when in
// list or report view
long GetTopItem() const;
virtual bool HasCheckBoxes() const override;
virtual bool EnableCheckBoxes(bool enable = true) override;
virtual bool IsItemChecked(long item) const override;
virtual void CheckItem(long item, bool check) override;
// Add or remove a single window style
void SetSingleStyle(long style, bool add = true);
// Set the whole window style
void SetWindowStyleFlag(long style) override;
// Searches for an item, starting from 'item'.
// item can be -1 to find the first item that matches the
// specified flags.
// Returns the item or -1 if unsuccessful.
long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE) const;
// refresh items selectively (only useful for virtual list controls)
void RefreshItem(long item);
void RefreshItems(long itemFrom, long itemTo);
// Operations
////////////////////////////////////////////////////////////////////////////
// Arranges the items
bool Arrange(int flag = wxLIST_ALIGN_DEFAULT);
// Deletes an item
bool DeleteItem(long item);
// Deletes all items
bool DeleteAllItems();
// Deletes a column
bool DeleteColumn(int col) override;
// Deletes all columns
bool DeleteAllColumns() override;
// Clears items, and columns if there are any.
void ClearAll();
// Edit the label
wxTextCtrl* EditLabel(long item, wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl));
// End label editing, optionally cancelling the edit
bool EndEditLabel(bool cancel);
// Ensures this item is visible
bool EnsureVisible(long item);
bool IsVisible(long item) const override;
// Find an item whose label matches this string, starting from the item after 'start'
// or the beginning if 'start' is -1.
long FindItem(long start, const wxString& str, bool partial = false);
// Find an item whose data matches this data, starting from the item after 'start'
// or the beginning if 'start' is -1.
long FindItem(long start, wxUIntPtr data);
// Find an item nearest this position in the specified direction, starting from
// the item after 'start' or the beginning if 'start' is -1.
long FindItem(long start, const wxPoint& pt, int direction);
// Determines which item (if any) is at the specified point,
// giving details in 'flags' (see wxLIST_HITTEST_... flags above)
// Request the subitem number as well at the given coordinate.
long HitTest(const wxPoint& point, int& flags, long* ptrSubItem = nullptr) const;
// Inserts an item, returning the index of the new item if successful,
// -1 otherwise.
long InsertItem(const wxListItem& info);
// Insert a string item
long InsertItem(long index, const wxString& label);
// Insert an image item
long InsertItem(long index, int imageIndex);
// Insert an image/string item
long InsertItem(long index, const wxString& label, int imageIndex);
// set the number of items in a virtual list control
void SetItemCount(long count);
// Scrolls the list control. If in icon, small icon or report view mode,
// x specifies the number of pixels to scroll. If in list view mode, x
// specifies the number of columns to scroll.
// If in icon, small icon or list view mode, y specifies the number of pixels
// to scroll. If in report view mode, y specifies the number of lines to scroll.
bool ScrollList(int dx, int dy);
// Sort items.
// fn is a function which takes 3 long arguments: item1, item2, data.
// item1 is the long data associated with a first item (NOT the index).
// item2 is the long data associated with a second item (NOT the index).
// data is the same value as passed to SortItems.
// The return value is a negative number if the first item should precede the second
// item, a positive number of the second item should precede the first,
// or zero if the two items are equivalent.
// data is arbitrary data to be passed to the sort function.
bool SortItems(wxListCtrlCompare fn, wxIntPtr data);
// Sort indicator in header.
virtual void ShowSortIndicator(int col, bool ascending = true) override;
virtual int GetSortIndicator() const override;
virtual bool IsAscendingSortIndicator() const override;
wxQtListTreeWidget* GetQListTreeWidget() const;
protected:
// Implement base class pure virtual methods.
virtual long DoInsertColumn(long col, const wxListItem& info) override;
void DoUpdateImages(int which) override;
bool m_hasCheckBoxes = false;
private:
// Allow access to OnGetItemXXX() method from the virtual model class.
friend class wxQtVirtualListModel;
wxQtListModel *m_model = nullptr;
wxDECLARE_DYNAMIC_CLASS(wxListCtrl);
};
#endif

View File

@@ -0,0 +1,163 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/mdi.h
// Author: Peter Most, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_MDI_H_
#define _WX_QT_MDI_H_
class QMdiArea;
class QMdiSubWindow;
class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase
{
public:
wxMDIParentFrame() = default;
wxMDIParentFrame(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
const wxString& name = wxASCII_STR(wxFrameNameStr));
~wxMDIParentFrame();
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
const wxString& name = wxASCII_STR(wxFrameNameStr));
QMdiArea* GetQtMdiArea() const;
enum class Layout
{
MDI,
Tabbed
};
void QtSetPreferredDILayout(Layout layout);
// override/implement base class [pure] virtual methods
// ----------------------------------------------------
// The default is to return what wxMDIParentFrame::IsTDI() is supposed to
// return under the target platform. i.e. wxMSW and wxOSX return false,
// while wxGTK returns true. Use QtSetPreferredDILayout() to change that.
static bool IsTDI() { return ms_layout == Layout::Tabbed; }
virtual void Cascade() override;
virtual void Tile(wxOrientation orient = wxHORIZONTAL) override;
virtual void ActivateNext() override;
virtual void ActivatePrevious() override;
// implementation only from now on
// MDI helpers
// -----------
#if wxUSE_MENUS
// called by wxMDIChildFrame after it was successfully created
void AddMDIChild(wxMDIChildFrame* child);
// called by wxMDIChildFrame just before it is destroyed
void RemoveMDIChild(wxMDIChildFrame* child);
#endif // wxUSE_MENUS
private:
void OnMDICommand(wxCommandEvent& event);
// add/remove window menu if we have it (i.e. m_windowMenu != nullptr)
void AddWindowMenu();
void RemoveWindowMenu();
// update the window menu (if we have it) to enable or disable the commands
// which only make sense when we have more than one child
void UpdateWindowMenu(bool enable);
// return the number of child frames we currently have (maybe 0)
int GetChildFramesCount() const;
// TDI=true, MDI=false
// Default to false under Windows, true otherwise.
static Layout ms_layout;
wxDECLARE_DYNAMIC_CLASS(wxMDIParentFrame);
};
class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxMDIChildFrameBase
{
public:
wxMDIChildFrame() = default;
wxMDIChildFrame(wxMDIParentFrame *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxASCII_STR(wxFrameNameStr));
~wxMDIChildFrame();
bool Create(wxMDIParentFrame *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxASCII_STR(wxFrameNameStr));
virtual void Activate() override;
virtual void SetMenuBar(wxMenuBar* menubar) override;
// This function is responsible for attaching/detaching this frame's menubar
// to m_mdiParent. i.e. the menubar is attached when this frame becomes active
// Otherwise, it will be detached and the m_mdiParent's menubar will be restored.
void InternalSetMenuBar();
// wxMDIChildFrame doesn't have toolbar nor statusbar
// --------------------------------------------------
#if wxUSE_STATUSBAR
virtual void SetStatusBar(wxStatusBar* WXUNUSED(statusBar)) override {}
#endif // wxUSE_STATUSBAR
#if wxUSE_TOOLBAR
virtual void SetToolBar(wxToolBar* WXUNUSED(toolbar)) override {}
#endif // wxUSE_TOOLBAR
virtual void SetWindowStyleFlag( long style ) override;
private:
void AttachWindowMenuTo(wxMenuBar* attachedMenuBar, wxMenuBar* detachedMenuBar);
wxMenuBar* m_menuBar = nullptr;
QMdiSubWindow* m_qtSubWindow = nullptr;
wxDECLARE_DYNAMIC_CLASS(wxMDIChildFrame);
};
class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase
{
public:
wxMDIClientWindow() = default;
virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL) override;
wxDECLARE_DYNAMIC_CLASS(wxMDIClientWindow);
};
#endif // _WX_QT_MDI_H_

View File

@@ -0,0 +1,61 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/menu.h
// Author: Peter Most, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_MENU_H_
#define _WX_QT_MENU_H_
class QMenu;
class QMenuBar;
class WXDLLIMPEXP_CORE wxMenu : public wxMenuBase
{
public:
explicit wxMenu(long style = 0);
explicit wxMenu(const wxString& title, long style = 0);
virtual QMenu *GetHandle() const;
protected:
virtual wxMenuItem *DoAppend(wxMenuItem *item) override;
virtual wxMenuItem *DoInsert(size_t pos, wxMenuItem *item) override;
virtual wxMenuItem *DoRemove(wxMenuItem *item) override;
private:
QMenu *m_qtMenu;
wxDECLARE_DYNAMIC_CLASS(wxMenu);
};
class WXDLLIMPEXP_CORE wxMenuBar : public wxMenuBarBase
{
public:
wxMenuBar();
explicit wxMenuBar(long style);
wxMenuBar(size_t n, wxMenu *menus[], const wxString titles[], long style = 0);
virtual bool Append(wxMenu *menu, const wxString& title) override;
virtual bool Insert(size_t pos, wxMenu *menu, const wxString& title) override;
virtual wxMenu *Remove(size_t pos) override;
virtual void EnableTop(size_t pos, bool enable) override;
virtual bool IsEnabledTop(size_t pos) const override;
virtual void SetMenuLabel(size_t pos, const wxString& label) override;
virtual wxString GetMenuLabel(size_t pos) const override;
QMenuBar* GetQMenuBar() const;
virtual void Attach(wxFrame *frame) override;
virtual void Detach() override;
private:
wxDECLARE_DYNAMIC_CLASS(wxMenuBar);
};
#endif // _WX_QT_MENU_H_

View File

@@ -0,0 +1,58 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/menuitem.h
// Author: Peter Most, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_MENUITEM_H_
#define _WX_QT_MENUITEM_H_
#include "wx/menuitem.h"
#include "wx/bitmap.h"
class QAction;
class WXDLLIMPEXP_FWD_CORE wxMenu;
class WXDLLIMPEXP_CORE wxMenuItem : public wxMenuItemBase
{
public:
wxMenuItem(wxMenu *parentMenu = nullptr,
int id = wxID_SEPARATOR,
const wxString& text = wxEmptyString,
const wxString& help = wxEmptyString,
wxItemKind kind = wxITEM_NORMAL,
wxMenu *subMenu = nullptr);
virtual void SetItemLabel(const wxString& str) override;
virtual void SetCheckable(bool checkable) override;
virtual void Enable(bool enable = true) override;
virtual bool IsEnabled() const override;
virtual void Check(bool check = true) override;
virtual bool IsChecked() const override;
virtual QAction *GetHandle() const;
virtual void SetFont(const wxFont& font);
#if wxUSE_ACCEL
virtual void AddExtraAccel(const wxAcceleratorEntry& accel) override;
virtual void ClearExtraAccels() override;
#endif // wxUSE_ACCEL
// implementation
void QtCreateAction(wxMenu* parentMenu);
private:
// Qt is using an action instead of a menu item.
QAction *m_qtAction = nullptr;
wxDECLARE_DYNAMIC_CLASS( wxMenuItem );
};
#endif // _WX_QT_MENUITEM_H_

View File

@@ -0,0 +1,48 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/minifram.h
// Purpose: wxMiniFrame class
// Author: Mariano Reingart
// Copyright: (c) 2014 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MINIFRAM_H_
#define _WX_MINIFRAM_H_
#include "wx/frame.h"
class WXDLLIMPEXP_CORE wxMiniFrame : public wxFrame
{
public:
wxMiniFrame() = default;
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER,
const wxString& name = wxASCII_STR(wxFrameNameStr))
{
return wxFrame::Create(parent, id, title, pos, size,
style | wxFRAME_TOOL_WINDOW | wxFRAME_NO_TASKBAR,
name);
}
wxMiniFrame(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCAPTION | wxCLIP_CHILDREN | wxRESIZE_BORDER,
const wxString& name = wxASCII_STR(wxFrameNameStr))
{
Create(parent, id, title, pos, size, style, name);
}
protected:
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMiniFrame);
};
#endif
// _WX_MINIFRAM_H_

View File

@@ -0,0 +1,29 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/msgdlg.h
// Author: Peter Most, Javier Torres
// Copyright: (c) Peter Most, Javier Torres
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_MSGDLG_H_
#define _WX_QT_MSGDLG_H_
#include "wx/msgdlg.h"
class WXDLLIMPEXP_CORE wxMessageDialog : public wxMessageDialogBase
{
public:
wxMessageDialog(wxWindow *parent, const wxString& message,
const wxString& caption = wxASCII_STR(wxMessageBoxCaptionStr),
long style = wxOK|wxCENTRE,
const wxPoint& pos = wxDefaultPosition);
virtual ~wxMessageDialog();
// Reimplemented to translate return codes from Qt to wx
virtual int ShowModal() override;
private:
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMessageDialog);
};
#endif // _WX_QT_MSGDLG_H_

View File

@@ -0,0 +1,30 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/nonownedwnd.h
// Author: Sean D'Epagnier
// Copyright: (c) 2016 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_NONOWNEDWND_H_
#define _WX_QT_NONOWNEDWND_H_
// ----------------------------------------------------------------------------
// wxNonOwnedWindow contains code common to wx{Popup,TopLevel}Window in wxQT.
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxNonOwnedWindow : public wxNonOwnedWindowBase
{
public:
wxNonOwnedWindow() = default;
protected:
virtual bool DoClearShape() override;
virtual bool DoSetRegionShape(const wxRegion& region) override;
#if wxUSE_GRAPHICS_CONTEXT
virtual bool DoSetPathShape(const wxGraphicsPath& path) override;
#endif // wxUSE_GRAPHICS_CONTEXT
wxDECLARE_NO_COPY_CLASS(wxNonOwnedWindow);
};
#endif // _WX_QT_NONOWNEDWND_H_

View File

@@ -0,0 +1,66 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/notebook.h
// Author: Peter Most, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_NOTEBOOK_H_
#define _WX_QT_NOTEBOOK_H_
class QTabWidget;
class WXDLLIMPEXP_CORE wxNotebook : public wxNotebookBase
{
public:
wxNotebook() = default;
wxNotebook(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxASCII_STR(wxNotebookNameStr));
bool Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxASCII_STR(wxNotebookNameStr));
virtual void SetPadding(const wxSize& padding) override;
virtual void SetTabSize(const wxSize& sz) override;
virtual bool SetPageText(size_t n, const wxString& strText) override;
virtual wxString GetPageText(size_t n) const override;
virtual int GetPageImage(size_t n) const override;
virtual bool SetPageImage(size_t n, int imageId) override;
virtual bool InsertPage(size_t n, wxWindow *page, const wxString& text,
bool bSelect = false, int imageId = -1) override;
virtual wxSize CalcSizeFromPage(const wxSize& sizePage) const override;
int SetSelection(size_t nPage) override;
int ChangeSelection(size_t nPage) override;
virtual bool DeleteAllPages() override;
QTabWidget* GetQTabWidget() const;
protected:
virtual wxWindow *DoRemovePage(size_t page) override;
virtual void OnImagesChanged() override;
private:
// internal array to store imageId for each page:
wxVector<int> m_images;
wxDECLARE_DYNAMIC_CLASS(wxNotebook);
};
#endif // _WX_QT_NOTEBOOK_H_

View File

@@ -0,0 +1,59 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/pen.h
// Author: Peter Most, Javier Torres
// Copyright: (c) Peter Most, Javier Torres
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_PEN_H_
#define _WX_QT_PEN_H_
class QPen;
class WXDLLIMPEXP_CORE wxPen : public wxPenBase
{
public:
wxPen();
wxPen( const wxColour &colour, int width = 1, wxPenStyle style = wxPENSTYLE_SOLID );
wxPen( const wxPenInfo& info );
wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants")
wxPen(const wxColour& col, int width, int style);
bool operator==(const wxPen& pen) const;
bool operator!=(const wxPen& pen) const;
virtual void SetColour(const wxColour& col) override;
virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) override;
virtual void SetWidth(int width) override;
virtual void SetStyle(wxPenStyle style) override;
virtual void SetStipple(const wxBitmap& stipple) override;
virtual void SetDashes(int nb_dashes, const wxDash *dash) override;
virtual void SetJoin(wxPenJoin join) override;
virtual void SetCap(wxPenCap cap) override;
virtual wxColour GetColour() const override;
virtual wxBitmap *GetStipple() const override;
virtual wxPenStyle GetStyle() const override;
virtual wxPenJoin GetJoin() const override;
virtual wxPenCap GetCap() const override;
virtual int GetWidth() const override;
virtual int GetDashes(wxDash **ptr) const override;
wxDEPRECATED_MSG("use wxPENSTYLE_XXX constants")
void SetStyle(int style) { SetStyle((wxPenStyle)style); }
QPen GetHandle() const;
protected:
virtual wxGDIRefData *CreateGDIRefData() const override;
wxNODISCARD virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const override;
private:
wxDECLARE_DYNAMIC_CLASS(wxPen);
};
#endif // _WX_QT_PEN_H_

View File

@@ -0,0 +1,26 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/popupwin.h
// Author: Peter Most
// Copyright: (c) Peter Most
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_POPUPWIN_H_
#define _WX_QT_POPUPWIN_H_
class WXDLLIMPEXP_CORE wxPopupWindow : public wxPopupWindowBase
{
public:
wxPopupWindow() = default;
wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE);
bool Create(wxWindow *parent, int flags = wxBORDER_NONE);
protected:
private:
wxDECLARE_DYNAMIC_CLASS(wxPopupWindow);
};
#endif // _WX_QT_POPUPWIN_H_

View File

@@ -0,0 +1,56 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/printdlg.h
// Author: Peter Most
// Copyright: (c) Peter Most
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_PRINTDLG_H_
#define _WX_QT_PRINTDLG_H_
#include "wx/prntbase.h"
#include "wx/printdlg.h"
class WXDLLIMPEXP_CORE wxQtPrintNativeData: public wxPrintNativeDataBase
{
public:
wxQtPrintNativeData();
virtual bool TransferTo( wxPrintData &data ) override;
virtual bool TransferFrom( const wxPrintData &data ) override;
virtual bool IsOk() const override;
};
class WXDLLIMPEXP_CORE wxQtPrintDialog : public wxPrintDialogBase
{
public:
wxQtPrintDialog(wxWindow *parent, wxPrintDialogData *data);
wxQtPrintDialog(wxWindow *parent, wxPrintData *data);
virtual wxPrintDialogData& GetPrintDialogData() override;
virtual wxPrintData& GetPrintData() override;
virtual wxDC *GetPrintDC() override;
protected:
private:
};
class WXDLLIMPEXP_CORE wxQtPageSetupDialog: public wxPageSetupDialogBase
{
public:
wxQtPageSetupDialog();
wxQtPageSetupDialog(wxWindow *parent, wxPageSetupDialogData *data = nullptr);
bool Create(wxWindow *parent, wxPageSetupDialogData *data = nullptr);
virtual wxPageSetupDialogData& GetPageSetupDialogData() override;
private:
};
#endif // _WX_QT_PRINTDLG_H_

View File

@@ -0,0 +1,42 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/printqt.h
// Author: Peter Most
// Copyright: (c) Peter Most
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_PRINTQT_H_
#define _WX_QT_PRINTQT_H_
#include "wx/prntbase.h"
class WXDLLIMPEXP_CORE wxQtPrinter : public wxPrinterBase
{
public:
explicit wxQtPrinter( wxPrintDialogData *data = nullptr );
virtual bool Setup(wxWindow *parent) override;
virtual bool Print(wxWindow *parent, wxPrintout *printout, bool prompt = true) override;
virtual wxDC* PrintDialog(wxWindow *parent) override;
private:
};
class WXDLLIMPEXP_CORE wxQtPrintPreview : public wxPrintPreviewBase
{
public:
wxQtPrintPreview(wxPrintout *printout,
wxPrintout *printoutForPrinting = nullptr,
wxPrintDialogData *data = nullptr);
wxQtPrintPreview(wxPrintout *printout,
wxPrintout *printoutForPrinting,
wxPrintData *data);
virtual bool Print(bool interactive) override;
virtual void DetermineScaling() override;
protected:
};
#endif // _WX_QT_PRINTQT_H_

View File

@@ -0,0 +1,37 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/private/compat.h
// Purpose: Helpers for dealing with various Qt versions
// Author: Vadim Zeitlin
// Created: 2022-10-21
// Copyright: (c) 2022 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_PRIVATE_COMPAT_H_
#define _WX_QT_PRIVATE_COMPAT_H_
#include <QtGui/QFontMetrics>
// Hide the difference in name of QFontMetrics::width() in various Qt versions.
inline int
wxQtGetWidthFromMetrics(const QFontMetrics& metrics, const QString& string)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
return metrics.horizontalAdvance( string );
#else
return metrics.width( string );
#endif
}
// Hide the difference in getting Qt event position in various Qt versions.
template<typename T>
inline QPoint wxQtGetEventPosition(T* event)
{
#if QT_VERSION_MAJOR >= 6
return event->position().toPoint();
#else
return event->pos();
#endif
}
#endif // _WX_QT_PRIVATE_COMPAT_H_

View File

@@ -0,0 +1,112 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/converter.h
// Purpose: Converter utility classes and functions
// Author: Peter Most, Kolya Kosenko
// Created: 02/28/10
// Copyright: (c) Peter Most
// (c) 2010 Kolya Kosenko
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_CONVERTER_H_
#define _WX_QT_CONVERTER_H_
#include "wx/defs.h"
#include "wx/kbdstate.h"
#include "wx/gdicmn.h"
#include "wx/colour.h"
#include "wx/geometry.h"
#include <QtCore/QRect>
#include <QtCore/QSize>
#include <QtCore/QString>
#include <QtGui/QColor>
// Rely on overloading and let the compiler pick the correct version, which makes
// them easier to use then to write wxQtConvertQtRectToWxRect() or wxQtConvertWxRectToQtRect()
inline wxPoint wxQtConvertPoint( const QPoint &point )
{
return wxPoint( point.x(), point.y() );
}
inline QPoint wxQtConvertPoint( const wxPoint &point )
{
return QPoint( point.x, point.y );
}
inline wxPoint2DDouble wxQtConvertPointF(const QPointF& point)
{
return wxPoint2DDouble(point.x(), point.y());
}
inline QPointF wxQtConvertPointF(const wxPoint2DDouble& point)
{
return QPointF(point.m_x, point.m_y);
}
inline wxRect wxQtConvertRect( const QRect &rect )
{
return wxRect( rect.x(), rect.y(), rect.width(), rect.height() );
}
inline QRect wxQtConvertRect( const wxRect &rect )
{
return QRect( rect.GetX(), rect.GetY(), rect.GetWidth(), rect.GetHeight() );
}
// TODO: Check whether QString::toStdString/QString::toStdWString might be faster
inline wxString wxQtConvertString( const QString &str )
{
return wxString( str.toUtf8().data(), wxConvUTF8 );
}
inline QString wxQtConvertString( const wxString &str )
{
return QString( str.utf8_str() );
}
inline wxColour wxQtConvertColour(const QColor &colour)
{
return wxColour(colour.red(), colour.green(), colour.blue(), colour.alpha());
}
inline QColor wxQtConvertColour(const wxColour &colour)
{
return QColor(colour.Red(), colour.Green(), colour.Blue(), colour.Alpha());
}
#if wxUSE_DATETIME
class WXDLLIMPEXP_FWD_BASE wxDateTime;
class QDate;
class QTime;
wxDateTime wxQtConvertDate(const QDate& date);
QDate wxQtConvertDate(const wxDateTime& date);
wxDateTime wxQtConvertTime(const QTime& Time);
QTime wxQtConvertTime(const wxDateTime& time);
#endif // wxUSE_DATETIME
inline wxSize wxQtConvertSize( const QSize &size )
{
return wxSize(size.width(), size.height());
}
inline QSize wxQtConvertSize( const wxSize &size )
{
return QSize(size.GetWidth(), size.GetHeight());
}
Qt::Orientation wxQtConvertOrientation( long style, wxOrientation defaultOrientation );
wxOrientation wxQtConvertOrientation( Qt::Orientation );
wxKeyCode wxQtConvertKeyCode( int key, Qt::KeyboardModifiers modifiers );
void wxQtFillKeyboardModifiers( Qt::KeyboardModifiers modifiers, wxKeyboardState *state );
int wxQtConvertKeyCode( int keyCode, int modifiers, Qt::KeyboardModifiers &qtmodifiers );
#endif // _WX_QT_CONVERTER_H_

View File

@@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/private/pointer.h
// Author: Peter Most
// Copyright: (c) Peter Most
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_POINTER_H_
#define _WX_QT_POINTER_H_
#include <QtCore/QPointer>
// Extend QPointer with the ability to delete the object in its destructor. The
// normal behaviour of the QPointer makes sure that this is safe, because if somebody
// has deleted the object, then data() returns nullptr and delete does nothing.
template < typename T >
class wxQtPointer : public QPointer< T >
{
public:
inline wxQtPointer()
: QPointer< T >()
{
}
inline wxQtPointer( T *p )
: QPointer< T >( p )
{
}
inline wxQtPointer< T > &operator = ( T *p )
{
QPointer< T >::operator = ( p );
return *this;
}
inline ~wxQtPointer()
{
delete QPointer< T >::data();
}
};
#endif // _WX_QT_POINTER_H_

View File

@@ -0,0 +1,39 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/timer.h
// Author: Javier Torres
// Copyright: (c) Javier Torres
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_TIMER_H_
#define _WX_QT_TIMER_H_
#if wxUSE_TIMER
#include <QtCore/QObject>
#include "wx/private/timer.h"
//-----------------------------------------------------------------------------
// wxTimer
//-----------------------------------------------------------------------------
class QTimerEvent;
class WXDLLIMPEXP_CORE wxQtTimerImpl : public wxTimerImpl, QObject
{
public:
wxQtTimerImpl( wxTimer* timer );
virtual bool Start( int millisecs = -1, bool oneShot = false ) override;
virtual void Stop() override;
virtual bool IsRunning() const override;
protected:
virtual void timerEvent( QTimerEvent * event ) override;
private:
int m_timerId;
};
#endif // wxUSE_TIMER
#endif // _WX_QT_TIMER_H_

View File

@@ -0,0 +1,99 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/private/treeitemdelegate.h
// Purpose: Delegate to create text edit controls for the tree items
// Author: Matthew Griffin
// Created: 2019-05-29
// Copyright: Matthew Griffin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_PRIVATE_TREEITEM_DELEGATE_H
#define _WX_QT_PRIVATE_TREEITEM_DELEGATE_H
#include <QtWidgets/QStyledItemDelegate>
#include <QtWidgets/QToolTip>
#include "wx/app.h"
#include "wx/textctrl.h"
#include "treeitemfactory.h"
class wxQTTreeItemDelegate : public QStyledItemDelegate
{
public:
explicit wxQTTreeItemDelegate(wxWindow* parent)
: m_parent(parent),
m_textCtrl(nullptr)
{
}
QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &WXUNUSED(option), const QModelIndex &index) const override
{
if ( m_textCtrl != nullptr )
destroyEditor(m_textCtrl->GetHandle(), m_currentModelIndex);
m_currentModelIndex = index;
m_textCtrl = new wxQtListTextCtrl(m_parent, parent);
m_textCtrl->SetFocus();
return m_textCtrl->GetHandle();
}
void destroyEditor(QWidget *WXUNUSED(editor), const QModelIndex &WXUNUSED(index)) const override
{
if ( m_textCtrl != nullptr )
{
m_currentModelIndex = QModelIndex(); // invalidate the index
wxTheApp->ScheduleForDestruction(m_textCtrl);
m_textCtrl = nullptr;
}
}
void setModelData(QWidget *WXUNUSED(editor), QAbstractItemModel *WXUNUSED(model), const QModelIndex &WXUNUSED(index)) const override
{
// Don't set model data until wx has had a chance to send out events
}
wxTextCtrl* GetEditControl() const
{
return m_textCtrl;
}
QModelIndex GetCurrentModelIndex() const
{
return m_currentModelIndex;
}
void AcceptModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
QStyledItemDelegate::setModelData(editor, model, index);
}
virtual bool helpEvent(QHelpEvent* event, QAbstractItemView* view, const QStyleOptionViewItem& option, const QModelIndex& index) override
{
if ( event->type() == QEvent::ToolTip )
{
const QRect &itemRect = view->visualRect(index);
const QSize &bestSize = sizeHint(option, index);
if ( itemRect.width() < bestSize.width() )
{
const QString &value = index.data(Qt::DisplayRole).toString();
QToolTip::showText(event->globalPos(), value, view);
}
else
{
QToolTip::hideText();
}
return true;
}
return QStyledItemDelegate::helpEvent(event, view, option, index);
}
private:
wxWindow* m_parent;
mutable wxTextCtrl* m_textCtrl;
mutable QModelIndex m_currentModelIndex;
};
#endif // _WX_QT_PRIVATE_TREEITEM_DELEGATE_H

View File

@@ -0,0 +1,122 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/private/treeitemfactory.h
// Purpose: Factory to create text edit controls for the tree items
// Author: Graham Dawes
// Created: 2019-02-07
// Copyright: Graham Dawes
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_PRIVATE_TREEITEM_FACTORY_H_
#define _WX_QT_PRIVATE_TREEITEM_FACTORY_H_
#include <QtWidgets/QItemEditorFactory>
#include <QtWidgets/QTreeWidget>
#include <QtWidgets/QItemDelegate>
#include "wx/recguard.h"
#include "wx/textctrl.h"
// wxQT Doesn't have a mechanism for "adopting" external widgets so we have to
// create an instance of wxTextCtrl rather than adopting the control QT would
// create.
//
// Unfortunately the factory is given an internal widget as the parent for
// editor.
//
// To work around these issues we create a wxTextCtl parented by the wxListCtrl
// then recalculate its position relative to the internal widget.
class wxQtListTextCtrl : public wxTextCtrl
{
public:
wxQtListTextCtrl(wxWindow* parent, QWidget* actualParent)
: wxTextCtrl(parent, wxID_ANY, wxEmptyString,
wxDefaultPosition, wxDefaultSize,
wxNO_BORDER),
m_actualParent(actualParent),
m_moving(0)
{
Bind(wxEVT_MOVE, &wxQtListTextCtrl::OnMove, this);
}
void OnMove(wxMoveEvent &event)
{
// QWidget::move generates a QMoveEvent so we need to guard against
// reentrant calls.
wxRecursionGuard guard(m_moving);
if ( guard.IsInside() )
{
event.Skip();
return;
}
const QPoint eventPos = wxQtConvertPoint(event.GetPosition());
const QPoint globalPos = m_actualParent->mapToGlobal(eventPos);
// For some reason this always gives us the offset from the header info
// the internal control. So we need to treat this as an offset rather
// than a position.
QWidget* widget = GetHandle();
const QPoint offset = widget->mapFromGlobal(globalPos);
widget->move(eventPos + offset);
}
private:
QWidget* m_actualParent;
wxRecursionGuardFlag m_moving;
wxDECLARE_NO_COPY_CLASS(wxQtListTextCtrl);
};
// QT doesn't give us direct access to the editor within the QTreeWidget.
// Instead, we'll supply a factory to create the widget for QT and keep track
// of it ourselves.
class wxQtTreeItemEditorFactory : public QItemEditorFactory
{
public:
explicit wxQtTreeItemEditorFactory(wxWindow* parent)
: m_parent(parent),
m_textCtrl(nullptr)
{
}
void AttachTo(QTreeWidget *tree)
{
QAbstractItemDelegate* delegate = tree->itemDelegate();
QItemDelegate *qItemDelegate = static_cast<QItemDelegate*>(delegate);
qItemDelegate->setItemEditorFactory(this);
}
QWidget* createEditor(int WXUNUSED(userType), QWidget* parent) const override
{
if (m_textCtrl != nullptr)
ClearEditor();
m_textCtrl = new wxQtListTextCtrl(m_parent, parent);
m_textCtrl->SetFocus();
return m_textCtrl->GetHandle();
}
wxTextCtrl* GetEditControl() const
{
return m_textCtrl;
}
void ClearEditor() const
{
delete m_textCtrl;
m_textCtrl = nullptr;
}
private:
wxWindow* m_parent;
mutable wxTextCtrl* m_textCtrl;
wxDECLARE_NO_COPY_CLASS(wxQtTreeItemEditorFactory);
};
#endif //_WX_QT_PRIVATE_TREEITEM_FACTORY_H_

View File

@@ -0,0 +1,27 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/utils.h
// Purpose: utility classes and/or functions
// Author: Peter Most, Javier Torres
// Created: 15/05/10
// Copyright: (c) Peter Most, Javier Torres
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_UTILS_H_
#define _WX_QT_UTILS_H_
#include "wx/mousestate.h"
#include <QtCore/Qt>
void wxQtFillMouseButtons( Qt::MouseButtons buttons, wxMouseState *state );
void wxMissingImplementation( const char fileName[], unsigned lineNumber,
const char feature[] );
#define wxMISSING_IMPLEMENTATION( feature )\
wxMissingImplementation( __FILE__, __LINE__, feature )
#define wxMISSING_FUNCTION() \
wxMISSING_IMPLEMENTATION( __func__ )
#endif // _WX_QT_UTILS_H_

View File

@@ -0,0 +1,583 @@
/////////////////////////////////////////////////////////////////////////////
// Name: include/wx/qt/private/winevent.h
// Purpose: QWidget to wxWindow event handler
// Author: Javier Torres, Peter Most
// Created: 21.06.10
// Copyright: (c) Javier Torres
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_EVENTSIGNALFORWARDER_H_
#define _WX_QT_EVENTSIGNALFORWARDER_H_
#include <QtCore/QEvent>
#include <QtGui/QCloseEvent>
#include "wx/log.h"
#include "wx/window.h"
#include "wx/qt/private/converter.h"
#include "wx/qt/private/utils.h"
#include <QtWidgets/QGestureEvent>
#include <QtGui/QCursor>
// redeclare wxEVT_TEXT_ENTER here instead of including "wx/textctrl.h"
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_TEXT_ENTER, wxCommandEvent);
// The parameter of QWidget::enterEvent() is changed to QEnterEvent in Qt6
#if QT_VERSION_MAJOR >= 6
using wxQtEnterEvent = QEnterEvent;
#else
using wxQtEnterEvent = QEvent;
#endif
class QPaintEvent;
class wxQtSignalHandler
{
protected:
explicit wxQtSignalHandler( wxWindow *handler ) : m_handler(handler)
{
}
bool EmitEvent( wxEvent &event ) const
{
event.SetEventObject( m_handler );
return m_handler->HandleWindowEvent( event );
}
virtual wxWindow *GetHandler() const
{
return m_handler;
}
// A hack for wxQtEventSignalHandler<>::keyPressEvent() handler for the
// convenience of wxTextCtrl-like controls to emit the wxEVT_TEXT_ENTER
// event if the control has wxTE_PROCESS_ENTER flag.
bool HandleKeyPressEvent(QWidget* widget, QKeyEvent* e)
{
if ( m_handler->HasFlag(wxTE_PROCESS_ENTER) )
{
if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter )
{
wxCommandEvent event( wxEVT_TEXT_ENTER, m_handler->GetId() );
event.SetString( GetValueForProcessEnter() );
event.SetEventObject( m_handler );
return m_handler->HandleWindowEvent( event );
}
}
return m_handler->QtHandleKeyEvent(widget, e);
}
// Controls supporting wxTE_PROCESS_ENTER flag (e.g. wxTextCtrl, wxComboBox and wxSpinCtrl)
// should override this to return the control value as string when enter is pressed.
virtual wxString GetValueForProcessEnter() { return wxString(); }
private:
wxWindow* const m_handler;
};
template < typename Widget, typename Handler >
class wxQtEventSignalHandler : public Widget, public wxQtSignalHandler
{
public:
wxQtEventSignalHandler( wxWindow *parent, Handler *handler )
: Widget( parent != nullptr ? parent->GetHandle() : nullptr )
, wxQtSignalHandler( handler )
{
// Set immediately as it is used to check if wxWindow is alive
wxWindow::QtStoreWindowPointer( this, handler );
Widget::setMouseTracking(true);
}
virtual Handler *GetHandler() const override
{
// Only process the signal / event if the wxWindow is not destroyed
if ( !wxWindow::QtRetrieveWindowPointer( this ) )
{
return nullptr;
}
else
return static_cast<Handler*>(wxQtSignalHandler::GetHandler());
}
protected:
/* Not implemented here: wxHelpEvent, wxIdleEvent wxJoystickEvent,
* wxMouseCaptureLostEvent, wxMouseCaptureChangedEvent,
* wxPowerEvent, wxScrollWinEvent, wxSysColourChangedEvent */
//wxActivateEvent
virtual void changeEvent ( QEvent * event ) override
{
if ( !this->GetHandler() )
return;
if ( !this->GetHandler()->QtHandleChangeEvent(this, event) )
Widget::changeEvent(event);
else
event->accept();
}
//wxCloseEvent
virtual void closeEvent ( QCloseEvent * event ) override
{
if ( !this->GetHandler() )
return;
if ( !this->GetHandler()->QtHandleCloseEvent(this, event) )
Widget::closeEvent(event);
else
event->ignore();
}
//wxContextMenuEvent
virtual void contextMenuEvent ( QContextMenuEvent * event ) override
{
if ( !this->GetHandler() )
return;
this->GetHandler()->QtHandleContextMenuEvent(this, event);
// Notice that we are simply accepting the event and deliberately not
// calling Widget::contextMenuEvent(event); here because the context menu
// is supposed to be shown from a wxEVT_CONTEXT_MENU handler and not from
// QWidget::contextMenuEvent() overrides (and we are already in one of
// these overrides to perform QContextMenuEvent --> wxContextMenuEvent
// translation).
// More importantly, the default implementation of contextMenuEvent() simply
// ignores the context event, which means that the event will be propagated
// to the parent widget again which is undesirable here because the event may
// have already been propagated at the wxWidgets level.
event->accept();
}
//wxDropFilesEvent
//virtual void dropEvent ( QDropEvent * event ) { }
//wxFocusEvent.
virtual void focusInEvent ( QFocusEvent * event ) override
{
if ( !this->GetHandler() )
return;
if ( !this->GetHandler()->QtHandleFocusEvent(this, event) )
Widget::focusInEvent(event);
else
event->accept();
}
//wxFocusEvent.
virtual void focusOutEvent ( QFocusEvent * event ) override
{
if ( !this->GetHandler() )
return;
if ( !this->GetHandler()->QtHandleFocusEvent(this, event) )
Widget::focusOutEvent(event);
else
event->accept();
}
//wxShowEvent
virtual void hideEvent ( QHideEvent * event ) override
{
if ( !this->GetHandler() )
return;
if ( !this->GetHandler()->QtHandleShowEvent(this, event) )
Widget::hideEvent(event);
else
event->accept();
}
//wxKeyEvent
virtual void keyPressEvent ( QKeyEvent * event ) override
{
if ( !this->GetHandler() )
return;
if ( !this->HandleKeyPressEvent(this, event) )
Widget::keyPressEvent(event);
else
event->accept();
}
//wxKeyEvent
virtual void keyReleaseEvent ( QKeyEvent * event ) override
{
if ( !this->GetHandler() )
return;
if ( !this->GetHandler()->QtHandleKeyEvent(this, event) )
Widget::keyReleaseEvent(event);
else
event->accept();
}
//wxMouseEvent
virtual void enterEvent ( wxQtEnterEvent * event ) override
{
if ( !this->GetHandler() )
return;
if ( !this->GetHandler()->QtHandleEnterEvent(this, event) )
Widget::enterEvent(event);
else
event->accept();
}
//wxMouseEvent
virtual void leaveEvent ( QEvent * event ) override
{
if ( !this->GetHandler() )
return;
if ( !this->GetHandler()->QtHandleEnterEvent(this, event) )
Widget::leaveEvent(event);
else
event->accept();
}
//wxMouseEvent
virtual void mouseDoubleClickEvent ( QMouseEvent * event ) override
{
if ( !this->GetHandler() )
return;
if ( !this->GetHandler()->QtHandleMouseEvent(this, event) )
Widget::mouseDoubleClickEvent(event);
else
event->accept();
}
//wxMouseEvent
virtual void mouseMoveEvent ( QMouseEvent * event ) override
{
if ( !this->GetHandler() )
return;
if ( !this->GetHandler()->QtHandleMouseEvent(this, event) )
Widget::mouseMoveEvent(event);
else
event->accept();
}
//wxMouseEvent
virtual void mousePressEvent ( QMouseEvent * event ) override
{
if ( !this->GetHandler() )
return;
if ( !this->GetHandler()->QtHandleMouseEvent(this, event) )
Widget::mousePressEvent(event);
else
event->accept();
}
//wxMouseEvent
virtual void mouseReleaseEvent ( QMouseEvent * event ) override
{
if ( !this->GetHandler() )
return;
if ( !this->GetHandler()->QtHandleMouseEvent(this, event) )
Widget::mouseReleaseEvent(event);
else
event->accept();
}
//wxMoveEvent
virtual void moveEvent ( QMoveEvent * event ) override
{
if ( !this->GetHandler() )
return;
if ( !this->GetHandler()->QtHandleMoveEvent(this, event) )
Widget::moveEvent(event);
else
event->accept();
}
//wxEraseEvent then wxPaintEvent
virtual void paintEvent ( QPaintEvent * event ) override
{
if ( !this->GetHandler() )
return;
if ( !this->GetHandler()->QtHandlePaintEvent(this, event) )
Widget::paintEvent(event);
else
event->accept();
}
//wxSizeEvent
virtual void resizeEvent ( QResizeEvent * event ) override
{
if ( !this->GetHandler() )
return;
if ( !this->GetHandler()->QtHandleResizeEvent(this, event) )
Widget::resizeEvent(event);
else
event->accept();
}
//wxShowEvent
virtual void showEvent ( QShowEvent * event ) override
{
if ( !this->GetHandler() )
return;
if ( !this->GetHandler()->QtHandleShowEvent(this, event) )
Widget::showEvent(event);
else
event->accept();
}
//wxMouseEvent
virtual void wheelEvent ( QWheelEvent * event ) override
{
if ( !this->GetHandler() )
return;
if ( !this->GetHandler()->QtHandleWheelEvent(this, event) )
Widget::wheelEvent(event);
else
event->accept();
}
/* Unused Qt events
virtual void actionEvent ( QActionEvent * event ) { }
virtual void dragEnterEvent ( QDragEnterEvent * event ) { }
virtual void dragLeaveEvent ( QDragLeaveEvent * event ) { }
virtual void dragMoveEvent ( QDragMoveEvent * event ) { }
virtual void inputMethodEvent ( QInputMethodEvent * event ) { }
virtual bool macEvent ( EventHandlerCallRef caller, EventRef event ) { }
virtual bool qwsEvent ( QWSEvent * event ) { }
virtual void tabletEvent ( QTabletEvent * event ) { }
virtual bool winEvent ( MSG * message, long * result ) { }
virtual bool x11Event ( XEvent * event ) { } */
virtual bool event(QEvent *event) override
{
switch (event->type())
{
case QEvent::Gesture:
return gestureEvent(static_cast<QGestureEvent*>(event), event);
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
case QEvent::TouchCancel:
case QEvent::TouchEnd:
return touchEvent(static_cast<QTouchEvent*>(event));
default:;
}
return Widget::event(event);
}
bool touchEvent(QTouchEvent *touch)
{
bool handled = false;
if ( wxWindow *win = wxWindow::QtRetrieveWindowPointer(this) )
{
#if QT_VERSION_MAJOR >= 6
for (const auto& tp : touch->points())
#else
for (const auto& tp : touch->touchPoints())
#endif
{
wxEventType evtype = wxEVT_NULL;
switch (tp.state())
{
case Qt::TouchPointPressed:
evtype = wxEVT_TOUCH_BEGIN;
break;
case Qt::TouchPointMoved:
evtype = wxEVT_TOUCH_MOVE;
break;
case Qt::TouchPointReleased:
evtype = wxEVT_TOUCH_END;
break;
default:
continue;
}
wxMultiTouchEvent evt(win->GetId(), evtype);
// Use screen position as the event might originate from a different
// Qt window than this one.
#if QT_VERSION_MAJOR >= 6
const auto screenPos = tp.globalPosition();
#else
const auto screenPos = tp.screenPos();
#endif
wxPoint2DDouble pt = wxQtConvertPointF(screenPos.toPoint());
wxPoint ref = pt.GetFloor();
evt.SetPosition(win->ScreenToClient(ref) + (pt - ref));
evt.SetSequenceId(wxTouchSequenceId(wxUIntToPtr((unsigned)tp.id())));
// Qt doesn't provide the primary point flag
handled |= win->ProcessWindowEvent(evt);
}
}
return handled;
}
bool gestureEvent(QGestureEvent *gesture, QEvent *event)
{
if (QGesture *tah = gesture->gesture(Qt::TapAndHoldGesture))
{
// Set the policy so that accepted gestures are taken by the first window that gets them
tah->setGestureCancelPolicy ( QGesture::CancelAllInContext );
tapandholdTriggered(static_cast<QTapAndHoldGesture *>(tah), event);
}
if (QGesture *pan = gesture->gesture(Qt::PanGesture))
{
panTriggered(static_cast<QPanGesture *>(pan), event);
}
if (QGesture *pinch = gesture->gesture(Qt::PinchGesture))
{
pinchTriggered(static_cast<QPinchGesture *>(pinch), event);
}
return true;
}
void tapandholdTriggered(QTapAndHoldGesture *gesture, QEvent *event)
{
if ( wxWindow *win = wxWindow::QtRetrieveWindowPointer( this ) )
{
if (gesture->state() == Qt::GestureFinished)
{
wxLongPressEvent ev(win->GetId());
ev.SetPosition( wxQtConvertPoint( gesture->position().toPoint() ) );
ev.SetGestureEnd();
win->ProcessWindowEvent( ev );
}
event->accept();
}
}
void panTriggered(QPanGesture *gesture, QEvent *event)
{
wxWindow *win = wxWindow::QtRetrieveWindowPointer( this );
if (win)
{
wxPanGestureEvent evp(win->GetId());
QPoint pos = QCursor::pos();
evp.SetPosition( wxQtConvertPoint( pos ) );
evp.SetDelta( wxQtConvertPoint( gesture->delta().toPoint() ) );
switch(gesture->state())
{
case Qt::GestureStarted:
evp.SetGestureStart();
break;
case Qt::GestureFinished:
case Qt::GestureCanceled:
evp.SetGestureEnd();
break;
default:
break;
}
win->ProcessWindowEvent( evp );
event->accept();
}
}
void pinchTriggered(QPinchGesture *gesture, QEvent *event)
{
wxWindow *win = wxWindow::QtRetrieveWindowPointer( this );
if (win)
{
if (gesture->changeFlags() & QPinchGesture::ScaleFactorChanged)
{
wxZoomGestureEvent evp(win->GetId());
evp.SetPosition(wxQtConvertPoint(gesture->centerPoint().toPoint()));
evp.SetZoomFactor(gesture->totalScaleFactor());
switch (gesture->state())
{
case Qt::GestureStarted:
evp.SetGestureStart();
break;
case Qt::GestureFinished:
case Qt::GestureCanceled:
evp.SetGestureEnd();
break;
default:
break;
}
win->ProcessWindowEvent(evp);
}
if (gesture->changeFlags() & QPinchGesture::RotationAngleChanged)
{
wxRotateGestureEvent evp(win->GetId());
evp.SetPosition(wxQtConvertPoint(gesture->centerPoint().toPoint()));
evp.SetRotationAngle(wxDegToRad(gesture->totalRotationAngle()));
switch (gesture->state())
{
case Qt::GestureStarted:
evp.SetGestureStart();
break;
case Qt::GestureFinished:
case Qt::GestureCanceled:
evp.SetGestureEnd();
break;
default:
break;
}
win->ProcessWindowEvent(evp);
}
event->accept();
}
}
};
// RAII wrapper for blockSignals(). It blocks signals in its constructor and in
// the destructor it restores the state to what it was before the constructor ran.
class wxQtEnsureSignalsBlocked
{
public:
// Use QObject instead of QWidget to avoid including <QWidget> from here.
wxQtEnsureSignalsBlocked(QObject *widget) :
m_widget(widget)
{
m_restore = m_widget->blockSignals(true);
}
~wxQtEnsureSignalsBlocked()
{
m_widget->blockSignals(m_restore);
}
private:
QObject* const m_widget;
bool m_restore;
wxDECLARE_NO_COPY_CLASS(wxQtEnsureSignalsBlocked);
};
#endif

View File

@@ -0,0 +1,98 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/radiobox.h
// Author: Peter Most, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_RADIOBOX_H_
#define _WX_QT_RADIOBOX_H_
class QGroupBox;
class QButtonGroup;
class QGridLayout;
class WXDLLIMPEXP_CORE wxRadioBox : public wxControl, public wxRadioBoxBase
{
public:
wxRadioBox() = default;
wxRadioBox(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = nullptr,
int majorDim = 0,
long style = wxRA_SPECIFY_COLS,
const wxValidator& val = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxRadioBoxNameStr));
wxRadioBox(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
int majorDim = 0,
long style = wxRA_SPECIFY_COLS,
const wxValidator& val = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxRadioBoxNameStr));
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = nullptr,
int majorDim = 0,
long style = wxRA_SPECIFY_COLS,
const wxValidator& val = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxRadioBoxNameStr));
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
int majorDim = 0,
long style = wxRA_SPECIFY_COLS,
const wxValidator& val = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxRadioBoxNameStr));
using wxWindowBase::Show;
using wxWindowBase::Enable;
using wxRadioBoxBase::GetDefaultBorder;
virtual bool Enable(unsigned int n, bool enable = true) override;
virtual bool Enable(bool enable = true) override;
virtual bool Show(unsigned int n, bool show = true) override;
virtual bool Show(bool show = true) override;
virtual bool IsItemEnabled(unsigned int n) const override;
virtual bool IsItemShown(unsigned int n) const override;
virtual unsigned int GetCount() const override;
virtual wxString GetString(unsigned int n) const override;
virtual void SetString(unsigned int n, const wxString& s) override;
virtual void SetSelection(int n) override;
virtual int GetSelection() const override;
virtual void SetLabel(const wxString &label) override;
virtual wxString GetLabel() const override;
// The 'visual' group box:
QGroupBox* GetQGroupBox() const;
private:
// Handles the mutual exclusion of buttons:
QButtonGroup *m_qtButtonGroup = nullptr;
// Autofit layout for buttons (either vert. or horiz.):
QGridLayout *m_qtGridLayout = nullptr;
wxDECLARE_DYNAMIC_CLASS(wxRadioBox);
};
#endif // _WX_QT_RADIOBOX_H_

View File

@@ -0,0 +1,47 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/radiobut.h
// Author: Peter Most
// Copyright: (c) Peter Most
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_RADIOBUT_H_
#define _WX_QT_RADIOBUT_H_
class QRadioButton;
class WXDLLIMPEXP_CORE wxRadioButton : public wxRadioButtonBase
{
public:
wxRadioButton() = default;
wxRadioButton( wxWindow *parent,
wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxRadioButtonNameStr) );
bool Create( wxWindow *parent,
wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxRadioButtonNameStr) );
virtual void SetValue(bool value) override;
virtual bool GetValue() const override;
virtual void SetLabel(const wxString &label) override;
virtual wxString GetLabel() const override;
QRadioButton* GetQRadioButton() const;
wxDECLARE_DYNAMIC_CLASS(wxRadioButton);
};
#endif // _WX_QT_RADIOBUT_H_

View File

@@ -0,0 +1,92 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/region.h
// Purpose: header for wxRegion
// Author: Peter Most, Javier Torres
// Copyright: (c) Peter Most, Javier Torres
// Licence: wxWindows Licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_REGION_H_
#define _WX_QT_REGION_H_
class QRect;
class QRegion;
class WXDLLIMPEXP_CORE wxRegion : public wxRegionBase
{
public:
wxRegion();
wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
wxRegion(const wxRect& rect);
wxRegion(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
wxRegion(const wxBitmap& bmp);
wxRegion(const wxBitmap& bmp, const wxColour& transp, int tolerance = 0);
virtual bool IsEmpty() const override;
virtual void Clear() override;
virtual const QRegion &GetHandle() const;
virtual void QtSetRegion(QRegion region); // Hangs on to this region
protected:
virtual wxGDIRefData *CreateGDIRefData() const override;
wxNODISCARD virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const override;
virtual bool DoIsEqual(const wxRegion& region) const override;
virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const override;
virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const override;
virtual wxRegionContain DoContainsRect(const wxRect& rect) const override;
virtual bool DoOffset(wxCoord x, wxCoord y) override;
virtual bool DoUnionWithRect(const wxRect& rect) override;
virtual bool DoUnionWithRegion(const wxRegion& region) override;
virtual bool DoIntersect(const wxRegion& region) override;
virtual bool DoSubtract(const wxRegion& region) override;
virtual bool DoXor(const wxRegion& region) override;
virtual bool DoCombine(const wxRegion& rgn, wxRegionOp op);
private:
wxDECLARE_DYNAMIC_CLASS(wxRegion);
};
class WXDLLIMPEXP_CORE wxRegionIterator: public wxObject
{
public:
wxRegionIterator();
wxRegionIterator(const wxRegion& region);
wxRegionIterator(const wxRegionIterator& ri);
~wxRegionIterator();
wxRegionIterator& operator=(const wxRegionIterator& ri);
void Reset();
void Reset(const wxRegion& region);
bool HaveRects() const;
operator bool () const;
wxRegionIterator& operator ++ ();
wxRegionIterator operator ++ (int);
wxCoord GetX() const;
wxCoord GetY() const;
wxCoord GetW() const;
wxCoord GetWidth() const;
wxCoord GetH() const;
wxCoord GetHeight() const;
wxRect GetRect() const;
private:
std::vector<QRect> m_qtRects;
unsigned int m_pos = 0;
wxDECLARE_DYNAMIC_CLASS(wxRegionIterator);
};
#endif // _WX_QT_REGION_H_

View File

@@ -0,0 +1,50 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/scrolbar.h
// Author: Peter Most, Javier Torres, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_SCROLBAR_H_
#define _WX_QT_SCROLBAR_H_
#include "wx/scrolbar.h"
class QScrollBar;
class WXDLLIMPEXP_CORE wxScrollBar : public wxScrollBarBase
{
public:
wxScrollBar() = default;
wxScrollBar( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSB_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxScrollBarNameStr) );
bool Create( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSB_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxScrollBarNameStr) );
virtual int GetThumbPosition() const override;
virtual int GetThumbSize() const override;
virtual int GetPageSize() const override;
virtual int GetRange() const override;
virtual void SetThumbPosition(int viewStart) override;
virtual void SetScrollbar(int position, int thumbSize,
int range, int pageSize,
bool refresh = true) override;
QScrollBar* GetQScrollBar() const;
wxDECLARE_DYNAMIC_CLASS(wxScrollBar);
};
#endif // _WX_QT_SCROLBAR_H_

View File

@@ -0,0 +1,63 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/slider.h
// Author: Peter Most, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_SLIDER_H_
#define _WX_QT_SLIDER_H_
class QSlider;
class WXDLLIMPEXP_CORE wxSlider : public wxSliderBase
{
public:
wxSlider() = default;
wxSlider(wxWindow *parent,
wxWindowID id,
int value, int minValue, int maxValue,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSL_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxSliderNameStr));
bool Create(wxWindow *parent,
wxWindowID id,
int value, int minValue, int maxValue,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSL_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxSliderNameStr));
virtual int GetValue() const override;
virtual void SetValue(int value) override;
virtual void SetRange(int minValue, int maxValue) override;
virtual int GetMin() const override;
virtual int GetMax() const override;
virtual int GetTickFreq() const override;
virtual void ClearTicks() override;
virtual void SetTick(int tickPos) override;
virtual void SetLineSize(int lineSize) override;
virtual void SetPageSize(int pageSize) override;
virtual int GetLineSize() const override;
virtual int GetPageSize() const override;
virtual void SetThumbLength(int lenPixels) override;
virtual int GetThumbLength() const override;
QSlider* GetQSlider() const;
protected:
virtual void DoSetTickFreq(int freq) override;
wxDECLARE_DYNAMIC_CLASS(wxSlider);
};
#endif // _WX_QT_SLIDER_H_

View File

@@ -0,0 +1,42 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/spinbutt.h
// Author: Peter Most, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_SPINBUTT_H_
#define _WX_QT_SPINBUTT_H_
#include "wx/spinbutt.h"
class QSpinBox;
class WXDLLIMPEXP_CORE wxSpinButton : public wxSpinButtonBase
{
public:
wxSpinButton() = default;
wxSpinButton(wxWindow *parent,
wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSP_VERTICAL,
const wxString& name = wxSPIN_BUTTON_NAME);
bool Create(wxWindow *parent,
wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSP_VERTICAL,
const wxString& name = wxSPIN_BUTTON_NAME);
virtual int GetValue() const override;
virtual void SetValue(int val) override;
virtual void SetRange(int min, int max) override;
QSpinBox* GetQSpinBox() const;
wxDECLARE_DYNAMIC_CLASS(wxSpinButton);
};
#endif // _WX_QT_SPINBUTT_H_

View File

@@ -0,0 +1,130 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/spinctrl.h
// Author: Peter Most, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_SPINCTRL_H_
#define _WX_QT_SPINCTRL_H_
class QSpinBox;
class QDoubleSpinBox;
// Take advantage of the Qt compile time polymorphy and use a template to avoid
// copy&paste code for the usage of QSpinBox/QDoubleSpinBox.
template < typename T, typename Widget >
class WXDLLIMPEXP_CORE wxSpinCtrlQt : public wxSpinCtrlBase
{
public:
wxSpinCtrlQt() = default;
wxSpinCtrlQt( wxWindow *parent, wxWindowID id, const wxString& value,
const wxPoint& pos, const wxSize& size, long style,
T min, T max, T initial, T inc,
const wxString& name );
bool Create( wxWindow *parent, wxWindowID id, const wxString& value,
const wxPoint& pos, const wxSize& size, long style,
T min, T max, T initial, T inc,
const wxString& name );
virtual wxString GetTextValue() const override;
virtual void SetValue(const wxString&) override {}
virtual void SetSnapToTicks(bool snap_to_ticks) override;
virtual bool GetSnapToTicks() const override;
virtual void SetSelection(long from, long to) override;
virtual void SetValue(T val);
void SetRange(T minVal, T maxVal);
void SetIncrement(T inc);
T GetValue() const;
T GetMin() const;
T GetMax() const;
T GetIncrement() const;
protected:
// QSpinBox / QDoubleSpinBox
Widget* GetQtSpinBox() const { return static_cast<Widget*>(this->GetHandle()); }
};
class WXDLLIMPEXP_CORE wxSpinCtrl : public wxSpinCtrlQt< int, QSpinBox >
{
using BaseType = wxSpinCtrlQt< int, QSpinBox >;
public:
wxSpinCtrl() = default;
wxSpinCtrl(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSP_ARROW_KEYS,
int min = 0, int max = 100, int initial = 0,
const wxString& name = wxT("wxSpinCtrl"));
bool Create(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSP_ARROW_KEYS,
int min = 0, int max = 100, int initial = 0,
const wxString& name = wxT("wxSpinCtrl"));
virtual int GetBase() const override { return m_base; }
virtual bool SetBase(int base) override;
virtual void SetValue(const wxString & val) override;
virtual void SetValue(int val) override { BaseType::SetValue(val); }
private:
int m_base = 10;
wxDECLARE_DYNAMIC_CLASS(wxSpinCtrl);
};
class WXDLLIMPEXP_CORE wxSpinCtrlDouble : public wxSpinCtrlQt< double, QDoubleSpinBox >
{
using BaseType = wxSpinCtrlQt< double, QDoubleSpinBox >;
public:
wxSpinCtrlDouble() = default;
wxSpinCtrlDouble(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSP_ARROW_KEYS,
double min = 0, double max = 100, double initial = 0,
double inc = 1,
const wxString& name = wxT("wxSpinCtrlDouble"));
bool Create(wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSP_ARROW_KEYS,
double min = 0, double max = 100, double initial = 0,
double inc = 1,
const wxString& name = wxT("wxSpinCtrlDouble"));
void SetDigits(unsigned digits);
unsigned GetDigits() const;
virtual int GetBase() const override { return 10; }
virtual bool SetBase(int WXUNUSED(base)) override { return false; }
virtual void SetValue(const wxString & val) override;
virtual void SetValue(double val) override { BaseType::SetValue(val); }
private:
wxDECLARE_DYNAMIC_CLASS( wxSpinCtrlDouble );
};
#endif // _WX_QT_SPINCTRL_H_

View File

@@ -0,0 +1,42 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/statbmp.h
// Author: Peter Most, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_STATBMP_H_
#define _WX_QT_STATBMP_H_
class QLabel;
class WXDLLIMPEXP_CORE wxStaticBitmap : public wxStaticBitmapBase
{
public:
wxStaticBitmap() = default;
wxStaticBitmap( wxWindow *parent,
wxWindowID id,
const wxBitmapBundle& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxASCII_STR(wxStaticBitmapNameStr) );
bool Create( wxWindow *parent,
wxWindowID id,
const wxBitmapBundle& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxASCII_STR(wxStaticBitmapNameStr));
virtual void SetBitmap(const wxBitmapBundle& bitmap) override;
virtual wxBitmap GetBitmap() const override;
QLabel* GetQLabel() const;
wxDECLARE_DYNAMIC_CLASS(wxStaticBitmap);
};
#endif // _WX_QT_STATBMP_H_

View File

@@ -0,0 +1,42 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/statbox.h
// Author: Peter Most, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_STATBOX_H_
#define _WX_QT_STATBOX_H_
class QGroupBox;
class WXDLLIMPEXP_CORE wxStaticBox : public wxStaticBoxBase
{
public:
wxStaticBox() = default;
wxStaticBox(wxWindow *parent, wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxASCII_STR(wxStaticBoxNameStr));
bool Create(wxWindow *parent, wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxASCII_STR(wxStaticBoxNameStr));
virtual void GetBordersForSizer(int *borderTop, int *borderOther) const override;
virtual void SetLabel(const wxString& label) override;
virtual wxString GetLabel() const override;
QGroupBox* GetQGroupBox() const;
wxDECLARE_DYNAMIC_CLASS(wxStaticBox);
};
#endif // _WX_QT_STATBOX_H_

View File

@@ -0,0 +1,37 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/statline.h
// Author: Peter Most
// Copyright: (c) Peter Most
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_STATLINE_H_
#define _WX_QT_STATLINE_H_
class QFrame;
class WXDLLIMPEXP_CORE wxStaticLine : public wxStaticLineBase
{
public:
wxStaticLine() = default;
wxStaticLine( wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxLI_HORIZONTAL,
const wxString &name = wxASCII_STR(wxStaticLineNameStr) );
bool Create( wxWindow *parent,
wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxLI_HORIZONTAL,
const wxString &name = wxASCII_STR(wxStaticLineNameStr) );
QFrame* GetQFrame() const;
wxDECLARE_DYNAMIC_CLASS(wxStaticLine);
};
#endif // _WX_QT_STATLINE_H_

View File

@@ -0,0 +1,47 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/stattext.h
// Author: Peter Most, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_STATTEXT_H_
#define _WX_QT_STATTEXT_H_
class QLabel;
class WXDLLIMPEXP_CORE wxStaticText : public wxStaticTextBase
{
public:
wxStaticText() = default;
wxStaticText(wxWindow *parent,
wxWindowID id,
const wxString &label,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
long style = 0,
const wxString &name = wxASCII_STR(wxStaticTextNameStr) );
~wxStaticText();
bool Create(wxWindow *parent,
wxWindowID id,
const wxString &label,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
long style = 0,
const wxString &name = wxASCII_STR(wxStaticTextNameStr) );
virtual void SetLabel(const wxString& label) override;
QLabel* GetQLabel() const;
protected:
virtual wxString WXGetVisibleLabel() const override;
virtual void WXSetVisibleLabel(const wxString& str) override;
wxDECLARE_DYNAMIC_CLASS(wxStaticText);
};
#endif // _WX_QT_STATTEXT_H_

View File

@@ -0,0 +1,47 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/statusbar.h
// Author: Peter Most, Javier Torres, Mariano Reingart, Sean D'Epagnier
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_STATUSBAR_H_
#define _WX_QT_STATUSBAR_H_
#include "wx/statusbr.h"
class QStatusBar;
class WXDLLIMPEXP_CORE wxStatusBar : public wxStatusBarBase
{
public:
wxStatusBar() = default;
wxStatusBar(wxWindow *parent, wxWindowID winid = wxID_ANY,
long style = wxSTB_DEFAULT_STYLE,
const wxString& name = wxASCII_STR(wxStatusBarNameStr));
bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY,
long style = wxSTB_DEFAULT_STYLE,
const wxString& name = wxASCII_STR(wxStatusBarNameStr));
virtual void SetStatusWidths(int n, const int widths_field[]) override;
virtual bool GetFieldRect(int i, wxRect& rect) const override;
virtual void SetMinHeight(int height) override;
virtual int GetBorderX() const override;
virtual int GetBorderY() const override;
QStatusBar* GetQStatusBar() const;
protected:
virtual void DoUpdateStatusText(int number) override;
private:
void CreateFieldsIfNeeded();
std::vector<QWidget*> m_qtPanes;
wxDECLARE_DYNAMIC_CLASS(wxStatusBar);
};
#endif // _WX_QT_STATUSBAR_H_

View File

@@ -0,0 +1,35 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/taskbar.h
// Author: Peter Most
// Copyright: (c) Peter Most
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_TASKBAR_H_
#define _WX_QT_TASKBAR_H_
class QSystemTrayIcon;
class WXDLLIMPEXP_ADV wxTaskBarIcon : public wxTaskBarIconBase
{
public:
wxTaskBarIcon(wxTaskBarIconType iconType = wxTBI_DEFAULT_TYPE);
virtual ~wxTaskBarIcon();
// Accessors
bool IsOk() const { return false; }
bool IsIconInstalled() const { return false; }
// Operations
virtual bool SetIcon(const wxBitmapBundle& icon,
const wxString& tooltip = wxEmptyString) override;
virtual bool RemoveIcon() override;
virtual bool PopupMenu(wxMenu *menu) override;
private:
QSystemTrayIcon *m_qtSystemTrayIcon;
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTaskBarIcon);
};
#endif // _WX_QT_TASKBAR_H_

View File

@@ -0,0 +1,105 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/textctrl.h
// Author: Mariano Reingart, Peter Most
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_TEXTCTRL_H_
#define _WX_QT_TEXTCTRL_H_
class wxQtEdit;
class WXDLLIMPEXP_CORE wxTextCtrl : public wxTextCtrlBase
{
public:
wxTextCtrl() = default;
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));
virtual int GetLineLength(long lineNo) const override;
virtual wxString GetLineText(long lineNo) const override;
virtual int GetNumberOfLines() const override;
virtual bool IsModified() const override;
virtual void MarkDirty() override;
virtual void DiscardEdits() override;
virtual bool SetStyle(long start, long end, const wxTextAttr& style) override;
virtual bool GetStyle(long position, wxTextAttr& style) override;
virtual bool SetDefaultStyle(const wxTextAttr& style) override;
virtual long XYToPosition(long x, long y) const override;
virtual bool PositionToXY(long pos, long *x, long *y) const override;
virtual void ShowPosition(long pos) override;
virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const override;
virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt,
wxTextCoord *col,
wxTextCoord *row) const override
{
return wxTextCtrlBase::HitTest(pt, col, row);
}
virtual void SetInsertionPoint(long pos) override;
virtual long GetInsertionPoint() const override;
virtual void SetSelection( long from, long to ) override;
virtual void GetSelection(long *from, long *to) const override;
virtual void Copy() override;
virtual void Cut() override;
virtual void Paste() override;
virtual void Undo() override;
virtual void Redo() override;
virtual bool CanUndo() const override;
virtual bool CanRedo() const override;
virtual void EmptyUndoBuffer() override;
virtual bool IsEditable() const override;
virtual void SetEditable(bool editable) override;
virtual wxString DoGetValue() const override;
virtual void DoSetValue(const wxString &text, int flags = 0) override;
virtual void WriteText(const wxString& text) override;
virtual void SetMaxLength(unsigned long len) override;
virtual wxTextSearchResult SearchText(const wxTextSearch& search) const override;
protected:
virtual wxSize DoGetBestSize() const override;
virtual bool DoLoadFile(const wxString& file, int fileType) override;
virtual bool DoSaveFile(const wxString& file, int fileType) override;
// From wxTextEntry:
virtual wxWindow *GetEditableWindow() override { return this; }
private:
wxQtEdit *m_qtEdit = nullptr;
wxDECLARE_DYNAMIC_CLASS( wxTextCtrl );
};
#endif // _WX_QT_TEXTCTRL_H_

View File

@@ -0,0 +1,62 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/textentry.h
// Author: Peter Most, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_TEXTENTRY_H_
#define _WX_QT_TEXTENTRY_H_
class wxTextAutoCompleteData; // private class used only by wxTextEntry itself
class WXDLLIMPEXP_CORE wxTextEntry : public wxTextEntryBase
{
public:
wxTextEntry();
virtual void WriteText(const wxString& text) override;
virtual void Remove(long from, long to) override;
virtual void Copy() override;
virtual void Cut() override;
virtual void Paste() override;
virtual void Undo() override;
virtual void Redo() override;
virtual bool CanUndo() const override;
virtual bool CanRedo() const override;
virtual void SetInsertionPoint(long pos) override;
virtual long GetInsertionPoint() const override;
virtual long GetLastPosition() const override;
virtual void SetSelection(long from, long to) override;
virtual void GetSelection(long *from, long *to) const override;
virtual bool IsEditable() const override;
virtual void SetEditable(bool editable) override;
protected:
virtual wxString DoGetValue() const override;
virtual void DoSetValue(const wxString& value, int flags=0) override;
virtual bool DoAutoCompleteStrings(const wxArrayString& choices) override;
virtual bool DoAutoCompleteFileNames(int flags) override;
virtual bool DoAutoCompleteCustom(wxTextCompleter* completer) override;
virtual wxWindow *GetEditableWindow() override;
// Block/unblock the corresponding Qt signal.
virtual void EnableTextChangedEvents(bool enable) override;
// Various auto-completion-related stuff, only used if any of AutoComplete()
// methods are called. Use the function above to access it.
wxTextAutoCompleteData* m_autoCompleteData = nullptr;
// It needs to call our GetEditableWindow() method.
friend class wxTextAutoCompleteData;
};
#endif // _WX_QT_TEXTENTRY_H_

View File

@@ -0,0 +1,77 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/tglbtn.h
// Author: Peter Most, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_TGLBTN_H_
#define _WX_QT_TGLBTN_H_
#include "wx/tglbtn.h"
class WXDLLIMPEXP_CORE wxToggleButton : public wxToggleButtonBase
{
public:
wxToggleButton() = default;
wxToggleButton(wxWindow *parent,
wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxCheckBoxNameStr));
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxCheckBoxNameStr));
virtual void SetValue(bool state) override;
virtual bool GetValue() const override;
// implementation only
virtual int QtGetEventType() const override { return wxEVT_TOGGLEBUTTON; }
private:
wxDECLARE_DYNAMIC_CLASS(wxToggleButton);
};
class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButton
{
public:
wxBitmapToggleButton() = default;
wxBitmapToggleButton(wxWindow *parent,
wxWindowID id,
const wxBitmapBundle& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxCheckBoxNameStr));
bool Create(wxWindow *parent,
wxWindowID id,
const wxBitmapBundle& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxCheckBoxNameStr));
private:
wxDECLARE_DYNAMIC_CLASS(wxBitmapToggleButton);
};
#endif // _WX_QT_TGLBTN_H_

View File

@@ -0,0 +1,54 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/timectrl.h
// Purpose: wxTimePickerCtrl for Qt.
// Author: Ali Kettab
// Created: 2023-10-13
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_TIMECTRL_H_
#define _WX_QT_TIMECTRL_H_
class QTimeEdit;
// ----------------------------------------------------------------------------
// wxTimePickerCtrl
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_ADV wxTimePickerCtrl : public wxTimePickerCtrlBase
{
public:
// ctors
wxTimePickerCtrl() = default;
wxTimePickerCtrl(wxWindow *parent,
wxWindowID id,
const wxDateTime& dt = wxDefaultDateTime,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTP_DEFAULT,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxTimePickerCtrlNameStr)
{
Create(parent, id, dt, pos, size, style, validator, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxDateTime& dt = wxDefaultDateTime,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTP_DEFAULT,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxTimePickerCtrlNameStr);
// Override this one to add time-specific (and date-ignoring) checks.
virtual void SetValue(const wxDateTime& dt) override;
virtual wxDateTime GetValue() const override;
QTimeEdit* GetQTimeEdit() const;
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxTimePickerCtrl);
};
#endif // _WX_QT_TIMECTRL_H_

View File

@@ -0,0 +1,78 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/toolbar.h
// Author: Sean D'Epagnier, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_TOOLBAR_H_
#define _WX_QT_TOOLBAR_H_
class QActionGroup;
class QToolBar;
class WXDLLIMPEXP_CORE wxToolBar : public wxToolBarBase
{
public:
wxToolBar() = default;
wxToolBar(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTB_DEFAULT_STYLE | wxNO_BORDER,
const wxString& name = wxASCII_STR(wxToolBarNameStr))
{
Create(parent, id, pos, size, style, name);
}
virtual ~wxToolBar();
bool Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTB_DEFAULT_STYLE | wxNO_BORDER,
const wxString& name = wxASCII_STR(wxToolBarNameStr));
virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const override;
virtual void SetWindowStyleFlag( long style ) override;
virtual void SetToolShortHelp(int id, const wxString& helpString) override;
virtual void SetToolNormalBitmap(int id, const wxBitmapBundle& bitmap) override;
virtual void SetToolDisabledBitmap(int id, const wxBitmapBundle& bitmap) override;
virtual bool Realize() override;
virtual wxToolBarToolBase *CreateTool(int toolid,
const wxString& label,
const wxBitmapBundle& bmpNormal,
const wxBitmapBundle& bmpDisabled = wxNullBitmap,
wxItemKind kind = wxITEM_NORMAL,
wxObject *clientData = nullptr,
const wxString& shortHelp = wxEmptyString,
const wxString& longHelp = wxEmptyString) override;
virtual wxToolBarToolBase *CreateTool(wxControl *control,
const wxString& label) override;
QToolBar* GetQToolBar() const;
protected:
QActionGroup* GetActionGroup(size_t pos);
virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool) override;
virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool) override;
virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable) override;
virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle) override;
virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle) override;
private:
long GetButtonStyle();
wxDECLARE_DYNAMIC_CLASS(wxToolBar);
};
#endif // _WX_QT_TOOLBAR_H_

View File

@@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/tooltip.h
// Author: Peter Most, Mariano Reingart
// Copyright: (c) 2010 wxWidgets dev team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_TOOLTIP_H_
#define _WX_QT_TOOLTIP_H_
#include "wx/object.h"
class WXDLLIMPEXP_FWD_CORE wxWindow;
class WXDLLIMPEXP_CORE wxToolTip : public wxObject
{
public:
// controlling tooltip behaviour: globally change tooltip parameters
// enable or disable the tooltips globally
static void Enable(bool flag);
// set the delay after which the tooltip appears
static void SetDelay(long milliseconds);
// set the delay after which the tooltip disappears or how long the
// tooltip remains visible
static void SetAutoPop(long milliseconds);
// set the delay between subsequent tooltips to appear
static void SetReshow(long milliseconds);
wxToolTip(const wxString &tip);
void SetTip(const wxString& tip);
const wxString& GetTip() const;
// the window we're associated with
void SetWindow(wxWindow *win);
wxWindow *GetWindow() const { return m_window; }
private:
wxString m_text;
wxWindow* m_window; // main window we're associated with
};
#endif // _WX_QT_TOOLTIP_H_

View File

@@ -0,0 +1,58 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/toplevel.h
// Purpose: declares wxTopLevelWindowNative class
// Author: Peter Most, Javier Torres, Mariano Reingart
// Copyright: (c) 2009 wxWidgets dev team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_TOPLEVEL_H_
#define _WX_QT_TOPLEVEL_H_
class WXDLLIMPEXP_CORE wxTopLevelWindowQt : public wxTopLevelWindowBase
{
public:
wxTopLevelWindowQt() = default;
wxTopLevelWindowQt(wxWindow *parent,
wxWindowID winid,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = wxASCII_STR(wxFrameNameStr));
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 bool Show(bool show = true) override;
virtual void Maximize(bool maximize = true) override;
virtual void Restore() override;
virtual void Iconize(bool iconize = true) override;
virtual bool IsMaximized() const override;
virtual bool IsIconized() const override;
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) override;
virtual bool IsFullScreen() const override;
virtual void SetTitle(const wxString& title) override;
virtual wxString GetTitle() const override;
virtual void SetIcons(const wxIconBundle& icons) override;
// Styles
virtual void SetWindowStyleFlag( long style ) override;
virtual long GetWindowStyleFlag() const override;
protected:
void QtSetSizeIncrement(int width, int height);
virtual void DoSetSizeHints( int minW, int minH,
int maxW, int maxH,
int incW, int incH) override;
};
#endif // _WX_QT_TOPLEVEL_H_

View File

@@ -0,0 +1,155 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/treectrl.h
// Author: Peter Most
// Copyright: (c) Peter Most
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_TREECTRL_H_
#define _WX_QT_TREECTRL_H_
class wxQTreeWidget;
class WXDLLIMPEXP_CORE wxTreeCtrl : public wxTreeCtrlBase
{
public:
wxTreeCtrl() = default;
wxTreeCtrl(wxWindow *parent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxTreeCtrlNameStr));
virtual ~wxTreeCtrl();
bool Create(wxWindow *parent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxTreeCtrlNameStr));
virtual unsigned int GetCount() const override;
virtual unsigned int GetIndent() const override;
virtual void SetIndent(unsigned int indent) override;
virtual void SetStateImages(const wxVector<wxBitmapBundle>& images) override;
virtual void SetImageList(wxImageList *imageList) override;
virtual void SetStateImageList(wxImageList *imageList) override;
virtual wxString GetItemText(const wxTreeItemId& item) const override;
virtual int GetItemImage(const wxTreeItemId& item,
wxTreeItemIcon which = wxTreeItemIcon_Normal) const override;
virtual wxTreeItemData *GetItemData(const wxTreeItemId& item) const override;
virtual wxColour GetItemTextColour(const wxTreeItemId& item) const override;
virtual wxColour GetItemBackgroundColour(const wxTreeItemId& item) const override;
virtual wxFont GetItemFont(const wxTreeItemId& item) const override;
virtual void SetItemText(const wxTreeItemId& item, const wxString& text) override;
virtual void SetItemImage(const wxTreeItemId& item,
int image,
wxTreeItemIcon which = wxTreeItemIcon_Normal) override;
virtual void SetItemData(const wxTreeItemId& item, wxTreeItemData *data) override;
virtual void SetItemHasChildren(const wxTreeItemId& item, bool has = true) override;
virtual void SetItemBold(const wxTreeItemId& item, bool bold = true) override;
virtual void SetItemDropHighlight(const wxTreeItemId& item, bool highlight = true) override;
virtual void SetItemTextColour(const wxTreeItemId& item, const wxColour& col) override;
virtual void SetItemBackgroundColour(const wxTreeItemId& item, const wxColour& col) override;
virtual void SetItemFont(const wxTreeItemId& item, const wxFont& font) override;
virtual bool IsVisible(const wxTreeItemId& item) const override;
virtual bool ItemHasChildren(const wxTreeItemId& item) const override;
virtual bool IsExpanded(const wxTreeItemId& item) const override;
virtual bool IsSelected(const wxTreeItemId& item) const override;
virtual bool IsBold(const wxTreeItemId& item) const override;
virtual size_t GetChildrenCount(const wxTreeItemId& item, bool recursively = true) const override;
virtual wxTreeItemId GetRootItem() const override;
virtual wxTreeItemId GetSelection() const override;
virtual size_t GetSelections(wxArrayTreeItemIds& selections) const override;
virtual void SetFocusedItem(const wxTreeItemId& item) override;
virtual void ClearFocusedItem() override;
virtual wxTreeItemId GetFocusedItem() const override;
virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const override;
virtual wxTreeItemId GetFirstChild(const wxTreeItemId& item, wxTreeItemIdValue& cookie) const override;
virtual wxTreeItemId GetNextChild(const wxTreeItemId& item, wxTreeItemIdValue& cookie) const override;
virtual wxTreeItemId GetLastChild(const wxTreeItemId& item) const override;
virtual wxTreeItemId GetNextSibling(const wxTreeItemId& item) const override;
virtual wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const override;
virtual wxTreeItemId GetFirstVisibleItem() const override;
virtual wxTreeItemId GetNextVisible(const wxTreeItemId& item) const override;
virtual wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const override;
virtual wxTreeItemId AddRoot(const wxString& text,
int image = -1, int selImage = -1,
wxTreeItemData *data = nullptr) override;
virtual void Delete(const wxTreeItemId& item) override;
virtual void DeleteChildren(const wxTreeItemId& item) override;
virtual void DeleteAllItems() override;
virtual void Expand(const wxTreeItemId& item) override;
virtual void Collapse(const wxTreeItemId& item) override;
virtual void CollapseAndReset(const wxTreeItemId& item) override;
virtual void Toggle(const wxTreeItemId& item) override;
virtual void Unselect() override;
virtual void UnselectAll() override;
virtual void SelectItem(const wxTreeItemId& item, bool select = true) override;
virtual void SelectChildren(const wxTreeItemId& parent) override;
virtual void EnsureVisible(const wxTreeItemId& item) override;
virtual void ScrollTo(const wxTreeItemId& item) override;
virtual wxTextCtrl *EditLabel(const wxTreeItemId& item, wxClassInfo* textCtrlClass = CLASSINFO(wxTextCtrl)) override;
virtual wxTextCtrl *GetEditControl() const override;
virtual void EndEditLabel(const wxTreeItemId& item, bool discardChanges = false) override;
virtual void SortChildren(const wxTreeItemId& item) override;
virtual bool GetBoundingRect(const wxTreeItemId& item, wxRect& rect, bool textOnly = false) const override;
virtual void SetWindowStyleFlag(long styles) override;
wxQTreeWidget* GetQTreeWidget() const;
protected:
virtual int DoGetItemState(const wxTreeItemId& item) const override;
virtual void DoSetItemState(const wxTreeItemId& item, int state) override;
virtual wxTreeItemId DoInsertItem(const wxTreeItemId& parent,
size_t pos,
const wxString& text,
int image, int selImage,
wxTreeItemData *data) override;
virtual wxTreeItemId DoInsertAfter(const wxTreeItemId& parent,
const wxTreeItemId& idPrevious,
const wxString& text,
int image = -1, int selImage = -1,
wxTreeItemData *data = nullptr) override;
virtual wxTreeItemId DoTreeHitTest(const wxPoint& point, int& flags) const override;
virtual void OnImagesChanged() override;
// For wxEVT_TREE_KEY_DOWN generation
void OnKeyDown(wxKeyEvent &event);
private:
void SendDeleteEvent(const wxTreeItemId &item);
wxTreeItemId GetNext(const wxTreeItemId &item) const;
void DoUpdateIconsSize(wxImageList *imageList);
wxDECLARE_DYNAMIC_CLASS(wxTreeCtrl);
};
#endif // _WX_QT_TREECTRL_H_

View File

@@ -0,0 +1,267 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/qt/window.h
// Purpose: wxWindow class
// Author: Peter Most, Javier Torres, Mariano Reingart
// Copyright: (c) 2009 wxWidgets dev team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_QT_WINDOW_H_
#define _WX_QT_WINDOW_H_
#include <memory>
class QShortcut;
class QAbstractScrollArea;
class QPainter;
class QPicture;
class QScrollBar;
class QWidget;
class QCloseEvent;
class QContextMenuEvent;
class QEvent;
class QFocusEvent;
class QKeyEvent;
class QPaintEvent;
class QResizeEvent;
class QWheelEvent;
class QMouseEvent;
class QMoveEvent;
class WXDLLIMPEXP_FWD_CORE wxQtShortcutHandler;
/* wxQt specific notes:
*
* Event handling is achieved by using the template class wxQtEventSignalHandler
* found in winevent.h to send all Qt events here to QtHandleXXXEvent() methods.
* All these methods receive the Qt event and the handler. This is done because
* events of the containers (the scrolled part of the window) are sent to the
* same wxWindow instance, that must be able to differentiate them as some events
* need different handling (paintEvent) depending on that.
* We pass the QWidget pointer to all event handlers for consistency.
*/
class WXDLLIMPEXP_CORE wxWindowQt : public wxWindowBase
{
public:
wxWindowQt();
~wxWindowQt();
wxWindowQt(wxWindowQt *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxASCII_STR(wxPanelNameStr));
bool Create(wxWindowQt *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxASCII_STR(wxPanelNameStr));
// Derived classes have to call PostCreation() explicitly if they don't call
// our Create() method during widget creation process.
void PostCreation( bool generic = true );
void AddChild( wxWindowBase *child ) override;
virtual bool Show( bool show = true ) override;
virtual void SetLabel(const wxString& label) override;
virtual wxString GetLabel() const override;
virtual void DoEnable( bool enable ) override;
virtual void SetFocus() override;
// Parent/Child:
static void QtReparent( QWidget *child, QWidget *parent );
virtual bool Reparent( wxWindowBase *newParent ) override;
// Z-order
virtual void Raise() override;
virtual void Lower() override;
// move the mouse to the specified position
virtual void WarpPointer(int x, int y) override;
virtual void Update() override;
virtual void Refresh( bool eraseBackground = true,
const wxRect *rect = nullptr ) override;
virtual bool SetCursor( const wxCursor &cursor ) override;
virtual bool SetFont(const wxFont& font) override;
// get the (average) character size for the current font
virtual int GetCharHeight() const override;
virtual int GetCharWidth() const override;
virtual double GetContentScaleFactor() const override;
virtual wxSize GetDPI() const override;
virtual double GetDPIScaleFactor() const override;
virtual void SetScrollbar( int orient,
int pos,
int thumbvisible,
int range,
bool refresh = true ) override;
virtual void SetScrollPos( int orient, int pos, bool refresh = true ) override;
virtual int GetScrollPos( int orient ) const override;
virtual int GetScrollThumb( int orient ) const override;
virtual int GetScrollRange( int orient ) const override;
virtual wxSize GetWindowBorderSize() const override;
// scroll window to the specified position
virtual void ScrollWindow( int dx, int dy,
const wxRect* rect = nullptr ) override;
// Styles
virtual void SetWindowStyleFlag( long style ) override;
virtual void SetExtraStyle( long exStyle ) override;
virtual bool SetBackgroundStyle(wxBackgroundStyle style) override;
virtual bool IsTransparentBackgroundSupported(wxString* reason = nullptr) const override;
virtual bool SetTransparent(wxByte alpha) override;
virtual bool CanSetTransparent() override { return true; }
virtual bool SetBackgroundColour(const wxColour& colour) override;
virtual bool SetForegroundColour(const wxColour& colour) override;
virtual void SetDoubleBuffered(bool on) override;
virtual bool IsDoubleBuffered() const override;
QWidget *GetHandle() const override;
#if wxUSE_DRAG_AND_DROP
virtual void SetDropTarget( wxDropTarget *dropTarget ) override;
#endif
#if wxUSE_ACCEL
// accelerators
// ------------
virtual void SetAcceleratorTable( const wxAcceleratorTable& accel ) override;
#endif // wxUSE_ACCEL
virtual bool EnableTouchEvents(int eventsMask) override;
// wxQt implementation internals:
// Takes ownership of pict - window will delete it
void QtSetPicture( QPicture* pict );
QPainter *QtGetPainter();
virtual bool QtCanPaintWithoutActivePainter() const;
virtual bool QtHandlePaintEvent ( QWidget *handler, QPaintEvent *event );
virtual bool QtHandleResizeEvent ( QWidget *handler, QResizeEvent *event );
virtual bool QtHandleWheelEvent ( QWidget *handler, QWheelEvent *event );
virtual bool QtHandleKeyEvent ( QWidget *handler, QKeyEvent *event );
virtual bool QtHandleMouseEvent ( QWidget *handler, QMouseEvent *event );
virtual bool QtHandleEnterEvent ( QWidget *handler, QEvent *event );
virtual bool QtHandleMoveEvent ( QWidget *handler, QMoveEvent *event );
virtual bool QtHandleShowEvent ( QWidget *handler, QEvent *event );
virtual bool QtHandleChangeEvent ( QWidget *handler, QEvent *event );
virtual bool QtHandleCloseEvent ( QWidget *handler, QCloseEvent *event );
virtual bool QtHandleContextMenuEvent ( QWidget *handler, QContextMenuEvent *event );
virtual bool QtHandleFocusEvent ( QWidget *handler, QFocusEvent *event );
static void QtStoreWindowPointer( QWidget *widget, const wxWindowQt *window );
static wxWindowQt *QtRetrieveWindowPointer( const QWidget *widget );
static void QtSendSetCursorEvent(wxWindowQt* win, const wxPoint& posClient);
#if wxUSE_ACCEL
virtual void QtHandleShortcut ( int command );
#endif // wxUSE_ACCEL
#if wxUSE_TOOLTIPS
// applies tooltip to the widget.
virtual void QtApplyToolTip(const wxString& text);
#endif // wxUSE_TOOLTIPS
protected:
virtual void DoGetTextExtent(const wxString& string,
int *x, int *y,
int *descent = nullptr,
int *externalLeading = nullptr,
const wxFont *font = nullptr) const override;
// coordinates translation
virtual void DoClientToScreen( int *x, int *y ) const override;
virtual void DoScreenToClient( int *x, int *y ) const override;
// capture/release the mouse, used by Capture/ReleaseMouse()
virtual void DoCaptureMouse() override;
virtual void DoReleaseMouse() override;
// freeze/thaw window updates
virtual void DoFreeze() override;
virtual void DoThaw() override;
// retrieve the position/size of the window
virtual void DoGetPosition(int *x, int *y) const override;
virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO) override;
virtual void DoGetSize(int *width, int *height) const override;
// same as DoSetSize() for the client size
virtual void DoSetClientSize(int width, int height) override;
virtual void DoGetClientSize(int *width, int *height) const override;
virtual void DoMoveWindow(int x, int y, int width, int height) override;
#if wxUSE_TOOLTIPS
virtual void DoSetToolTip( wxToolTip *tip ) override;
#endif // wxUSE_TOOLTIPS
#if wxUSE_MENUS
virtual bool DoPopupMenu(wxMenu *menu, int x, int y) override;
#endif // wxUSE_MENUS
// This is called when capture is taken from the window. It will
// fire off capture lost events.
void QtReleaseMouseAndNotify();
// Return the parent to use for children being reparented to us: this is
// overridden in wxFrame to use its central widget rather than the frame
// itself.
virtual QWidget* QtGetParentWidget() const { return GetHandle(); }
QWidget *m_qtWindow;
QAbstractScrollArea *m_qtContainer; // either nullptr or the same as m_qtWindow pointer
// if m_qtWindow derives from QAbstractScrollArea,
// e.g. QListWidget and QTextEdit.
private:
void Init();
// Return the viewport of m_qtContainer, if it's used, or just m_qtWindow.
//
// Always returns non-null pointer if the window has been already created.
QWidget *QtGetClientWidget() const;
QScrollBar *QtGetScrollBar( int orientation ) const;
bool QtSetBackgroundStyle();
std::unique_ptr<QPicture> m_qtPicture; // owned by this window
std::unique_ptr<QPainter> m_qtPainter; // always allocated
bool m_mouseInside;
bool m_pendingSize = false; // to properly set the size of the TLW if SetSize()
// is called before the window is shown.
wxSize m_pendingClientSize;
#if wxUSE_ACCEL
wxVector<QShortcut*> m_qtShortcuts; // owned by whatever GetHandle() returns
std::unique_ptr<wxQtShortcutHandler> m_qtShortcutHandler; // always allocated
bool m_processingShortcut;
#endif // wxUSE_ACCEL
wxDECLARE_DYNAMIC_CLASS_NO_COPY( wxWindowQt );
};
#endif // _WX_QT_WINDOW_H_