mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Minor clean-ups.
This commit is contained in:
parent
5f8069719e
commit
7a3453f48b
32 changed files with 219 additions and 277 deletions
|
|
@ -87,26 +87,27 @@ int TableHeaderComponent::getNumColumns (const bool onlyCountVisibleColumns) con
|
|||
|
||||
return num;
|
||||
}
|
||||
else
|
||||
{
|
||||
return columns.size();
|
||||
}
|
||||
|
||||
return columns.size();
|
||||
}
|
||||
|
||||
String TableHeaderComponent::getColumnName (const int columnId) const
|
||||
{
|
||||
const ColumnInfo* const ci = getInfoForId (columnId);
|
||||
return ci != nullptr ? ci->name : String::empty;
|
||||
if (const ColumnInfo* const ci = getInfoForId (columnId))
|
||||
return ci->name;
|
||||
|
||||
return String::empty;
|
||||
}
|
||||
|
||||
void TableHeaderComponent::setColumnName (const int columnId, const String& newName)
|
||||
{
|
||||
ColumnInfo* const ci = getInfoForId (columnId);
|
||||
|
||||
if (ci != nullptr && ci->name != newName)
|
||||
if (ColumnInfo* const ci = getInfoForId (columnId))
|
||||
{
|
||||
ci->name = newName;
|
||||
sendColumnsChanged();
|
||||
if (ci->name != newName)
|
||||
{
|
||||
ci->name = newName;
|
||||
sendColumnsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -173,8 +174,10 @@ void TableHeaderComponent::moveColumn (const int columnId, int newIndex)
|
|||
|
||||
int TableHeaderComponent::getColumnWidth (const int columnId) const
|
||||
{
|
||||
const ColumnInfo* const ci = getInfoForId (columnId);
|
||||
return ci != nullptr ? ci->width : 0;
|
||||
if (const ColumnInfo* const ci = getInfoForId (columnId))
|
||||
return ci->width;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void TableHeaderComponent::setColumnWidth (const int columnId, const int newWidth)
|
||||
|
|
@ -233,8 +236,10 @@ int TableHeaderComponent::getColumnIdOfIndex (int index, const bool onlyCountVis
|
|||
if (onlyCountVisibleColumns)
|
||||
index = visibleIndexToTotalIndex (index);
|
||||
|
||||
const ColumnInfo* const ci = columns [index];
|
||||
return (ci != nullptr) ? ci->id : 0;
|
||||
if (const ColumnInfo* const ci = columns [index])
|
||||
return ci->id;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Rectangle<int> TableHeaderComponent::getColumnPosition (const int index) const
|
||||
|
|
@ -355,17 +360,18 @@ void TableHeaderComponent::resizeColumnsToFit (int firstColumnIndex, int targetT
|
|||
|
||||
void TableHeaderComponent::setColumnVisible (const int columnId, const bool shouldBeVisible)
|
||||
{
|
||||
ColumnInfo* const ci = getInfoForId (columnId);
|
||||
|
||||
if (ci != nullptr && shouldBeVisible != ci->isVisible())
|
||||
if (ColumnInfo* const ci = getInfoForId (columnId))
|
||||
{
|
||||
if (shouldBeVisible)
|
||||
ci->propertyFlags |= visible;
|
||||
else
|
||||
ci->propertyFlags &= ~visible;
|
||||
if (shouldBeVisible != ci->isVisible())
|
||||
{
|
||||
if (shouldBeVisible)
|
||||
ci->propertyFlags |= visible;
|
||||
else
|
||||
ci->propertyFlags &= ~visible;
|
||||
|
||||
sendColumnsChanged();
|
||||
resized();
|
||||
sendColumnsChanged();
|
||||
resized();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -481,10 +487,9 @@ void TableHeaderComponent::removeListener (Listener* const listenerToRemove)
|
|||
//==============================================================================
|
||||
void TableHeaderComponent::columnClicked (int columnId, const ModifierKeys& mods)
|
||||
{
|
||||
const ColumnInfo* const ci = getInfoForId (columnId);
|
||||
|
||||
if (ci != nullptr && (ci->propertyFlags & sortable) != 0 && ! mods.isPopupMenu())
|
||||
setSortColumnId (columnId, (ci->propertyFlags & sortedForwards) == 0);
|
||||
if (const ColumnInfo* const ci = getInfoForId (columnId))
|
||||
if ((ci->propertyFlags & sortable) != 0 && ! mods.isPopupMenu())
|
||||
setSortColumnId (columnId, (ci->propertyFlags & sortedForwards) == 0);
|
||||
}
|
||||
|
||||
void TableHeaderComponent::addMenuItems (PopupMenu& menu, const int /*columnIdClicked*/)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue