From 12ed78335cce892c70df04ad005ffb30d57dd53a Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Thu, 29 Apr 2021 23:37:37 +0000 Subject: [PATCH] Adjust to ObjFW changes FossilOrigin-Name: 9c69939020d3573683bd3e3df6eb85a7e11a3696872253e59942b6c7905ead03 --- src/QtCore/QtEvent.mm | 4 +- src/QtCore/QtObject.mm | 6 +-- src/QtWidgets/QtAbstractButton.h | 2 +- src/QtWidgets/QtAbstractButton.mm | 4 +- src/QtWidgets/QtApplication.h | 2 +- src/QtWidgets/QtApplication.mm | 4 +- src/QtWidgets/QtGraphicsWidget.h | 19 ++++--- src/QtWidgets/QtGraphicsWidget.mm | 27 +++++----- src/QtWidgets/QtWidget.h | 78 +++++++++++++--------------- src/QtWidgets/QtWidget.mm | 86 ++++++++++++++----------------- src/common/helpers.h | 31 ++++++----- 11 files changed, 123 insertions(+), 140 deletions(-) diff --git a/src/QtCore/QtEvent.mm b/src/QtCore/QtEvent.mm index 35d3deb..ca4d4a1 100644 --- a/src/QtCore/QtEvent.mm +++ b/src/QtCore/QtEvent.mm @@ -54,13 +54,13 @@ - (void)takeOwnership { - OF_ENSURE(!_ownsEvent); + OFEnsure(!_ownsEvent); _ownsEvent = true; } - (void)giveUpOwnership { - OF_ENSURE(_ownsEvent); + OFEnsure(_ownsEvent); _ownsEvent = false; } diff --git a/src/QtCore/QtObject.mm b/src/QtCore/QtObject.mm index 3184a31..cc5e612 100644 --- a/src/QtCore/QtObject.mm +++ b/src/QtCore/QtObject.mm @@ -58,13 +58,13 @@ using ObjQt::toQt; - (void)takeOwnership { - OF_ENSURE(!_ownsObject); + OFEnsure(!_ownsObject); _ownsObject = true; } - (void)giveUpOwnership { - OF_ENSURE(_ownsObject); + OFEnsure(_ownsObject); _ownsObject = false; } @@ -241,7 +241,7 @@ using ObjQt::toQt; - (void)deleteLater { - OF_ENSURE(!_ownsObject); + OFEnsure(!_ownsObject); _qObject->deleteLater(); } @end diff --git a/src/QtWidgets/QtAbstractButton.h b/src/QtWidgets/QtAbstractButton.h index f601253..b5a9476 100644 --- a/src/QtWidgets/QtAbstractButton.h +++ b/src/QtWidgets/QtAbstractButton.h @@ -34,7 +34,7 @@ @property (nonatomic, getter=isChecked) bool checked; @property (nonatomic, getter=isDown) bool down; @property (nonatomic) QIcon icon; -@property (nonatomic) of_dimension_t iconSize; +@property (nonatomic) OFSize iconSize; @property (nonatomic) QKeySequence shortcut; @property (nonatomic, copy) OFString *text; @property (readonly, nonatomic) QButtonGroup *group; diff --git a/src/QtWidgets/QtAbstractButton.mm b/src/QtWidgets/QtAbstractButton.mm index 8208d95..a7bedb3 100644 --- a/src/QtWidgets/QtAbstractButton.mm +++ b/src/QtWidgets/QtAbstractButton.mm @@ -124,12 +124,12 @@ using ObjQt::toQt; toQt(self)->setIcon(icon); } -- (of_dimension_t)iconSize +- (OFSize)iconSize { return toOF(toQt(self)->iconSize()); } -- (void)setIconSize: (of_dimension_t)iconSize +- (void)setIconSize: (OFSize)iconSize { toQt(self)->setIconSize(toQt(iconSize).toSize()); } diff --git a/src/QtWidgets/QtApplication.h b/src/QtWidgets/QtApplication.h index 958c063..95abe67 100644 --- a/src/QtWidgets/QtApplication.h +++ b/src/QtWidgets/QtApplication.h @@ -29,7 +29,7 @@ @property (nonatomic) bool autoSIPEnabled; @property (nonatomic) int cursorFlashTime; @property (nonatomic) int doubleClickInterval; -@property (nonatomic) of_dimension_t globalStrut; +@property (nonatomic) OFSize globalStrut; @property (nonatomic) int keyboardInputInterval; @property (nonatomic) int startDragDistance; @property (nonatomic) int startDragTime; diff --git a/src/QtWidgets/QtApplication.mm b/src/QtWidgets/QtApplication.mm index c3637df..8001e42 100644 --- a/src/QtWidgets/QtApplication.mm +++ b/src/QtWidgets/QtApplication.mm @@ -74,12 +74,12 @@ using ObjQt::toQt; toQt(self)->setDoubleClickInterval(doubleClickInterval); } -- (of_dimension_t)globalStrut +- (OFSize)globalStrut { return toOF(toQt(self)->globalStrut()); } -- (void)setGlobalStrut: (of_dimension_t)globalStrut +- (void)setGlobalStrut: (OFSize)globalStrut { toQt(self)->setGlobalStrut(toQt(globalStrut).toSize()); } diff --git a/src/QtWidgets/QtGraphicsWidget.h b/src/QtWidgets/QtGraphicsWidget.h index cb0a20b..0500a1b 100644 --- a/src/QtWidgets/QtGraphicsWidget.h +++ b/src/QtWidgets/QtGraphicsWidget.h @@ -35,22 +35,22 @@ @property (readonly, nonatomic) QGraphicsWidget *qGraphicsWidget; @property (nonatomic) bool autoFillBackground; @property (nonatomic) Qt::FocusPolicy focusPolicy; -@property (nonatomic) of_rectangle_t geometry; +@property (nonatomic) OFRect geometry; @property (nonatomic) QGraphicsLayout *layout; @property (nonatomic) Qt::LayoutDirection layoutDirection; -@property (nonatomic) of_dimension_t maximumSize; -@property (nonatomic) of_dimension_t minimumSize; +@property (nonatomic) OFSize maximumSize; +@property (nonatomic) OFSize minimumSize; @property (nonatomic) QPalette palette; -@property (nonatomic) of_dimension_t preferredSize; -@property (readonly, nonatomic) of_dimension_t size; +@property (nonatomic) OFSize preferredSize; +@property (readonly, nonatomic) OFSize size; @property (nonatomic) QSizePolicy sizePolicy; @property (nonatomic) Qt::WindowFlags windowFlags; @property (copy, nonatomic) OFString *windowTitle; @property (readonly, nonatomic) OFArray OF_GENERIC(QtAction *) *actions; @property (readonly, nonatomic) bool isActiveWindow; @property (nonatomic) QStyle *style; -@property (readonly, nonatomic) of_rectangle_t windowFrameGeometry; -@property (readonly, nonatomic) of_rectangle_t windowFrameRect; +@property (readonly, nonatomic) OFRect windowFrameGeometry; +@property (readonly, nonatomic) OFRect windowFrameRect; - (instancetype)initWithQObject: (QObject *)qObject OF_UNAVAILABLE; - (instancetype)initWithQGraphicsWidget: (QGraphicsWidget *)qGraphicsWidget @@ -76,9 +76,8 @@ widget: (QtWidget *)widget; - (void)releaseShortcut: (int)ID; - (void)removeAction: (QtAction *)action; -- (void)resizeTo: (of_dimension_t)size; -- (void)setAttribute: (Qt::WidgetAttribute)attribute - to: (bool)on; +- (void)resizeTo: (OFSize)size; +- (void)setAttribute: (Qt::WidgetAttribute)attribute to: (bool)on; - (void)setContentsMarginsWithLeft: (qreal)left top: (qreal)top right: (qreal)right diff --git a/src/QtWidgets/QtGraphicsWidget.mm b/src/QtWidgets/QtGraphicsWidget.mm index 0080045..89cbac2 100644 --- a/src/QtWidgets/QtGraphicsWidget.mm +++ b/src/QtWidgets/QtGraphicsWidget.mm @@ -68,12 +68,12 @@ using ObjQt::toQt; toQt(self)->setFocusPolicy(focusPolicy); } -- (of_rectangle_t)geometry +- (OFRect)geometry { return toOF(toQt(self)->geometry()); } -- (void)setGeometry: (of_rectangle_t)geometry +- (void)setGeometry: (OFRect)geometry { toQt(self)->setGeometry(toQt(geometry)); } @@ -98,22 +98,22 @@ using ObjQt::toQt; toQt(self)->setLayoutDirection(layoutDirection); } -- (of_dimension_t)maximumSize +- (OFSize)maximumSize { return toOF(toQt(self)->maximumSize()); } -- (void)setMaximumSize: (of_dimension_t)maximumSize +- (void)setMaximumSize: (OFSize)maximumSize { toQt(self)->setMaximumSize(toQt(maximumSize)); } -- (of_dimension_t)minimumSize +- (OFSize)minimumSize { return toOF(toQt(self)->minimumSize()); } -- (void)setMinimumSize: (of_dimension_t)minimumSize +- (void)setMinimumSize: (OFSize)minimumSize { toQt(self)->setMinimumSize(toQt(minimumSize)); } @@ -128,17 +128,17 @@ using ObjQt::toQt; toQt(self)->setPalette(palette); } -- (of_dimension_t)preferredSize +- (OFSize)preferredSize { return toOF(toQt(self)->preferredSize()); } -- (void)setPreferredSize: (of_dimension_t)preferredSize +- (void)setPreferredSize: (OFSize)preferredSize { toQt(self)->setPreferredSize(toQt(preferredSize)); } -- (of_dimension_t)size +- (OFSize)size { return toOF(toQt(self)->size()); } @@ -205,12 +205,12 @@ using ObjQt::toQt; toQt(self)->setStyle(style); } -- (of_rectangle_t)windowFrameGeometry +- (OFRect)windowFrameGeometry { return toOF(toQt(self)->windowFrameGeometry()); } -- (of_rectangle_t)windowFrameRect +- (OFRect)windowFrameRect { return toOF(toQt(self)->windowFrameRect()); } @@ -290,13 +290,12 @@ using ObjQt::toQt; toQt(self)->removeAction(toQt(action)); } -- (void)resizeTo: (of_dimension_t)size +- (void)resizeTo: (OFSize)size { toQt(self)->resize(toQt(size)); } -- (void)setAttribute: (Qt::WidgetAttribute)attribute - to: (bool)on +- (void)setAttribute: (Qt::WidgetAttribute)attribute to: (bool)on { toQt(self)->setAttribute(attribute, on); } diff --git a/src/QtWidgets/QtWidget.h b/src/QtWidgets/QtWidget.h index 1c9c6cd..4ccb0e8 100644 --- a/src/QtWidgets/QtWidget.h +++ b/src/QtWidgets/QtWidget.h @@ -33,18 +33,18 @@ @property (copy, nonatomic) OFString *accessibleDescription; @property (copy, nonatomic) OFString *accessibleName; @property (nonatomic) bool autoFillBackground; -@property (nonatomic) of_dimension_t baseSize; -@property (readonly, nonatomic) of_rectangle_t childrenRect; +@property (nonatomic) OFSize baseSize; +@property (readonly, nonatomic) OFRect childrenRect; @property (readonly, nonatomic) QRegion childrenRegion; @property (nonatomic) Qt::ContextMenuPolicy contextMenuPolicy; @property (nonatomic) QCursor cursor; @property (nonatomic, getter=isEnabled) bool enabled; @property (nonatomic) Qt::FocusPolicy focusPolicy; @property (nonatomic) const QFont &font; -@property (readonly, nonatomic) of_rectangle_t frameGeometry; -@property (readonly, nonatomic) of_dimension_t frameSize; +@property (readonly, nonatomic) OFRect frameGeometry; +@property (readonly, nonatomic) OFSize frameSize; @property (readonly, nonatomic, getter=isFullScreen) bool fullScreen; -@property (nonatomic) of_rectangle_t geometry; +@property (nonatomic) OFRect geometry; @property (readonly, nonatomic) int height; @property (nonatomic) Qt::InputMethodHints inputMethodHints; @property (readonly, nonatomic) bool isActiveWindow; @@ -52,22 +52,22 @@ @property (nonatomic) QLocale locale; @property (readonly, nonatomic, getter=isMaximized) bool maximized; @property (nonatomic) int maximumHeight; -@property (nonatomic) of_dimension_t maximumSize; +@property (nonatomic) OFSize maximumSize; @property (nonatomic) int maximumWidth; @property (readonly, nonatomic, getter=isMinimized) bool minimized; @property (nonatomic) int minimumHeight; -@property (nonatomic) of_dimension_t minimumSize; -@property (readonly, nonatomic) of_dimension_t minimumSizeHint; +@property (nonatomic) OFSize minimumSize; +@property (readonly, nonatomic) OFSize minimumSizeHint; @property (nonatomic) int minimumWidth; @property (readonly, nonatomic, getter=isModal) bool modal; @property (nonatomic, getter=hasMouseTracking) bool mouseTracking; -@property (readonly, nonatomic) of_rectangle_t normalGeometry; +@property (readonly, nonatomic) OFRect normalGeometry; @property (nonatomic) const QPalette &palette; -@property (nonatomic, setter=moveToPosition:) of_point_t pos; -@property (readonly, nonatomic) of_rectangle_t rect; -@property (nonatomic, setter=resizeTo:) of_dimension_t size; -@property (readonly, nonatomic) of_dimension_t sizeHint; -@property (nonatomic) of_dimension_t sizeIncrement; +@property (nonatomic, setter=moveToPosition:) OFPoint pos; +@property (readonly, nonatomic) OFRect rect; +@property (nonatomic, setter=resizeTo:) OFSize size; +@property (readonly, nonatomic) OFSize sizeHint; +@property (nonatomic) OFSize sizeIncrement; @property (nonatomic) QSizePolicy sizePolicy; @property (copy, nonatomic) OFString *statusTip; @property (copy, nonatomic) OFString *styleSheet; @@ -86,7 +86,7 @@ @property (readonly, nonatomic) int x; @property (readonly, nonatomic) int y; @property (readonly, nonatomic) OFArray OF_GENERIC(QtAction *) *actions; -@property (readonly, nonatomic) of_rectangle_t contentsRect; +@property (readonly, nonatomic) OFRect contentsRect; @property (readonly, nonatomic) QtWidget *focusProxy; @property (readonly, nonatomic) QtWidget *focusWidget; @property (readonly, nonatomic, getter=isHidden) bool hidden; @@ -106,7 +106,7 @@ - (void)adjustSize; - (QPalette::ColorRole)backgroundRole; - (QBackingStore *)backingStore; -- (QtWidget *)childAt: (of_point_t)point; +- (QtWidget *)childAt: (OFPoint)point; - (void)clearFocus; - (void)clearMask; - (QMargins)contentsMargins; @@ -115,10 +115,9 @@ - (QFontInfo)fontInfo; - (QFontMetrics)fontMetrics; - (QPalette::ColorRole)foregroundRole; -- (QPixmap)grabRectangle: (of_rectangle_t)rectangle; +- (QPixmap)grabRectangle: (OFRect)rectangle; - (void)grabGesture: (Qt::GestureType)gesture; -- (void)grabGesture: (Qt::GestureType)gesture - flags: (Qt::GestureFlags)flags; +- (void)grabGesture: (Qt::GestureType)gesture flags: (Qt::GestureFlags)flags; - (void)grabKeyboard; - (void)grabMouse; - (void)grabMouseWithCursor: (const QCursor &)cursor; @@ -134,21 +133,18 @@ - (bool)hasHeightForWidth; - (int)heightForWidth: (int)w; - (QVariant)queryInputMethod: (Qt::InputMethodQuery)query; -- (void)insertAction: (QtAction *)action - before: (QtAction *)before; +- (void)insertAction: (QtAction *)action before: (QtAction *)before; - (void)insertActions: (OFArray OF_GENERIC(QtAction *) *)actions before: (QtAction *)before; - (bool)isAncestorOf: (QtWidget *)child; - (bool)isEnabledTo: (QtWidget *)ancestor; - (bool)isVisibleTo: (QtWidget *)ancestor; -- (of_point_t)mapPosition: (of_point_t)pos - from: (QtWidget *)parent; -- (of_point_t)mapPositionFromGlobal: (of_point_t)pos; -- (of_point_t)mapPositionFromParent: (of_point_t)pos; -- (of_point_t)mapPosition: (of_point_t)pos - to: (QtWidget *)parent; -- (of_point_t)mapPositionToGlobal: (of_point_t)pos; -- (of_point_t)mapPositionToParent: (of_point_t)pos; +- (OFPoint)mapPosition: (OFPoint)pos from: (QtWidget *)parent; +- (OFPoint)mapPositionFromGlobal: (OFPoint)pos; +- (OFPoint)mapPositionFromParent: (OFPoint)pos; +- (OFPoint)mapPosition: (OFPoint)pos to: (QtWidget *)parent; +- (OFPoint)mapPositionToGlobal: (OFPoint)pos; +- (OFPoint)mapPositionToParent: (OFPoint)pos; - (QRegion)mask; - (void)overrideWindowFlags: (Qt::WindowFlags)flags; - (void)releaseKeyboard; @@ -156,36 +152,32 @@ - (void)releaseShortcut: (int)ID; - (void)removeAction: (QtAction *)action; - (void)renderIntoPaintDevice: (QtObject *)target - targetOffset: (of_point_t)targetOffset + targetOffset: (OFPoint)targetOffset sourceRegion: (QRegion)sourceRegion; - (void)renderIntoPaintDevice: (QtObject *)target - targetOffset: (of_point_t)targetOffset + targetOffset: (OFPoint)targetOffset sourceRegion: (QRegion)sourceRegion flags: (QWidget::RenderFlags)renderFlags; - (void)renderIntoPainter: (QPainter *)target - targetOffset: (of_point_t)targetOffset + targetOffset: (OFPoint)targetOffset sourceRegion: (QRegion)sourceRegion; - (void)renderIntoPainter: (QPainter *)target - targetOffset: (of_point_t)targetOffset + targetOffset: (OFPoint)targetOffset sourceRegion: (QRegion)sourceRegion flags: (QWidget::RenderFlags)renderFlags; -- (void)repaintInRectangle: (of_rectangle_t)rect; +- (void)repaintInRectangle: (OFRect)rect; - (void)repaintInRegion: (const QRegion &)region; - (bool)restoreGeometry: (OFData *)geometry; - (OFData *)saveGeometry; -- (void)scrollRight: (int)dx - down: (int)dy; -- (void)scrollRight: (int)dx - down: (int)dy - inRectangle: (of_rectangle_t)rect; -- (void)setAttribute: (Qt::WidgetAttribute)attribute - to: (bool)on; +- (void)scrollRight: (int)dx down: (int)dy; +- (void)scrollRight: (int)dx down: (int)dy inRectangle: (OFRect)rect; +- (void)setAttribute: (Qt::WidgetAttribute)attribute to: (bool)on; - (void)setFocus: (Qt::FocusReason)reason; #ifdef QT_KEYPAD_NAVIGATION - (void)setEditFocus: (bool)enable; #endif - (void)setFixedHeight: (int)height; -- (void)setFixedSize: (of_dimension_t)size; +- (void)setFixedSize: (OFSize)size; - (void)setFixedWidth: (int)width; - (void)setFocusProxy: (QtWidget *)widget; - (void)setForegroundRole: (QPalette::ColorRole)role; @@ -211,7 +203,7 @@ - (void)unsetCursor; - (void)unsetLayoutDirection; - (void)unsetLocale; -- (void)updateInRectangle: (of_rectangle_t)rect; +- (void)updateInRectangle: (OFRect)rect; - (void)updateInRegion: (const QRegion &)region; - (void)updateGeometry; - (QRegion)visibleRegion; diff --git a/src/QtWidgets/QtWidget.mm b/src/QtWidgets/QtWidget.mm index ee97eb1..751d9af 100644 --- a/src/QtWidgets/QtWidget.mm +++ b/src/QtWidgets/QtWidget.mm @@ -95,17 +95,17 @@ using ObjQt::toQt; toQt(self)->setAutoFillBackground(autoFillBackground); } -- (of_dimension_t)baseSize +- (OFSize)baseSize { return toOF(toQt(self)->baseSize()); } -- (void)setBaseSize: (of_dimension_t)baseSize +- (void)setBaseSize: (OFSize)baseSize { toQt(self)->setBaseSize(toQt(baseSize).toSize()); } -- (of_rectangle_t)childrenRect +- (OFRect)childrenRect { return toOF(toQt(self)->childrenRect()); } @@ -175,12 +175,12 @@ using ObjQt::toQt; toQt(self)->setFont(font); } -- (of_rectangle_t)frameGeometry +- (OFRect)frameGeometry { return toOF(toQt(self)->frameGeometry()); } -- (of_dimension_t)frameSize +- (OFSize)frameSize { return toOF(toQt(self)->frameSize()); } @@ -190,12 +190,12 @@ using ObjQt::toQt; return toQt(self)->isFullScreen(); } -- (of_rectangle_t)geometry +- (OFRect)geometry { return toOF(toQt(self)->geometry()); } -- (void)setGeometry: (of_rectangle_t)geometry +- (void)setGeometry: (OFRect)geometry { toQt(self)->setGeometry(toQt(geometry).toRect()); } @@ -265,12 +265,12 @@ using ObjQt::toQt; toQt(self)->setMaximumHeight(maximumHeight); } -- (of_dimension_t)maximumSize +- (OFSize)maximumSize { return toOF(toQt(self)->maximumSize()); } -- (void)setMaximumSize: (of_dimension_t)maximumSize +- (void)setMaximumSize: (OFSize)maximumSize { toQt(self)->setMaximumSize(toQt(maximumSize).toSize()); } @@ -300,17 +300,17 @@ using ObjQt::toQt; toQt(self)->setMinimumHeight(minimumHeight); } -- (of_dimension_t)minimumSize +- (OFSize)minimumSize { return toOF(toQt(self)->minimumSize()); } -- (void)setMinimumSize: (of_dimension_t)minimumSize +- (void)setMinimumSize: (OFSize)minimumSize { toQt(self)->setMinimumSize(toQt(minimumSize).toSize()); } -- (of_dimension_t)minimumSizeHint +- (OFSize)minimumSizeHint { return toOF(toQt(self)->minimumSizeHint()); } @@ -340,7 +340,7 @@ using ObjQt::toQt; toQt(self)->setMouseTracking(mouseTracking); } -- (of_rectangle_t)normalGeometry +- (OFRect)normalGeometry { return toOF(toQt(self)->normalGeometry()); } @@ -355,42 +355,42 @@ using ObjQt::toQt; toQt(self)->setPalette(palette); } -- (of_point_t)pos +- (OFPoint)pos { return toOF(toQt(self)->pos()); } -- (void)moveToPosition: (of_point_t)pos +- (void)moveToPosition: (OFPoint)pos { toQt(self)->move(toQt(pos)); } -- (of_rectangle_t)rect +- (OFRect)rect { return toOF(toQt(self)->rect()); } -- (of_dimension_t)size +- (OFSize)size { return toOF(toQt(self)->size()); } -- (void)resizeTo: (of_dimension_t)size +- (void)resizeTo: (OFSize)size { toQt(self)->resize(toQt(size).toSize()); } -- (of_dimension_t)sizeHint +- (OFSize)sizeHint { return toOF(toQt(self)->sizeHint()); } -- (of_dimension_t)sizeIncrement +- (OFSize)sizeIncrement { return toOF(toQt(self)->sizeIncrement()); } -- (void)setSizeIncrement: (of_dimension_t)sizeIncrement +- (void)setSizeIncrement: (OFSize)sizeIncrement { toQt(self)->setSizeIncrement(toQt(sizeIncrement).toSize()); } @@ -612,7 +612,7 @@ using ObjQt::toQt; return toQt(self)->backingStore(); } -- (QtWidget *)childAt: (of_point_t)point +- (QtWidget *)childAt: (OFPoint)point { return toOF(toQt(self)->childAt(toQt(point))); } @@ -632,7 +632,7 @@ using ObjQt::toQt; return toQt(self)->contentsMargins(); } -- (of_rectangle_t)contentsRect +- (OFRect)contentsRect { return toOF(toQt(self)->contentsRect()); } @@ -672,7 +672,7 @@ using ObjQt::toQt; return toQt(self)->foregroundRole(); } -- (QPixmap)grabRectangle: (of_rectangle_t)rectangle +- (QPixmap)grabRectangle: (OFRect)rectangle { return toQt(self)->grab(toQt(rectangle).toRect()); } @@ -788,34 +788,32 @@ using ObjQt::toQt; return toQt(self)->isWindow(); } -- (of_point_t)mapPosition: (of_point_t)pos - from: (QtWidget *)parent +- (OFPoint)mapPosition: (OFPoint)pos from: (QtWidget *)parent { return toOF(toQt(self)->mapFrom(toQt(parent), toQt(pos))); } -- (of_point_t)mapPositionFromGlobal: (of_point_t)pos +- (OFPoint)mapPositionFromGlobal: (OFPoint)pos { return toOF(toQt(self)->mapFromGlobal(toQt(pos))); } -- (of_point_t)mapPositionFromParent: (of_point_t)pos +- (OFPoint)mapPositionFromParent: (OFPoint)pos { return toOF(toQt(self)->mapFromParent(toQt(pos))); } -- (of_point_t)mapPosition: (of_point_t)pos - to: (QtWidget *)parent +- (OFPoint)mapPosition: (OFPoint)pos to: (QtWidget *)parent { return toOF(toQt(self)->mapTo(toQt(parent), toQt(pos))); } -- (of_point_t)mapPositionToGlobal: (of_point_t)pos +- (OFPoint)mapPositionToGlobal: (OFPoint)pos { return toOF(toQt(self)->mapToGlobal(toQt(pos))); } -- (of_point_t)mapPositionToParent: (of_point_t)pos +- (OFPoint)mapPositionToParent: (OFPoint)pos { return toOF(toQt(self)->mapToParent(toQt(pos))); } @@ -871,7 +869,7 @@ using ObjQt::toQt; } - (void)renderIntoPaintDevice: (QtObject *)target - targetOffset: (of_point_t)targetOffset + targetOffset: (OFPoint)targetOffset sourceRegion: (QRegion)sourceRegion { toQt(self)->render([target qPaintDevice], toQt(targetOffset), @@ -879,7 +877,7 @@ using ObjQt::toQt; } - (void)renderIntoPaintDevice: (QtObject *)target - targetOffset: (of_point_t)targetOffset + targetOffset: (OFPoint)targetOffset sourceRegion: (QRegion)sourceRegion flags: (QWidget::RenderFlags)renderFlags { @@ -888,14 +886,14 @@ using ObjQt::toQt; } - (void)renderIntoPainter: (QPainter *)target - targetOffset: (of_point_t)targetOffset + targetOffset: (OFPoint)targetOffset sourceRegion: (QRegion)sourceRegion { toQt(self)->render(target, toQt(targetOffset), sourceRegion); } - (void)renderIntoPainter: (QPainter *)target - targetOffset: (of_point_t)targetOffset + targetOffset: (OFPoint)targetOffset sourceRegion: (QRegion)sourceRegion flags: (QWidget::RenderFlags)renderFlags { @@ -903,7 +901,7 @@ using ObjQt::toQt; renderFlags); } -- (void)repaintInRectangle: (of_rectangle_t)rect +- (void)repaintInRectangle: (OFRect)rect { toQt(self)->repaint(toQt(rect).toRect()); } @@ -923,21 +921,17 @@ using ObjQt::toQt; return toOF(toQt(self)->saveGeometry()); } -- (void)scrollRight: (int)dx - down: (int)dy +- (void)scrollRight: (int)dx down: (int)dy { toQt(self)->scroll(dx, dy); } -- (void)scrollRight: (int)dx - down: (int)dy - inRectangle: (of_rectangle_t)rect +- (void)scrollRight: (int)dx down: (int)dy inRectangle: (OFRect)rect { toQt(self)->scroll(dx, dy, toQt(rect).toRect()); } -- (void)setAttribute: (Qt::WidgetAttribute)attribute - to: (bool)on +- (void)setAttribute: (Qt::WidgetAttribute)attribute to: (bool)on { toQt(self)->setAttribute(attribute, on); } @@ -954,7 +948,7 @@ using ObjQt::toQt; toQt(self)->setFixedHeight(height); } -- (void)setFixedSize: (of_dimension_t)size +- (void)setFixedSize: (OFSize)size { toQt(self)->setFixedSize(toQt(size).toSize()); } @@ -1062,7 +1056,7 @@ using ObjQt::toQt; toQt(self)->ungrabGesture(gesture); } -- (void)updateInRectangle: (of_rectangle_t)rect +- (void)updateInRectangle: (OFRect)rect { toQt(self)->update(toQt(rect).toRect()); } diff --git a/src/common/helpers.h b/src/common/helpers.h index ec7be56..8cef95f 100644 --- a/src/common/helpers.h +++ b/src/common/helpers.h @@ -34,55 +34,54 @@ namespace ObjQt { -static OF_INLINE of_point_t +static OF_INLINE OFPoint toOF(const QPoint &qPoint) { - return of_point(qPoint.x(), qPoint.y()); + return OFPointMake(qPoint.x(), qPoint.y()); } static OF_INLINE QPoint -toQt(const of_point_t &point) +toQt(const OFPoint &point) { return QPoint(point.x, point.y); } -static OF_INLINE of_dimension_t +static OF_INLINE OFSize toOF(const QSize &qSize) { - return of_dimension(qSize.width(), qSize.height()); + return OFSizeMake(qSize.width(), qSize.height()); } -static OF_INLINE of_dimension_t +static OF_INLINE OFSize toOF(const QSizeF &qSizeF) { - return of_dimension(qSizeF.width(), qSizeF.height()); + return OFSizeMake(qSizeF.width(), qSizeF.height()); } static OF_INLINE QSizeF -toQt(const of_dimension_t &dimension) +toQt(const OFSize &dimension) { return QSizeF(dimension.width, dimension.height); } -static OF_INLINE of_rectangle_t +static OF_INLINE OFRect toOF(const QRect &qRect) { - return of_rectangle(qRect.x(), qRect.y(), - qRect.width(), qRect.height()); + return OFRectMake(qRect.x(), qRect.y(), qRect.width(), qRect.height()); } -static OF_INLINE of_rectangle_t +static OF_INLINE OFRect toOF(const QRectF &qRectF) { - return of_rectangle(qRectF.x(), qRectF.y(), + return OFRectMake(qRectF.x(), qRectF.y(), qRectF.width(), qRectF.height()); } static OF_INLINE QRectF -toQt(const of_rectangle_t &rectangle) +toQt(const OFRect &rect) { - return QRectF(rectangle.origin.x, rectangle.origin.y, - rectangle.size.width, rectangle.size.height); + return QRectF(rect.origin.x, rect.origin.y, + rect.size.width, rect.size.height); } }