Inheritance diagram for EditableText::Observer:
Public Member Functions | |
Observer (EditableText *const pContainer) | |
void | Notify (Notifier *const pSender) |
Embedded object catches Notifications (doesn't do anything en ce moment, so don't use Notify. | |
Private Attributes | |
EditableText * | m_pTheTextObject |
Definition at line 283 of file uielem.h.
|
Definition at line 287 of file uielem.h. 00287 : m_pTheTextObject(pContainer){}
|
|
Embedded object catches Notifications (doesn't do anything en ce moment, so don't use Notify.
Implements Notifiable. Definition at line 985 of file uielem.cpp. 00986 { 00987 // This function is a friend of class Text, a pointer 00988 // to which is in the owner field; It's called when the 00989 // String base class changes. Note that we have to turn 00990 // notify off in whichever object is being updated. Otherwise, 00991 // we'll just end up back here. 00992 00993 EditableText* const pText = (EditableText*)(pSender); 00994 if (pText != NULL) 00995 { 00996 // String base class was changed, transfer the new value 00997 // to the display. 00998 TextControl* const pUI = pText->m_pUIElement; 00999 if (pUI != NULL) 01000 { 01001 pUI->NotifyOff(); 01002 pUI->UpdateText(*m_pTheTextObject); // modify the string 01003 pUI->NotifyOn(); 01004 } 01005 } 01006 else // User changed the TextControl, copy new value to 01007 { // the string base class of the associated text object. 01008 01009 TextControl* pUI = (TextControl*)(pSender); 01010 ASSERT(pUI != NULL); 01011 01012 pUI->NotifyOff(); // prevent string from notifying us 01013 pUI->RetrieveText(&m_pTheTextObject->m_String); 01014 pUI->NotifyOn(); // re-enable notification 01015 } 01016 }
|
|
|