LMMS
Loading...
Searching...
No Matches
juce_TableListBox.h
Go to the documentation of this file.
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29//==============================================================================
41{
42public:
43 //==============================================================================
44 TableListBoxModel() = default;
45
47 virtual ~TableListBoxModel() = default;
48
49 //==============================================================================
55 virtual int getNumRows() = 0;
56
66 int rowNumber,
67 int width, int height,
68 bool rowIsSelected) = 0;
69
78 virtual void paintCell (Graphics&,
79 int rowNumber,
80 int columnId,
81 int width, int height,
82 bool rowIsSelected) = 0;
83
84 //==============================================================================
105 virtual Component* refreshComponentForCell (int rowNumber, int columnId, bool isRowSelected,
106 Component* existingComponentToUpdate);
107
108 //==============================================================================
114 virtual void cellClicked (int rowNumber, int columnId, const MouseEvent&);
115
121 virtual void cellDoubleClicked (int rowNumber, int columnId, const MouseEvent&);
122
128 virtual void backgroundClicked (const MouseEvent&);
129
130 //==============================================================================
139 virtual void sortOrderChanged (int newSortColumnId, bool isForwards);
140
141 //==============================================================================
151 virtual int getColumnAutoSizeWidth (int columnId);
152
154 virtual String getCellTooltip (int rowNumber, int columnId);
155
156 //==============================================================================
160 virtual void selectedRowsChanged (int lastRowSelected);
161
165 virtual void deleteKeyPressed (int lastRowSelected);
166
170 virtual void returnKeyPressed (int lastRowSelected);
171
177 virtual void listWasScrolled();
178
188 virtual var getDragSourceDescription (const SparseSet<int>& currentlySelectedRows);
189};
190
191
192//==============================================================================
205 private ListBoxModel,
207{
208public:
209 //==============================================================================
218 TableListBoxModel* model = nullptr);
219
221 ~TableListBox() override;
222
223 //==============================================================================
228 void setModel (TableListBoxModel* newModel);
229
232
233 //==============================================================================
236
242 void setHeader (std::unique_ptr<TableHeaderComponent> newHeader);
243
247 void setHeaderHeight (int newHeight);
248
252 int getHeaderHeight() const noexcept;
253
254 //==============================================================================
262 void autoSizeColumn (int columnId);
263
265 void autoSizeAllColumns();
266
270 void setAutoSizeMenuOptionShown (bool shouldBeShown) noexcept;
271
276
286 Rectangle<int> getCellPosition (int columnId, int rowNumber,
287 bool relativeToComponentTopLeft) const;
288
294 Component* getCellComponent (int columnId, int rowNumber) const;
295
300 void scrollToEnsureColumnIsOnscreen (int columnId);
301
302 //==============================================================================
304 int getNumRows() override;
306 void paintListBoxItem (int, Graphics&, int, int, bool) override;
308 Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate) override;
310 void selectedRowsChanged (int row) override;
312 void deleteKeyPressed (int currentSelectedRow) override;
314 void returnKeyPressed (int currentSelectedRow) override;
316 void backgroundClicked (const MouseEvent&) override;
318 void listWasScrolled() override;
320 void tableColumnsChanged (TableHeaderComponent*) override;
322 void tableColumnsResized (TableHeaderComponent*) override;
324 void tableSortOrderChanged (TableHeaderComponent*) override;
326 void tableColumnDraggingChanged (TableHeaderComponent*, int) override;
328 void resized() override;
329
330private:
331 //==============================================================================
332 class Header;
333 class RowComp;
334
339
340 std::unique_ptr<AccessibilityHandler> createAccessibilityHandler() override;
341 void updateColumnComponents() const;
342
344};
345
346} // namespace juce
#define noexcept
Definition DistrhoDefines.h:72
Definition juce_Component.h:36
String componentName
Definition juce_Component.h:2534
Definition juce_GraphicsContext.h:45
Definition juce_ListBox.h:38
friend class ListBox
Definition juce_ListBox.h:169
Definition juce_MouseEvent.h:39
Definition juce_Rectangle.h:67
Definition juce_SparseSet.h:41
Definition juce_String.h:53
Definition juce_TableHeaderComponent.h:305
Definition juce_TableHeaderComponent.h:47
int columnIdNowBeingDragged
Definition juce_TableListBox.h:337
void setModel(TableListBoxModel *newModel)
Definition juce_TableListBox.cpp:358
std::unique_ptr< AccessibilityHandler > createAccessibilityHandler() override
Definition juce_TableListBox.cpp:547
TableListBoxModel * model
Definition juce_TableListBox.h:336
bool isAutoSizeMenuOptionShown() const noexcept
Definition juce_TableListBox.h:275
TableHeaderComponent * header
Definition juce_TableListBox.h:335
TableListBox(const String &componentName=String(), TableListBoxModel *model=nullptr)
Definition juce_TableListBox.cpp:346
bool autoSizeOptionsShown
Definition juce_TableListBox.h:338
void updateColumnComponents() const
Definition juce_TableListBox.cpp:538
TableHeaderComponent & getHeader() const noexcept
Definition juce_TableListBox.h:235
TableListBoxModel * getModel() const noexcept
Definition juce_TableListBox.h:231
Definition juce_TableListBox.h:41
virtual ~TableListBoxModel()=default
virtual String getCellTooltip(int rowNumber, int columnId)
Definition juce_TableListBox.cpp:608
virtual void paintCell(Graphics &, int rowNumber, int columnId, int width, int height, bool rowIsSelected)=0
virtual int getColumnAutoSizeWidth(int columnId)
Definition juce_TableListBox.cpp:602
virtual var getDragSourceDescription(const SparseSet< int > &currentlySelectedRows)
Definition juce_TableListBox.cpp:609
virtual void cellClicked(int rowNumber, int columnId, const MouseEvent &)
Definition juce_TableListBox.cpp:598
virtual void sortOrderChanged(int newSortColumnId, bool isForwards)
Definition juce_TableListBox.cpp:601
virtual void cellDoubleClicked(int rowNumber, int columnId, const MouseEvent &)
Definition juce_TableListBox.cpp:599
virtual void selectedRowsChanged(int lastRowSelected)
Definition juce_TableListBox.cpp:603
virtual void returnKeyPressed(int lastRowSelected)
Definition juce_TableListBox.cpp:605
virtual void backgroundClicked(const MouseEvent &)
Definition juce_TableListBox.cpp:600
virtual void listWasScrolled()
Definition juce_TableListBox.cpp:606
virtual Component * refreshComponentForCell(int rowNumber, int columnId, bool isRowSelected, Component *existingComponentToUpdate)
Definition juce_TableListBox.cpp:611
virtual void paintRowBackground(Graphics &, int rowNumber, int width, int height, bool rowIsSelected)=0
virtual int getNumRows()=0
virtual void deleteKeyPressed(int lastRowSelected)
Definition juce_TableListBox.cpp:604
Definition juce_Variant.h:42
static int int height
Definition pugl.h:1594
static int width
Definition pugl.h:1593
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
#define JUCE_API
Definition juce_StandardHeader.h:152
Definition carla_juce.cpp:31
#define const
Definition zconf.h:137