Skip to content
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.

Commit

Permalink
Add layout to QMacCocoaViewContainer
Browse files Browse the repository at this point in the history
  • Loading branch information
DDRBoxman committed Feb 7, 2018
1 parent 220ad08 commit b0f046f
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions mac/EditorWidget-osx.mm
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,26 @@
*****************************************************************************/
#import "../headers/EditorWidget.h"
#import <Cocoa/Cocoa.h>
#include <QLayout>

#import "../headers/VSTPlugin.h"

void EditorWidget::buildEffectContainer(AEffect *effect) {
cocoaViewContainer = new QMacCocoaViewContainer(0, this);
cocoaViewContainer = new QMacCocoaViewContainer(nullptr, this);
cocoaViewContainer->move(0, 0);
cocoaViewContainer->resize(300, 300);
NSView *view = [[NSView alloc] initWithFrame: NSMakeRect(0, 0,
300, 300)];

cocoaViewContainer->setCocoaView(view);

VstRect* vstRect = 0;
cocoaViewContainer->show();

auto *hblParams =new QHBoxLayout();
hblParams->setContentsMargins(0, 0, 0, 0);
hblParams->addWidget(cocoaViewContainer);

VstRect* vstRect = nullptr;
effect->dispatcher (effect, effEditGetRect, 0, 0, &vstRect, 0);
if (vstRect)
{
Expand All @@ -38,9 +46,15 @@

cocoaViewContainer->resize(vstRect->right - vstRect->left,
vstRect->bottom- vstRect->top);

this->setGeometry(QRect(0,0,vstRect->right - vstRect->left,
vstRect->bottom- vstRect->top));
}

effect->dispatcher (effect, effEditOpen, 0, 0, view, 0);


this->setLayout(hblParams);
}

void EditorWidget::handleResizeRequest(int width, int height) {
Expand Down

0 comments on commit b0f046f

Please sign in to comment.