initial (not yet working) code for DirectFB port
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40865 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
49
include/wx/dfb/app.h
Normal file
49
include/wx/dfb/app.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/dfb/app.h
|
||||
// Purpose: wxApp class
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2006-08-10
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2006 REA Elektronik GmbH
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DFB_APP_H_
|
||||
#define _WX_DFB_APP_H_
|
||||
|
||||
#include "wx/dfb/ifacehelpers.h"
|
||||
|
||||
wxDFB_DECLARE_INTERFACE(IDirectFB);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxApp
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxApp: public wxAppBase
|
||||
{
|
||||
public:
|
||||
wxApp();
|
||||
~wxApp();
|
||||
|
||||
// override base class (pure) virtuals
|
||||
virtual bool Initialize(int& argc, wxChar **argv);
|
||||
virtual void CleanUp();
|
||||
|
||||
virtual void WakeUpIdle();
|
||||
virtual bool Yield(bool onlyIfNeeded = false);
|
||||
|
||||
virtual wxVideoMode GetDisplayMode() const;
|
||||
virtual bool SetDisplayMode(const wxVideoMode& mode);
|
||||
|
||||
// implementation - get singleton DirectFB interface
|
||||
IDirectFBPtr GetDirectFBInterface();
|
||||
|
||||
private:
|
||||
IDirectFBPtr m_dfb;
|
||||
wxVideoMode m_videoMode;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxApp)
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif // _WX_DFB_APP_H_
|
125
include/wx/dfb/bitmap.h
Normal file
125
include/wx/dfb/bitmap.h
Normal file
@@ -0,0 +1,125 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/dfb/bitmap.h
|
||||
// Purpose: wxBitmap class
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2006-08-04
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2006 REA Elektronik GmbH
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DFB_BITMAP_H_
|
||||
#define _WX_DFB_BITMAP_H_
|
||||
|
||||
#include "wx/dfb/ifacehelpers.h"
|
||||
|
||||
wxDFB_DECLARE_INTERFACE(IDirectFBSurface);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxMask
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#warning "FIXME: move wxMask to common code"
|
||||
class WXDLLIMPEXP_CORE wxMask: public wxObject
|
||||
{
|
||||
public:
|
||||
wxMask();
|
||||
wxMask(const wxBitmap& bitmap);
|
||||
wxMask(const wxBitmap& bitmap, const wxColour& colour);
|
||||
#if wxUSE_PALETTE
|
||||
wxMask(const wxBitmap& bitmap, int paletteIndex);
|
||||
#endif
|
||||
wxMask(const wxMask& mask);
|
||||
~wxMask();
|
||||
|
||||
bool Create(const wxBitmap& bitmap);
|
||||
bool Create(const wxBitmap& bitmap, const wxColour& colour);
|
||||
#if wxUSE_PALETTE
|
||||
bool Create(const wxBitmap& bitmap, int paletteIndex);
|
||||
#endif
|
||||
|
||||
// implementation
|
||||
const wxBitmap& GetBitmap() const;
|
||||
|
||||
private:
|
||||
wxBitmap *m_bitmap;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxMask)
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxBitmap
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxBitmapHandler : public wxBitmapHandlerBase
|
||||
{
|
||||
public:
|
||||
wxBitmapHandler() : wxBitmapHandlerBase() {}
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxBitmapHandler)
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_CORE wxBitmap: public wxBitmapBase
|
||||
{
|
||||
public:
|
||||
wxBitmap() {}
|
||||
wxBitmap(int width, int height, int depth = -1);
|
||||
wxBitmap(const char bits[], int width, int height, int depth = 1);
|
||||
wxBitmap(const wxString &filename, wxBitmapType type = wxBITMAP_TYPE_RESOURCE);
|
||||
wxBitmap(const char **bits) { CreateFromXpm(bits); }
|
||||
wxBitmap(char **bits) { CreateFromXpm((const char **)bits); }
|
||||
#if wxUSE_IMAGE
|
||||
wxBitmap(const wxImage& image, int depth = -1);
|
||||
#endif
|
||||
|
||||
bool Ok() const;
|
||||
bool operator==(const wxBitmap& bmp) const;
|
||||
bool operator!=(const wxBitmap& bmp) const { return !(*this == bmp); }
|
||||
|
||||
bool Create(int width, int height, int depth = -1);
|
||||
|
||||
virtual int GetHeight() const;
|
||||
virtual int GetWidth() const;
|
||||
virtual int GetDepth() const;
|
||||
|
||||
#if wxUSE_IMAGE
|
||||
virtual wxImage ConvertToImage() const;
|
||||
#endif
|
||||
|
||||
virtual wxMask *GetMask() const;
|
||||
virtual void SetMask(wxMask *mask);
|
||||
|
||||
virtual wxBitmap GetSubBitmap(const wxRect& rect) const;
|
||||
|
||||
virtual bool SaveFile(const wxString &name, wxBitmapType type, const wxPalette *palette = (wxPalette *) NULL) const;
|
||||
virtual bool LoadFile(const wxString &name, wxBitmapType type = wxBITMAP_TYPE_RESOURCE);
|
||||
|
||||
#if wxUSE_PALETTE
|
||||
virtual wxPalette *GetPalette() const;
|
||||
virtual void SetPalette(const wxPalette& palette);
|
||||
#endif
|
||||
|
||||
// copies the contents and mask of the given (colour) icon to the bitmap
|
||||
virtual bool CopyFromIcon(const wxIcon& icon);
|
||||
|
||||
static void InitStandardHandlers();
|
||||
|
||||
// implementation:
|
||||
virtual void SetHeight(int height);
|
||||
virtual void SetWidth(int width);
|
||||
virtual void SetDepth(int depth);
|
||||
|
||||
// get underlying native representation:
|
||||
IDirectFBSurfacePtr GetDirectFBSurface() const;
|
||||
|
||||
protected:
|
||||
bool CreateFromXpm(const char **bits);
|
||||
|
||||
// ref counting code
|
||||
virtual wxObjectRefData *CreateRefData() const;
|
||||
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxBitmap)
|
||||
};
|
||||
|
||||
#endif // _WX_DFB_BITMAP_H_
|
59
include/wx/dfb/brush.h
Normal file
59
include/wx/dfb/brush.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/dfb/brush.h
|
||||
// Purpose: wxBrush class declaration
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2006-08-04
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2006 REA Elektronik GmbH
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DFB_BRUSH_H_
|
||||
#define _WX_DFB_BRUSH_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/object.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/gdiobj.h"
|
||||
#include "wx/bitmap.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxBitmap;
|
||||
class WXDLLIMPEXP_CORE wxBrush;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxBrush
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxBrush: public wxBrushBase
|
||||
{
|
||||
public:
|
||||
wxBrush() {}
|
||||
wxBrush(const wxColour &colour, int style = wxSOLID);
|
||||
wxBrush(const wxBitmap &stippleBitmap);
|
||||
|
||||
bool Ok() const;
|
||||
bool operator==(const wxBrush& brush) const;
|
||||
bool operator!=(const wxBrush& brush) const { return !(*this == brush); }
|
||||
|
||||
virtual int GetStyle() const;
|
||||
wxColour &GetColour() const;
|
||||
wxBitmap *GetStipple() const;
|
||||
|
||||
void SetColour(const wxColour& col);
|
||||
void SetColour(unsigned char r, unsigned char g, unsigned char b);
|
||||
void SetStyle(int style);
|
||||
void SetStipple(const wxBitmap& stipple);
|
||||
|
||||
protected:
|
||||
// ref counting code
|
||||
virtual wxObjectRefData *CreateRefData() const;
|
||||
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxBrush)
|
||||
};
|
||||
|
||||
#endif // _WX_DFB_BRUSH_H_
|
20
include/wx/dfb/chkconf.h
Normal file
20
include/wx/dfb/chkconf.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Name: wx/dfb/chkconf.h
|
||||
* Author: Vaclav Slavik
|
||||
* Purpose: Compiler-specific configuration checking
|
||||
* Created: 2006-08-10
|
||||
* RCS-ID: $Id$
|
||||
* Copyright: (c) 2006 REA Elektronik GmbH
|
||||
* Licence: wxWindows licence
|
||||
*/
|
||||
|
||||
/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
|
||||
|
||||
#ifndef _WX_DFB_CHKCONF_H_
|
||||
#define _WX_DFB_CHKCONF_H_
|
||||
|
||||
#ifndef __WXUNIVERSAL__
|
||||
# error "wxDirectFB cannot be built without wxUniversal"
|
||||
#endif
|
||||
|
||||
#endif /* _WX_DFB_CHKCONF_H_ */
|
50
include/wx/dfb/cursor.h
Normal file
50
include/wx/dfb/cursor.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/dfb/cursor.h
|
||||
// Purpose: wxCursor declaration
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2006-08-08
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2006 REA Elektronik GmbH
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DFB_CURSOR_H_
|
||||
#define _WX_DFB_CURSOR_H_
|
||||
|
||||
#include "wx/object.h"
|
||||
#include "wx/gdicmn.h"
|
||||
|
||||
class WXDLLIMPEXP_CORE wxBitmap;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxCursor
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxCursor: public wxObject
|
||||
{
|
||||
public:
|
||||
wxCursor() {}
|
||||
wxCursor(int cursorId);
|
||||
wxCursor(const char bits[], int width, int height,
|
||||
int hotSpotX=-1, int hotSpotY=-1,
|
||||
const char maskBits[]=0, wxColour *fg=0, wxColour *bg=0);
|
||||
wxCursor(const wxString& name,
|
||||
long flags = wxBITMAP_TYPE_CUR_RESOURCE,
|
||||
int hotSpotX = 0, int hotSpotY = 0);
|
||||
|
||||
bool Ok() const;
|
||||
bool operator==(const wxCursor& cursor) const;
|
||||
bool operator!=(const wxCursor& cursor) const { return !(*this == cursor); }
|
||||
|
||||
// implementation
|
||||
wxBitmap GetBitmap() const;
|
||||
|
||||
protected:
|
||||
// ref counting code
|
||||
virtual wxObjectRefData *CreateRefData() const;
|
||||
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxCursor)
|
||||
};
|
||||
|
||||
#endif // _WX_DFB_CURSOR_H_
|
220
include/wx/dfb/dc.h
Normal file
220
include/wx/dfb/dc.h
Normal file
@@ -0,0 +1,220 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/dfb/dc.h
|
||||
// Purpose: wxDC class
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2006-08-07
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2006 REA Elektronik GmbH
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DFB_DC_H_
|
||||
#define _WX_DFB_DC_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/region.h"
|
||||
#include "wx/dfb/ifacehelpers.h"
|
||||
|
||||
wxDFB_DECLARE_INTERFACE(IDirectFBSurface);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxDC
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxDC : public wxDCBase
|
||||
{
|
||||
public:
|
||||
wxDC();
|
||||
|
||||
// Ctor.
|
||||
// Takes ownership of the surface, i.e. does not call AddRef() on it
|
||||
// but calls Release() on it from dtor.
|
||||
wxDC(const IDirectFBSurfacePtr& surface);
|
||||
|
||||
public:
|
||||
// implement base class pure virtuals
|
||||
// ----------------------------------
|
||||
|
||||
virtual void Clear();
|
||||
|
||||
virtual bool StartDoc(const wxString& message);
|
||||
virtual void EndDoc();
|
||||
|
||||
virtual void StartPage();
|
||||
virtual void EndPage();
|
||||
|
||||
virtual void SetFont(const wxFont& font);
|
||||
virtual void SetPen(const wxPen& pen);
|
||||
virtual void SetBrush(const wxBrush& brush);
|
||||
virtual void SetBackground(const wxBrush& brush);
|
||||
virtual void SetBackgroundMode(int mode);
|
||||
#if wxUSE_PALETTE
|
||||
virtual void SetPalette(const wxPalette& palette);
|
||||
#endif
|
||||
|
||||
virtual void DestroyClippingRegion();
|
||||
|
||||
virtual wxCoord GetCharHeight() const;
|
||||
virtual wxCoord GetCharWidth() const;
|
||||
virtual void DoGetTextExtent(const wxString& string,
|
||||
wxCoord *x, wxCoord *y,
|
||||
wxCoord *descent = NULL,
|
||||
wxCoord *externalLeading = NULL,
|
||||
wxFont *theFont = NULL) const;
|
||||
|
||||
virtual bool CanDrawBitmap() const { return true; }
|
||||
virtual bool CanGetTextExtent() const { return true; }
|
||||
virtual int GetDepth() const;
|
||||
virtual wxSize GetPPI() const;
|
||||
|
||||
virtual void SetMapMode(int mode);
|
||||
virtual void SetUserScale(double x, double y);
|
||||
virtual void SetLogicalScale(double x, double y);
|
||||
virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
|
||||
virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
|
||||
virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
|
||||
virtual void SetLogicalFunction(int function);
|
||||
|
||||
// implementation from now on
|
||||
// --------------------------
|
||||
|
||||
virtual void ComputeScaleAndOrigin();
|
||||
|
||||
wxCoord XDEV2LOG(wxCoord x) const
|
||||
{
|
||||
wxCoord new_x = x - m_deviceOriginX;
|
||||
if (new_x > 0)
|
||||
return (wxCoord)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX;
|
||||
else
|
||||
return (wxCoord)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX;
|
||||
}
|
||||
wxCoord XDEV2LOGREL(wxCoord x) const
|
||||
{
|
||||
if (x > 0)
|
||||
return (wxCoord)((double)(x) / m_scaleX + 0.5);
|
||||
else
|
||||
return (wxCoord)((double)(x) / m_scaleX - 0.5);
|
||||
}
|
||||
wxCoord YDEV2LOG(wxCoord y) const
|
||||
{
|
||||
wxCoord new_y = y - m_deviceOriginY;
|
||||
if (new_y > 0)
|
||||
return (wxCoord)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY;
|
||||
else
|
||||
return (wxCoord)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY;
|
||||
}
|
||||
wxCoord YDEV2LOGREL(wxCoord y) const
|
||||
{
|
||||
if (y > 0)
|
||||
return (wxCoord)((double)(y) / m_scaleY + 0.5);
|
||||
else
|
||||
return (wxCoord)((double)(y) / m_scaleY - 0.5);
|
||||
}
|
||||
wxCoord XLOG2DEV(wxCoord x) const
|
||||
{
|
||||
wxCoord new_x = x - m_logicalOriginX;
|
||||
if (new_x > 0)
|
||||
return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX;
|
||||
else
|
||||
return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX;
|
||||
}
|
||||
wxCoord XLOG2DEVREL(wxCoord x) const
|
||||
{
|
||||
if (x > 0)
|
||||
return (wxCoord)((double)(x) * m_scaleX + 0.5);
|
||||
else
|
||||
return (wxCoord)((double)(x) * m_scaleX - 0.5);
|
||||
}
|
||||
wxCoord YLOG2DEV(wxCoord y) const
|
||||
{
|
||||
wxCoord new_y = y - m_logicalOriginY;
|
||||
if (new_y > 0)
|
||||
return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY;
|
||||
else
|
||||
return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY;
|
||||
}
|
||||
wxCoord YLOG2DEVREL(wxCoord y) const
|
||||
{
|
||||
if (y > 0)
|
||||
return (wxCoord)((double)(y) * m_scaleY + 0.5);
|
||||
else
|
||||
return (wxCoord)((double)(y) * m_scaleY - 0.5);
|
||||
}
|
||||
|
||||
// Returns the surface (and increases its ref count)
|
||||
IDirectFBSurfacePtr GetDirectFBSurface() const { return m_surface; }
|
||||
|
||||
protected:
|
||||
// initializes the DC from a surface, must be called if default ctor
|
||||
// was used
|
||||
void Init(const IDirectFBSurfacePtr& surface);
|
||||
|
||||
virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
|
||||
int style = wxFLOOD_SURFACE);
|
||||
|
||||
virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const;
|
||||
|
||||
virtual void DoDrawPoint(wxCoord x, wxCoord y);
|
||||
virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
|
||||
|
||||
virtual void DoDrawArc(wxCoord x1, wxCoord y1,
|
||||
wxCoord x2, wxCoord y2,
|
||||
wxCoord xc, wxCoord yc);
|
||||
virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
|
||||
double sa, double ea);
|
||||
|
||||
virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
||||
virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
|
||||
wxCoord width, wxCoord height,
|
||||
double radius);
|
||||
virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
|
||||
|
||||
virtual void DoCrossHair(wxCoord x, wxCoord y);
|
||||
|
||||
virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
|
||||
virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
|
||||
bool useMask = false);
|
||||
|
||||
virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
|
||||
virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
|
||||
double angle);
|
||||
|
||||
virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
|
||||
wxDC *source, wxCoord xsrc, wxCoord ysrc,
|
||||
int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
|
||||
|
||||
// this is gnarly - we can't even call this function DoSetClippingRegion()
|
||||
// because of virtual function hiding
|
||||
virtual void DoSetClippingRegionAsRegion(const wxRegion& region);
|
||||
virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
|
||||
wxCoord width, wxCoord height);
|
||||
|
||||
virtual void DoGetSize(int *width, int *height) const;
|
||||
virtual void DoGetSizeMM(int* width, int* height) const;
|
||||
|
||||
virtual void DoDrawLines(int n, wxPoint points[],
|
||||
wxCoord xoffset, wxCoord yoffset);
|
||||
virtual void DoDrawPolygon(int n, wxPoint points[],
|
||||
wxCoord xoffset, wxCoord yoffset,
|
||||
int fillStyle = wxODDEVEN_RULE);
|
||||
|
||||
// implementation from now on:
|
||||
|
||||
private:
|
||||
// Unified implementation of DrawIcon, DrawBitmap and Blit:
|
||||
void DoDrawSubBitmap(const wxBitmap &bmp,
|
||||
wxCoord x, wxCoord y, wxCoord w, wxCoord h,
|
||||
wxCoord destx, wxCoord desty, int rop, bool useMask);
|
||||
|
||||
// selects colour into surface's state
|
||||
void SelectColour(const wxColour& clr);
|
||||
|
||||
protected:
|
||||
IDirectFBSurfacePtr m_surface;
|
||||
|
||||
double m_mm_to_pix_x, m_mm_to_pix_y;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxDC)
|
||||
};
|
||||
|
||||
#endif // _WX_DFB_DC_H_
|
77
include/wx/dfb/dcclient.h
Normal file
77
include/wx/dfb/dcclient.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/dfb/dcclient.h
|
||||
// Purpose: wxWindowDC, wxClientDC and wxPaintDC
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2006-08-10
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2006 REA Elektronik GmbH
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DFB_DCCLIENT_H_
|
||||
#define _WX_DFB_DCCLIENT_H_
|
||||
|
||||
#include "wx/dc.h"
|
||||
|
||||
class WXDLLIMPEXP_CORE wxWindow;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxWindowDC
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxWindowDC : public wxDC
|
||||
{
|
||||
public:
|
||||
wxWindowDC() {}
|
||||
wxWindowDC(wxWindow *win);
|
||||
|
||||
protected:
|
||||
void InitForWin(wxWindow *win);
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxWindowDC)
|
||||
DECLARE_NO_COPY_CLASS(wxWindowDC)
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// base class for wxClientDC and wxPaintDC
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxClientDCBase : public wxWindowDC
|
||||
{
|
||||
public:
|
||||
wxClientDCBase() {}
|
||||
wxClientDCBase(wxWindow *win);
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxClientDC
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxClientDC : public wxClientDCBase
|
||||
{
|
||||
public:
|
||||
wxClientDC() {}
|
||||
wxClientDC(wxWindow *win) : wxClientDCBase(win) {}
|
||||
~wxClientDC();
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxClientDC)
|
||||
DECLARE_NO_COPY_CLASS(wxClientDC)
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxPaintDC
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxPaintDC : public wxClientDCBase
|
||||
{
|
||||
public:
|
||||
wxPaintDC() {}
|
||||
wxPaintDC(wxWindow *win) : wxClientDCBase(win) {}
|
||||
~wxPaintDC();
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxPaintDC)
|
||||
DECLARE_NO_COPY_CLASS(wxPaintDC)
|
||||
};
|
||||
|
||||
#endif // _WX_DFB_DCCLIENT_H_
|
29
include/wx/dfb/dcmemory.h
Normal file
29
include/wx/dfb/dcmemory.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/dfb/dcmemory.h
|
||||
// Purpose: wxMemoryDC class declaration
|
||||
// Created: 2006-08-10
|
||||
// Author: Vaclav Slavik
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2006 REA Elektronik GmbH
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DFB_DCMEMORY_H_
|
||||
#define _WX_DFB_DCMEMORY_H_
|
||||
|
||||
#include "wx/dc.h"
|
||||
#include "wx/bitmap.h"
|
||||
|
||||
class WXDLLIMPEXP_CORE wxMemoryDC : public wxDC
|
||||
{
|
||||
public:
|
||||
wxMemoryDC();
|
||||
wxMemoryDC(wxDC *dc); // create compatible DC
|
||||
|
||||
virtual void SelectObject(const wxBitmap& bitmap);
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxMemoryDC)
|
||||
};
|
||||
|
||||
#endif // _WX_DFB_DCMEMORY_H_
|
||||
|
31
include/wx/dfb/dcscreen.h
Normal file
31
include/wx/dfb/dcscreen.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/dfb/dcscreen.h
|
||||
// Purpose: wxScreenDC declaration
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2006-08-10
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2006 REA Elektronik GmbH
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DFB_DCSCREEN_H_
|
||||
#define _WX_DFB_DCSCREEN_H_
|
||||
|
||||
#include "wx/dc.h"
|
||||
|
||||
class WXDLLIMPEXP_CORE wxScreenDC: public wxDC
|
||||
{
|
||||
public:
|
||||
wxScreenDC();
|
||||
|
||||
static bool StartDrawingOnTop(wxWindow *WXUNUSED(window))
|
||||
{ return true; }
|
||||
static bool StartDrawingOnTop(wxRect *WXUNUSED(rect) = NULL)
|
||||
{ return true; }
|
||||
static bool EndDrawingOnTop()
|
||||
{ return true; }
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxScreenDC)
|
||||
};
|
||||
|
||||
#endif // _WX_DFB_DCSCREEN_H_
|
51
include/wx/dfb/evtloop.h
Normal file
51
include/wx/dfb/evtloop.h
Normal file
@@ -0,0 +1,51 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/dfb/evtloop.h
|
||||
// Purpose: declares wxEventLoop class
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2006-08-16
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2006 REA Elektronik GmbH
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DFB_EVTLOOP_H_
|
||||
#define _WX_DFB_EVTLOOP_H_
|
||||
|
||||
#include "wx/dfb/ifacehelpers.h"
|
||||
|
||||
wxDFB_DECLARE_INTERFACE(IDirectFBEventBuffer);
|
||||
struct wxDFBEvent;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxEventLoop
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxEventLoop : public wxEventLoopManual
|
||||
{
|
||||
public:
|
||||
wxEventLoop();
|
||||
|
||||
virtual bool Pending() const;
|
||||
virtual bool Dispatch();
|
||||
|
||||
// returns DirectFB event buffer used by wx
|
||||
static IDirectFBEventBufferPtr GetDirectFBEventBuffer();
|
||||
|
||||
protected:
|
||||
virtual void WakeUp();
|
||||
virtual void OnNextIteration();
|
||||
|
||||
virtual void HandleDFBEvent(const wxDFBEvent& event);
|
||||
|
||||
private:
|
||||
static void InitBuffer();
|
||||
|
||||
private:
|
||||
static IDirectFBEventBufferPtr ms_buffer;
|
||||
|
||||
friend class wxApp; // calls WakeUp()
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxEventLoop)
|
||||
};
|
||||
|
||||
#endif // _WX_DFB_EVTLOOP_H_
|
78
include/wx/dfb/font.h
Normal file
78
include/wx/dfb/font.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/dfb/font.h
|
||||
// Author: Vaclav Slavik
|
||||
// Purpose: wxFont declaration
|
||||
// Created: 2006-08-08
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2006 REA Elektronik GmbH
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DFB_FONT_H_
|
||||
#define _WX_DFB_FONT_H_
|
||||
|
||||
#include "wx/dfb/ifacehelpers.h"
|
||||
|
||||
wxDFB_DECLARE_INTERFACE(IDirectFBFont);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFont
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxFont : public wxFontBase
|
||||
{
|
||||
public:
|
||||
wxFont() {}
|
||||
wxFont(const wxNativeFontInfo& info) { Create(info); }
|
||||
wxFont(int size,
|
||||
int family,
|
||||
int style,
|
||||
int weight,
|
||||
bool underlined = false,
|
||||
const wxString& face = wxEmptyString,
|
||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
|
||||
{
|
||||
Create(size, family, style, weight, underlined, face, encoding);
|
||||
}
|
||||
|
||||
bool Create(int size,
|
||||
int family,
|
||||
int style,
|
||||
int weight,
|
||||
bool underlined = false,
|
||||
const wxString& face = wxEmptyString,
|
||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
|
||||
bool Create(const wxNativeFontInfo& fontinfo);
|
||||
|
||||
// implement base class pure virtuals
|
||||
virtual int GetPointSize() const;
|
||||
virtual int GetFamily() const;
|
||||
virtual int GetStyle() const;
|
||||
virtual int GetWeight() const;
|
||||
virtual wxString GetFaceName() const;
|
||||
virtual bool GetUnderlined() const;
|
||||
virtual wxFontEncoding GetEncoding() const;
|
||||
virtual bool IsFixedWidth() const;
|
||||
virtual const wxNativeFontInfo *GetNativeFontInfo() const;
|
||||
|
||||
virtual void SetPointSize(int pointSize);
|
||||
virtual void SetFamily(int family);
|
||||
virtual void SetStyle(int style);
|
||||
virtual void SetWeight(int weight);
|
||||
virtual bool SetFaceName(const wxString& faceName);
|
||||
virtual void SetUnderlined(bool underlined);
|
||||
virtual void SetEncoding(wxFontEncoding encoding);
|
||||
|
||||
// implementation from now on:
|
||||
IDirectFBFontPtr GetDirectFBFont() const;
|
||||
|
||||
protected:
|
||||
// ref counting code
|
||||
virtual wxObjectRefData *CreateRefData() const;
|
||||
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxFont)
|
||||
};
|
||||
|
||||
#endif // _WX_DFB_FONT_H_
|
116
include/wx/dfb/ifacehelpers.h
Normal file
116
include/wx/dfb/ifacehelpers.h
Normal file
@@ -0,0 +1,116 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/dfb/ifacehelpers.h
|
||||
// Purpose: helpers for dealing with DFB interfaces
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2006-08-09
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2006 REA Elektronik GmbH
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DFB_IFACEHELPERS_H_
|
||||
#define _WX_DFB_IFACEHELPERS_H_
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxDFB_DECLARE_INTERFACE
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
Forward declares DirectFB interface @a name.
|
||||
|
||||
Also declares name##Ptr typedef for wxDfbPtr<name> pointer.
|
||||
|
||||
@param name name of the DirectFB interface
|
||||
*/
|
||||
#define wxDFB_DECLARE_INTERFACE(name) \
|
||||
struct _##name; \
|
||||
typedef _##name name; \
|
||||
typedef wxDfbPtr<name> name##Ptr;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxDfbPtr
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// base class for wxDfbPtr
|
||||
class wxDfbPtrBase
|
||||
{
|
||||
protected:
|
||||
// increment/decrement refcount; see ifacehelpers.cpp for why using
|
||||
// void* is safe
|
||||
static void DoAddRef(void *ptr);
|
||||
static void DoRelease(void *ptr);
|
||||
};
|
||||
|
||||
/**
|
||||
This template implements smart pointer for keeping pointers to DirectFB
|
||||
interfaces. Interface's reference count is increased on copying and the
|
||||
interface is released when the pointer is deleted.
|
||||
*/
|
||||
template<typename T>
|
||||
class wxDfbPtr : private wxDfbPtrBase
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Creates the pointer from raw interface pointer.
|
||||
|
||||
Takes ownership of @a ptr, i.e. AddRef() is @em not called on it.
|
||||
*/
|
||||
wxDfbPtr(T *ptr = NULL) : m_ptr(ptr) {}
|
||||
|
||||
/// Copy ctor
|
||||
wxDfbPtr(const wxDfbPtr& ptr) { InitFrom(ptr); }
|
||||
|
||||
/// Dtor. Releases the interface
|
||||
~wxDfbPtr() { Reset(); }
|
||||
|
||||
/// Resets the pointer to NULL, decreasing reference count of the interface.
|
||||
void Reset()
|
||||
{
|
||||
if ( m_ptr )
|
||||
{
|
||||
DoRelease(m_ptr);
|
||||
m_ptr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/// Cast to raw pointer
|
||||
operator T*() const { return m_ptr; }
|
||||
|
||||
/**
|
||||
Cast to @em writeable raw pointer so that code like
|
||||
"dfb->CreateFont(dfb, NULL, &desc, &fontPtr)" works.
|
||||
|
||||
Note that this operator calls Reset(), so using it looses the value.
|
||||
*/
|
||||
T** operator&()
|
||||
{
|
||||
Reset();
|
||||
return &m_ptr;
|
||||
}
|
||||
|
||||
// standard operators:
|
||||
|
||||
wxDfbPtr& operator=(const wxDfbPtr& ptr)
|
||||
{
|
||||
Reset();
|
||||
InitFrom(ptr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
T& operator*() const { return *m_ptr; }
|
||||
T* operator->() const { return m_ptr; }
|
||||
|
||||
private:
|
||||
void InitFrom(const wxDfbPtr& ptr)
|
||||
{
|
||||
m_ptr = ptr.m_ptr;
|
||||
if ( m_ptr )
|
||||
DoAddRef(m_ptr);
|
||||
}
|
||||
|
||||
private:
|
||||
T *m_ptr;
|
||||
};
|
||||
|
||||
#endif // _WX_DFB_IFACEHELPERS_H_
|
70
include/wx/dfb/pen.h
Normal file
70
include/wx/dfb/pen.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/dfb/pen.h
|
||||
// Purpose: wxPen class declaration
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2006-08-04
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2006 REA Elektronik GmbH
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DFB_PEN_H_
|
||||
#define _WX_DFB_PEN_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/object.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/gdiobj.h"
|
||||
#include "wx/gdicmn.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxBitmap;
|
||||
class WXDLLIMPEXP_CORE wxPen;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxPen
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxPen: public wxGDIObject
|
||||
{
|
||||
public:
|
||||
wxPen() {}
|
||||
wxPen(const wxColour &colour, int width = 1, int style = wxSOLID);
|
||||
wxPen(const wxBitmap& stipple, int width);
|
||||
|
||||
bool operator==(const wxPen& pen) const;
|
||||
bool operator!=(const wxPen& pen) const { return !(*this == pen); }
|
||||
|
||||
void SetColour(const wxColour &colour);
|
||||
void SetColour(unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetCap(int capStyle);
|
||||
void SetJoin(int joinStyle);
|
||||
void SetStyle(int style);
|
||||
void SetWidth(int width);
|
||||
void SetDashes(int number_of_dashes, const wxDash *dash);
|
||||
void SetStipple(const wxBitmap& stipple);
|
||||
|
||||
wxColour &GetColour() const;
|
||||
int GetCap() const;
|
||||
int GetJoin() const;
|
||||
int GetStyle() const;
|
||||
int GetWidth() const;
|
||||
int GetDashes(wxDash **ptr) const;
|
||||
int GetDashCount() const;
|
||||
wxDash* GetDash() const;
|
||||
wxBitmap *GetStipple() const;
|
||||
|
||||
bool Ok() const;
|
||||
|
||||
protected:
|
||||
// ref counting code
|
||||
virtual wxObjectRefData *CreateRefData() const;
|
||||
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxPen)
|
||||
};
|
||||
|
||||
#endif // _WX_DFB_PEN_H_
|
156
include/wx/dfb/private.h
Normal file
156
include/wx/dfb/private.h
Normal file
@@ -0,0 +1,156 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/dfb/private.h
|
||||
// Purpose: private helpers for wxDFB implementation
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2006-08-09
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2006 REA Elektronik GmbH
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DFB_PRIVATE_H_
|
||||
#define _WX_DFB_PRIVATE_H_
|
||||
|
||||
#include "wx/intl.h"
|
||||
#include "wx/log.h"
|
||||
|
||||
#include <directfb.h>
|
||||
|
||||
#include "wx/dfb/ifacehelpers.h"
|
||||
|
||||
wxDFB_DECLARE_INTERFACE(IDirectFB);
|
||||
wxDFB_DECLARE_INTERFACE(IDirectFBDisplayLayer);
|
||||
wxDFB_DECLARE_INTERFACE(IDirectFBSurface);
|
||||
wxDFB_DECLARE_INTERFACE(IDirectFBPalette);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// strings conversion
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// convert string from wxString to UTF-8 encoded const char*
|
||||
#if wxUSE_UNICODE
|
||||
#define wxSTR_TO_DFB(s) (s).mb_str(wxConvUTF8)
|
||||
#else
|
||||
#define wxSTR_TO_DFB(s) wxConvUTF8.cWC2MB((s).wc_str(*wxConvUI))
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// error checking
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
inline bool wxDfbCheckReturn(DFBResult code)
|
||||
{
|
||||
switch ( code )
|
||||
{
|
||||
case DFB_OK:
|
||||
return true;
|
||||
|
||||
// these are programming errors, assert:
|
||||
#define DFB_ASSERT(code) \
|
||||
case code: \
|
||||
wxFAIL_MSG( _T("DirectFB error: ") _T(#code) ); \
|
||||
return false \
|
||||
|
||||
DFB_ASSERT(DFB_DEAD);
|
||||
DFB_ASSERT(DFB_UNSUPPORTED);
|
||||
DFB_ASSERT(DFB_UNIMPLEMENTED);
|
||||
DFB_ASSERT(DFB_INVARG);
|
||||
DFB_ASSERT(DFB_NOIMPL);
|
||||
DFB_ASSERT(DFB_MISSINGFONT);
|
||||
DFB_ASSERT(DFB_THIZNULL);
|
||||
DFB_ASSERT(DFB_INVAREA);
|
||||
DFB_ASSERT(DFB_DESTROYED);
|
||||
DFB_ASSERT(DFB_NOSUCHMETHOD);
|
||||
DFB_ASSERT(DFB_NOSUCHINSTANCE);
|
||||
DFB_ASSERT(DFB_VERSIONMISMATCH);
|
||||
|
||||
#undef DFB_ASSERT
|
||||
|
||||
// these are not errors, but valid return codes:
|
||||
case DFB_INTERRUPTED:
|
||||
case DFB_BUFFEREMPTY:
|
||||
return true;
|
||||
|
||||
default:
|
||||
// FIXME: should handle the errors individually
|
||||
wxLogError(_("DirectFB error %d occured."), (int)code);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Wrap all calls to DirectFB in this macro so that the return value is
|
||||
checked and errors reported as appropriate.
|
||||
|
||||
Returns true if the call succeeded, false otherwise.
|
||||
*/
|
||||
#define DFB_CALL(call) (wxDfbCheckReturn(call))
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// surface manipulation helpers
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/// Mode of wxDfbCloneSurface() call
|
||||
enum wxDfbCloneSurfaceMode
|
||||
{
|
||||
/// Don't copy surface pixels, just clone surface size and attributes
|
||||
wxDfbCloneSurface_NoPixels = 0,
|
||||
/// Make exact copy, including the pixels
|
||||
wxDfbCloneSurface_CopyPixels
|
||||
};
|
||||
|
||||
/**
|
||||
Creates a new surface by cloning existing one. Depending on @a mode,
|
||||
either makes exact copy (wxDfbCloneSurface_CopyPixels) or only creates a
|
||||
new surface with the same size and attributes (wxDfbCloneSurface_NoPixels).
|
||||
*/
|
||||
IDirectFBSurfacePtr wxDfbCloneSurface(const IDirectFBSurfacePtr& s,
|
||||
wxDfbCloneSurfaceMode mode);
|
||||
|
||||
/// Returns bit depth used by the surface
|
||||
int wxDfbGetSurfaceDepth(const IDirectFBSurfacePtr& s);
|
||||
|
||||
/// Returns interface to the primary display layer:
|
||||
IDirectFBDisplayLayerPtr wxDfbGetDisplayLayer();
|
||||
|
||||
/// Returns interface to the primary surface:
|
||||
IDirectFBSurfacePtr wxDfbGetPrimarySurface();
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxDfbEvent
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
The struct defined by this macro is a thin wrapper around DFB*Event type.
|
||||
It is needed because DFB*Event are typedefs and so we can't forward declare
|
||||
them, but we need to pass them to methods declared in public headers where
|
||||
<directfb.h> cannot be included. So this struct just holds the event value,
|
||||
it's sole purpose is that it can be forward declared.
|
||||
*/
|
||||
#define WXDFB_DEFINE_EVENT_WRAPPER(T) \
|
||||
struct wx##T \
|
||||
{ \
|
||||
wx##T() {} \
|
||||
wx##T(const T& event) : m_event(event) {} \
|
||||
\
|
||||
operator T&() { return m_event; } \
|
||||
operator const T&() const { return m_event; } \
|
||||
T* operator&() { return &m_event; } \
|
||||
\
|
||||
DFBEventClass GetClass() const { return m_event.clazz; } \
|
||||
\
|
||||
private: \
|
||||
T m_event; \
|
||||
};
|
||||
|
||||
WXDFB_DEFINE_EVENT_WRAPPER(DFBEvent)
|
||||
WXDFB_DEFINE_EVENT_WRAPPER(DFBWindowEvent)
|
||||
|
||||
/// Convert DirectFB timestamp to wxEvent one:
|
||||
#define wxDFB_EVENT_TIMESTAMP(event) \
|
||||
((event).timestamp.tv_sec * 1000 + (event).timestamp.tv_usec / 1000)
|
||||
|
||||
|
||||
#endif // _WX_DFB_PRIVATE_H_
|
156
include/wx/dfb/region.h
Normal file
156
include/wx/dfb/region.h
Normal file
@@ -0,0 +1,156 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/dfb/region.h
|
||||
// Purpose: wxRegion class
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2006-08-08
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2006 REA Elektronik GmbH
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DFB_REGION_H_
|
||||
#define _WX_DFB_REGION_H_
|
||||
|
||||
#include "wx/gdiobj.h"
|
||||
#include "wx/gdicmn.h"
|
||||
|
||||
#warning "Move these to wx/region.h when common code is moved there"
|
||||
class WXDLLIMPEXP_CORE wxBitmap;
|
||||
class WXDLLIMPEXP_CORE wxColour;
|
||||
|
||||
class WXDLLIMPEXP_CORE wxRegion : public wxGDIObject
|
||||
{
|
||||
|
||||
public:
|
||||
wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
|
||||
wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
|
||||
wxRegion(const wxRect& rect);
|
||||
wxRegion(const wxBitmap& bmp)
|
||||
{
|
||||
Union(bmp);
|
||||
}
|
||||
wxRegion(const wxBitmap& bmp,
|
||||
const wxColour& transColour, int tolerance = 0)
|
||||
{
|
||||
Union(bmp, transColour, tolerance);
|
||||
}
|
||||
|
||||
wxRegion();
|
||||
~wxRegion();
|
||||
|
||||
#warning "FIXME: move this to common code? at least Ok()"
|
||||
bool Ok() const { return m_refData != NULL; }
|
||||
|
||||
bool operator==(const wxRegion& region) const;
|
||||
bool operator!=(const wxRegion& region) const { return !(*this == region); }
|
||||
|
||||
// Clear current region
|
||||
void Clear();
|
||||
|
||||
bool Offset(wxCoord x, wxCoord y);
|
||||
|
||||
// Union rectangle or region with this.
|
||||
bool Union(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
|
||||
{ return Union(wxRect(x, y, width, height)); }
|
||||
bool Union(const wxRect& rect);
|
||||
bool Union(const wxRegion& region);
|
||||
|
||||
// Intersect rectangle or region with this.
|
||||
bool Intersect(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
|
||||
{ return Intersect(wxRect(x, y, width, height)); }
|
||||
bool Intersect(const wxRect& rect);
|
||||
bool Intersect(const wxRegion& region);
|
||||
|
||||
// Subtract rectangle or region from this:
|
||||
// Combines the parts of 'this' that are not part of the second region.
|
||||
bool Subtract(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
|
||||
{ return Subtract(wxRect(x, y, width, height)); }
|
||||
bool Subtract(const wxRect& rect);
|
||||
bool Subtract(const wxRegion& region);
|
||||
|
||||
// XOR: the union of two combined regions except for any overlapping areas.
|
||||
bool Xor(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
|
||||
{ return Xor(wxRect(x, y, width, height)); }
|
||||
bool Xor(const wxRect& rect);
|
||||
bool Xor(const wxRegion& region);
|
||||
|
||||
// Outer bounds of region
|
||||
void GetBox(wxCoord& x, wxCoord& y, wxCoord&w, wxCoord &h) const;
|
||||
wxRect GetBox(void) const;
|
||||
|
||||
// Is region empty?
|
||||
bool Empty(void) const;
|
||||
inline bool IsEmpty(void) const { return Empty(); }
|
||||
|
||||
// Does the region contain the point (x,y)?
|
||||
wxRegionContain Contains(wxCoord x, wxCoord y) const;
|
||||
// Does the region contain the point pt?
|
||||
wxRegionContain Contains(const wxPoint& pt) const
|
||||
{ return Contains(pt.x, pt.y); }
|
||||
// Does the region contain the rectangle rect?
|
||||
wxRegionContain Contains(const wxRect& rect) const;
|
||||
// Does the region contain the rectangle (x, y, w, h)?
|
||||
wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h) const
|
||||
{ return Contains(wxRect(x, y, w, h)); }
|
||||
|
||||
|
||||
#warning "Move these union versions + ConvertToBitmap to wxRegionBase"
|
||||
// Convert the region to a B&W bitmap with the white pixels being inside
|
||||
// the region.
|
||||
wxBitmap ConvertToBitmap() const;
|
||||
|
||||
// Use the non-transparent pixels of a wxBitmap for the region to combine
|
||||
// with this region. First version takes transparency from bitmap's mask,
|
||||
// second lets the user specify the colour to be treated as transparent
|
||||
// along with an optional tolerance value.
|
||||
// NOTE: implemented in common/rgncmn.cpp
|
||||
bool Union(const wxBitmap& bmp);
|
||||
bool Union(const wxBitmap& bmp,
|
||||
const wxColour& transColour, int tolerance = 0);
|
||||
|
||||
// NB: implementation detail of DirectFB, should be removed if full
|
||||
// (i.e. not rect-only version is implemented) so that all code that
|
||||
// assumes region==rect breaks
|
||||
wxRect AsRect() const { return GetBox(); }
|
||||
|
||||
protected:
|
||||
// ref counting code
|
||||
virtual wxObjectRefData *CreateRefData() const;
|
||||
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
|
||||
|
||||
friend class WXDLLIMPEXP_CORE wxRegionIterator;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxRegion);
|
||||
};
|
||||
|
||||
|
||||
class WXDLLIMPEXP_CORE wxRegionIterator : public wxObject
|
||||
{
|
||||
public:
|
||||
wxRegionIterator() {}
|
||||
wxRegionIterator(const wxRegion& region) { Reset(region); }
|
||||
|
||||
void Reset() { m_rect = wxRect(); }
|
||||
void Reset(const wxRegion& region);
|
||||
|
||||
bool HaveRects() const { return !m_rect.IsEmpty(); }
|
||||
operator bool() const { return HaveRects(); }
|
||||
|
||||
wxRegionIterator& operator++();
|
||||
wxRegionIterator operator++(int);
|
||||
|
||||
wxCoord GetX() const { return m_rect.GetX(); }
|
||||
wxCoord GetY() const { return m_rect.GetY(); }
|
||||
wxCoord GetW() const { return m_rect.GetWidth(); }
|
||||
wxCoord GetWidth() const { return GetW(); }
|
||||
wxCoord GetH() const { return m_rect.GetHeight(); }
|
||||
wxCoord GetHeight() const { return GetH(); }
|
||||
wxRect GetRect() const { return m_rect; }
|
||||
|
||||
private:
|
||||
wxRect m_rect;
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxRegionIterator);
|
||||
};
|
||||
|
||||
#endif // _WX_DFB_REGION_H_
|
127
include/wx/dfb/toplevel.h
Normal file
127
include/wx/dfb/toplevel.h
Normal file
@@ -0,0 +1,127 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/dfb/toplevel.h
|
||||
// Purpose: Top level window, abstraction of wxFrame and wxDialog
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2006-08-10
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2006 REA Elektronik GmbH
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DFB_TOPLEVEL_H_
|
||||
#define _WX_DFB_TOPLEVEL_H_
|
||||
|
||||
#include "wx/dfb/ifacehelpers.h"
|
||||
|
||||
wxDFB_DECLARE_INTERFACE(IDirectFBWindow);
|
||||
|
||||
class wxDfbQueuedPaintRequests;
|
||||
struct wxDFBWindowEvent;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxTopLevelWindowDFB
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxTopLevelWindowDFB : public wxTopLevelWindowBase
|
||||
{
|
||||
public:
|
||||
// construction
|
||||
wxTopLevelWindowDFB() { Init(); }
|
||||
wxTopLevelWindowDFB(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr)
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, id, title, pos, size, style, name);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
|
||||
virtual ~wxTopLevelWindowDFB();
|
||||
|
||||
// implement base class pure virtuals
|
||||
virtual void Maximize(bool maximize = true);
|
||||
virtual bool IsMaximized() const;
|
||||
virtual void Iconize(bool iconize = true);
|
||||
virtual bool IsIconized() const;
|
||||
virtual void Restore();
|
||||
|
||||
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
|
||||
virtual bool IsFullScreen() const { return m_fsIsShowing; }
|
||||
|
||||
virtual bool Show(bool show = true);
|
||||
|
||||
virtual bool CanSetTransparent() { return true; }
|
||||
virtual bool SetTransparent(wxByte alpha);
|
||||
|
||||
virtual void SetTitle(const wxString &title) { m_title = title; }
|
||||
virtual wxString GetTitle() const { return m_title; }
|
||||
|
||||
virtual void Update();
|
||||
|
||||
// implementation from now on
|
||||
// --------------------------
|
||||
|
||||
void OnInternalIdle();
|
||||
|
||||
IDirectFBWindowPtr GetDirectFBWindow() const { return m_dfbwin; }
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
virtual IDirectFBSurfacePtr ObtainDfbSurface() const;
|
||||
|
||||
// overriden wxWindow methods
|
||||
virtual void DoGetPosition(int *x, int *y) const;
|
||||
virtual void DoGetSize(int *width, int *height) const;
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
|
||||
virtual void DoRefreshRect(const wxRect& rect, bool eraseBack = true);
|
||||
|
||||
private:
|
||||
// do queued painting in idle time
|
||||
void HandleQueuedPaintRequests();
|
||||
|
||||
// DirectFB events handling
|
||||
static void HandleDFBWindowEvent(const wxDFBWindowEvent& event_);
|
||||
|
||||
protected:
|
||||
wxString m_title;
|
||||
|
||||
bool m_fsIsShowing:1; /* full screen */
|
||||
long m_fsSaveStyle;
|
||||
long m_fsSaveFlag;
|
||||
wxRect m_fsSaveFrame;
|
||||
|
||||
// is the frame currently maximized?
|
||||
bool m_isMaximized:1;
|
||||
wxRect m_savedFrame;
|
||||
|
||||
// did we sent wxSizeEvent at least once?
|
||||
bool m_sizeSet:1;
|
||||
|
||||
// window's opacity (0: transparent, 255: opaque)
|
||||
wxByte m_opacity;
|
||||
|
||||
// interface to the underlying DirectFB window
|
||||
IDirectFBWindowPtr m_dfbwin;
|
||||
|
||||
private:
|
||||
wxDfbQueuedPaintRequests *m_toPaint;
|
||||
|
||||
friend class wxEventLoop; // for HandleDFBWindowEvent
|
||||
};
|
||||
|
||||
#endif // _WX_DFB_TOPLEVEL_H_
|
181
include/wx/dfb/window.h
Normal file
181
include/wx/dfb/window.h
Normal file
@@ -0,0 +1,181 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/dfb/window.h
|
||||
// Purpose: wxWindow class
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2006-08-10
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2006 REA Elektronik GmbH
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DFB_WINDOW_H_
|
||||
#define _WX_DFB_WINDOW_H_
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// headers
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#include "wx/dfb/ifacehelpers.h"
|
||||
|
||||
wxDFB_DECLARE_INTERFACE(IDirectFBSurface);
|
||||
struct wxDFBWindowEvent;
|
||||
|
||||
class WXDLLIMPEXP_CORE wxFont;
|
||||
class WXDLLIMPEXP_CORE wxTopLevelWindowDFB;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxWindow
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxWindowDFB : public wxWindowBase
|
||||
{
|
||||
public:
|
||||
wxWindowDFB() { Init(); }
|
||||
|
||||
wxWindowDFB(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr)
|
||||
{
|
||||
Init();
|
||||
Create(parent, id, pos, size, style, name);
|
||||
}
|
||||
|
||||
virtual ~wxWindowDFB();
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
|
||||
// implement base class (pure) virtual methods
|
||||
// -------------------------------------------
|
||||
|
||||
virtual void SetLabel( const wxString &WXUNUSED(label) ) {}
|
||||
virtual wxString GetLabel() const { return wxEmptyString; }
|
||||
|
||||
virtual void Raise();
|
||||
virtual void Lower();
|
||||
|
||||
virtual bool Show(bool show = true);
|
||||
|
||||
virtual void SetFocus();
|
||||
|
||||
virtual bool Reparent(wxWindowBase *newParent);
|
||||
|
||||
virtual void WarpPointer(int x, int y);
|
||||
|
||||
virtual void Refresh(bool eraseBackground = true,
|
||||
const wxRect *rect = (const wxRect *) NULL);
|
||||
virtual void Update();
|
||||
virtual void Clear();
|
||||
virtual void Freeze();
|
||||
virtual void Thaw();
|
||||
bool IsFrozen() const { return m_frozenness > 0; }
|
||||
|
||||
virtual bool SetCursor(const wxCursor &cursor);
|
||||
virtual bool SetFont(const wxFont &font) { m_font = font; return true; }
|
||||
|
||||
virtual int GetCharHeight() const;
|
||||
virtual int GetCharWidth() const;
|
||||
virtual void GetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = (int *) NULL,
|
||||
int *externalLeading = (int *) NULL,
|
||||
const wxFont *theFont = (const wxFont *) NULL)
|
||||
const;
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
virtual void SetDropTarget(wxDropTarget *dropTarget);
|
||||
|
||||
// Accept files for dragging
|
||||
virtual void DragAcceptFiles(bool accept);
|
||||
#endif // wxUSE_DRAG_AND_DROP
|
||||
|
||||
virtual WXWidget GetHandle() const { return this; }
|
||||
|
||||
// implementation from now on
|
||||
// --------------------------
|
||||
|
||||
// Returns DirectFB surface used for rendering of this window
|
||||
IDirectFBSurfacePtr GetDfbSurface();
|
||||
|
||||
// returns toplevel window the window belongs to
|
||||
wxTopLevelWindowDFB *GetTLW() const { return m_tlw; }
|
||||
|
||||
void OnInternalIdle();
|
||||
|
||||
protected:
|
||||
// implement the base class pure virtuals
|
||||
virtual void DoClientToScreen(int *x, int *y) const;
|
||||
virtual void DoScreenToClient(int *x, int *y) const;
|
||||
virtual void DoGetPosition(int *x, int *y) const;
|
||||
virtual void DoGetSize(int *width, int *height) const;
|
||||
virtual void DoGetClientSize(int *width, int *height) const;
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
|
||||
virtual void DoCaptureMouse();
|
||||
virtual void DoReleaseMouse();
|
||||
|
||||
// move the window to the specified location and resize it: this is called
|
||||
// from both DoSetSize() and DoSetClientSize() and would usually just call
|
||||
// ::MoveWindow() except for composite controls which will want to arrange
|
||||
// themselves inside the given rectangle
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
|
||||
// return DFB surface used to render this window (will be assigned to
|
||||
// m_surface if the window is visible)
|
||||
virtual IDirectFBSurfacePtr ObtainDfbSurface() const;
|
||||
|
||||
// this method must be called when window's position, size or visibility
|
||||
// changes; it resets m_surface so that ObtainDfbSurface has to be called
|
||||
// next time GetDfbSurface is called
|
||||
void InvalidateDfbSurface();
|
||||
|
||||
// called by parent to render (part of) the window
|
||||
void PaintWindow(const wxRect& rect, bool eraseBackground);
|
||||
|
||||
// implementation of Refresh()
|
||||
void DoRefreshWindow(bool eraseBack = true);
|
||||
virtual void DoRefreshRect(const wxRect& rect, bool eraseBack = true);
|
||||
|
||||
// DirectFB events handling
|
||||
void HandleKeyEvent(const wxDFBWindowEvent& event_);
|
||||
|
||||
private:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
// counterpart to SetFocus
|
||||
void KillFocus();
|
||||
|
||||
protected:
|
||||
// toplevel window (i.e. DirectFB window) this window belongs to
|
||||
wxTopLevelWindowDFB *m_tlw;
|
||||
|
||||
private:
|
||||
// subsurface of TLW's surface covered by this window
|
||||
IDirectFBSurfacePtr m_surface;
|
||||
|
||||
// position of the window (relative to the parent, not used by wxTLW, so
|
||||
// don't access it directly)
|
||||
wxRect m_rect;
|
||||
|
||||
// number of calls to Freeze() minus number of calls to Thaw()
|
||||
unsigned m_frozenness;
|
||||
|
||||
friend class wxTopLevelWindowDFB; // for HandleXXXEvent
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxWindowDFB)
|
||||
DECLARE_NO_COPY_CLASS(wxWindowDFB)
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
#endif // _WX_DFB_WINDOW_H_
|
Reference in New Issue
Block a user