MCPcopy Create free account
hub / github.com/EasyIME/PIME / updateCandidates

Method updateCandidates

PIMETextService/PIMETextService.cpp:246–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

244}
245
246void TextService::updateCandidates(Ime::EditSession* session) {
247 createCandidateWindow(session);
248 candidateWindow_->clear();
249
250 // FIXME: is this the right place to do it?
251 if (updateFont_) {
252 // font for candidate and mesasge windows
253 LOGFONT lf;
254 GetObject(font_, sizeof(lf), &lf);
255 ::DeleteObject(font_); // delete old font
256 lf.lfHeight = candFontHeight(); // apply the new size
257 if (!candFontName_.empty()) { // apply new font name
258 wcsncpy(lf.lfFaceName, candFontName_.c_str(), 31);
259 }
260 font_ = CreateFontIndirect(&lf); // create new font
261 // if (messageWindow_)
262 // messageWindow_->setFont(font_);
263 if (candidateWindow_)
264 candidateWindow_->setFont(font_);
265 updateFont_ = false;
266 }
267
268 candidateWindow_->setUseCursor(candUseCursor_);
269 candidateWindow_->setCandPerRow(candPerRow_);
270
271 // the items in the candidate list should not exist the
272 // number of available keys used to select them.
273 assert(candidates_.size() <= selKeys_.size());
274 for (int i = 0; i < candidates_.size(); ++i) {
275 candidateWindow_->add(candidates_[i], selKeys_[i]);
276 }
277 candidateWindow_->recalculateSize();
278 candidateWindow_->refresh();
279
280 RECT textRect;
281 // get the position of composition area from TSF
282 if (selectionRect(session, &textRect)) {
283 // FIXME: where should we put the candidate window?
284 candidateWindow_->move(textRect.left, textRect.bottom);
285 }
286
287 if (validCandidateListElementId_) {
288 auto elementMgr = Ime::ComPtr<ITfUIElementMgr>::queryFrom(threadMgr());
289 if (elementMgr) {
290 elementMgr->UpdateUIElement(candidateListElementId_);
291 }
292 }
293}
294
295void TextService::updateCandidatesWindow(Ime::EditSession* session) {
296 if (candidateWindow_) {

Callers 1

updateCandidateListMethod · 0.80

Calls 8

assertFunction · 0.85
setCandPerRowMethod · 0.80
clearMethod · 0.45
emptyMethod · 0.45
c_strMethod · 0.45
sizeMethod · 0.45
addMethod · 0.45
moveMethod · 0.45

Tested by

no test coverage detected