Add remaining files
[juce-lv2.git] / juce / source / src / gui / components / buttons / juce_ToggleButton.h
blob6806224607c7aa91948abb24a0ca7588417f63df
1 /*
2 ==============================================================================
4 This file is part of the JUCE library - "Jules' Utility Class Extensions"
5 Copyright 2004-11 by Raw Material Software Ltd.
7 ------------------------------------------------------------------------------
9 JUCE can be redistributed and/or modified under the terms of the GNU General
10 Public License (Version 2), as published by the Free Software Foundation.
11 A copy of the license is included in the JUCE distribution, or can be found
12 online at www.gnu.org/licenses.
14 JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 ------------------------------------------------------------------------------
20 To release a closed-source product which uses JUCE, commercial licenses are
21 available: visit www.rawmaterialsoftware.com/juce for more information.
23 ==============================================================================
26 #ifndef __JUCE_TOGGLEBUTTON_JUCEHEADER__
27 #define __JUCE_TOGGLEBUTTON_JUCEHEADER__
29 #include "juce_Button.h"
32 //==============================================================================
33 /**
34 A button that can be toggled on/off.
36 All buttons can be toggle buttons, but this lets you create one of the
37 standard ones which has a tick-box and a text label next to it.
39 @see Button, DrawableButton, TextButton
41 class JUCE_API ToggleButton : public Button
43 public:
44 //==============================================================================
45 /** Creates a ToggleButton.
47 @param buttonText the text to put in the button (the component's name is also
48 initially set to this string, but these can be changed later
49 using the setName() and setButtonText() methods)
51 explicit ToggleButton (const String& buttonText = String::empty);
53 /** Destructor. */
54 ~ToggleButton();
56 //==============================================================================
57 /** Resizes the button to fit neatly around its current text.
59 The button's height won't be affected, only its width.
61 void changeWidthToFitText();
63 //==============================================================================
64 /** A set of colour IDs to use to change the colour of various aspects of the button.
66 These constants can be used either via the Component::setColour(), or LookAndFeel::setColour()
67 methods.
69 @see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
71 enum ColourIds
73 textColourId = 0x1006501 /**< The colour to use for the button's text. */
76 protected:
77 /** @internal */
78 void paintButton (Graphics& g,
79 bool isMouseOverButton,
80 bool isButtonDown);
82 /** @internal */
83 void colourChanged();
85 private:
86 //==============================================================================
87 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ToggleButton);
91 #endif // __JUCE_TOGGLEBUTTON_JUCEHEADER__