分类:
2008-10-15 16:39:34
#001 ITextDocument* AutocompleteEdit::GetTextObjectModel() const { |
#002 if (!text_object_model_) { #003 // This is lazily initialized, instead of being initialized in the #004 // constructor, in order to avoid hurting startup performance. |
#005 CComPtr |
#006 ole_interface.Attach(GetOleInterface()); |
#007 text_object_model_ = ole_interface; #008 } #009 return text_object_model_; #010 } |
#001 AutocompleteEdit::ScopedFreeze::ScopedFreeze(AutocompleteEdit* edit, #002 ITextDocument* text_object_model) #003 : edit_(edit), #004 text_object_model_(text_object_model) { #005 // Freeze the screen. #006 if (text_object_model_) { #007 long count; #008 text_object_model_->Freeze(&count); #009 } #010 } #011 #012 AutocompleteEdit::ScopedFreeze::~ScopedFreeze() { #013 // Unfreeze the screen. #014 // NOTE: If this destructor is reached while the edit is being destroyed (for #015 // example, because we double-clicked the edit of a popup and caused it to #016 // transform to an unconstrained window), it will no longer have an HWND, and #017 // text_object_model_ may point to a destroyed object, so do nothing here. #018 if (edit_->IsWindow() && text_object_model_) { #019 long count; #020 text_object_model_->Unfreeze(&count); #021 if (count == 0) { |
#022 // We need to UpdateWindow() here instead of InvalidateRect() because, as #023 // far as I can tell, the edit likes to synchronously erase its background #024 // when unfreezing, thus requiring us to synchronously redraw if we don't #025 // want flicker. #026 edit_->UpdateWindow(); #027 } #028 } #029 } |