improve cursor and color implementation in wxqt

This commit is contained in:
Sean D'Epagnier
2016-08-24 22:04:59 -04:00
committed by Vadim Zeitlin
parent 9f39eeb5e9
commit 88e134ef81
14 changed files with 141 additions and 71 deletions

View File

@@ -65,7 +65,7 @@ DECLARE_VARIANT_OBJECT_EXPORTED(wxColour,WXDLLIMPEXP_CORE)
not need the wxGDIObject machinery to handle colors, please add it to the
list of ports which do not need it.
*/
#if defined( __WXMAC__ ) || defined( __WXMSW__ )
#if defined( __WXMAC__ ) || defined( __WXMSW__ ) || defined( __WXQT__ )
#define wxCOLOUR_IS_GDIOBJECT 0
#else
#define wxCOLOUR_IS_GDIOBJECT 1

View File

@@ -10,37 +10,35 @@
#ifndef _WX_QT_COLOUR_H_
#define _WX_QT_COLOUR_H_
#include <QtGui/QColor>
class QColor;
class WXDLLIMPEXP_CORE wxColour : public wxColourBase
{
public:
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
wxColour(const QColor& color) : m_qtColor(color) {}
wxColour(const QColor& color);
virtual bool IsOk() const { return m_qtColor.isValid(); }
virtual bool IsOk() const;
unsigned char Red() const { return m_qtColor.red(); }
unsigned char Green() const { return m_qtColor.green(); }
unsigned char Blue() const { return m_qtColor.blue(); }
unsigned char Alpha() const { return m_qtColor.alpha(); }
unsigned char Red() const;
unsigned char Green() const;
unsigned char Blue() const;
unsigned char Alpha() const;
bool operator==(const wxColour& color) const
{ return m_qtColor == color.m_qtColor; }
bool operator!=(const wxColour& color) const
{ return m_qtColor != color.m_qtColor; }
bool operator==(const wxColour& color) const;
bool operator!=(const wxColour& color) const;
int GetPixel() const;
QColor GetHandle() const { return m_qtColor; };
QColor GetQColor() const;
protected:
virtual void
InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a)
{ m_qtColor.setRgb(r, g, b, a); }
void Init();
virtual void InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a);
private:
QColor m_qtColor;
unsigned char red, green, blue, alpha;
bool valid;
wxDECLARE_DYNAMIC_CLASS(wxColour);
};

View File

@@ -16,7 +16,6 @@ class WXDLLIMPEXP_CORE wxCursor : public wxCursorBase
{
public:
wxCursor() { }
wxCursor( const wxCursor & );
wxCursor(wxStockCursor id) { InitFromStock(id); }
#if WXWIN_COMPATIBILITY_2_8
wxCursor(int id) { InitFromStock((wxStockCursor)id); }
@@ -28,8 +27,9 @@ public:
int hotSpotX = 0, int hotSpotY = 0);
#endif
QCursor m_qtCursor;
virtual wxPoint GetHotSpot() const;
QCursor &GetHandle() const;
protected:
void InitFromStock( wxStockCursor cursorId );
#if wxUSE_IMAGE

View File

@@ -82,6 +82,7 @@ public:
virtual void Refresh( bool eraseBackground = true,
const wxRect *rect = (const wxRect *) NULL );
virtual bool SetCursor( const wxCursor &cursor ) wxOVERRIDE;
virtual bool SetFont(const wxFont& font);
// get the (average) character size for the current font