Qt 4.8
Public Functions | Properties | List of all members
QCocoaWindowSurface Class Reference

#include <qcocoawindowsurface.h>

Inheritance diagram for QCocoaWindowSurface:
QWindowSurface

Public Functions

void flush (QWidget *widget, const QRegion &region, const QPoint &offset)
 Flushes the given region from the specified widget onto the screen. More...
 
QPaintDevicepaintDevice ()
 Implement this function to return the appropriate paint device. More...
 
 QCocoaWindowSurface (QWidget *window, WId wid)
 
void resize (const QSize &size)
 
 ~QCocoaWindowSurface ()
 
- Public Functions inherited from QWindowSurface
virtual void beginPaint (const QRegion &)
 This function is called before painting onto the surface begins, with the region in which the painting will occur. More...
 
virtual QImagebuffer (const QWidget *widget)
 Returns a QImage pointer which represents the actual buffer the widget is drawn into or 0 if this is unavailable. More...
 
virtual void endPaint (const QRegion &)
 This function is called after painting onto the surface has ended, with the region in which the painting was performed. More...
 
virtual WindowSurfaceFeatures features () const
 
QRect geometry () const
 Returns the currently allocated area on the screen. More...
 
virtual QPixmap grabWidget (const QWidget *widget, const QRect &rectangle=QRect()) const
 Returns a QPixmap generated from the part of the backing store corresponding to widget. More...
 
bool hasFeature (WindowSurfaceFeature feature) const
 
virtual QPoint offset (const QWidget *widget) const
 Returns the offset of widget in the coordinates of this window surface. More...
 
 QWindowSurface (QWidget *window, bool setDefaultSurface=true)
 Constructs an empty surface for the given top-level window. More...
 
QRect rect (const QWidget *widget) const
 Returns the rectangle for widget in the coordinates of this window surface. More...
 
virtual bool scroll (const QRegion &area, int dx, int dy)
 Scrolls the given area dx pixels to the right and dy downward; both dx and dy may be negative. More...
 
virtual void setGeometry (const QRect &rect)
 Sets the currently allocated area to be the given rect. More...
 
void setStaticContents (const QRegion &region)
 
QRegion staticContents () const
 
QWidgetwindow () const
 Returns a pointer to the top-level window associated with this surface. More...
 
virtual ~QWindowSurface ()
 Destroys this surface. More...
 

Properties

QCocoaWindowm_cocoaWindow
 
QNSViewm_contentView
 
QImagem_image
 

Additional Inherited Members

- Public Types inherited from QWindowSurface
enum  WindowSurfaceFeature { PartialUpdates = 0x00000001, PreservedContents = 0x00000002, StaticContents = 0x00000004, AllFeatures = 0xffffffff }
 
- Protected Functions inherited from QWindowSurface
bool hasStaticContents () const
 

Detailed Description

Definition at line 54 of file qcocoawindowsurface.h.

Constructors and Destructors

◆ QCocoaWindowSurface()

QCocoaWindowSurface::QCocoaWindowSurface ( QWidget window,
WId  wid 
)

Definition at line 59 of file qcocoawindowsurface.mm.

60  : QWindowSurface(window)
61 {
62  m_cocoaWindow = static_cast<QCocoaWindow *>(window->platformWindow());
63 
64  const QRect geo = window->geometry();
65  NSRect rect = NSMakeRect(geo.x(),geo.y(),geo.width(),geo.height());
66  m_contentView = [[QNSView alloc] initWithWidget:window];
67  m_cocoaWindow->setContentView(m_contentView);
68 
69  m_image = new QImage(window->size(),QImage::Format_ARGB32);
70 }
QRect rect(const QWidget *widget) const
Returns the rectangle for widget in the coordinates of this window surface.
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
QSize size
the size of the widget excluding any window frame
Definition: qwidget.h:165
QCocoaWindow * m_cocoaWindow
QWindowSurface(QWidget *window, bool setDefaultSurface=true)
Constructs an empty surface for the given top-level window.
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QRect geometry
the geometry of the widget relative to its parent and excluding the window frame
Definition: qwidget.h:158
QWidget * window() const
Returns a pointer to the top-level window associated with this surface.
void setContentView(NSView *contentView)

◆ ~QCocoaWindowSurface()

QCocoaWindowSurface::~QCocoaWindowSurface ( )

Definition at line 72 of file qcocoawindowsurface.mm.

73 {
74  delete m_image;
75 }

Functions

◆ flush()

void QCocoaWindowSurface::flush ( QWidget widget,
const QRegion region,
const QPoint offset 
)
virtual

Flushes the given region from the specified widget onto the screen.

Note that the offset parameter is currently unused.

Implements QWindowSurface.

Definition at line 82 of file qcocoawindowsurface.mm.

83 {
84  Q_UNUSED(widget);
85  Q_UNUSED(offset);
86 
87  QRect geo = region.boundingRect();
88 
89  NSRect rect = NSMakeRect(geo.x(), geo.y(), geo.width(), geo.height());
90  [m_contentView displayRect:rect];
91 }
QRect rect(const QWidget *widget) const
Returns the rectangle for widget in the coordinates of this window surface.
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
QRect boundingRect() const
Returns the bounding rectangle of this region.
Definition: qregion.cpp:4363
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ paintDevice()

QPaintDevice * QCocoaWindowSurface::paintDevice ( )
virtual

Implement this function to return the appropriate paint device.

Implements QWindowSurface.

Definition at line 77 of file qcocoawindowsurface.mm.

78 {
79  return m_image;
80 }

◆ resize()

void QCocoaWindowSurface::resize ( const QSize size)

Definition at line 93 of file qcocoawindowsurface.mm.

94 {
95  QWindowSurface::resize(size);
96  delete m_image;
98  NSSize newSize = NSMakeSize(size.width(),size.height());
99  [m_contentView setImage:m_image];
100 
101 }
int width() const
Returns the width.
Definition: qsize.h:126
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
int height() const
Returns the height.
Definition: qsize.h:129

Properties

◆ m_cocoaWindow

QCocoaWindow* QCocoaWindowSurface::m_cocoaWindow
private

Definition at line 66 of file qcocoawindowsurface.h.

Referenced by QCocoaWindowSurface().

◆ m_contentView

QNSView* QCocoaWindowSurface::m_contentView
private

Definition at line 68 of file qcocoawindowsurface.h.

Referenced by flush(), QCocoaWindowSurface(), and resize().

◆ m_image

QImage* QCocoaWindowSurface::m_image
private

The documentation for this class was generated from the following files: