#include <brshname.h>
Inheritance diagram for CNameBrushDlg:
Static Public Member Functions | |
static BOOL | Init () |
Register operation. | |
static OpState | GetState (String_256 *, OpDescriptor *) |
The usual default GetState function for the CNameBrushDlg dialog operation. | |
Protected Member Functions | |
CNameBrushDlg () | |
Constructs a CNameBrushDlg object, a modeless version of the base class dialog, which gets a name for a newly created brush. | |
virtual StringBase * | GetDescription (StringBase *pstrDesc) |
Nothing, at the moment, when I get around to writing some descriptive strings I will add them in here. | |
virtual StringBase * | GetSuggestion (StringBase *pstrDesc) |
Works out a suggestion for the name of the new brush. | |
virtual UINT32 | IsValid (const StringBase &strName) |
virtual BOOL | DoCommit (const StringBase &strName) |
Invokes the op to apply the name to the brush. | |
virtual void | InitGadgetText (String_32 *pString=NULL, BOOL resizeDialog=TRUE) |
Initialises the text of the gadgets in the dialog. | |
Private Member Functions | |
CC_DECLARE_DYNCREATE (CNameBrushDlg) |
Definition at line 168 of file brshname.h.
|
Constructs a CNameBrushDlg object, a modeless version of the base class dialog, which gets a name for a newly created brush.
Definition at line 309 of file brshname.cpp. 00310 : CBaseBrushNameDlg(_R(IDD_BRUSHNAMEDLG), m_bModeless ? MODELESS : MODAL) 00311 { 00312 // Empty. 00313 }
|
|
|
|
Invokes the op to apply the name to the brush.
Implements CBaseBrushNameDlg. Reimplemented in CInitBrushNameDlg. Definition at line 483 of file brshname.cpp. 00484 { 00485 // Apply and (do or do not) close the dialog. 00486 OpDescriptor* pDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_CHANGEBRUSHDEF); 00487 00488 // if we haven't got a brush then error 00489 if (m_BrushHandle == BrushHandle_NoBrush) 00490 { 00491 ERROR3("No brush handle in CNameBrushDlg::DoCommit"); 00492 return FALSE; 00493 } 00494 00495 // our param needs to know the brush handle and new name 00496 ChangeBrushDefOpParam Param; 00497 Param.m_NewBrushName = (String_32)strName; 00498 Param.m_Handle = m_BrushHandle; 00499 Param.ChangeType = CHANGEBRUSH_NAME; 00500 00501 ERROR3IF(pDesc == 0, "CNameBrushDlg::DoCommit: can't find descriptor"); 00502 pDesc->Invoke(&Param); 00503 return m_bModeless; 00504 }
|
|
Nothing, at the moment, when I get around to writing some descriptive strings I will add them in here.
Implements CBaseBrushNameDlg. Definition at line 329 of file brshname.cpp.
|
|
The usual default GetState function for the CNameBrushDlg dialog operation.
Reimplemented in CInitBrushNameDlg. Definition at line 537 of file brshname.cpp. 00538 { 00539 OpState OpSt; 00540 return OpSt; 00541 }
|
|
Works out a suggestion for the name of the new brush.
Implements CBaseBrushNameDlg. Definition at line 421 of file brshname.cpp. 00422 { 00423 ERROR2IF(pstrSuggest == NULL, FALSE, "Null input pointer to CNameBrushDlg::GetSuggestion"); 00424 00425 // get the brush component from the document 00426 Document* pDoc = Document::GetCurrent(); 00427 ERROR2IF(pDoc == NULL, FALSE, "Wheres the document?"); 00428 BrushComponent* pBrushComp = (BrushComponent*)pDoc->GetDocComponent(CC_RUNTIME_CLASS(BrushComponent)); 00429 ERROR2IF(pBrushComp == NULL, FALSE, "No brush component"); 00430 00431 if (!pstrSuggest->IsEmpty()) 00432 *pstrSuggest = pBrushComp->GetUniqueName((String_32*)pstrSuggest); 00433 else 00434 *pstrSuggest = pBrushComp->GetUniqueName(NULL); 00435 00436 return pstrSuggest; 00437 }
|
|
Register operation.
Reimplemented from SimpleCCObject. Reimplemented in CInitBrushNameDlg. Definition at line 516 of file brshname.cpp. 00517 { 00518 return RegisterOpDescriptor(0, 00519 _R(IDS_OK), 00520 CC_RUNTIME_CLASS(CNameBrushDlg), 00521 OPTOKEN_NAME_BRUSH_DLG, 00522 CNameBrushDlg::GetState, 00523 0, // help ID 00524 0); // bubble ID 00525 }
|
|
Initialises the text of the gadgets in the dialog.
Implements CBaseBrushNameDlg. Reimplemented in CInitBrushNameDlg. Definition at line 347 of file brshname.cpp. 00348 { 00349 if (pString != NULL) 00350 m_strSuggest = *pString; 00351 SetStringGadgetValue(_R(IDC_EDITBRUSHNAME), *GetSuggestion(&m_strSuggest)); 00352 HighlightText(_R(IDC_EDITBRUSHNAME)); 00353 SetKeyboardFocus(_R(IDC_EDITBRUSHNAME)); 00354 00355 // change the dialog title to "Enter brush name:" 00356 String_256 Name = TEXT("Enter brush name:"); 00357 SetTitlebarName(&Name); 00358 00359 if (resizeDialog) 00360 { 00361 // what we want to do is shrink the dialog by the size of the label and then hide it 00362 RECT LabelRect; 00363 GetGadgetPosition(_R(IDC_STATICBRUSHGROUP), &LabelRect); 00364 00365 // hide the label 00366 HideGadget(_R(IDC_STATICBRUSHGROUP), TRUE); 00367 00368 // get the size of this dialog 00369 RECT DialogRect; 00370 GetWindowPosition(&DialogRect); 00371 00372 // subtract the size of the label 00373 INT32 Subtract = LabelRect.bottom - LabelRect.top; 00374 DialogRect.bottom -= Subtract; 00375 00376 // We want to move up the buttons 00377 RECT OkRect; 00378 if (GetGadgetPosition(_R(IDOK), &OkRect)) 00379 { 00380 OkRect.top -= Subtract; 00381 OkRect.bottom -= Subtract; 00382 INT32 Width = OkRect.right - OkRect.left; 00383 Width = (Width * 2) / 3; 00384 OkRect.left += Width ; 00385 OkRect.right += Width; 00386 SetGadgetPosition(_R(IDOK), OkRect); 00387 } 00388 00389 RECT CancelRect; 00390 if (GetGadgetPosition(_R(IDCANCEL), &CancelRect)) 00391 { 00392 CancelRect.top -= Subtract; 00393 CancelRect.bottom -= Subtract; 00394 INT32 Width = CancelRect.right - CancelRect.left; 00395 Width = (Width * 2) / 3; 00396 CancelRect.left += Width; 00397 CancelRect.right += Width; 00398 SetGadgetPosition(_R(IDCANCEL), CancelRect); 00399 } 00400 00401 // Reset the window 00402 SetWindowPosition(DialogRect); 00403 00404 // Hide the help button 00405 HideGadget(_R(ID_CC_HELP_BUTTON), TRUE); 00406 } 00407 }
|
|
Reimplemented from CBaseBrushNameDlg. Definition at line 453 of file brshname.cpp. 00454 { 00455 UINT32 NumChars = strName.Length(); 00456 if (NumChars > 20) 00457 return _R(IDS_BRUSHNAME_TOOLONG); 00458 // get the brush component from the document 00459 Document* pDoc = Document::GetCurrent(); 00460 ERROR2IF(pDoc == NULL, FALSE, "Wheres the document?"); 00461 BrushComponent* pBrushComp = (BrushComponent*)pDoc->GetDocComponent(CC_RUNTIME_CLASS(BrushComponent)); 00462 ERROR2IF(pBrushComp == NULL, FALSE, "No brush component"); 00463 00464 if (pBrushComp->NameIsUnique(strName)) 00465 return 0; 00466 00467 return _R(IDS_BRUSHNAME_INVALID); 00468 }
|