LMMS
Loading...
Searching...
No Matches
juce_TextButton.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
32
36
37TextButton::TextButton (const String& name, const String& toolTip) : Button (name)
38{
39 setTooltip (toolTip);
40}
41
45
46void TextButton::paintButton (Graphics& g, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown)
47{
48 auto& lf = getLookAndFeel();
49
50 lf.drawButtonBackground (g, *this,
52 shouldDrawButtonAsHighlighted, shouldDrawButtonAsDown);
53
54 lf.drawButtonText (g, *this, shouldDrawButtonAsHighlighted, shouldDrawButtonAsDown);
55}
56
61
66
67void TextButton::changeWidthToFitText (const int newHeight)
68{
69 setSize (getBestWidthForHeight (newHeight), newHeight);
70}
71
73{
74 return getLookAndFeel().getTextButtonWidthToFitText (*this, buttonHeight);
75}
76
77} // namespace juce
bool getToggleState() const noexcept
Definition juce_Button.h:127
Button(const String &buttonName)
Definition juce_Button.cpp:76
void setTooltip(const String &newTooltip) override
Definition juce_Button.cpp:105
int getHeight() const noexcept
Definition juce_Component.h:274
void repaint()
Definition juce_Component.cpp:1917
void setSize(int newWidth, int newHeight)
Definition juce_Component.cpp:1262
Colour findColour(int colourID, bool inheritFromParent=false) const
Definition juce_Component.cpp:2219
LookAndFeel & getLookAndFeel() const noexcept
Definition juce_Component.cpp:2173
Definition juce_GraphicsContext.h:45
Definition juce_String.h:53
TextButton()
Definition juce_TextButton.cpp:29
void changeWidthToFitText()
Definition juce_TextButton.cpp:62
void colourChanged() override
Definition juce_TextButton.cpp:57
int getBestWidthForHeight(int buttonHeight)
Definition juce_TextButton.cpp:72
@ buttonColourId
Definition juce_TextButton.h:73
@ buttonOnColourId
Definition juce_TextButton.h:76
~TextButton() override
Definition juce_TextButton.cpp:42
void paintButton(Graphics &, bool, bool) override
Definition juce_TextButton.cpp:46
int g
Definition inflate.c:1573
static const char * name
Definition pugl.h:1582
Definition carla_juce.cpp:31