Home » Developing U++ » External resources » JUCE (widgets and library) GNU Public Licence
Re: JUCE (widgets and library) GNU Public Licence [message #7405 is a reply to message #7404] |
Wed, 27 December 2006 09:01   |
 |
mirek
Messages: 14267 Registered: November 2005
|
Ultimate Member |
|
|
JUCE code:
class RatingColumnCustomComponent : public Component,
public ComboBoxListener
{
public:
RatingColumnCustomComponent (TableDemoComponent& owner_)
: owner (owner_)
{
// just put a combo box inside this component
addAndMakeVisible (comboBox = new ComboBox (String::empty));
comboBox->addItem (T("fab"), 1);
comboBox->addItem (T("groovy"), 2);
comboBox->addItem (T("hep"), 3);
comboBox->addItem (T("neat"), 4);
comboBox->addItem (T("wild"), 5);
comboBox->addItem (T("swingin"), 6);
comboBox->addItem (T("mad for it"), 7);
// when the combo is changed, we'll get a callback.
comboBox->addListener (this);
comboBox->setWantsKeyboardFocus (false);
}
~RatingColumnCustomComponent()
{
deleteAllChildren();
}
void resized()
{
comboBox->setBoundsInset (BorderSize (2));
}
// Our demo code will call this when we may need to update our contents
void setRowAndColumn (const int newRow, const int newColumn)
{
row = newRow;
columnId = newColumn;
comboBox->setSelectedId (owner.getRating (row, columnId), true);
}
void comboBoxChanged (ComboBox* comboBoxThatHasChanged)
{
owner.setRating (row, columnId, comboBox->getSelectedId());
}
private:
TableDemoComponent& owner;
ComboBox* comboBox;
int row, columnId;
};
Now this has all quirks we are trying to avoid. Why is comboBox allocated on the heap? Why should I test in comboBoxChanged which combobox did? - BTW the only purpose of this class seems to be to isolate particular combobox in the dialog. Why should I take care about "deleting all children" in destructor?
In U++, 50% of above code is unnecessary.
OTOH, of course, MacOS X is something JUCE has and U++ does not - something to add quickly...
|
|
|
 |
|
JUCE (widgets and library) GNU Public Licence
By: fudadmin on Sat, 10 December 2005 17:41
|
 |
|
Re: JUCE (widgets and library) GNU Public Licence
By: captainc on Tue, 26 December 2006 16:54
|
 |
|
Re: JUCE (widgets and library) GNU Public Licence
By: forlano on Tue, 26 December 2006 19:30
|
 |
|
Re: JUCE (widgets and library) GNU Public Licence
|
 |
|
Re: JUCE (widgets and library) GNU Public Licence
By: Ulti on Wed, 27 December 2006 02:58
|
 |
|
Re: JUCE (widgets and library) GNU Public Licence
By: mirek on Wed, 27 December 2006 08:38
|
 |
|
Re: JUCE (widgets and library) GNU Public Licence
By: mirek on Wed, 27 December 2006 09:01
|
 |
|
Re: JUCE (widgets and library) GNU Public Licence
By: cdoty on Sun, 27 April 2008 00:18
|
 |
|
Re: JUCE (widgets and library) GNU Public Licence
By: mirek on Sun, 27 April 2008 09:24
|
 |
|
Re: JUCE (widgets and library) GNU Public Licence
|
 |
|
Re: JUCE (widgets and library) GNU Public Licence
By: mrjt on Mon, 28 April 2008 01:13
|
 |
|
Re: JUCE (widgets and library) GNU Public Licence
By: mirek on Mon, 28 April 2008 09:29
|
 |
|
Re: JUCE (widgets and library) GNU Public Licence
By: cdoty on Tue, 29 April 2008 04:28
|
Goto Forum:
Current Time: Thu Aug 14 03:51:35 CEST 2025
Total time taken to generate the page: 0.08293 seconds
|