void CCandidateWindow::_BeginUIElement() { BOOL bShow = TRUE; if(!_reg) { _InitList(); } _Update(); if((_hwnd == NULL) && (_depth == 0)) { ITfUIElementMgr *pUIElementMgr; if(_pTextService->_GetThreadMgr()->QueryInterface(IID_PPV_ARGS(&pUIElementMgr)) == S_OK) { pUIElementMgr->BeginUIElement(this, &bShow, &_dwUIElementId); if(!bShow) { pUIElementMgr->UpdateUIElement(_dwUIElementId); } SafeRelease(&pUIElementMgr); } } if(_hwnd == NULL) { _bShow = FALSE; } else { _bShow = bShow; } if(_bShow) { if(_hwnd != NULL) { SetWindowPos(_hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW); if(_reg) { if(_pInputModeWindow != NULL) { _pInputModeWindow->_Show(TRUE); } } if(_depth == 0) { NotifyWinEvent(EVENT_OBJECT_IME_SHOW, _hwnd, OBJID_CLIENT, CHILDID_SELF); } } } }
void TeamsListView::AttachedToWindow() { Inherited::AttachedToWindow(); TeamsColumn::InitTextMargin(ScrollView()); fInterface->GetTargetHost()->AddListener(this); _InitList(); }
void InterfacesListView::AttachedToWindow() { BListView::AttachedToWindow(); _InitList(); start_watching_network( B_WATCH_NETWORK_INTERFACE_CHANGES | B_WATCH_NETWORK_LINK_CHANGES, this); }
void CCandidateWindow::_UpdateComp() { _comp = TRUE; candidates = _pTextService->candidates; candidx = _pTextService->candidx; searchkey = _pTextService->searchkey; _InitList(); _Update(); _UpdateUIElement(); }
void InterfacesListView::AttachedToWindow() { BListView::AttachedToWindow(); _InitList(); start_watching_network( B_WATCH_NETWORK_INTERFACE_CHANGES | B_WATCH_NETWORK_LINK_CHANGES, this); Select(0); // Select the first item in the list }
BOOL KEditDialogImpl::OnInitDialog(CWindow wndFocus, LPARAM lInitParam) { _InitEdit(); _InitList(); m_hIcon = ::LoadIcon(m_hInstance, MAKEINTRESOURCE(ICO_DUBA)); if (m_hIcon != NULL) { SetIcon(m_hIcon); return TRUE; } return FALSE; }
void TeamsListView::_SetInterface(TargetHostInterface* interface) { if (interface == fInterface) return; if (fInterface != NULL) { Clear(); fInterface->GetTargetHost()->RemoveListener(this); } fInterface = interface; if (fInterface == NULL) return; fInterface->GetTargetHost()->AddListener(this); _InitList(); }
void CCandidateWindow::_PrevComp() { UINT uOldPage, uNewPage; GetCurrentPage(&uOldPage); if(_uIndex == 0) { if(_pTextService->cx_stacompmulti && !_pTextService->cx_dyncompmulti) { _InvokeSfHandler(SKK_PREV_COMP); return; } } _InvokeSfHandler(SKK_PREV_COMP); if(_uIndex == 0) { candidx = (size_t)-1; _InitList(); _Update(); _UpdateUIElement(); return; } candidx--; _uIndex--; GetCurrentPage(&uNewPage); _dwFlags = TF_CLUIE_SELECTION; if(uNewPage != uOldPage) { _dwFlags |= TF_CLUIE_CURRENTPAGE; } _Update(); _UpdateUIElement(); }
void CCandidateWindow::_OnKeyDownRegword(UINT uVKey) { WCHAR ch; BYTE sf; _GetChSf(uVKey, ch, sf); //確定していないとき if(!regwordfixed) { _pTextService->showcandlist = FALSE; //候補一覧表示をループさせる _HandleKey((WPARAM)uVKey, SKK_NULL); _Update(); if(_pInputModeWindow != NULL) { _pInputModeWindow->_Redraw(); } return; } if(_pTextService->_IsKeyVoid(ch, (BYTE)uVKey)) { _pTextService->_UpdateLanguageBar(); if(_pInputModeWindow != NULL) { _pInputModeWindow->_Redraw(); } if(sf == SKK_ENTER) { return; } } switch(sf) { case SKK_ENTER: _RestoreStatusReg(); _ClearStatusReg(); regwordfixed = FALSE; regwordul = FALSE; regword = FALSE; //スペースのみのとき空として扱う if(std::regex_match(regwordtext, std::wregex(L"^\\s+$"))) { regwordtext.clear(); } if(regwordtext.empty()) //空のときはキャンセル扱い { regwordtext.clear(); regwordtextpos = 0; if(!_reg) { _InitList(); _uIndex = _PageIndex[_PageIndex.size() - 1]; _Update(); _UpdateUIElement(); if(_pInputModeWindow != NULL) { _pInputModeWindow->_Show(FALSE); } } else { if(_pCandidateWindowParent == NULL) { if(_pTextService->candidates.empty()) { _InvokeSfHandler(SKK_CANCEL); } else { _InvokeSfHandler(SKK_PREV_CAND); } } else { _PreEndReq(); if(_pTextService->candidates.empty()) { _HandleKey(0, SKK_CANCEL); } else { _HandleKey(0, SKK_PREV_CAND); } _EndReq(); } } } else { std::wstring conv; std::wstring candidate; std::wstring annotation; std::wsmatch result; std::wstring okurikey; //候補と注釈を、行頭以外の最後のセミコロンで分割 if(std::regex_search(regwordtext, result, std::wregex(L".+;"))) { candidate = result.str().substr(0, result.str().size() - 1); annotation = result.suffix(); } else { candidate = regwordtext; annotation.clear(); } if(_pTextService->okuriidx != 0) { okurikey = _pTextService->kana.substr(_pTextService->okuriidx + 1); if(okurikey.size() >= 2 && IS_SURROGATE_PAIR(okurikey.c_str()[0], okurikey.c_str()[1])) { okurikey = okurikey.substr(0, 2); } else { okurikey = okurikey.substr(0, 1); } } //候補変換 _pTextService->_ConvertWord(REQ_CONVERTCND, _pTextService->searchkeyorg, candidate, okurikey, conv); if(_pTextService->searchkey.empty() || conv.empty()) { //変換見出し語が空文字列または //変換済み候補が空文字列であれば未変換見出し語を見出し語とする _pTextService->searchkey = _pTextService->searchkeyorg; } if(conv.empty()) { conv = candidate; } _pTextService->candidates.push_back(CANDIDATE (CANDIDATEBASE(conv, annotation), (CANDIDATEBASE(candidate, annotation)))); _pTextService->candidx = _pTextService->candidates.size() - 1; _pTextService->candorgcnt = 0; regwordtext.clear(); regwordtextpos = 0; if(_pCandidateWindowParent == NULL) { _InvokeSfHandler(SKK_ENTER); } else { _PreEndReq(); _HandleKey(0, SKK_ENTER); _EndReq(); } } break; case SKK_CANCEL: _RestoreStatusReg(); _ClearStatusReg(); regwordfixed = FALSE; regwordul = FALSE; regword = FALSE; regwordtext.clear(); regwordtextpos = 0; if(!_reg) { _InitList(); _uIndex = _PageIndex[_PageIndex.size() - 1]; _Update(); _UpdateUIElement(); if(_pInputModeWindow != NULL) { _pInputModeWindow->_Show(FALSE); } } else { if(_pCandidateWindowParent == NULL) { if(_pTextService->candidates.empty()) { _InvokeSfHandler(SKK_CANCEL); } else { _InvokeSfHandler(SKK_PREV_CAND); } } else { _PreEndReq(); if(_pTextService->candidates.empty()) { _HandleKey(0, SKK_CANCEL); } else { _HandleKey(0, SKK_PREV_CAND); } _EndReq(); } } break; case SKK_BACK: if(comptext.empty() && regwordtextpos > 0 && regwordtext.size() > 0) { // surrogate pair if(regwordtext.size() >= 2 && regwordtextpos >= 2 && IS_SURROGATE_PAIR(regwordtext[regwordtextpos - 2], regwordtext[regwordtextpos - 1])) { regwordtextpos -= 2; regwordtext.erase(regwordtext.begin() + regwordtextpos); regwordtext.erase(regwordtext.begin() + regwordtextpos); } else { --regwordtextpos; regwordtext.erase(regwordtext.begin() + regwordtextpos); } _Update(); } break; case SKK_DELETE: if(comptext.empty() && regwordtextpos < regwordtext.size()) { // surrogate pair if(regwordtext.size() >= regwordtextpos + 2 && IS_SURROGATE_PAIR(regwordtext[regwordtextpos + 0], regwordtext[regwordtextpos + 1])) { regwordtext.erase(regwordtext.begin() + regwordtextpos); regwordtext.erase(regwordtext.begin() + regwordtextpos); } else { regwordtext.erase(regwordtext.begin() + regwordtextpos); } _Update(); } break; case SKK_LEFT: if(comptext.empty() && regwordtextpos > 0 && regwordtext.size() > 0) { // surrogate pair if(regwordtext.size() >= 2 && regwordtextpos >= 2 && IS_SURROGATE_PAIR(regwordtext[regwordtextpos - 2], regwordtext[regwordtextpos - 1])) { regwordtextpos -= 2; } else { --regwordtextpos; } _Update(); } break; case SKK_UP: if(comptext.empty()) { regwordtextpos = 0; _Update(); } break; case SKK_RIGHT: if(comptext.empty() && regwordtextpos < regwordtext.size()) { // surrogate pair if(regwordtext.size() >= regwordtextpos + 2 && IS_SURROGATE_PAIR(regwordtext[regwordtextpos + 0], regwordtext[regwordtextpos + 1])) { regwordtextpos += 2; } else { ++regwordtextpos; } _Update(); } break; case SKK_DOWN: if(comptext.empty()) { regwordtextpos = regwordtext.size(); _Update(); } break; case SKK_PASTE: if(IsClipboardFormatAvailable(CF_UNICODETEXT)) { if(OpenClipboard(NULL)) { HANDLE hCB = GetClipboardData(CF_UNICODETEXT); if(hCB != NULL) { LPWSTR pwCB = (LPWSTR)GlobalLock(hCB); if(pwCB != NULL) { std::wstring scb = std::regex_replace(std::wstring(pwCB), std::wregex(L"[\\x00-\\x19]"), std::wstring(L"")); regwordtext.insert(regwordtextpos, scb); regwordtextpos += scb.size(); _Update(); _UpdateUIElement(); GlobalUnlock(hCB); } } CloseClipboard(); } } break; default: _HandleKey((WPARAM)uVKey, SKK_NULL); if(_pInputModeWindow != NULL) { _pInputModeWindow->_Redraw(); } break; } }