FIXME: Complete stubs or other cruft necessary to make wxCocoa build
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19688 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
201
include/wx/cocoa/bitmap.h
Normal file
201
include/wx/cocoa/bitmap.h
Normal file
@@ -0,0 +1,201 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: bitmap.h
|
||||
// Purpose: wxBitmap class
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_BITMAP_H_
|
||||
#define _WX_BITMAP_H_
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma interface "bitmap.h"
|
||||
#endif
|
||||
|
||||
#include "wx/palette.h"
|
||||
|
||||
// Bitmap
|
||||
class WXDLLEXPORT wxBitmap;
|
||||
class WXDLLEXPORT wxBitmapHandler;
|
||||
class WXDLLEXPORT wxIcon;
|
||||
class WXDLLEXPORT wxCursor;
|
||||
class WXDLLEXPORT wxImage;
|
||||
|
||||
// A mask is a mono bitmap used for drawing bitmaps
|
||||
// transparently.
|
||||
class WXDLLEXPORT wxMask: public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxMask)
|
||||
DECLARE_NO_COPY_CLASS(wxMask)
|
||||
|
||||
public:
|
||||
wxMask();
|
||||
|
||||
// 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);
|
||||
|
||||
~wxMask();
|
||||
|
||||
bool Create(const wxBitmap& bitmap, const wxColour& colour);
|
||||
bool Create(const wxBitmap& bitmap, int paletteIndex);
|
||||
bool Create(const wxBitmap& bitmap);
|
||||
|
||||
// Implementation
|
||||
// inline WXHBITMAP GetMaskBitmap() const { return m_maskBitmap; }
|
||||
// inline void SetMaskBitmap(WXHBITMAP bmp) { m_maskBitmap = bmp; }
|
||||
protected:
|
||||
// WXHBITMAP m_maskBitmap;
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxBitmapRefData: public wxGDIRefData
|
||||
{
|
||||
DECLARE_NO_COPY_CLASS(wxBitmapRefData)
|
||||
|
||||
friend class WXDLLEXPORT wxBitmap;
|
||||
friend class WXDLLEXPORT wxIcon;
|
||||
friend class WXDLLEXPORT wxCursor;
|
||||
public:
|
||||
wxBitmapRefData();
|
||||
~wxBitmapRefData();
|
||||
|
||||
public:
|
||||
int m_width;
|
||||
int m_height;
|
||||
int m_depth;
|
||||
bool m_ok;
|
||||
int m_numColors;
|
||||
wxPalette m_bitmapPalette;
|
||||
int m_quality;
|
||||
|
||||
// TOTO: platofmr specific hBitmap
|
||||
// WXHBITMAP m_hBitmap;
|
||||
wxMask * m_bitmapMask; // Optional mask
|
||||
};
|
||||
|
||||
#define M_BITMAPDATA ((wxBitmapRefData *)m_refData)
|
||||
|
||||
class WXDLLEXPORT wxBitmapHandler: public wxBitmapHandlerBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxBitmapHandler)
|
||||
public:
|
||||
wxBitmapHandler() : m_name(), m_extension(), m_type(0) { }
|
||||
virtual ~wxBitmapHandler();
|
||||
|
||||
virtual bool Create(wxBitmap *bitmap, void *data, long flags, int width, int height, int depth = 1);
|
||||
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
|
||||
int desiredWidth, int desiredHeight);
|
||||
virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette = NULL);
|
||||
|
||||
void SetName(const wxString& name) { m_name = name; }
|
||||
void SetExtension(const wxString& ext) { m_extension = ext; }
|
||||
void SetType(long type) { m_type = type; }
|
||||
wxString GetName() const { return m_name; }
|
||||
wxString GetExtension() const { return m_extension; }
|
||||
long GetType() const { return m_type; }
|
||||
|
||||
protected:
|
||||
wxString m_name;
|
||||
wxString m_extension;
|
||||
long m_type;
|
||||
};
|
||||
|
||||
#define M_BITMAPHANDLERDATA ((wxBitmapRefData *)bitmap->GetRefData())
|
||||
|
||||
class WXDLLEXPORT wxBitmap: public wxBitmapBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxBitmap)
|
||||
|
||||
friend class WXDLLEXPORT wxBitmapHandler;
|
||||
|
||||
public:
|
||||
wxBitmap(); // Platform-specific
|
||||
|
||||
// Copy constructors
|
||||
wxBitmap(const wxBitmap& bitmap)
|
||||
: wxBitmapBase()
|
||||
{ Ref(bitmap); }
|
||||
|
||||
// Initialize with raw data.
|
||||
wxBitmap(const char bits[], int width, int height, int depth = 1);
|
||||
|
||||
// Initialize with XPM data
|
||||
bool CreateFromXpm(const char **bits);
|
||||
wxBitmap(const char **bits) { CreateFromXpm(bits); }
|
||||
wxBitmap(char **bits);
|
||||
|
||||
// Load a file or resource
|
||||
wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_BMP_RESOURCE);
|
||||
|
||||
// Constructor for generalised creation from data
|
||||
wxBitmap(void *data, wxBitmapType type, int width, int height, int depth = 1);
|
||||
|
||||
// If depth is omitted, will create a bitmap compatible with the display
|
||||
wxBitmap(int width, int height, int depth = -1);
|
||||
|
||||
// Convert from wxImage:
|
||||
wxBitmap(const wxImage& image, int depth = -1);
|
||||
|
||||
~wxBitmap();
|
||||
|
||||
wxImage ConvertToImage() const;
|
||||
|
||||
// get the given part of bitmap
|
||||
wxBitmap GetSubBitmap( const wxRect& rect ) const;
|
||||
|
||||
virtual bool Create(int width, int height, int depth = -1);
|
||||
virtual bool Create(void *data, wxBitmapType type, int width, int height, int depth = 1);
|
||||
virtual bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_BMP_RESOURCE);
|
||||
virtual bool SaveFile(const wxString& name, wxBitmapType type, const wxPalette *cmap = NULL) const;
|
||||
|
||||
// copies the contents and mask of the given (colour) icon to the bitmap
|
||||
virtual bool CopyFromIcon(const wxIcon& icon);
|
||||
|
||||
bool Ok() const;
|
||||
int GetWidth() const;
|
||||
int GetHeight() const;
|
||||
int GetDepth() const;
|
||||
int GetQuality() const;
|
||||
void SetWidth(int w);
|
||||
void SetHeight(int h);
|
||||
void SetDepth(int d);
|
||||
void SetQuality(int q);
|
||||
void SetOk(bool isOk);
|
||||
|
||||
wxPalette* GetPalette() const;
|
||||
void SetPalette(const wxPalette& palette);
|
||||
|
||||
wxMask *GetMask() const;
|
||||
void SetMask(wxMask *mask) ;
|
||||
|
||||
int GetBitmapType() const;
|
||||
|
||||
inline wxBitmap& operator = (const wxBitmap& bitmap) { if (*this == bitmap) return (*this); Ref(bitmap); return *this; }
|
||||
inline bool operator == (const wxBitmap& bitmap) const { return m_refData == bitmap.m_refData; }
|
||||
inline bool operator != (const wxBitmap& bitmap) const { return m_refData != bitmap.m_refData; }
|
||||
|
||||
static void InitStandardHandlers();
|
||||
protected:
|
||||
|
||||
// TODO: Implementation
|
||||
public:
|
||||
// void SetHBITMAP(WXHBITMAP bmp);
|
||||
// WXHBITMAP GetHBITMAP() const;
|
||||
|
||||
// WXHMETAFILE GetPict() const;
|
||||
|
||||
bool FreeResource(bool force = FALSE);
|
||||
};
|
||||
#endif
|
||||
// _WX_BITMAP_H_
|
68
include/wx/cocoa/brush.h
Normal file
68
include/wx/cocoa/brush.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: brush.h
|
||||
// Purpose: wxBrush class
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_BRUSH_H_
|
||||
#define _WX_BRUSH_H_
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma interface "brush.h"
|
||||
#endif
|
||||
|
||||
#include "wx/gdicmn.h"
|
||||
#include "wx/gdiobj.h"
|
||||
#include "wx/bitmap.h"
|
||||
|
||||
class WXDLLEXPORT wxBrush;
|
||||
|
||||
// Brush
|
||||
class WXDLLEXPORT wxBrush: public wxGDIObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxBrush)
|
||||
|
||||
public:
|
||||
wxBrush();
|
||||
wxBrush(const wxColour& col, int style);
|
||||
wxBrush(const wxBitmap& stipple);
|
||||
wxBrush(const wxBrush& brush)
|
||||
: wxGDIObject()
|
||||
{ Ref(brush); }
|
||||
~wxBrush();
|
||||
|
||||
virtual void SetColour(const wxColour& col) ;
|
||||
virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) ;
|
||||
virtual void SetStyle(int style) ;
|
||||
virtual void SetStipple(const wxBitmap& stipple) ;
|
||||
|
||||
wxBrush& operator = (const wxBrush& brush)
|
||||
{ if (*this == brush) return (*this); Ref(brush); return *this; }
|
||||
bool operator == (const wxBrush& brush)
|
||||
{ return m_refData == brush.m_refData; }
|
||||
bool operator != (const wxBrush& brush)
|
||||
{ return m_refData != brush.m_refData; }
|
||||
|
||||
wxColour& GetColour() const ;
|
||||
int GetStyle() const ;
|
||||
wxBitmap *GetStipple() const ;
|
||||
|
||||
virtual bool Ok() const { return (m_refData != NULL) ; }
|
||||
|
||||
// Implementation
|
||||
|
||||
// Useful helper: create the brush resource
|
||||
bool RealizeResource();
|
||||
|
||||
// When setting properties, we must make sure we're not changing
|
||||
// another object
|
||||
void Unshare();
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_BRUSH_H_
|
103
include/wx/cocoa/colour.h
Normal file
103
include/wx/cocoa/colour.h
Normal file
@@ -0,0 +1,103 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: colour.h
|
||||
// Purpose: wxColour class
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COLOUR_H_
|
||||
#define _WX_COLOUR_H_
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma interface "colour.h"
|
||||
#endif
|
||||
|
||||
#include "wx/object.h"
|
||||
#include "wx/string.h"
|
||||
|
||||
// Colour
|
||||
class WXDLLEXPORT wxColour: public wxObject
|
||||
{
|
||||
public:
|
||||
// ctors
|
||||
// default
|
||||
wxColour();
|
||||
// from RGB
|
||||
wxColour( unsigned char red, unsigned char green, unsigned char blue );
|
||||
wxColour( unsigned long colRGB )
|
||||
: m_isInit(FALSE), m_red(0), m_blue(0), m_green(0)
|
||||
{ Set(colRGB); }
|
||||
|
||||
// implicit conversion from the colour name
|
||||
wxColour( const wxString &colourName )
|
||||
: m_isInit(FALSE), m_red(0), m_blue(0), m_green(0)
|
||||
{ InitFromName(colourName); }
|
||||
wxColour( const char *colourName )
|
||||
: m_isInit(FALSE), m_red(0), m_blue(0), m_green(0)
|
||||
{ InitFromName(colourName); }
|
||||
|
||||
// copy ctors and assignment operators
|
||||
wxColour( const wxColour& col );
|
||||
wxColour( const wxColour* col );
|
||||
wxColour& operator = ( const wxColour& col );
|
||||
|
||||
// dtor
|
||||
~wxColour();
|
||||
|
||||
// Set() functions
|
||||
void Set( unsigned char red, unsigned char green, unsigned char blue );
|
||||
void Set( unsigned long colRGB )
|
||||
{
|
||||
// we don't need to know sizeof(long) here because we assume that the three
|
||||
// least significant bytes contain the R, G and B values
|
||||
Set((unsigned char)colRGB,
|
||||
(unsigned char)(colRGB >> 8),
|
||||
(unsigned char)(colRGB >> 16));
|
||||
}
|
||||
|
||||
// accessors
|
||||
bool Ok() const {return m_isInit; }
|
||||
|
||||
// Let's remove this inelegant function
|
||||
#if WXWIN_COMPATIBILITY
|
||||
void Get(unsigned char *r, unsigned char *g, unsigned char *b) const;
|
||||
#endif
|
||||
|
||||
unsigned char Red() const { return m_red; }
|
||||
unsigned char Green() const { return m_green; }
|
||||
unsigned char Blue() const { return m_blue; }
|
||||
|
||||
// comparison
|
||||
bool operator == (const wxColour& colour) const
|
||||
{
|
||||
return (m_isInit == colour.m_isInit &&
|
||||
m_red == colour.m_red &&
|
||||
m_green == colour.m_green &&
|
||||
m_blue == colour.m_blue);
|
||||
}
|
||||
bool operator != (const wxColour& colour) const { return !(*this == colour); }
|
||||
|
||||
void InitFromName(const wxString& col);
|
||||
|
||||
// const WXCOLORREF& GetPixel() const { return m_pixel; };
|
||||
|
||||
private:
|
||||
bool m_isInit;
|
||||
unsigned char m_red;
|
||||
unsigned char m_blue;
|
||||
unsigned char m_green;
|
||||
|
||||
public:
|
||||
// WXCOLORREF m_pixel ;
|
||||
// void Set( const WXCOLORREF* color ) ;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxColour)
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_COLOUR_H_
|
69
include/wx/cocoa/cursor.h
Normal file
69
include/wx/cocoa/cursor.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: cursor.h
|
||||
// Purpose: wxCursor class
|
||||
// Author: David Elliott <dfe@cox.net>
|
||||
// Modified by:
|
||||
// Created: 2002/11/27
|
||||
// RCS-ID:
|
||||
// Copyright: (c) David Elliott
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_COCOA_CURSOR_H_
|
||||
#define _WX_COCOA_CURSOR_H_
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma interface "cursor.h"
|
||||
#endif
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
|
||||
class WXDLLEXPORT wxCursorRefData: public wxBitmapRefData
|
||||
{
|
||||
DECLARE_NO_COPY_CLASS(wxCursorRefData)
|
||||
|
||||
friend class WXDLLEXPORT wxBitmap;
|
||||
friend class WXDLLEXPORT wxCursor;
|
||||
public:
|
||||
wxCursorRefData();
|
||||
~wxCursorRefData();
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
#define M_CURSORDATA ((wxCursorRefData *)m_refData)
|
||||
#define M_CURSORHANDLERDATA ((wxCursorRefData *)bitmap->m_refData)
|
||||
|
||||
// Cursor
|
||||
class WXDLLEXPORT wxCursor: public wxBitmap
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxCursor)
|
||||
|
||||
public:
|
||||
wxCursor();
|
||||
|
||||
// Copy constructors
|
||||
wxCursor(const wxCursor& cursor)
|
||||
: wxBitmap()
|
||||
{ Ref(cursor); }
|
||||
|
||||
wxCursor(const char bits[], int width, int height, int hotSpotX = -1, int hotSpotY = -1,
|
||||
const char maskBits[] = NULL);
|
||||
|
||||
wxCursor(const wxString& name, long flags = 0,
|
||||
int hotSpotX = 0, int hotSpotY = 0);
|
||||
|
||||
wxCursor(int cursor_type);
|
||||
~wxCursor();
|
||||
|
||||
virtual bool Ok() const { return m_refData ; }
|
||||
|
||||
inline wxCursor& operator = (const wxCursor& cursor) { if (*this == cursor) return (*this); Ref(cursor); return *this; }
|
||||
inline bool operator == (const wxCursor& cursor) { return m_refData == cursor.m_refData; }
|
||||
inline bool operator != (const wxCursor& cursor) { return m_refData != cursor.m_refData; }
|
||||
|
||||
};
|
||||
|
||||
extern WXDLLEXPORT void wxSetCursor(const wxCursor& cursor);
|
||||
|
||||
#endif // _WX_COCOA_CURSOR_H_
|
231
include/wx/cocoa/dc.h
Normal file
231
include/wx/cocoa/dc.h
Normal file
@@ -0,0 +1,231 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dc.h
|
||||
// Purpose: wxDC class
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DC_H_
|
||||
#define _WX_DC_H_
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma interface "dc.h"
|
||||
#endif
|
||||
|
||||
#include "wx/pen.h"
|
||||
#include "wx/brush.h"
|
||||
#include "wx/icon.h"
|
||||
#include "wx/font.h"
|
||||
#include "wx/gdicmn.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// constants
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MM_TEXT
|
||||
#define MM_TEXT 0
|
||||
#define MM_ISOTROPIC 1
|
||||
#define MM_ANISOTROPIC 2
|
||||
#define MM_LOMETRIC 3
|
||||
#define MM_HIMETRIC 4
|
||||
#define MM_TWIPS 5
|
||||
#define MM_POINTS 6
|
||||
#define MM_METRIC 7
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// global variables
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
extern int wxPageNumber;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxDC
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxDC: public wxDCBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxDC)
|
||||
DECLARE_NO_COPY_CLASS(wxDC)
|
||||
|
||||
public:
|
||||
|
||||
wxDC();
|
||||
~wxDC();
|
||||
|
||||
|
||||
// implement base class pure virtuals
|
||||
// ----------------------------------
|
||||
|
||||
virtual void Clear();
|
||||
|
||||
virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; }
|
||||
virtual void EndDoc(void) {};
|
||||
|
||||
virtual void StartPage(void) {};
|
||||
virtual void EndPage(void) {};
|
||||
|
||||
virtual void SetFont(const wxFont& font) {}
|
||||
virtual void SetPen(const wxPen& pen);
|
||||
virtual void SetBrush(const wxBrush& brush);
|
||||
virtual void SetBackground(const wxBrush& brush);
|
||||
virtual void SetBackgroundMode(int mode) {}
|
||||
virtual void SetPalette(const wxPalette& palette);
|
||||
|
||||
virtual void 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;
|
||||
virtual bool CanGetTextExtent() const;
|
||||
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);
|
||||
|
||||
virtual void SetTextForeground(const wxColour& colour) ;
|
||||
virtual void SetTextBackground(const wxColour& colour) ;
|
||||
|
||||
void ComputeScaleAndOrigin(void);
|
||||
public:
|
||||
|
||||
|
||||
wxCoord XDEV2LOG(wxCoord x) const
|
||||
{
|
||||
long 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
|
||||
{
|
||||
long 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
|
||||
{
|
||||
long 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
|
||||
{
|
||||
long 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);
|
||||
}
|
||||
|
||||
protected:
|
||||
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 DoGetClippingRegion(wxCoord *x, wxCoord *y,
|
||||
wxCoord *width, wxCoord *height)
|
||||
{
|
||||
GetClippingBox(x, y, width, 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);
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_DC_H_
|
69
include/wx/cocoa/dcclient.h
Normal file
69
include/wx/cocoa/dcclient.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dcclient.h
|
||||
// Purpose: wxClientDC, wxPaintDC and wxWindowDC classes
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DCCLIENT_H_
|
||||
#define _WX_DCCLIENT_H_
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma interface "dcclient.h"
|
||||
#endif
|
||||
|
||||
#include "wx/dc.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxPaintDC;
|
||||
class WXDLLEXPORT wxWindow;
|
||||
|
||||
class WXDLLEXPORT wxWindowDC: public wxDC
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxWindowDC)
|
||||
|
||||
public:
|
||||
wxWindowDC(void);
|
||||
|
||||
// Create a DC corresponding to a canvas
|
||||
wxWindowDC(wxWindow *win);
|
||||
|
||||
~wxWindowDC(void);
|
||||
};
|
||||
|
||||
|
||||
class WXDLLEXPORT wxClientDC: public wxWindowDC
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxClientDC)
|
||||
|
||||
public:
|
||||
wxClientDC(void);
|
||||
|
||||
// Create a DC corresponding to a canvas
|
||||
wxClientDC(wxWindow *win);
|
||||
|
||||
~wxClientDC(void);
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxPaintDC: public wxWindowDC
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPaintDC)
|
||||
|
||||
public:
|
||||
wxPaintDC(void);
|
||||
|
||||
// Create a DC corresponding to a canvas
|
||||
wxPaintDC(wxWindow *win);
|
||||
|
||||
~wxPaintDC(void);
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_DCCLIENT_H_
|
180
include/wx/cocoa/font.h
Normal file
180
include/wx/cocoa/font.h
Normal file
@@ -0,0 +1,180 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: font.h
|
||||
// Purpose: wxFont class
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_FONT_H_
|
||||
#define _WX_FONT_H_
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma interface "font.h"
|
||||
#endif
|
||||
|
||||
class WXDLLEXPORT wxFontRefData: public wxGDIRefData
|
||||
{
|
||||
friend class WXDLLEXPORT wxFont;
|
||||
public:
|
||||
wxFontRefData()
|
||||
: m_fontId(0)
|
||||
, m_pointSize(10)
|
||||
, m_family(wxDEFAULT)
|
||||
, m_style(wxNORMAL)
|
||||
, m_weight(wxNORMAL)
|
||||
, m_underlined(FALSE)
|
||||
, m_faceName("Geneva")
|
||||
, m_encoding(wxFONTENCODING_DEFAULT)
|
||||
{
|
||||
Init(10, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE,
|
||||
"Geneva", wxFONTENCODING_DEFAULT);
|
||||
}
|
||||
|
||||
wxFontRefData(const wxFontRefData& data)
|
||||
: wxGDIRefData()
|
||||
, m_fontId(data.m_fontId)
|
||||
, m_pointSize(data.m_pointSize)
|
||||
, m_family(data.m_family)
|
||||
, m_style(data.m_style)
|
||||
, m_weight(data.m_weight)
|
||||
, m_underlined(data.m_underlined)
|
||||
, m_faceName(data.m_faceName)
|
||||
, m_encoding(data.m_encoding)
|
||||
{
|
||||
Init(data.m_pointSize, data.m_family, data.m_style, data.m_weight,
|
||||
data.m_underlined, data.m_faceName, data.m_encoding);
|
||||
}
|
||||
|
||||
wxFontRefData(int size,
|
||||
int family,
|
||||
int style,
|
||||
int weight,
|
||||
bool underlined,
|
||||
const wxString& faceName,
|
||||
wxFontEncoding encoding)
|
||||
: m_fontId(0)
|
||||
, m_pointSize(size)
|
||||
, m_family(family)
|
||||
, m_style(style)
|
||||
, m_weight(weight)
|
||||
, m_underlined(underlined)
|
||||
, m_faceName(faceName)
|
||||
, m_encoding(encoding)
|
||||
{
|
||||
Init(size, family, style, weight, underlined, faceName, encoding);
|
||||
}
|
||||
|
||||
virtual ~wxFontRefData();
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init(int size,
|
||||
int family,
|
||||
int style,
|
||||
int weight,
|
||||
bool underlined,
|
||||
const wxString& faceName,
|
||||
wxFontEncoding encoding);
|
||||
|
||||
// font characterstics
|
||||
int m_fontId;
|
||||
int m_pointSize;
|
||||
int m_family;
|
||||
int m_style;
|
||||
int m_weight;
|
||||
bool m_underlined;
|
||||
wxString m_faceName;
|
||||
wxFontEncoding m_encoding;
|
||||
|
||||
public:
|
||||
};
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFont
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxFont : public wxFontBase
|
||||
{
|
||||
public:
|
||||
// ctors and such
|
||||
wxFont() { Init(); }
|
||||
wxFont(const wxFont& font)
|
||||
: wxFontBase()
|
||||
{
|
||||
Init();
|
||||
Ref(font);
|
||||
}
|
||||
|
||||
wxFont(int size,
|
||||
int family,
|
||||
int style,
|
||||
int weight,
|
||||
bool underlined = FALSE,
|
||||
const wxString& face = wxEmptyString,
|
||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
|
||||
{
|
||||
Init();
|
||||
|
||||
(void)Create(size, family, style, weight, underlined, face, encoding);
|
||||
}
|
||||
|
||||
wxFont(const wxNativeFontInfo& info)
|
||||
{
|
||||
Init();
|
||||
|
||||
(void)Create(info);
|
||||
}
|
||||
|
||||
wxFont(const wxString& fontDesc);
|
||||
|
||||
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& info);
|
||||
|
||||
virtual ~wxFont();
|
||||
|
||||
// assignment
|
||||
wxFont& operator=(const wxFont& font);
|
||||
|
||||
// implement base class pure virtuals
|
||||
virtual int GetPointSize() const;
|
||||
virtual int GetFamily() const;
|
||||
virtual int GetStyle() const;
|
||||
virtual int GetWeight() const;
|
||||
virtual bool GetUnderlined() const;
|
||||
virtual wxString GetFaceName() const;
|
||||
virtual wxFontEncoding GetEncoding() const;
|
||||
|
||||
virtual void SetPointSize(int pointSize);
|
||||
virtual void SetFamily(int family);
|
||||
virtual void SetStyle(int style);
|
||||
virtual void SetWeight(int weight);
|
||||
virtual void SetFaceName(const wxString& faceName);
|
||||
virtual void SetUnderlined(bool underlined);
|
||||
virtual void SetEncoding(wxFontEncoding encoding);
|
||||
|
||||
// implementation only from now on
|
||||
// -------------------------------
|
||||
|
||||
virtual bool RealizeResource();
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
void Unshare();
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxFont)
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_FONT_H_
|
48
include/wx/cocoa/gdiobj.h
Normal file
48
include/wx/cocoa/gdiobj.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: gdiobj.h
|
||||
// Purpose: wxGDIObject class: base class for other GDI classes
|
||||
// Author: David Elliott <dfe@cox.net>
|
||||
// Modified by:
|
||||
// Created: 2002/11/27
|
||||
// RCS-ID:
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GDIOBJ_H_
|
||||
#define _WX_GDIOBJ_H_
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma interface "gdiobj.h"
|
||||
#endif
|
||||
|
||||
#include "wx/object.h"
|
||||
|
||||
class WXDLLEXPORT wxGDIRefData: public wxObjectRefData {
|
||||
public:
|
||||
inline wxGDIRefData()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
#define M_GDIDATA ((wxGDIRefData *)m_refData)
|
||||
|
||||
class WXDLLEXPORT wxGDIObject: public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxGDIObject)
|
||||
public:
|
||||
wxGDIObject() : m_visible(FALSE) { }
|
||||
~wxGDIObject() { }
|
||||
|
||||
bool IsNull() const { return (m_refData == 0); }
|
||||
|
||||
virtual bool GetVisible() { return m_visible; }
|
||||
virtual void SetVisible(bool v) { m_visible = v; }
|
||||
|
||||
protected:
|
||||
bool m_visible; // Can a pointer to this object be safely taken?
|
||||
// - only if created within FindOrCreate...
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_GDIOBJ_H_
|
57
include/wx/cocoa/icon.h
Normal file
57
include/wx/cocoa/icon.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: icon.h
|
||||
// Purpose: wxIcon class
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_ICON_H_
|
||||
#define _WX_ICON_H_
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma interface "icon.h"
|
||||
#endif
|
||||
|
||||
#include "wx/bitmap.h"
|
||||
|
||||
// Icon
|
||||
class WXDLLEXPORT wxIcon: public wxBitmap
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxIcon)
|
||||
|
||||
public:
|
||||
wxIcon();
|
||||
|
||||
// Copy constructors
|
||||
wxIcon(const wxIcon& icon)
|
||||
: wxBitmap()
|
||||
{ Ref(icon); }
|
||||
|
||||
wxIcon(const char **data);
|
||||
wxIcon(char **data);
|
||||
wxIcon(const char bits[], int width , int height );
|
||||
wxIcon(const wxString& name, int flags = wxBITMAP_TYPE_ICON_RESOURCE,
|
||||
int desiredWidth = -1, int desiredHeight = -1);
|
||||
~wxIcon();
|
||||
|
||||
bool LoadFile(const wxString& name, wxBitmapType flags /* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
|
||||
int desiredWidth /* = -1 */ , int desiredHeight = -1);
|
||||
bool LoadFile(const wxString& name ,wxBitmapType flags = wxBITMAP_TYPE_ICON_RESOURCE )
|
||||
{ return LoadFile( name , flags , -1 , -1 ) ; }
|
||||
|
||||
inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; }
|
||||
inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; }
|
||||
inline bool operator != (const wxIcon& icon) { return m_refData != icon.m_refData; }
|
||||
|
||||
// create from bitmap (which should have a mask unless it's monochrome):
|
||||
// there shouldn't be any implicit bitmap -> icon conversion (i.e. no
|
||||
// ctors, assignment operators...), but it's ok to have such function
|
||||
void CopyFromBitmap(const wxBitmap& bmp);
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_ICON_H_
|
103
include/wx/cocoa/pen.h
Normal file
103
include/wx/cocoa/pen.h
Normal file
@@ -0,0 +1,103 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: pen.h
|
||||
// Purpose: wxPen class
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_PEN_H_
|
||||
#define _WX_PEN_H_
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma interface "pen.h"
|
||||
#endif
|
||||
|
||||
#include "wx/gdiobj.h"
|
||||
#include "wx/colour.h"
|
||||
#include "wx/bitmap.h"
|
||||
|
||||
class WXDLLEXPORT wxPen;
|
||||
|
||||
class WXDLLEXPORT wxPenRefData: public wxGDIRefData
|
||||
{
|
||||
friend class WXDLLEXPORT wxPen;
|
||||
public:
|
||||
wxPenRefData();
|
||||
wxPenRefData(const wxPenRefData& data);
|
||||
~wxPenRefData();
|
||||
|
||||
wxPenRefData& operator=(const wxPenRefData& data);
|
||||
|
||||
protected:
|
||||
int m_width;
|
||||
int m_style;
|
||||
int m_join ;
|
||||
int m_cap ;
|
||||
wxBitmap m_stipple ;
|
||||
int m_nbDash ;
|
||||
wxDash * m_dash ;
|
||||
wxColour m_colour;
|
||||
/* TODO: implementation
|
||||
WXHPEN m_hPen;
|
||||
*/
|
||||
};
|
||||
|
||||
#define M_PENDATA ((wxPenRefData *)m_refData)
|
||||
|
||||
// Pen
|
||||
class WXDLLEXPORT wxPen: public wxGDIObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxPen)
|
||||
public:
|
||||
wxPen();
|
||||
wxPen(const wxColour& col, int width, int style);
|
||||
wxPen(const wxBitmap& stipple, int width);
|
||||
wxPen(const wxPen& pen)
|
||||
: wxGDIObject()
|
||||
{ Ref(pen); }
|
||||
~wxPen();
|
||||
|
||||
inline wxPen& operator = (const wxPen& pen) { if (*this == pen) return (*this); Ref(pen); return *this; }
|
||||
inline bool operator == (const wxPen& pen) { return m_refData == pen.m_refData; }
|
||||
inline bool operator != (const wxPen& pen) { return m_refData != pen.m_refData; }
|
||||
|
||||
virtual bool Ok() const { return (m_refData != NULL) ; }
|
||||
|
||||
// Override in order to recreate the pen
|
||||
void SetColour(const wxColour& col) ;
|
||||
void SetColour(unsigned char r, unsigned char g, unsigned char b) ;
|
||||
|
||||
void SetWidth(int width) ;
|
||||
void SetStyle(int style) ;
|
||||
void SetStipple(const wxBitmap& stipple) ;
|
||||
void SetDashes(int nb_dashes, const wxDash *dash) ;
|
||||
void SetJoin(int join) ;
|
||||
void SetCap(int cap) ;
|
||||
|
||||
inline wxColour& GetColour() const { return (M_PENDATA ? M_PENDATA->m_colour : wxNullColour); };
|
||||
inline int GetWidth() const { return (M_PENDATA ? M_PENDATA->m_width : 0); };
|
||||
inline int GetStyle() const { return (M_PENDATA ? M_PENDATA->m_style : 0); };
|
||||
inline int GetJoin() const { return (M_PENDATA ? M_PENDATA->m_join : 0); };
|
||||
inline int GetCap() const { return (M_PENDATA ? M_PENDATA->m_cap : 0); };
|
||||
inline int GetDashes(wxDash **ptr) const {
|
||||
*ptr = (M_PENDATA ? M_PENDATA->m_dash : (wxDash*) NULL); return (M_PENDATA ? M_PENDATA->m_nbDash : 0);
|
||||
}
|
||||
|
||||
inline wxBitmap *GetStipple() const { return (M_PENDATA ? (& M_PENDATA->m_stipple) : (wxBitmap*) NULL); };
|
||||
|
||||
// Implementation
|
||||
|
||||
// Useful helper: create the brush resource
|
||||
bool RealizeResource();
|
||||
|
||||
// When setting properties, we must make sure we're not changing
|
||||
// another object
|
||||
void Unshare();
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_PEN_H_
|
156
include/wx/cocoa/region.h
Normal file
156
include/wx/cocoa/region.h
Normal file
@@ -0,0 +1,156 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: region.h
|
||||
// Purpose: wxRegion class
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_REGION_H_
|
||||
#define _WX_REGION_H_
|
||||
|
||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||
#pragma interface "region.h"
|
||||
#endif
|
||||
|
||||
#include "wx/list.h"
|
||||
#include "wx/gdiobj.h"
|
||||
#include "wx/gdicmn.h"
|
||||
|
||||
class WXDLLEXPORT wxRect;
|
||||
class WXDLLEXPORT wxPoint;
|
||||
|
||||
enum wxRegionContain {
|
||||
wxOutRegion = 0, wxPartRegion = 1, wxInRegion = 2
|
||||
};
|
||||
|
||||
// So far, for internal use only
|
||||
enum wxRegionOp {
|
||||
wxRGN_AND, // Creates the intersection of the two combined regions.
|
||||
wxRGN_COPY, // Creates a copy of the region identified by hrgnSrc1.
|
||||
wxRGN_DIFF, // Combines the parts of hrgnSrc1 that are not part of hrgnSrc2.
|
||||
wxRGN_OR, // Creates the union of two combined regions.
|
||||
wxRGN_XOR // Creates the union of two combined regions except for any overlapping areas.
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxRegion : public wxGDIObject {
|
||||
DECLARE_DYNAMIC_CLASS(wxRegion);
|
||||
friend class WXDLLEXPORT wxRegionIterator;
|
||||
public:
|
||||
wxRegion(long x, long y, long w, long h);
|
||||
wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
|
||||
wxRegion(const wxRect& rect);
|
||||
wxRegion();
|
||||
~wxRegion();
|
||||
|
||||
//# Copying
|
||||
wxRegion(const wxRegion& r)
|
||||
: wxGDIObject()
|
||||
{ Ref(r); }
|
||||
wxRegion& operator = (const wxRegion& r)
|
||||
{ Ref(r); return (*this); }
|
||||
|
||||
//# Modify region
|
||||
// Clear current region
|
||||
void Clear();
|
||||
|
||||
// Union rectangle or region with this.
|
||||
bool Union(long x, long y, long width, long height)
|
||||
{ return Combine(x, y, width, height, wxRGN_OR); }
|
||||
bool Union(const wxRect& rect)
|
||||
{ return Combine(rect, wxRGN_OR); }
|
||||
bool Union(const wxRegion& region)
|
||||
{ return Combine(region, wxRGN_OR); }
|
||||
|
||||
// Intersect rectangle or region with this.
|
||||
bool Intersect(long x, long y, long width, long height)
|
||||
{ return Combine(x, y, width, height, wxRGN_AND); }
|
||||
bool Intersect(const wxRect& rect)
|
||||
{ return Combine(rect, wxRGN_AND); }
|
||||
bool Intersect(const wxRegion& region)
|
||||
{ return Combine(region, wxRGN_AND); }
|
||||
|
||||
// Subtract rectangle or region from this:
|
||||
// Combines the parts of 'this' that are not part of the second region.
|
||||
bool Subtract(long x, long y, long width, long height)
|
||||
{ return Combine(x, y, width, height, wxRGN_DIFF); }
|
||||
bool Subtract(const wxRect& rect)
|
||||
{ return Combine(rect, wxRGN_DIFF); }
|
||||
bool Subtract(const wxRegion& region)
|
||||
{ return Combine(region, wxRGN_DIFF); }
|
||||
|
||||
// XOR: the union of two combined regions except for any overlapping areas.
|
||||
bool Xor(long x, long y, long width, long height)
|
||||
{ return Combine(x, y, width, height, wxRGN_XOR); }
|
||||
bool Xor(const wxRect& rect)
|
||||
{ return Combine(rect, wxRGN_XOR); }
|
||||
bool Xor(const wxRegion& region)
|
||||
{ return Combine(region, wxRGN_XOR); }
|
||||
|
||||
//# Information on region
|
||||
// Outer bounds of region
|
||||
void GetBox(wxCoord& x, wxCoord& y, wxCoord&w, wxCoord &h) const;
|
||||
wxRect GetBox() const ;
|
||||
|
||||
// Is region empty?
|
||||
bool Empty() const;
|
||||
inline bool IsEmpty() const { return Empty(); }
|
||||
|
||||
//# Tests
|
||||
// Does the region contain the point (x,y)?
|
||||
wxRegionContain Contains(long x, long y) const;
|
||||
// Does the region contain the point pt?
|
||||
wxRegionContain Contains(const wxPoint& pt) const;
|
||||
// Does the region contain the rectangle (x, y, w, h)?
|
||||
wxRegionContain Contains(long x, long y, long w, long h) const;
|
||||
// Does the region contain the rectangle rect?
|
||||
wxRegionContain Contains(const wxRect& rect) const;
|
||||
|
||||
// Internal
|
||||
bool Combine(long x, long y, long width, long height, wxRegionOp op);
|
||||
bool Combine(const wxRegion& region, wxRegionOp op);
|
||||
bool Combine(const wxRect& rect, wxRegionOp op);
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxRegionIterator : public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxRegionIterator)
|
||||
|
||||
public:
|
||||
wxRegionIterator();
|
||||
wxRegionIterator(const wxRegion& region);
|
||||
wxRegionIterator(const wxRegionIterator& iterator);
|
||||
~wxRegionIterator();
|
||||
|
||||
wxRegionIterator& operator=(const wxRegionIterator& iterator);
|
||||
|
||||
void Reset() { m_current = 0; }
|
||||
void Reset(const wxRegion& region);
|
||||
|
||||
operator bool () const { return m_current < m_numRects; }
|
||||
bool HaveRects() const { return m_current < m_numRects; }
|
||||
|
||||
wxRegionIterator& operator++();
|
||||
wxRegionIterator operator++(int);
|
||||
|
||||
long GetX() const;
|
||||
long GetY() const;
|
||||
long GetW() const;
|
||||
long GetWidth() const { return GetW(); }
|
||||
long GetH() const;
|
||||
long GetHeight() const { return GetH(); }
|
||||
wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); }
|
||||
private:
|
||||
void SetRects(long numRects, wxRect *rects);
|
||||
|
||||
long m_current;
|
||||
long m_numRects;
|
||||
wxRegion m_region;
|
||||
wxRect* m_rects;
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_REGION_H_
|
Reference in New Issue
Block a user