CBaseBrushNameDlg Class Reference

Base class for the dialog that is used to name or rename brushes. More...

#include <brshname.h>

Inheritance diagram for CBaseBrushNameDlg:

DialogOp Operation MessageHandler ListItem CCObject SimpleCCObject CNameBrushDlg CInitBrushNameDlg List of all members.

Protected Member Functions

 CBaseBrushNameDlg (CDlgResID idRes, CDlgMode nMode)
 Create a CBaseBrushNameDlg, an abstract base class for the Name name and 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 HandleCancel ()
virtual void Do (OpDescriptor *)
 Creates and runs a CBaseBrushNameDlg. Shouldn't really use this as we will have no definition to name.
virtual void DoWithParam (OpDescriptor *, OpParam *pParam)
 Creates and runs a CBaseBrushNameDlg to get a name for the brush definition included in our param.
virtual MsgResult Message (Msg *pMessage)
 Handles kernel messages for the CBaseBrushNameDlg dialog operation.
virtual void InitGadgetText (String_32 *pString=NULL, BOOL resizeDialog=TRUE)=0

Protected Attributes

BrushHandle m_BrushHandle
String_32 m_strSuggest

Static Private Attributes

static BOOL m_bModeless = FALSE

Detailed Description

Base class for the dialog that is used to name or rename brushes.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/6/2000
See also:
DialogOp

Definition at line 116 of file brshname.h.


Constructor & Destructor Documentation

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

Create a CBaseBrushNameDlg, an abstract base class for the Name name and dialogs.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/6/2000
Parameters:
idRes --- resource ID of the dialog template to use [INPUTS] nMode --- mode to run in, MODAL or MODELESS
See also:
CBrushNameDlg; CRenameBrushDlg

Definition at line 130 of file brshname.cpp.

00131   : DialogOp(idRes, nMode)
00132 {   
00133     m_BrushHandle = BrushHandle_NoBrush;
00134 }        


Member Function Documentation

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

Creates and runs a CBaseBrushNameDlg. Shouldn't really use this as we will have no definition to name.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/6/2000
See also:
CBaseBrushNameDlg; CBaseBrushNameDlg

Reimplemented from Operation.

Definition at line 149 of file brshname.cpp.

00150 {
00151     // Try to run this operation.
00152     if (!Create())
00153     {
00154         InformError(0, _R(IDS_OK));
00155         End();
00156     }
00157     if (m_bModeless == TRUE)
00158         Open();
00159     
00160 }

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

Implemented in CNameBrushDlg, and CInitBrushNameDlg.

void CBaseBrushNameDlg::DoWithParam OpDescriptor pDesc,
OpParam pParam
[protected, virtual]
 

Creates and runs a CBaseBrushNameDlg to get a name for the brush definition included in our param.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/6/2000
See also:
CBaseBrushNameDlg; CBaseBrushNameDlg

Reimplemented from Operation.

Definition at line 172 of file brshname.cpp.

00173 {
00174     if (pParam == NULL)
00175     {
00176         ERROR3("Param is null in CBaseBrushNameDlg::DoWithParam");
00177         return;
00178     }
00179     // first extract the brush handle
00180     m_BrushHandle =  static_cast<BrushHandle> (pParam->Param1);
00181     
00182     // now do it
00183     Do(pDesc);
00184 }

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

Implemented in CNameBrushDlg.

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

Implemented in CNameBrushDlg.

virtual void CBaseBrushNameDlg::HandleCancel  )  [inline, protected, virtual]
 

Reimplemented in CInitBrushNameDlg.

Definition at line 136 of file brshname.h.

00136 {};

virtual void CBaseBrushNameDlg::InitGadgetText String_32 pString = NULL,
BOOL  resizeDialog = TRUE
[protected, pure virtual]
 

Implemented in CNameBrushDlg, and CInitBrushNameDlg.

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

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/6/2000
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:
CBaseBrushNameDlg::Message

Reimplemented in CNameBrushDlg.

Definition at line 288 of file brshname.cpp.

00289 {
00290     return 0;
00291 }

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

Handles kernel messages for the CBaseBrushNameDlg dialog operation.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/6/2000

Reimplemented from DialogOp.

Definition at line 194 of file brshname.cpp.

00195 {
00196     // A message from the dialog or its gadgets?
00197     if (IS_OUR_DIALOG_MSG(pMessage))
00198     {
00199         DialogMsg* pMsg = (DialogMsg*) pMessage;
00200         switch (pMsg->DlgMsg)
00201         {
00202         case DIM_CREATE:
00203             InitGadgetText();
00204             break;
00205 
00206         case DIM_TEXT_CHANGED:
00207             // Disable the OK/Apply button if there's no document or entered text.
00208             EnableGadget(_R(IDOK), !GetStringGadgetValue(_R(IDC_EDITBRUSHNAME), 0).IsEmpty()
00209                             && Document::GetSelected() != 0);
00210             break;
00211 
00212         case DIM_LFT_BN_CLICKED:    // enter messages when the edit box has the focus get cast to this
00213             if (pMsg->GadgetID == _R(ID_CC_HELP_BUTTON))
00214                 break;
00215         case DIM_COMMIT:
00216             {
00217                 // Check name for validity.
00218                 String_256 strEnter = GetStringGadgetValue(_R(IDC_EDITBRUSHNAME), 0);
00219                 UINT32 nErrID = IsValid(strEnter);
00220                 
00221                 if (nErrID != 0)
00222                 {
00223                     // Invalid, reinitialise.
00224                     InformError(nErrID);
00225                     if (nErrID == _R(IDS_BRUSHNAME_INVALID))
00226                     {
00227                         String_32 s(strEnter);
00228                         InitGadgetText(&s, FALSE);
00229                     }
00230                     else
00231                         InitGadgetText(NULL);
00232                     break;
00233                 }
00234                 else
00235                 {
00236                     // Entry is valid, try committing it.
00237                     String_32 FinalString(strEnter);
00238                     if (DoCommit(strEnter))
00239                     {
00240                         // Don't close, reinitialise (dialog is modeless).
00241                         InitGadgetText();
00242                         pMsg->DlgMsg = DIM_NONE; // stop base class closing it
00243                         break;
00244                     }
00245                     else
00246                     {
00247                         // Close();
00248                         // End(); - base class will close
00249                         break;
00250                     }
00251                 }
00252                         
00253             }
00254             break;
00255         case DIM_CANCEL:
00256             HandleCancel(); // base class will close
00257             break;
00258         default:
00259             break;
00260         }
00261     }
00262     
00263 
00264     // Has the document been switched or closed?
00265     else if (MESSAGE_IS_A(pMessage, DocChangingMsg))
00266     {
00267         DocChangingMsg* pMsg = (DocChangingMsg*) pMessage;
00268         if (pMsg->State == DocChangingMsg::SELCHANGED)
00269             EnableGadget(_R(IDOK), pMsg->pNewDoc != 0);
00270     }
00271 
00272     // Pass everything on to the base class . . .
00273     return DialogOp::Message(pMessage);
00274 }  


Member Data Documentation

BOOL CBaseBrushNameDlg::m_bModeless = FALSE [static, private]
 

Definition at line 119 of file brshname.h.

BrushHandle CBaseBrushNameDlg::m_BrushHandle [protected]
 

Definition at line 147 of file brshname.h.

String_32 CBaseBrushNameDlg::m_strSuggest [protected]
 

Definition at line 150 of file brshname.h.


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