Hot Door CORE 0.8.2
Adobe® Illustrator® Plug-in Library
Loading...
Searching...
No Matches
hdicoreColumnView.h
Go to the documentation of this file.
1
7#ifndef __HDI_CORE_COLUMN_VIEW__
8#define __HDI_CORE_COLUMN_VIEW__
9
10#include <vector>
11
12#include "hdicoreMacros.h"
13
14#include "hdicoreWidget.h"
15
16namespace hdi
17{
18 namespace core
19 {
20 class Callback;
21 class ColumnEntry;
22
26 class ColumnView : public Widget
27 {
28 public:
29 typedef std::vector<ColumnEntry> EntryVector;
30 typedef std::vector<std::string> ColumnNameVector;
31 typedef std::vector<double> ColumnWidthVector;
32
45
53 ColumnView(const ColumnView& colView_);
54
63 ColumnView(const Rect& frame_, const uint16_t numCols_);
64
73 ColumnView(const Rect& frame_, const ColumnNameVector& colNames_);
74
86 const Rect& frame_,
87 const uint16_t numCols_,
88 const EntryVector& entries_,
89 const int32_t index_
90 );
91
103 const Rect& frame_,
104 const ColumnNameVector& colNames_,
105 const EntryVector& entries_,
106 const int32_t index_
107 );
108
121 const Rect& frame_,
122 const uint16_t numCols_,
123 const EntryVector& entries_,
124 const std::string& initialID_
125 );
126
139 const Rect& frame_,
140 const ColumnNameVector& colNames_,
141 const EntryVector& entries_,
142 const std::string& initialID_
143 );
144
153 virtual ColumnView& operator=(const ColumnView& rhs_);
154
160 virtual ~ColumnView();
161
175 virtual ColumnView* clone() const;
176
192 virtual ColumnView* duplicate() const;
193
199 virtual void deselectAll();
200
208 virtual std::string text() const;
209
219 virtual void setText(const std::string&);
220
228 virtual int32_t currentIndex() const;
229
238 virtual bool setCurrentIndex(const int32_t index_);
239
247 virtual std::string currentID() const;
248
257 virtual bool setCurrentID(const std::string& id_);
258
266 virtual std::unique_ptr<ColumnEntry> currentEntry() const;
267
278 virtual const std::vector< std::shared_ptr<ColumnEntry> >* const entries() const;
279
288 virtual bool hasEntry(const std::string& id_) const;
289
298 virtual std::shared_ptr<ColumnEntry> entryWithID(const std::string& id_) const;
299
307 virtual void setEntries(const EntryVector& entries_);
308
319 virtual bool pushEntry(const ColumnEntry& entry_);
320
330 virtual bool popEntry(ColumnEntry& entry__);
331
346 virtual bool insertEntry(const std::string& id_, const ColumnEntry& entry_);
347
358 virtual bool removeEntry(const std::string& id_, ColumnEntry& entry__);
359
375 virtual bool reorderEntry(const std::string& targetID_, const std::string& positionID_);
376
382 virtual void clearEntries();
383
391 virtual bool hasHeader() const;
392
400 virtual uint16_t columnCount() const;
401
412 virtual ColumnNameVector columnNames() const;
413
421 virtual ColumnWidthVector columnWidths() const;
422
430 virtual void setColumnWidths(const ColumnWidthVector& widths_);
431
439 virtual bool columnWidthsLocked() const;
440
448 virtual void setColumnWidthsLocked(const bool locked_);
449
455 virtual void valueChanged();
456
466 virtual Callback* const valueChangedCallback() const;
467
477 virtual void setValueChangedCallback(const Callback& callback_);
478
484 virtual void update();
485
493 virtual Callback* const cellClickCallback() const;
494
505 virtual void setCellClickCallback(const Callback& callback_);
506
517 virtual std::unique_ptr<ColumnEntry> clickedEntry() const;
518
529 virtual int32_t clickedColumnIndex() const;
530
538 virtual Callback* const cellChangedCallback() const;
539
550 virtual void setCellChangedCallback(const Callback& callback_);
551
562 virtual std::unique_ptr<ColumnEntry> changedEntry() const;
563
574 virtual int32_t changedColumnIndex() const;
575
583 virtual bool reorderable() const;
584
592 virtual void setReorderable(const bool enable_);
593
601 virtual Callback* const potentialReorderCallback() const;
602
614 virtual void setPotentialReorderCallback(const Callback& callback_);
615
626 virtual std::vector<std::string> potentialReorderSource() const;
627
640 virtual std::vector<std::string> potentialReorderPosition() const;
641
653 virtual bool potentialReorderGood() const;
654
673 virtual void setPotentialReorderGood(const bool good_);
674
682 virtual Callback* const reorderCallback() const;
683
694 virtual void setReorderCallback(const Callback& callback_);
695
706 virtual std::vector<std::string> reorderSource() const;
707
720 virtual std::vector<std::string> reorderPosition() const;
721 };
722
723 typedef std::unique_ptr<ColumnView> ColumnViewUP;
724 typedef std::shared_ptr<ColumnView> ColumnViewSP;
725 typedef std::weak_ptr<ColumnView> ColumnViewWP;
726 }
727}
728
729#endif
730// __HDI_CORE_COLUMN_VIEW__
Base class for templated __Callback class.
Definition: hdicoreCallback.h:68
Allows column views to store more data than simply strings and indices.
Definition: hdicoreColumnEntry.h:30
Column view widget, much like a list view but allowing for entries with multiple columns.
Definition: hdicoreColumnView.h:27
virtual ColumnWidthVector columnWidths() const
Gets the widths of each column in the view.
virtual Callback *const reorderCallback() const
Gets the current reorder callback for the widget.
virtual ColumnNameVector columnNames() const
Gets the column names vector.
virtual void setPotentialReorderCallback(const Callback &callback_)
Sets the potential-reorder callback for the widget.
virtual std::vector< std::string > reorderPosition() const
Gets the position for the reorder, i.e. the entry just before the reposition.
virtual bool setCurrentID(const std::string &id_)
Sets the currently selected entry by ID.
virtual int32_t changedColumnIndex() const
Gets the column index of the cell in the entry that was last modified.
virtual Callback *const valueChangedCallback() const
Gets the value changed callback for the column view.
virtual void setColumnWidthsLocked(const bool locked_)
Sets whether the column widths are locked (i.e. the user cannot change them)
virtual int32_t currentIndex() const
Gets the index of the currently selected entry.
virtual bool hasEntry(const std::string &id_) const
Gets whether the entries vector already contains an entry, based on its ID.
virtual bool reorderEntry(const std::string &targetID_, const std::string &positionID_)
Reorders a target entry (based on ID) to be newly located just after another existing entry in the li...
ColumnView(const Rect &frame_, const ColumnNameVector &colNames_, const EntryVector &entries_, const std::string &initialID_)
Constructor for a column view with an initial ID selected.
virtual void deselectAll()
Deselects all currently selected entries in the list.
ColumnView(const Rect &frame_, const ColumnNameVector &colNames_, const EntryVector &entries_, const int32_t index_)
Constructs a column view.
virtual bool pushEntry(const ColumnEntry &entry_)
Pushes an entry onto the list (i.e. at the end)
ColumnView(const ColumnView &colView_)
Constructs a new ColumnView object from an existing ColumnView object (copy constructor)
virtual void setValueChangedCallback(const Callback &callback_)
Sets the value changed callback.
virtual std::unique_ptr< ColumnEntry > clickedEntry() const
Gets the entry of the cell that was last clicked.
virtual std::unique_ptr< ColumnEntry > changedEntry() const
Gets the entry that was last modified via double-click inline editing.
virtual bool columnWidthsLocked() const
Gets whether the column widths are locked (i.e. the user cannot change them)
virtual ColumnView * duplicate() const
Convenience method to duplicate a ColumnView object, creating a new and identical UI element to the t...
virtual void setText(const std::string &)
Does nothing.
virtual bool potentialReorderGood() const
Gets whether the potential reorder is acceptable; if not, the drag cursor will indicate the proposed ...
virtual ColumnView * clone() const
Convenience method to clone a ColumnView object on the heap.
virtual bool hasHeader() const
Gets whether the widget has a header component to show the names of the columns.
virtual void clearEntries()
Clears all entries contained by the widget.
virtual void update()
Force the column view to update its entries.
virtual std::vector< std::string > reorderSource() const
Gets the source item involved in the reorder, i.e. the entry being dropped.
virtual bool reorderable() const
Gets whether reordering support for the list is enabled.
virtual void valueChanged()
Simulates the column view having its value changed.
virtual void setReorderCallback(const Callback &callback_)
Sets the reorder callback for the widget.
virtual bool removeEntry(const std::string &id_, ColumnEntry &entry__)
Removes a specific entry from the list of entries.
virtual std::string text() const
Gets the current text value of the list.
ColumnView(const Rect &frame_, const uint16_t numCols_, const EntryVector &entries_, const int32_t index_)
Constructs a column view.
virtual std::vector< std::string > potentialReorderPosition() const
Gets the position for the reorder, i.e. the entry just before the proposed reposition.
ColumnView(const Rect &frame_, const uint16_t numCols_)
Constructs a column view with a frame only, no contents.
virtual void setCellClickCallback(const Callback &callback_)
Sets/updates the callback for when a cell is clicked.
virtual std::shared_ptr< ColumnEntry > entryWithID(const std::string &id_) const
Gets the entry with the given ID, provided it exists within the widget.
virtual void setEntries(const EntryVector &entries_)
Allows the entries in a column view to be changed out entirely.
ColumnView()
Constructs an empty ColumnView object.
virtual Callback *const cellClickCallback() const
Gets the callback set for when a cell is clicked.
virtual Callback *const potentialReorderCallback() const
Gets the current potential-reorder callback for the list.
ColumnView(const Rect &frame_, const uint16_t numCols_, const EntryVector &entries_, const std::string &initialID_)
Constructor for a column view with an initial ID selected.
virtual int32_t clickedColumnIndex() const
Gets the column index of the cell in the entry that was last clicked.
virtual void setPotentialReorderGood(const bool good_)
Sets whether the potential reorder is acceptable; if not, the drag cursor will indicate the proposed ...
virtual const std::vector< std::shared_ptr< ColumnEntry > > *const entries() const
Gets the entries vector.
virtual bool setCurrentIndex(const int32_t index_)
Sets the currently selected entry by index.
virtual std::string currentID() const
Gets the ID of the currently selected entry.
virtual std::vector< std::string > potentialReorderSource() const
Gets the source item involved in the potential reorder, i.e. the entry being dragged.
virtual void setReorderable(const bool enable_)
Sets whether reordering support for the list is enabled.
virtual ColumnView & operator=(const ColumnView &rhs_)
Allows one ColumnView object to be assigned from another.
ColumnView(const Rect &frame_, const ColumnNameVector &colNames_)
Constructs a column view with a frame only, no contents.
virtual std::unique_ptr< ColumnEntry > currentEntry() const
Gets the current entry object.
virtual void setColumnWidths(const ColumnWidthVector &widths_)
Sets the widths of each column in the view.
virtual uint16_t columnCount() const
Gets the number of columns in the widget.
virtual Callback *const cellChangedCallback() const
Gets the callback for when a cell is modified via double-click inline editing.
virtual void setCellChangedCallback(const Callback &callback_)
Sets the callback for when a cell is modified via double-click inline editing.
virtual bool popEntry(ColumnEntry &entry__)
Pops an entry off the list (i.e. from the end)
virtual bool insertEntry(const std::string &id_, const ColumnEntry &entry_)
Inserts an entry into the list of entries at a given position.
virtual ~ColumnView()
ColumnView destructor.
Contains Point and Size objects to describe a rectangle that exists at a specific point of given dime...
Definition: hdicoreRect.h:34
Base class for all interface widgets; handles many common needs, e.g. text, position,...
Definition: hdicoreWidget.h:30
Header file for a variety of plugin convenience macros.
Header file for plugin user interface widgets.