#include <ngdialog.h>
Inheritance diagram for BaseNameObjectsDlg:
Protected Member Functions | |
BaseNameObjectsDlg (CDlgResID idRes, CDlgMode nMode) | |
Create a BaseNameObjectsDlg, an abstract base class for the Name Objects and Rename Objects dialogs. | |
virtual StringBase * | GetDescription (StringBase *pstrDesc)=0 |
virtual StringBase * | GetSuggestion (StringBase *pstrDesc)=0 |
virtual UINT32 | IsValid (const StringBase &strName) |
virtual BOOL | DoCommit (const StringBase &strName)=0 |
virtual void | Do (OpDescriptor *) |
Creates and runs a BaseNameObjectsDlg. | |
virtual MsgResult | Message (Msg *pMessage) |
Handles kernel messages for the BaseNameObjectsDlg dialog operation. | |
Private Member Functions | |
void | InitGadgetText () |
Initialises the text of the gadgets in the dialog. | |
Private Attributes | |
String_256 | m_strSuggest |
Definition at line 121 of file ngdialog.h.
|
Create a BaseNameObjectsDlg, an abstract base class for the Name Objects and Rename Objects dialogs.
Definition at line 160 of file ngdialog.cpp. 00161 : DialogOp(idRes, nMode) 00162 { 00163 // Empty. 00164 }
|
|
Creates and runs a BaseNameObjectsDlg.
Reimplemented from Operation. Definition at line 178 of file ngdialog.cpp. 00179 { 00180 // Try to run this operation. 00181 if (!Create()) 00182 { 00183 InformError(0, _R(IDS_OK)); 00184 End(); 00185 } 00186 }
|
|
Implemented in NameObjectsDlg, and RenameObjectsDlg. |
|
Implemented in NameObjectsDlg, and RenameObjectsDlg. |
|
Implemented in NameObjectsDlg, and RenameObjectsDlg. |
|
Initialises the text of the gadgets in the dialog.
Definition at line 290 of file ngdialog.cpp. 00291 { 00292 String_256 str; 00293 SetStringGadgetValue(_R(IDC_NAMEDLG_DESC), *GetDescription(&str)); 00294 SetStringGadgetValue(_R(IDC_NAMEDLG_NAME), *GetSuggestion(&m_strSuggest)); 00295 HighlightText(_R(IDC_NAMEDLG_NAME)); 00296 SetKeyboardFocus(_R(IDC_NAMEDLG_NAME)); 00297 }
|
|
Reimplemented in NameObjectsDlg. Definition at line 312 of file ngdialog.cpp.
|
|
Handles kernel messages for the BaseNameObjectsDlg dialog operation.
Reimplemented from DialogOp. Reimplemented in NameObjectsDlg. Definition at line 198 of file ngdialog.cpp. 00199 { 00200 // A message from the dialog or its gadgets? 00201 if (IS_OUR_DIALOG_MSG(pMessage)) 00202 { 00203 DialogMsg* pMsg = (DialogMsg*) pMessage; 00204 switch (pMsg->DlgMsg) 00205 { 00206 case DIM_CREATE: 00207 InitGadgetText(); 00208 break; 00209 00210 case DIM_TEXT_CHANGED: 00211 // Disable the OK/Apply button if there's no document or entered text. 00212 EnableGadget(_R(IDOK), !GetStringGadgetValue(_R(IDC_NAMEDLG_NAME), 0).IsEmpty() 00213 && Document::GetSelected() != 0); 00214 break; 00215 00216 case DIM_COMMIT: 00217 { 00218 // Check name for validity. 00219 String_256 strEnter = GetStringGadgetValue(_R(IDC_NAMEDLG_NAME), 0); 00220 UINT32 nErrID = IsValid(strEnter); 00221 if (nErrID != 0) 00222 { 00223 // Invalid, reinitialise. 00224 InformError(nErrID); 00225 InitGadgetText(); 00226 break; 00227 } 00228 else 00229 // Entry is valid, try committing it. 00230 if (DoCommit(strEnter)) 00231 { 00232 // Don't close, reinitialise (dialog is modeless). 00233 InitGadgetText(); 00234 break; 00235 } 00236 } 00237 00238 case DIM_CANCEL: 00239 Close(); 00240 End(); 00241 break; 00242 00243 default: 00244 break; 00245 } 00246 } 00247 00248 // Or has something changed the object selection? 00249 else if (MESSAGE_IS_A(pMessage, CommonAttrsChangedMsg) || 00250 (MESSAGE_IS_A(pMessage, OpMsg) && 00251 (((OpMsg*) pMessage)->MsgType == OpMsg::AFTER_UNDO || 00252 ((OpMsg*) pMessage)->MsgType == OpMsg::AFTER_REDO))) 00253 { 00254 // Update the description. 00255 String_256 strEnter; 00256 SetStringGadgetValue(_R(IDC_NAMEDLG_DESC), *GetDescription(&strEnter)); 00257 00258 // And if not changed or empty, also the suggestion. 00259 strEnter = GetStringGadgetValue(_R(IDC_NAMEDLG_NAME), 0); 00260 if (strEnter.IsEmpty() || strEnter == m_strSuggest) 00261 { 00262 SetStringGadgetValue(_R(IDC_NAMEDLG_NAME), *GetSuggestion(&m_strSuggest)); 00263 HighlightText(_R(IDC_NAMEDLG_NAME)); 00264 } 00265 } 00266 00267 // Has the document been switched or closed? 00268 else if (MESSAGE_IS_A(pMessage, DocChangingMsg)) 00269 { 00270 DocChangingMsg* pMsg = (DocChangingMsg*) pMessage; 00271 if (pMsg->State == DocChangingMsg::SELCHANGED) 00272 EnableGadget(_R(IDOK), pMsg->pNewDoc != 0); 00273 } 00274 00275 // Pass everything on to the base class . . . 00276 return DialogOp::Message(pMessage); 00277 }
|
|
Definition at line 148 of file ngdialog.h. |