LMMS
Loading...
Searching...
No Matches
juce_SplashScreen.cpp
Go to the documentation of this file.
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29SplashScreen::SplashScreen (const String& title, const Image& image, bool useDropShadow)
30 : Component (title),
33{
34 // You must supply a valid image here!
35 jassert (backgroundImage.isValid());
36
37 setOpaque (! backgroundImage.hasAlphaChannel());
38
39 #if JUCE_IOS || JUCE_ANDROID
40 const bool useFullScreen = true;
41 #else
42 const bool useFullScreen = false;
43 #endif
44
45 makeVisible (image.getWidth(), image.getHeight(), useDropShadow, useFullScreen);
46}
47
48SplashScreen::SplashScreen (const String& title, int width, int height, bool useDropShadow)
49 : Component (title),
51{
52 makeVisible (width, height, useDropShadow, false);
53}
54
55void SplashScreen::makeVisible (int w, int h, bool useDropShadow, bool fullscreen)
56{
57 clickCountToDelete = Desktop::getInstance().getMouseButtonClickCounter();
59
60 const Rectangle<int> screenSize = Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea;
61 const int width = (fullscreen ? screenSize.getWidth() : w);
62 const int height = (fullscreen ? screenSize.getHeight() : h);
63
64 setAlwaysOnTop (true);
65 setVisible (true);
68
69 if (fullscreen)
70 getPeer()->setFullScreen (true);
71
72 toFront (false);
73}
74
76
78{
79 // Note that this method must be safe to call from non-GUI threads
80 if (! removeOnMouseClick)
81 clickCountToDelete = std::numeric_limits<int>::max();
82
84
85 startTimer (50);
86}
87
89{
90 g.setOpacity (1.0f);
92}
93
95{
97 || Desktop::getInstance().getMouseButtonClickCounter() > clickCountToDelete)
98 delete this;
99}
100
101} // namespace juce
void toFront(bool shouldAlsoGainKeyboardFocus)
Definition juce_Component.cpp:954
void setAlwaysOnTop(bool shouldStayOnTop)
Definition juce_Component.cpp:1074
void setOpaque(bool shouldBeOpaque)
Definition juce_Component.cpp:829
Component() noexcept
Definition juce_Component.cpp:517
virtual void addToDesktop(int windowStyleFlags, void *nativeWindowToAttachTo=nullptr)
Definition juce_Component.cpp:658
ComponentPeer * getPeer() const
Definition juce_Component.cpp:801
Rectangle< int > getLocalBounds() const noexcept
Definition juce_Component.cpp:2283
void centreWithSize(int width, int height)
Definition juce_Component.cpp:1290
virtual void setVisible(bool shouldBeVisible)
Definition juce_Component.cpp:575
@ windowHasDropShadow
Definition juce_ComponentPeer.h:66
static Desktop &JUCE_CALLTYPE getInstance()
Definition juce_Desktop.cpp:50
Definition juce_GraphicsContext.h:45
Definition juce_Image.h:58
Definition juce_Rectangle.h:67
ValueType getHeight() const noexcept
Definition juce_Rectangle.h:136
ValueType getWidth() const noexcept
Definition juce_Rectangle.h:133
Definition juce_RectanglePlacement.h:40
@ fillDestination
Definition juce_RectanglePlacement.h:101
Definition juce_RelativeTime.h:37
void timerCallback() override
Definition juce_SplashScreen.cpp:94
Time creationTime
Definition juce_SplashScreen.h:146
Image backgroundImage
Definition juce_SplashScreen.h:145
void paint(Graphics &) override
Definition juce_SplashScreen.cpp:88
void deleteAfterDelay(RelativeTime minimumTotalTimeToDisplayFor, bool removeOnMouseClick)
Definition juce_SplashScreen.cpp:77
SplashScreen(const String &title, const Image &backgroundImage, bool useDropShadow)
Definition juce_SplashScreen.cpp:29
~SplashScreen() override
Definition juce_SplashScreen.cpp:75
int clickCountToDelete
Definition juce_SplashScreen.h:148
void makeVisible(int w, int h, bool shadow, bool fullscreen)
Definition juce_SplashScreen.cpp:55
RelativeTime minimumVisibleTime
Definition juce_SplashScreen.h:147
Definition juce_String.h:53
static Time JUCE_CALLTYPE getCurrentTime() noexcept
Definition juce_Time.cpp:233
void startTimer(int intervalInMilliseconds) noexcept
Definition juce_Timer.cpp:332
UINT_D64 w
Definition inflate.c:942
int g
Definition inflate.c:1573
static const char * title
Definition pugl.h:1747
static double timeout
Definition pugl.h:1799
static int int height
Definition pugl.h:1594
static int width
Definition pugl.h:1593
#define jassert(expression)
Definition carla_juce.cpp:31
@ image
Definition juce_AccessibilityRole.h:42
uch h[RAND_HEAD_LEN]
Definition crypt.c:459