mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
PIP: Respect screen safe areas for demo projects
This commit is contained in:
parent
34c32cbaf0
commit
cabb396c83
3 changed files with 64 additions and 8 deletions
|
|
@ -114,7 +114,7 @@ static const unsigned char temp_binary_data_4[] =
|
|||
"\r\n"
|
||||
" void initialise (const juce::String&) override\r\n"
|
||||
" {\r\n"
|
||||
" mainWindow.reset (new MainWindow (\"${JUCE_PIP_NAME}\", new ${JUCE_PIP_MAIN_CLASS}, *this));\r\n"
|
||||
" mainWindow.reset (new MainWindow (\"${JUCE_PIP_NAME}\", std::make_unique<${JUCE_PIP_MAIN_CLASS}>(), *this));\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
" void shutdown() override { mainWindow = nullptr; }\r\n"
|
||||
|
|
@ -123,18 +123,19 @@ static const unsigned char temp_binary_data_4[] =
|
|||
" class MainWindow : public juce::DocumentWindow\r\n"
|
||||
" {\r\n"
|
||||
" public:\r\n"
|
||||
" MainWindow (const juce::String& name, juce::Component* c, JUCEApplication& a)\r\n"
|
||||
" MainWindow (const juce::String& name, std::unique_ptr<juce::Component> c, JUCEApplication& a)\r\n"
|
||||
" : DocumentWindow (name, juce::Desktop::getInstance().getDefaultLookAndFeel()\r\n"
|
||||
" .findColour (ResizableWindow::backgroundColourId),\r\n"
|
||||
" juce::DocumentWindow::allButtons),\r\n"
|
||||
" app (a)\r\n"
|
||||
" {\r\n"
|
||||
" setUsingNativeTitleBar (true);\r\n"
|
||||
" setContentOwned (c, true);\r\n"
|
||||
"\r\n"
|
||||
" #if JUCE_ANDROID || JUCE_IOS\r\n"
|
||||
" setContentOwned (new SafeAreaComponent { std::move (c) }, true);\r\n"
|
||||
" setFullScreen (true);\r\n"
|
||||
" #else\r\n"
|
||||
" setContentOwned (c.release(), true);\r\n"
|
||||
" setResizable (true, false);\r\n"
|
||||
" setResizeLimits (300, 250, 10000, 10000);\r\n"
|
||||
" centreWithSize (getWidth(), getHeight());\r\n"
|
||||
|
|
@ -148,6 +149,33 @@ static const unsigned char temp_binary_data_4[] =
|
|||
" app.systemRequestedQuit();\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
" #if JUCE_ANDROID || JUCE_IOS\r\n"
|
||||
" class SafeAreaComponent : public juce::Component\r\n"
|
||||
" {\r\n"
|
||||
" public:\r\n"
|
||||
" explicit SafeAreaComponent (std::unique_ptr<Component> c)\r\n"
|
||||
" : content (std::move (c))\r\n"
|
||||
" {\r\n"
|
||||
" addAndMakeVisible (*content);\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
" void resized() override\r\n"
|
||||
" {\r\n"
|
||||
" if (const auto* d = Desktop::getInstance().getDisplays().getDisplayForRect (getLocalBounds()))\r\n"
|
||||
" content->setBounds (d->safeAreaInsets.subtractedFrom (getLocalBounds()));\r\n"
|
||||
" }\r\n"
|
||||
"\r\n"
|
||||
" private:\r\n"
|
||||
" std::unique_ptr<Component> content;\r\n"
|
||||
" };\r\n"
|
||||
"\r\n"
|
||||
" void parentSizeChanged() override\r\n"
|
||||
" {\r\n"
|
||||
" if (auto* c = getContentComponent())\r\n"
|
||||
" c->resized();\r\n"
|
||||
" }\r\n"
|
||||
" #endif\r\n"
|
||||
"\r\n"
|
||||
" private:\r\n"
|
||||
" JUCEApplication& app;\r\n"
|
||||
"\r\n"
|
||||
|
|
@ -8988,7 +9016,7 @@ const char* getNamedResource (const char* resourceNameUTF8, int& numBytes)
|
|||
case 0x31d21131: numBytes = 1042; return LaunchScreen_storyboard;
|
||||
case 0x24e5a04d: numBytes = 483; return PIPAudioProcessor_cpp_in;
|
||||
case 0x956e0109: numBytes = 689; return PIPAudioProcessorWithARA_cpp_in;
|
||||
case 0xd572ce5a: numBytes = 2275; return PIPComponent_cpp_in;
|
||||
case 0xd572ce5a: numBytes = 3231; return PIPComponent_cpp_in;
|
||||
case 0x1a77c680: numBytes = 299; return PIPConsole_cpp_in;
|
||||
case 0xa41e649d: numBytes = 2842; return RecentFilesMenuTemplate_nib;
|
||||
case 0x667fbbb3: numBytes = 6424; return UnityPluginGUIScript_cs_in;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ namespace BinaryData
|
|||
const int PIPAudioProcessorWithARA_cpp_inSize = 689;
|
||||
|
||||
extern const char* PIPComponent_cpp_in;
|
||||
const int PIPComponent_cpp_inSize = 2275;
|
||||
const int PIPComponent_cpp_inSize = 3231;
|
||||
|
||||
extern const char* PIPConsole_cpp_in;
|
||||
const int PIPConsole_cpp_inSize = 299;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue