30 class i_item_presentation_model;
125 for (
auto const& part : aSelection)
127 auto const& area = part.second();
128 if (aIndex.row() >= area.topLeft.row() && aIndex.row() <= area.bottomRight.row() &&
129 aIndex.column() >= area.topLeft.column() && aIndex.column() <= area.bottomRight.column())
139 template <
typename Type>
151 iSelection{ nullptr }, iIterator {}
155 iSelection{ &aSelection }, iIterator{ aPosition }
161 if (singular() || aRhs.singular())
163 else if (&selection() != &aRhs.selection())
165 else if (is_end() || aRhs.is_end())
166 return is_end() == aRhs.is_end();
167 else if (iterator() != aRhs.iterator())
170 return index() == aRhs.index();
174 return !(*
this == aRhs);
188 if constexpr (std::is_same_v<Type, row>)
190 index() += item_presentation_model_index{ 1, 0 };
191 if (index().
row() > iIterator->second().bottomRight.row())
194 iIndex = std::nullopt;
197 else if constexpr (std::is_same_v<Type, cell>)
199 index() += item_presentation_model_index{ 0, 1 };
200 if (index().column() > iIterator->second().bottomRight.column())
202 index().set_column(iIterator->second().topLeft.column());
203 index() += item_presentation_model_index{ 1, 0 };
204 if (index().
row() > iIterator->second().bottomRight.row())
207 iIndex = std::nullopt;
214 bool singular()
const
216 return iSelection ==
nullptr;
220 return !singular() && iterator() == selection().
end();
234 item_presentation_model_index
const& index()
const
236 if (iIndex == std::nullopt)
237 iIndex = iterator()->first();
240 item_presentation_model_index& index()
242 return const_cast<item_presentation_model_index&
>(
const_cast<selection_iterator const&
>(*this).index());
247 mutable std::optional<item_presentation_model_index> iIndex;
276 declare_event(current_index_changed,
const optional_item_presentation_model_index& ,
const optional_item_presentation_model_index& )
279 declare_event(presentation_model_changed, i_item_presentation_model&, i_item_presentation_model&)
302 virtual item_presentation_model_index
relative_to_index(item_presentation_model_index
const& aIndex,
index_location aRelativeLocation,
bool aSelectable =
true,
bool aEditable =
false)
const = 0;
303 virtual item_presentation_model_index
next_cell()
const = 0;
304 virtual item_presentation_model_index
next_cell(item_presentation_model_index
const& aIndex)
const = 0;
306 virtual item_presentation_model_index
previous_cell(item_presentation_model_index
const& aIndex)
const = 0;
309 virtual bool is_selected(item_presentation_model_index
const& aIndex)
const = 0;
310 virtual bool is_selectable(item_presentation_model_index
const& aIndex)
const = 0;
318 virtual bool is_editable(item_presentation_model_index
const& aIndex)
const = 0;
327 void select(item_presentation_model_index
const& aIndex)
361 void clear(item_presentation_model_index
const& aIndex)
virtual item_presentation_model_index previous_cell(item_presentation_model_index const &aIndex) const =0
virtual bool has_presentation_model() const =0
virtual void set_mode(item_selection_mode aType)=0
void clear(item_presentation_model_index const &aIndex)
virtual void set_current_index(item_presentation_model_index const &aIndex)=0
virtual item_presentation_model_index relative_to_index(item_presentation_model_index const &aIndex, index_location aRelativeLocation, bool aSelectable=true, bool aEditable=false) const =0
virtual i_item_presentation_model & presentation_model() const =0
virtual ~i_item_selection_model()=default
i_item_selection_model abstract_type
virtual bool is_selected(item_presentation_model_index const &aIndex) const =0
virtual void select(item_model_index const &aIndex, item_selection_operation aOperation)=0
void select(item_model_index const &aIndex)
row_selection_iterator row_begin() const
cell_selection_iterator cell_begin() const
virtual item_presentation_model_index relative_to_current_index(index_location aRelativeLocation, bool aSelectable=true, bool aEditable=false) const =0
virtual item_selection_mode mode() const =0
virtual bool is_editable(item_presentation_model_index const &aIndex) const =0
void clear(item_model_index const &aIndex)
virtual bool is_selectable(item_presentation_model_index const &aIndex) const =0
virtual void select(item_presentation_model_index const &aIndex, item_selection_operation aOperation)=0
virtual bool sorting() const =0
virtual void clear_selection()=0
void select(item_presentation_model_index const &aIndex)
virtual void clear_current_index()=0
virtual item_presentation_model_index next_cell(item_presentation_model_index const &aIndex) const =0
row_selection_iterator row_end() const
cell_selection_iterator begin() const
cell_selection_iterator cell_end() const
optional_item_presentation_model_index current_index_maybe() const
virtual void set_presentation_model(i_item_presentation_model &aModel)=0
virtual bool filtering() const =0
virtual bool has_current_index() const =0
virtual item_presentation_model_index next_cell() const =0
declare_event(current_index_changed, const optional_item_presentation_model_index &, const optional_item_presentation_model_index &) declare_event(selection_changed
virtual const item_selection & selection() const =0
virtual item_presentation_model_index previous_cell() const =0
virtual item_presentation_model_index const & current_index() const =0
cell_selection_iterator end() const
item_presentation_model_index value_type
std::forward_iterator_tag iterator_catagory
pointer operator->() const
selection_iterator(item_selection const &aSelection, item_selection::const_iterator aPosition)
value_type const * pointer
selection_iterator & operator++()
bool operator!=(const selection_iterator &aRhs) const
bool operator==(const selection_iterator &aRhs) const
std::ptrdiff_t difference_type
reference operator*() const
value_type const & reference
const_iterator begin() const
const_iterator end() const
base_type::const_iterator const_iterator
row_selection_iterator row_end(item_selection const &aSelection)
bool contains(item_selection const &aSelection, item_presentation_model_index aIndex)
row_selection_iterator row_begin(item_selection const &aSelection)
constexpr font_style & operator&=(font_style &aLhs, font_style aRhs)
constexpr style_aspect operator&(style_aspect aLhs, style_aspect aRhs)
@ ClearAndSelectRowAsCurrent
audio_channel operator~(audio_channel lhs)
selection_iterator< row > row_selection_iterator
cell_selection_iterator cell_end(item_selection const &aSelection)
constexpr font_style & operator|=(font_style &aLhs, font_style aRhs)
selection_iterator< cell > cell_selection_iterator
cell_selection_iterator cell_begin(item_selection const &aSelection)
constexpr style_aspect operator|(style_aspect aLhs, style_aspect aRhs)
neolib::i_map< item_presentation_model_index, selection_area > item_selection
#define declare_event(declName,...)
item_presentation_model_index bottomRight
item_presentation_model_index topLeft
selection_area abstract_type