1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

added colour ids to LassoComponent

This commit is contained in:
jules 2007-06-13 12:47:46 +00:00
parent 052ac2761e
commit d11e104152
2 changed files with 24 additions and 8 deletions

View file

@ -46,6 +46,7 @@ BEGIN_JUCE_NAMESPACE
#include "../menus/juce_MenuBarComponent.h" #include "../menus/juce_MenuBarComponent.h"
#include "../menus/juce_PopupMenu.h" #include "../menus/juce_PopupMenu.h"
#include "../layout/juce_ScrollBar.h" #include "../layout/juce_ScrollBar.h"
#include "../mouse/juce_LassoComponent.h"
#include "../controls/juce_Slider.h" #include "../controls/juce_Slider.h"
#include "../controls/juce_ListBox.h" #include "../controls/juce_ListBox.h"
#include "../controls/juce_TableHeaderComponent.h" #include "../controls/juce_TableHeaderComponent.h"
@ -153,6 +154,9 @@ LookAndFeel::LookAndFeel()
setColour (FileListComponent::highlightColourId, findColour (TextEditor::highlightColourId)); setColour (FileListComponent::highlightColourId, findColour (TextEditor::highlightColourId));
setColour (FileListComponent::textColourId, Colours::black); setColour (FileListComponent::textColourId, Colours::black);
setColour (0x1000440, /*LassoComponent::lassoFillColourId*/ Colour (0x66dddddd));
setColour (0x1000441, /*LassoComponent::lassoOutlineColourId*/ Colour (0x99111111));
setColour (MidiKeyboardComponent::whiteNoteColourId, Colours::white); setColour (MidiKeyboardComponent::whiteNoteColourId, Colours::white);
setColour (MidiKeyboardComponent::blackNoteColourId, Colours::black); setColour (MidiKeyboardComponent::blackNoteColourId, Colours::black);
setColour (MidiKeyboardComponent::keySeparatorLineColourId, Colours::black.withAlpha (0.4f)); setColour (MidiKeyboardComponent::keySeparatorLineColourId, Colours::black.withAlpha (0.4f));

View file

@ -112,12 +112,8 @@ public:
The fill colour is used to fill the lasso'ed rectangle, and the outline The fill colour is used to fill the lasso'ed rectangle, and the outline
colour is used to draw a line around its edge. colour is used to draw a line around its edge.
*/ */
LassoComponent (const Colour& fillColour_ = Colour (0x66dddddd), LassoComponent (const int outlineThickness_ = 1)
const Colour& outlineColour_ = Colour (0x99111111),
const int outlineThickness_ = 1)
: source (0), : source (0),
fillColour (fillColour_),
outlineColour (outlineColour_),
outlineThickness (outlineThickness_) outlineThickness (outlineThickness_)
{ {
} }
@ -207,13 +203,30 @@ public:
setVisible (false); setVisible (false);
} }
//==============================================================================
/** A set of colour IDs to use to change the colour of various aspects of the label.
These constants can be used either via the Component::setColour(), or LookAndFeel::setColour()
methods.
Note that you can also use the constants from TextEditor::ColourIds to change the
colour of the text editor that is opened when a label is editable.
@see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
*/
enum ColourIds
{
lassoFillColourId = 0x1000440, /**< The colour to fill the lasso rectangle with. */
lassoOutlineColourId = 0x1000441, /**< The colour to draw the outline with. */
};
//============================================================================== //==============================================================================
/** @internal */ /** @internal */
void paint (Graphics& g) void paint (Graphics& g)
{ {
g.fillAll (fillColour); g.fillAll (findColour (lassoFillColourId));
g.setColour (outlineColour);
g.setColour (findColour (lassoOutlineColourId));
g.drawRect (0, 0, getWidth(), getHeight(), outlineThickness); g.drawRect (0, 0, getWidth(), getHeight(), outlineThickness);
// this suggests that you've left a lasso comp lying around after the // this suggests that you've left a lasso comp lying around after the
@ -231,7 +244,6 @@ public:
private: private:
Array <SelectableItemType> originalSelection; Array <SelectableItemType> originalSelection;
LassoSource <SelectableItemType>* source; LassoSource <SelectableItemType>* source;
Colour fillColour, outlineColour;
int outlineThickness; int outlineThickness;
}; };