delete classes that weren't meant to exist any more
This commit is contained in:
parent
ea10d012ff
commit
c708fd5914
4
Builds/MacOSX/.gitignore
vendored
Normal file
4
Builds/MacOSX/.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
*.xcodeproj/project.xcworkspace/
|
||||
*.xcodeproj/xcuserdata/
|
||||
build/
|
||||
.idea
|
File diff suppressed because it is too large
Load Diff
|
@ -1,17 +0,0 @@
|
|||
//
|
||||
// Created by Alex Birch on 01/10/2017.
|
||||
//
|
||||
|
||||
#include "Pill.h"
|
||||
|
||||
Pill::Pill(
|
||||
const String& buttonName,
|
||||
const int index,
|
||||
const int lastIx
|
||||
) : TextButton(buttonName) {
|
||||
setBounds(20 + index * 55, 260, 55, 24);
|
||||
setConnectedEdges (
|
||||
(index == 0 ? 0 : Button::ConnectedOnLeft)
|
||||
| (index == lastIx ? 0 : Button::ConnectedOnRight)
|
||||
);
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
//
|
||||
// Created by Alex Birch on 01/10/2017.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../JuceLibraryCode/JuceHeader.h"
|
||||
|
||||
class Pill : public TextButton {
|
||||
public:
|
||||
explicit Pill(
|
||||
const String& buttonName,
|
||||
const int index,
|
||||
const int lastIx
|
||||
);
|
||||
|
||||
private:
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Pill)
|
||||
};
|
|
@ -1,88 +0,0 @@
|
|||
//
|
||||
// Created by Alex Birch on 17/09/2017.
|
||||
//
|
||||
|
||||
#include "TableModel.h"
|
||||
|
||||
// This is overloaded from TableListBoxModel, and must return the total number of rows in our table
|
||||
int TableModel::getNumRows()
|
||||
{
|
||||
return static_cast<int>(dataList.size());
|
||||
}
|
||||
|
||||
// This is overloaded from TableListBoxModel, and should fill in the background of the whole row
|
||||
void TableModel::paintRowBackground (
|
||||
Graphics& g,
|
||||
int rowNumber,
|
||||
int /*width*/,
|
||||
int /*height*/,
|
||||
bool rowIsSelected
|
||||
) {
|
||||
const Colour alternateColour (getLookAndFeel().findColour (ListBox::backgroundColourId)
|
||||
.interpolatedWith (getLookAndFeel().findColour (ListBox::textColourId), 0.03f));
|
||||
if (rowIsSelected)
|
||||
g.fillAll (Colours::lightblue);
|
||||
else if (rowNumber % 2)
|
||||
g.fillAll (alternateColour);
|
||||
}
|
||||
|
||||
// This is overloaded from TableListBoxModel, and must paint any cells that aren't using custom
|
||||
// components.
|
||||
void TableModel::paintCell (
|
||||
Graphics& g,
|
||||
int rowNumber,
|
||||
int columnId,
|
||||
int width,
|
||||
int height,
|
||||
bool /*rowIsSelected*/
|
||||
) {
|
||||
g.setColour (getLookAndFeel().findColour (ListBox::textColourId));
|
||||
g.setFont (font);
|
||||
|
||||
if (const XmlElement* rowElement = dataList->getChildElement (rowNumber))
|
||||
{
|
||||
const String text (rowElement->getStringAttribute (getAttributeNameForColumnId (columnId)));
|
||||
|
||||
g.drawText (text, 2, 0, width - 4, height, Justification::centredLeft, true);
|
||||
}
|
||||
|
||||
g.setColour (getLookAndFeel().findColour (ListBox::backgroundColourId));
|
||||
g.fillRect (width - 1, 0, 1, height);
|
||||
}
|
||||
|
||||
// This is overloaded from TableListBoxModel, and tells us that the user has clicked a table header
|
||||
// to change the sort order.
|
||||
void TableModel::sortOrderChanged (
|
||||
int newSortColumnId,
|
||||
bool isForwards
|
||||
) {
|
||||
if (newSortColumnId != 0)
|
||||
{
|
||||
TableModel::DataSorter sorter (getAttributeNameForColumnId (newSortColumnId), isForwards);
|
||||
dataList->sortChildElements (sorter);
|
||||
|
||||
table.updateContent();
|
||||
}
|
||||
}
|
||||
|
||||
// This is overloaded from TableListBoxModel, and should choose the best width for the specified
|
||||
// column.
|
||||
int TableModel::getColumnAutoSizeWidth (int columnId) {
|
||||
if (columnId == 5)
|
||||
return 100; // (this is the ratings column, containing a custom combobox component)
|
||||
|
||||
int widest = 32;
|
||||
|
||||
// find the widest bit of text in this column..
|
||||
for (int i = getNumRows(); --i >= 0;)
|
||||
{
|
||||
if (const XmlElement* rowElement = dataList->getChildElement (i))
|
||||
{
|
||||
const String text (rowElement->getStringAttribute (getAttributeNameForColumnId (columnId)));
|
||||
|
||||
widest = jmax (widest, font.getStringWidth (text));
|
||||
}
|
||||
}
|
||||
|
||||
return widest + 8;
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
//
|
||||
// Created by Alex Birch on 17/09/2017.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../JuceLibraryCode/JuceHeader.h"
|
||||
|
||||
|
||||
class TableModel: public TableListBoxModel {
|
||||
public:
|
||||
int getNumRows() override;
|
||||
|
||||
void paintRowBackground (
|
||||
Graphics& g,
|
||||
int rowNumber,
|
||||
int width,
|
||||
int height,
|
||||
bool rowIsSelected
|
||||
) override;
|
||||
void paintCell (
|
||||
Graphics& g,
|
||||
int rowNumber,
|
||||
int columnId,
|
||||
int width,
|
||||
int height,
|
||||
bool rowIsSelected
|
||||
) override;
|
||||
|
||||
void sortOrderChanged (int newSortColumnId, bool isForwards) override;
|
||||
|
||||
int getColumnAutoSizeWidth (int columnId) override;
|
||||
|
||||
private:
|
||||
ScopedPointer<XmlElement> demoData; // This is the XML document loaded from the embedded file "demo table data.xml"
|
||||
std::vector<String> columnList;
|
||||
std::vector<std::vector<String>> dataList;
|
||||
|
||||
void loadData();
|
||||
String getAttributeNameForColumnId (const int columnId) const;
|
||||
|
||||
// A comparator used to sort our data when the user clicks a column header
|
||||
class DataSorter {
|
||||
public:
|
||||
DataSorter (
|
||||
const String& attributeToSortBy,
|
||||
bool forwards
|
||||
);
|
||||
|
||||
int compareElements (
|
||||
XmlElement* first,
|
||||
XmlElement* second
|
||||
) const;
|
||||
|
||||
private:
|
||||
String attributeToSort;
|
||||
int direction;
|
||||
};
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (TableModel)
|
||||
};
|
Loading…
Reference in New Issue
Block a user