Example #1
0
void CreatureAI::Talk(uint8 id, uint64 WhisperGuid, uint32 range)
{
    TextRange _range = TextRange(range);
    if (range == TEXT_RANGE_NORMAL)
        _range = (me->GetMap()->IsDungeon() ? TEXT_RANGE_ZONE : TEXT_RANGE_NORMAL);
    sCreatureTextMgr->SendChat(me, id, WhisperGuid, CHAT_MSG_ADDON, LANG_ADDON, _range);
}
Example #2
0
void ComboBox::DropDownListBoxSelectionChange() {
    
    if (selection_change_action_ == SelectionChangeAction::Nothing) {
        return;
    }

    auto selected_index = drop_down_list_box_->GetFirstSelectedItemIndex();
    if (selected_index != InvalidIndex) {

        auto text = drop_down_list_box_->GetItemTextAtIndex(selected_index);

        if (IsEditable()) {
            auto guard = SetTextChangeAction(TextChangeAction::Nothing);
            edit_text_box_->SetText(text);
            edit_text_box_->SetSelectionRange(TextRange(0, text.length()));
        }

        SetText(text);
        NotifySelectionChange();
    }

    if (selection_change_action_ == SelectionChangeAction::ChangeText) {
        return;
    }

    drop_down_window_->Close();
}
Example #3
0
void ComboBox::EnterKeyDown() {

    if (drop_down_list_box_->GetSelectedItemCount() > 0) {

        //Simulate changing the selection of drop down list box when 
        //pressing ENTER key
        auto guard = SetSelectionChangeAction(SelectionChangeAction::CloseDropDownWindow);
        DropDownListBoxSelectionChange();
    }
    else {

        drop_down_window_->Close();

        if (IsEditable()) {
            edit_text_box_->SetSelectionRange(TextRange(0, std::numeric_limits<std::size_t>::max()));
            NotifySelectionChange();
        }
    }
}