void ODSTree :: SetLastID (int32 inst_id ) { GetListControl()->SetLastID(inst_id); }
void ListControlExtendedMultipleSelectStrategy::RecordSelectionStatesInRange(std::size_t index, std::size_t count) { auto list_control = GetListControl(); if (list_control == nullptr) { return; } for (std::size_t current_index = index; current_index != index + count; ++current_index) { if ((current_index < orginally_recorded_index_) || (orginally_recorded_index_ + orginally_recorded_count_ <= current_index)) { bool is_selected = list_control->IsItemSelectedAtIndex(current_index); if (is_selected) { orginally_selected_indexes_.insert(current_index); } } } orginally_recorded_index_ = index; orginally_recorded_count_ = count; auto iterator = orginally_selected_indexes_.begin(); while (iterator != orginally_selected_indexes_.end()) { if ((*iterator < index) || (index + count <= *iterator)) { iterator = orginally_selected_indexes_.erase(iterator); } else { ++iterator; } } }
logical ODSTree :: IsItemExpanded (ItemData *pItemData ) { OListCtl *list_ctl = GetListControl(); return ( list_ctl ? list_ctl->IsItemExpanded(pItemData) : NO ); }
void ListControlExtendedMultipleSelectStrategy::EndChangingSelectionByMouseUp(const Point& position, const MouseMessage& message) { orginally_recorded_index_ = 0; orginally_recorded_count_ = 0; orginally_selected_indexes_.clear(); auto list_control = GetListControl(); if (list_control != nullptr) { list_control->NotifySelectionChange(); } }
logical ODSTree :: BeforeDataFill ( ) { logical term = NO; emit OnBeforeDataFill(&term); if ( !term ) term = GetListControl()->GenerateEvent(DEV_Fill) == YES ? YES : NO; return(term); }
void ListControlExtendedMultipleSelectStrategy::SelectItemsBetweenFocusedAndSpecified(std::size_t index) { std::size_t select_index = 0; std::size_t select_count = 0; MakeSelectionRange(index, focused_index_, select_index, select_count); auto list_control = GetListControl(); if (list_control != nullptr) { list_control->ReplaceSelection(select_index, select_count); list_control->ScrollToItemAtIndex(index); } }
bool ListControlExtendedMultipleSelectStrategy::ChangeSelectionByKeyDown(const KeyMessage& message) { bool is_pressing_shift_key = (GetKeyState(VK_SHIFT) < 0); std::size_t previous_index = InvalidIndex; if (is_pressing_shift_key) { previous_index = last_focused_index_with_shift_key_; } if (previous_index == InvalidIndex) { previous_index = focused_index_; } std::size_t new_index = 0; bool is_changed = ChangeIndexByKeyDown(message, previous_index, new_index); if (! is_changed) { return false; } std::size_t select_range_index = 0; std::size_t select_range_count = 0; if (is_pressing_shift_key) { MakeSelectionRange(focused_index_, new_index, select_range_index, select_range_count); } else { select_range_index = new_index; select_range_count = 1; focused_index_ = new_index; } last_focused_index_with_shift_key_ = new_index; auto list_control = GetListControl(); if (list_control != nullptr) { list_control->ReplaceSelection(select_range_index, select_range_count); list_control->ScrollToItemAtIndex(new_index); list_control->NotifySelectionChange(); } return true; }
void ListControlExtendedMultipleSelectStrategy::SelectItemsByMouseEventWithControlKey(std::size_t current_index, bool is_mouse_moving) { if (! is_mouse_moving) { focused_index_ = current_index; orginally_recorded_index_ = 0; orginally_recorded_count_ = 0; orginally_selected_indexes_.clear(); } std::size_t select_index = 0; std::size_t select_count = 0; MakeSelectionRange(current_index, focused_index_, select_index, select_count); //Recover orginally selection states not in current selection range. RecoverSelectionStatesNotInRange(select_index, select_count); //Record orginally selection states in current selection range. RecordSelectionStatesInRange(select_index, select_count); if (! is_mouse_moving) { is_focused_index_orginally_selected_ = orginally_selected_indexes_.find(current_index) != orginally_selected_indexes_.end(); } auto list_control = GetListControl(); if (list_control != nullptr) { //Add or remove newly selection. if (is_focused_index_orginally_selected_) { list_control->RemoveSelection(select_index, select_count); } else { list_control->AddSelection(select_index, select_count); } list_control->ScrollToItemAtIndex(current_index); } }
void ListControlExtendedMultipleSelectStrategy::RecoverSelectionStatesNotInRange(std::size_t index, std::size_t count) { auto list_control = GetListControl(); if (list_control == nullptr) { return; } for (std::size_t current_index = orginally_recorded_index_; current_index != orginally_recorded_index_ + orginally_recorded_count_; ++current_index) { if ((current_index < index) || (index + count <= current_index)) { if (orginally_selected_indexes_.find(current_index) == orginally_selected_indexes_.end()) { list_control->RemoveSelection(current_index, 1); } else { list_control->AddSelection(current_index, 1); } } } }
void ODSTree :: AfterDataSet ( ) { GetListControl()->GenerateEvent(DEV_AfterDataSet); }
void ODSTree :: AfterDataFill ( ) { GetListControl()->GenerateEvent(DEV_Filled); }
void ODSTree :: SetCurItem (ItemData *pItemData ) { GetListControl()->set_cur_item(pItemData); }
logical ODSTree :: IsCurItem (ItemData *pItemData, logical recursive ) { return ( GetListControl()->IsCurItem(pItemData,recursive) ); }