BaseNameObjectsDlg Class Reference

Base class UI dialogs which create and rename sets of objects in the Attribute gallery. More...

#include <ngdialog.h>

Inheritance diagram for BaseNameObjectsDlg:

DialogOp Operation MessageHandler ListItem CCObject SimpleCCObject NameObjectsDlg RenameObjectsDlg List of all members.

Protected Member Functions

 BaseNameObjectsDlg (CDlgResID idRes, CDlgMode nMode)
 Create a BaseNameObjectsDlg, an abstract base class for the Name Objects and Rename Objects dialogs.
virtual StringBaseGetDescription (StringBase *pstrDesc)=0
virtual StringBaseGetSuggestion (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

Detailed Description

Base class UI dialogs which create and rename sets of objects in the Attribute gallery.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/6/99
See also:
DialogOp

Definition at line 121 of file ngdialog.h.


Constructor & Destructor Documentation

BaseNameObjectsDlg::BaseNameObjectsDlg CDlgResID  idRes,
CDlgMode  nMode
[protected]
 

Create a BaseNameObjectsDlg, an abstract base class for the Name Objects and Rename Objects dialogs.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/8/99
Parameters:
idRes --- resource ID of the dialog template to use [INPUTS] nMode --- mode to run in, MODAL or MODELESS
See also:
NameObjectsDlg; RenameObjectsDlg

Definition at line 160 of file ngdialog.cpp.

00161   : DialogOp(idRes, nMode)
00162 {   
00163     // Empty.
00164 }        


Member Function Documentation

void BaseNameObjectsDlg::Do OpDescriptor  )  [protected, virtual]
 

Creates and runs a BaseNameObjectsDlg.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/8/99
See also:
NameObjectsDlg; RenameObjectsDlg

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 }

virtual BOOL BaseNameObjectsDlg::DoCommit const StringBase strName  )  [protected, pure virtual]
 

Implemented in NameObjectsDlg, and RenameObjectsDlg.

virtual StringBase* BaseNameObjectsDlg::GetDescription StringBase pstrDesc  )  [protected, pure virtual]
 

Implemented in NameObjectsDlg, and RenameObjectsDlg.

virtual StringBase* BaseNameObjectsDlg::GetSuggestion StringBase pstrDesc  )  [protected, pure virtual]
 

Implemented in NameObjectsDlg, and RenameObjectsDlg.

void BaseNameObjectsDlg::InitGadgetText  )  [private]
 

Initialises the text of the gadgets in the dialog.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/5/99
See also:
BaseNameObjectsDlg::Message

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 }

UINT32 BaseNameObjectsDlg::IsValid const StringBase strName  )  [protected, virtual]
 

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/5/99
Parameters:
strName --- name to test for suitability [INPUTS]
Returns:
0 if valid (by default any non-empty text is valid), or the ID of an error string explaining why if it is not.
See also:
BaseNameObjectsDlg::Message

Reimplemented in NameObjectsDlg.

Definition at line 312 of file ngdialog.cpp.

00313 {
00314     return 0;
00315 }

MsgResult BaseNameObjectsDlg::Message Msg pMessage  )  [protected, virtual]
 

Handles kernel messages for the BaseNameObjectsDlg dialog operation.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/8/99

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 }  


Member Data Documentation

String_256 BaseNameObjectsDlg::m_strSuggest [private]
 

Definition at line 148 of file ngdialog.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:50:58 2007 for Camelot by  doxygen 1.4.4