Qt 4.8
Classes | Functions
qmacnativewidget_mac.mm File Reference
#import <Cocoa/Cocoa.h>
#import <private/qcocoaview_mac_p.h>
#include "qmacnativewidget_mac.h"
#include <private/qwidget_p.h>

Go to the source code of this file.

Classes

class  QMacNativeWidgetPrivate
 

Functions

OSViewRef qt_mac_create_widget (QWidget *widget, QWidgetPrivate *widgetPrivate, OSViewRef parent)
 

Function Documentation

◆ qt_mac_create_widget()

OSViewRef qt_mac_create_widget ( QWidget widget,
QWidgetPrivate widgetPrivate,
OSViewRef  parent 
)

Definition at line 1602 of file qwidget_mac.mm.

Referenced by QWidgetPrivate::create_sys(), QMacNativeWidget::QMacNativeWidget(), and qt_mac_unregister_widget().

1603 {
1604 #ifdef QT_MAC_USE_COCOA
1606  QT_MANGLE_NAMESPACE(QCocoaView) *view = [[QT_MANGLE_NAMESPACE(QCocoaView) alloc] initWithQWidget:widget widgetPrivate:widgetPrivate];
1607 
1608 #ifdef ALIEN_DEBUG
1609  qDebug() << "Creating NSView for" << widget;
1610 #endif
1611 
1612  if (view && parent)
1613  [parent addSubview:view];
1614  return view;
1615 #else
1616  Q_UNUSED(widget);
1617  Q_UNUSED(widgetPrivate);
1618  if(!widget_class) {
1619  OSStatus err = HIObjectRegisterSubclass(kObjectQWidget, kHIViewClassID, 0, make_widget_eventUPP(),
1620  GetEventTypeCount(widget_events), widget_events,
1621  0, &widget_class);
1622  if (err && err != hiObjectClassExistsErr)
1623  qWarning("QWidget: Internal error (%d)", __LINE__);
1624  }
1625  HIViewRef ret = 0;
1626  if(HIObjectCreate(kObjectQWidget, 0, (HIObjectRef*)&ret) != noErr)
1627  qWarning("QWidget: Internal error (%d)", __LINE__);
1628  if(ret && parent)
1629  HIViewAddSubview(parent, ret);
1630  return ret;
1631 #endif
1632 }
static const EventHandlerUPP make_widget_eventUPP()
static EventTypeSpec widget_events[]
QPointer< QWidget > widget
Q_CORE_EXPORT void qDebug(const char *,...)
static HIObjectClassRef widget_class
struct OpaqueControlRef * HIViewRef
Q_CORE_EXPORT void qWarning(const char *,...)
signed long OSStatus
#define QT_MANGLE_NAMESPACE(name)
Definition: qglobal.h:106
struct OpaqueHIObjectRef * HIObjectRef
static CFStringRef kObjectQWidget
Definition: qwidget_mac.mm:167
#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