адаптация s13bby/osc под vst и gui. (вайбкод)
вайбкод потому что мне в моменте стало понятно. что проще было сразу писать на фреймворке JUCE, чем адаптировать консольное приложение на MiniAudio. обновляться данный репозиторий не будет. СmakeLists адаптирован онли под linux.
This commit is contained in:
+142
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE framework.
|
||||
Copyright (c) Raw Material Software Limited
|
||||
|
||||
JUCE is an open source framework subject to commercial or open source
|
||||
licensing.
|
||||
|
||||
By downloading, installing, or using the JUCE framework, or combining the
|
||||
JUCE framework with any other source code, object code, content or any other
|
||||
copyrightable work, you agree to the terms of the JUCE End User Licence
|
||||
Agreement, and all incorporated terms including the JUCE Privacy Policy and
|
||||
the JUCE Website Terms of Service, as applicable, which will bind you. If you
|
||||
do not agree to the terms of these agreements, we will not license the JUCE
|
||||
framework to you, and you must discontinue the installation or download
|
||||
process and cease use of the JUCE framework.
|
||||
|
||||
JUCE End User Licence Agreement: https://juce.com/legal/juce-9-licence/
|
||||
JUCE Privacy Policy: https://juce.com/juce-privacy-policy
|
||||
JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/
|
||||
|
||||
Or:
|
||||
|
||||
You may also use this code under the terms of the AGPLv3:
|
||||
https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
|
||||
THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL
|
||||
WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF
|
||||
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
namespace juce
|
||||
{
|
||||
|
||||
#if JUCE_WINDOWS || DOXYGEN
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
A Windows-specific class that can create and embed an ActiveX control inside
|
||||
itself.
|
||||
|
||||
To use it, create one of these, put it in place and make sure it's visible in a
|
||||
window, then use createControl() to instantiate an ActiveX control. The control
|
||||
will then be moved and resized to follow the movements of this component.
|
||||
|
||||
Of course, since the control is a heavyweight window, it'll obliterate any
|
||||
JUCE components that may overlap this component, but that's life.
|
||||
|
||||
@tags{GUI}
|
||||
*/
|
||||
class JUCE_API ActiveXControlComponent : public Component
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
/** Create an initially-empty container. */
|
||||
ActiveXControlComponent();
|
||||
|
||||
/** Destructor. */
|
||||
~ActiveXControlComponent() override;
|
||||
|
||||
/** Tries to create an ActiveX control and embed it in this peer.
|
||||
|
||||
The peer controlIID is a pointer to an IID structure - it's treated
|
||||
as a void* because when including the JUCE headers, you might not always
|
||||
have included windows.h first, in which case IID wouldn't be defined.
|
||||
|
||||
e.g. @code
|
||||
const IID myIID = __uuidof (QTControl);
|
||||
myControlComp->createControl (&myIID);
|
||||
@endcode
|
||||
*/
|
||||
bool createControl (const void* controlIID);
|
||||
|
||||
/** Deletes the ActiveX control, if one has been created.
|
||||
*/
|
||||
void deleteControl();
|
||||
|
||||
/** Returns true if a control is currently in use. */
|
||||
bool isControlOpen() const noexcept { return control != nullptr; }
|
||||
|
||||
/** Does a QueryInterface call on the embedded control object.
|
||||
|
||||
This allows you to cast the control to whatever type of COM object you need.
|
||||
|
||||
The iid parameter is a pointer to an IID structure - it's treated
|
||||
as a void* because when including the JUCE headers, you might not always
|
||||
have included windows.h first, in which case IID wouldn't be defined, but
|
||||
you should just pass a pointer to an IID.
|
||||
|
||||
e.g. @code
|
||||
const IID iid = __uuidof (IOleWindow);
|
||||
|
||||
IOleWindow* oleWindow = (IOleWindow*) myControlComp->queryInterface (&iid);
|
||||
|
||||
if (oleWindow != nullptr)
|
||||
{
|
||||
HWND hwnd;
|
||||
oleWindow->GetWindow (&hwnd);
|
||||
|
||||
...
|
||||
|
||||
oleWindow->Release();
|
||||
}
|
||||
@endcode
|
||||
*/
|
||||
void* queryInterface (const void* iid) const;
|
||||
|
||||
/** Set this to false to stop mouse events being allowed through to the control.
|
||||
*/
|
||||
void setMouseEventsAllowed (bool eventsCanReachControl);
|
||||
|
||||
/** Returns true if mouse events are allowed to get through to the control.
|
||||
*/
|
||||
bool areMouseEventsAllowed() const noexcept { return mouseEventsAllowed; }
|
||||
|
||||
//==============================================================================
|
||||
/** Set an instance of IDispatch where dispatch events should be delivered to
|
||||
*/
|
||||
void setEventHandler (void* eventHandler);
|
||||
|
||||
//==============================================================================
|
||||
/** @internal */
|
||||
void paint (Graphics&) override;
|
||||
|
||||
/** @internal */
|
||||
intptr_t offerEventToActiveXControl (void*);
|
||||
static intptr_t offerEventToActiveXControlStatic (void*);
|
||||
|
||||
private:
|
||||
class Pimpl;
|
||||
std::unique_ptr<Pimpl> control;
|
||||
bool mouseEventsAllowed = true;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ActiveXControlComponent)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace juce
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE framework.
|
||||
Copyright (c) Raw Material Software Limited
|
||||
|
||||
JUCE is an open source framework subject to commercial or open source
|
||||
licensing.
|
||||
|
||||
By downloading, installing, or using the JUCE framework, or combining the
|
||||
JUCE framework with any other source code, object code, content or any other
|
||||
copyrightable work, you agree to the terms of the JUCE End User Licence
|
||||
Agreement, and all incorporated terms including the JUCE Privacy Policy and
|
||||
the JUCE Website Terms of Service, as applicable, which will bind you. If you
|
||||
do not agree to the terms of these agreements, we will not license the JUCE
|
||||
framework to you, and you must discontinue the installation or download
|
||||
process and cease use of the JUCE framework.
|
||||
|
||||
JUCE End User Licence Agreement: https://juce.com/legal/juce-9-licence/
|
||||
JUCE Privacy Policy: https://juce.com/juce-privacy-policy
|
||||
JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/
|
||||
|
||||
Or:
|
||||
|
||||
You may also use this code under the terms of the AGPLv3:
|
||||
https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
|
||||
THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL
|
||||
WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF
|
||||
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
namespace juce
|
||||
{
|
||||
|
||||
#if JUCE_ANDROID || DOXYGEN
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
An Android-specific class that can create and embed a View inside itself.
|
||||
|
||||
To use it, create one of these, put it in place and make sure it's visible in a
|
||||
window, then use setView() to assign a View to it. The view will then be
|
||||
moved and resized to follow the movements of this component.
|
||||
|
||||
Of course, since the view is a native object, it'll obliterate any
|
||||
JUCE components that may overlap this component, but that's life.
|
||||
|
||||
@tags{GUI}
|
||||
*/
|
||||
class JUCE_API AndroidViewComponent : public Component
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
/** Create an initially-empty container */
|
||||
AndroidViewComponent();
|
||||
|
||||
/** Destructor. */
|
||||
~AndroidViewComponent() override;
|
||||
|
||||
/** Assigns a View to this peer.
|
||||
|
||||
The view will be retained and released by this component for as long as
|
||||
it is needed. To remove the current view, just call setView (nullptr).
|
||||
*/
|
||||
void setView (void* uiView);
|
||||
|
||||
/** Returns the current View. */
|
||||
void* getView() const;
|
||||
|
||||
/** Resizes this component to fit the view that it contains. */
|
||||
void resizeToFitView();
|
||||
|
||||
//==============================================================================
|
||||
/** @internal */
|
||||
void paint (Graphics&) override;
|
||||
/** @internal */
|
||||
std::unique_ptr<AccessibilityHandler> createAccessibilityHandler() override;
|
||||
|
||||
private:
|
||||
class Pimpl;
|
||||
std::unique_ptr<Pimpl> pimpl;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AndroidViewComponent)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace juce
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE framework.
|
||||
Copyright (c) Raw Material Software Limited
|
||||
|
||||
JUCE is an open source framework subject to commercial or open source
|
||||
licensing.
|
||||
|
||||
By downloading, installing, or using the JUCE framework, or combining the
|
||||
JUCE framework with any other source code, object code, content or any other
|
||||
copyrightable work, you agree to the terms of the JUCE End User Licence
|
||||
Agreement, and all incorporated terms including the JUCE Privacy Policy and
|
||||
the JUCE Website Terms of Service, as applicable, which will bind you. If you
|
||||
do not agree to the terms of these agreements, we will not license the JUCE
|
||||
framework to you, and you must discontinue the installation or download
|
||||
process and cease use of the JUCE framework.
|
||||
|
||||
JUCE End User Licence Agreement: https://juce.com/legal/juce-9-licence/
|
||||
JUCE Privacy Policy: https://juce.com/juce-privacy-policy
|
||||
JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/
|
||||
|
||||
Or:
|
||||
|
||||
You may also use this code under the terms of the AGPLv3:
|
||||
https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
|
||||
THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL
|
||||
WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF
|
||||
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
namespace juce
|
||||
{
|
||||
|
||||
#if JUCE_WINDOWS || DOXYGEN
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
A Windows-specific class that can create and embed a HWND inside itself.
|
||||
|
||||
To use it, create one of these, put it in place and make sure it's visible in a
|
||||
window, then use setHWND() to assign a HWND to it. The window will then be
|
||||
moved and resized to follow the movements of this component.
|
||||
|
||||
Of course, since the window is a native object, it'll obliterate any
|
||||
JUCE components that may overlap this component, but that's life.
|
||||
|
||||
@tags{GUI}
|
||||
*/
|
||||
class JUCE_API HWNDComponent : public Component
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
/** Create an initially-empty container. */
|
||||
HWNDComponent();
|
||||
|
||||
/** Destructor. */
|
||||
~HWNDComponent() override;
|
||||
|
||||
/** Assigns a HWND to this peer.
|
||||
|
||||
The window will be retained and released by this component for as long as
|
||||
it is needed. To remove the current HWND, just call setHWND (nullptr).
|
||||
|
||||
Note: A void* is used here to avoid including the Windows headers as
|
||||
part of JuceHeader.h, but the method expects a HWND.
|
||||
*/
|
||||
void setHWND (void* hwnd);
|
||||
|
||||
/** Returns the current HWND.
|
||||
|
||||
Note: A void* is returned here to avoid the needing to include the Windows
|
||||
headers, so you should just cast the return value to a HWND.
|
||||
*/
|
||||
void* getHWND() const;
|
||||
|
||||
/** Resizes this component to fit the HWND that it contains. */
|
||||
void resizeToFit();
|
||||
|
||||
/** Forces the bounds of the HWND to match the bounds of this component. */
|
||||
void updateHWNDBounds();
|
||||
|
||||
/** @internal */
|
||||
void paint (Graphics&) override;
|
||||
|
||||
private:
|
||||
class Pimpl;
|
||||
std::unique_ptr<Pimpl> pimpl;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (HWNDComponent)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace juce
|
||||
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE framework.
|
||||
Copyright (c) Raw Material Software Limited
|
||||
|
||||
JUCE is an open source framework subject to commercial or open source
|
||||
licensing.
|
||||
|
||||
By downloading, installing, or using the JUCE framework, or combining the
|
||||
JUCE framework with any other source code, object code, content or any other
|
||||
copyrightable work, you agree to the terms of the JUCE End User Licence
|
||||
Agreement, and all incorporated terms including the JUCE Privacy Policy and
|
||||
the JUCE Website Terms of Service, as applicable, which will bind you. If you
|
||||
do not agree to the terms of these agreements, we will not license the JUCE
|
||||
framework to you, and you must discontinue the installation or download
|
||||
process and cease use of the JUCE framework.
|
||||
|
||||
JUCE End User Licence Agreement: https://juce.com/legal/juce-9-licence/
|
||||
JUCE Privacy Policy: https://juce.com/juce-privacy-policy
|
||||
JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/
|
||||
|
||||
Or:
|
||||
|
||||
You may also use this code under the terms of the AGPLv3:
|
||||
https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
|
||||
THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL
|
||||
WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF
|
||||
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
namespace juce
|
||||
{
|
||||
|
||||
#if JUCE_MAC || DOXYGEN
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
A Mac-specific class that can create and embed an NSView inside itself.
|
||||
|
||||
To use it, create one of these, put it in place and make sure it's visible in a
|
||||
window, then use setView() to assign an NSView to it. The view will then be
|
||||
moved and resized to follow the movements of this component.
|
||||
|
||||
Of course, since the view is a native object, it'll obliterate any
|
||||
JUCE components that may overlap this component, but that's life.
|
||||
|
||||
@tags{GUI}
|
||||
*/
|
||||
class JUCE_API NSViewComponent : public Component
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
/** Create an initially-empty container. */
|
||||
NSViewComponent();
|
||||
|
||||
/** Destructor. */
|
||||
~NSViewComponent() override;
|
||||
|
||||
/** Assigns an NSView to this peer.
|
||||
|
||||
The view will be retained and released by this component for as long as
|
||||
it is needed. To remove the current view, just call setView (nullptr).
|
||||
|
||||
Note: A void* is used here to avoid including the cocoa headers as
|
||||
part of JuceHeader.h, but the method expects an NSView*.
|
||||
*/
|
||||
void setView (void* nsView);
|
||||
|
||||
/** Returns the current NSView.
|
||||
|
||||
Note: A void* is returned here to avoid the needing to include the cocoa
|
||||
headers, so you should just cast the return value to an NSView*.
|
||||
*/
|
||||
void* getView() const;
|
||||
|
||||
/** Resizes this component to fit the view that it contains. */
|
||||
void resizeToFitView();
|
||||
|
||||
/** Resizes the NSView to match the bounds of this component.
|
||||
|
||||
Most of the time, this will be done for you automatically.
|
||||
*/
|
||||
void resizeViewToFit();
|
||||
|
||||
//==============================================================================
|
||||
/** @internal */
|
||||
void paint (Graphics&) override;
|
||||
/** @internal */
|
||||
void alphaChanged() override;
|
||||
/** @internal */
|
||||
static ReferenceCountedObject* attachViewToComponent (Component&, void*);
|
||||
/** @internal */
|
||||
std::unique_ptr<AccessibilityHandler> createAccessibilityHandler() override;
|
||||
|
||||
private:
|
||||
ReferenceCountedObjectPtr<ReferenceCountedObject> attachment;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (NSViewComponent)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace juce
|
||||
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE framework.
|
||||
Copyright (c) Raw Material Software Limited
|
||||
|
||||
JUCE is an open source framework subject to commercial or open source
|
||||
licensing.
|
||||
|
||||
By downloading, installing, or using the JUCE framework, or combining the
|
||||
JUCE framework with any other source code, object code, content or any other
|
||||
copyrightable work, you agree to the terms of the JUCE End User Licence
|
||||
Agreement, and all incorporated terms including the JUCE Privacy Policy and
|
||||
the JUCE Website Terms of Service, as applicable, which will bind you. If you
|
||||
do not agree to the terms of these agreements, we will not license the JUCE
|
||||
framework to you, and you must discontinue the installation or download
|
||||
process and cease use of the JUCE framework.
|
||||
|
||||
JUCE End User Licence Agreement: https://juce.com/legal/juce-9-licence/
|
||||
JUCE Privacy Policy: https://juce.com/juce-privacy-policy
|
||||
JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/
|
||||
|
||||
Or:
|
||||
|
||||
You may also use this code under the terms of the AGPLv3:
|
||||
https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
|
||||
THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL
|
||||
WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF
|
||||
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
namespace juce
|
||||
{
|
||||
|
||||
#if JUCE_IOS || DOXYGEN
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
An iOS-specific class that can create and embed an UIView inside itself.
|
||||
|
||||
To use it, create one of these, put it in place and make sure it's visible in a
|
||||
window, then use setView() to assign a UIView to it. The view will then be
|
||||
moved and resized to follow the movements of this component.
|
||||
|
||||
Of course, since the view is a native object, it'll obliterate any
|
||||
JUCE components that may overlap this component, but that's life.
|
||||
|
||||
@tags{GUI}
|
||||
*/
|
||||
class JUCE_API UIViewComponent : public Component
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
/** Create an initially-empty container. */
|
||||
UIViewComponent();
|
||||
|
||||
/** Destructor. */
|
||||
~UIViewComponent() override;
|
||||
|
||||
/** Assigns an UIView to this peer.
|
||||
|
||||
The view will be retained and released by this component for as long as
|
||||
it is needed. To remove the current view, just call setView (nullptr).
|
||||
|
||||
Note: A void* is used here to avoid including the cocoa headers as
|
||||
part of JuceHeader.h, but the method expects an UIView*.
|
||||
*/
|
||||
void setView (void* uiView);
|
||||
|
||||
/** Returns the current UIView.
|
||||
|
||||
Note: A void* is returned here to avoid the needing to include the cocoa
|
||||
headers, so you should just cast the return value to an UIView*.
|
||||
*/
|
||||
void* getView() const;
|
||||
|
||||
/** Resizes this component to fit the view that it contains. */
|
||||
void resizeToFitView();
|
||||
|
||||
//==============================================================================
|
||||
/** @internal */
|
||||
void paint (Graphics&) override;
|
||||
/** @internal */
|
||||
std::unique_ptr<AccessibilityHandler> createAccessibilityHandler() override;
|
||||
|
||||
|
||||
private:
|
||||
class Pimpl;
|
||||
std::unique_ptr<Pimpl> pimpl;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (UIViewComponent)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace juce
|
||||
@@ -0,0 +1,203 @@
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE framework.
|
||||
Copyright (c) Raw Material Software Limited
|
||||
|
||||
JUCE is an open source framework subject to commercial or open source
|
||||
licensing.
|
||||
|
||||
By downloading, installing, or using the JUCE framework, or combining the
|
||||
JUCE framework with any other source code, object code, content or any other
|
||||
copyrightable work, you agree to the terms of the JUCE End User Licence
|
||||
Agreement, and all incorporated terms including the JUCE Privacy Policy and
|
||||
the JUCE Website Terms of Service, as applicable, which will bind you. If you
|
||||
do not agree to the terms of these agreements, we will not license the JUCE
|
||||
framework to you, and you must discontinue the installation or download
|
||||
process and cease use of the JUCE framework.
|
||||
|
||||
JUCE End User Licence Agreement: https://juce.com/legal/juce-9-licence/
|
||||
JUCE Privacy Policy: https://juce.com/juce-privacy-policy
|
||||
JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/
|
||||
|
||||
Or:
|
||||
|
||||
You may also use this code under the terms of the AGPLv3:
|
||||
https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||
|
||||
THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL
|
||||
WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF
|
||||
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
namespace juce
|
||||
{
|
||||
|
||||
/** @internal */
|
||||
bool juce_handleXEmbedEvent (ComponentPeer*, void*);
|
||||
/** @internal */
|
||||
unsigned long juce_getCurrentFocusWindow (ComponentPeer*);
|
||||
|
||||
#if JUCE_LINUX || JUCE_BSD || DOXYGEN
|
||||
|
||||
/** Options for constructing an XEmbedComponent.
|
||||
|
||||
@see XEmbedComponent
|
||||
*/
|
||||
class JUCE_API XEmbedComponentOptions
|
||||
{
|
||||
public:
|
||||
/** Returns a copy of these options with the client window id specified. This corresponds to
|
||||
the client initiated embedding workflow.
|
||||
|
||||
Omitting this option corresponds to the host initiated embedding workflow.
|
||||
*/
|
||||
[[nodiscard]] XEmbedComponentOptions withClientWindow (unsigned long x) const
|
||||
{
|
||||
jassert (x != 0);
|
||||
return withMember (*this, &XEmbedComponentOptions::clientWindow, x);
|
||||
}
|
||||
|
||||
/** Specifies that this Component wants to receive and forward keyboard focus.
|
||||
|
||||
The default value is true.
|
||||
*/
|
||||
[[nodiscard]] XEmbedComponentOptions withWantsKeyboardFocus (bool x) const
|
||||
{
|
||||
return withMember (*this, &XEmbedComponentOptions::wantsKeyboardFocus, x);
|
||||
}
|
||||
|
||||
/** Specifies that the embedded window is allowed to resize the Component.
|
||||
|
||||
The default value is false.
|
||||
*/
|
||||
[[nodiscard]] XEmbedComponentOptions withAllowForeignWidgetToResizeComponent (bool x = true) const
|
||||
{
|
||||
return withMember (*this, &XEmbedComponentOptions::allowForeignWidgetToResizeComponent, x);
|
||||
}
|
||||
|
||||
/** When this option is enabled the client window will be unconditionally mapped regardless of
|
||||
the value of the XEMBED_MAPPED flag.
|
||||
|
||||
You should generally not use this option. The default value is false.
|
||||
|
||||
It's used internally by JUCE plugin hosting to accommodate some plugins that report
|
||||
XEmbedInfo compatibility, but don't set the flag.
|
||||
*/
|
||||
[[nodiscard]] XEmbedComponentOptions withIgnoreXembedMapped (bool x = true) const
|
||||
{
|
||||
return withMember (*this, &XEmbedComponentOptions::ignoreXembedMapped, x);
|
||||
}
|
||||
|
||||
/** @see withClientWindow() */
|
||||
[[nodiscard]] auto getClientWindow() const { return clientWindow; }
|
||||
|
||||
/** @see withWantsKeyboardFocus() */
|
||||
[[nodiscard]] bool getWantsKeyboardFocus() const { return wantsKeyboardFocus; }
|
||||
|
||||
/** @see withAllowForeignWidgetToResizeComponent() */
|
||||
[[nodiscard]] bool getAllowForeignWidgetToResizeComponent() const { return allowForeignWidgetToResizeComponent; }
|
||||
|
||||
/** @see withIgnoreXembedMapped() */
|
||||
[[nodiscard]] bool getIgnoreXembedMapped() const { return ignoreXembedMapped; }
|
||||
|
||||
private:
|
||||
unsigned long clientWindow{};
|
||||
bool wantsKeyboardFocus = true;
|
||||
bool allowForeignWidgetToResizeComponent = false;
|
||||
bool ignoreXembedMapped = false;
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
A Linux-specific class that can embed a foreign X11 widget.
|
||||
|
||||
Use this class to embed a foreign X11 widget from other toolkits such as
|
||||
GTK+ or QT.
|
||||
|
||||
There are two ways to initiate the Xembed protocol. Either the client creates
|
||||
a window and passes this to the host (client initiated) or the host
|
||||
creates a window in which the client can reparent it's client widget
|
||||
(host initiated). XEmbedComponent supports both protocol types.
|
||||
|
||||
This is how you embed a GTK+ widget: if you are using the client
|
||||
initiated version of the protocol, then create a new gtk widget with
|
||||
gtk_plug_new (0). Then query the window id of the plug via gtk_plug_get_id().
|
||||
Pass this id to the constructor of this class.
|
||||
|
||||
If you are using the host initiated version of the protocol, then first create
|
||||
the XEmbedComponent using the default constructor. Use getHostWindowID to get
|
||||
the window id of the host, use this to construct your gtk plug via gtk_plug_new.
|
||||
|
||||
A similar approach can be used to embed QT widgets via QT's QX11EmbedWidget
|
||||
class.
|
||||
|
||||
Other toolkits or raw X11 widgets should follow the X11 embed protocol:
|
||||
https://specifications.freedesktop.org/xembed-spec/xembed-spec-latest.html
|
||||
|
||||
@tags{GUI}
|
||||
*/
|
||||
class XEmbedComponent : public Component
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
/** Creates a JUCE component wrapping a foreign widget.
|
||||
|
||||
Depending on the options passed, this constructor can be used for either
|
||||
the host initiated or client initiated version of the XEmbedProtocol.
|
||||
*/
|
||||
explicit XEmbedComponent (const XEmbedComponentOptions& options);
|
||||
|
||||
/** Creates a JUCE component wrapping a foreign widget
|
||||
|
||||
Use this constructor if you are using the host initiated version
|
||||
of the XEmbedProtocol. When using this version of the protocol
|
||||
you must call getHostWindowID() and pass this id to the foreign toolkit.
|
||||
*/
|
||||
XEmbedComponent (bool wantsKeyboardFocus = true,
|
||||
bool allowForeignWidgetToResizeComponent = false);
|
||||
|
||||
/** Create a JUCE component wrapping the foreign widget with id wID
|
||||
|
||||
Use this constructor if you are using the client initiated version
|
||||
of the XEmbedProtocol.
|
||||
*/
|
||||
XEmbedComponent (unsigned long wID, bool wantsKeyboardFocus = true,
|
||||
bool allowForeignWidgetToResizeComponent = false);
|
||||
|
||||
|
||||
/** Destructor. */
|
||||
~XEmbedComponent() override;
|
||||
|
||||
/** Use this method to retrieve the host's window id when using the
|
||||
host initiated version of the XEmbedProtocol
|
||||
*/
|
||||
unsigned long getHostWindowID();
|
||||
|
||||
/** Removes the client window from the host. */
|
||||
void removeClient();
|
||||
|
||||
/** Forces the embedded window to match the current size of this component. */
|
||||
void updateEmbeddedBounds();
|
||||
|
||||
protected:
|
||||
//==============================================================================
|
||||
/** @internal */
|
||||
void paint (Graphics&) override;
|
||||
void focusGainedWithDirection (FocusChangeType, FocusChangeDirection) override;
|
||||
void focusLost (FocusChangeType) override;
|
||||
void broughtToFront() override;
|
||||
|
||||
private:
|
||||
friend bool juce::juce_handleXEmbedEvent (ComponentPeer*, void*);
|
||||
friend unsigned long juce_getCurrentFocusWindow (ComponentPeer*);
|
||||
|
||||
class Pimpl;
|
||||
std::unique_ptr<Pimpl> pimpl;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace juce
|
||||
Reference in New Issue
Block a user