#include <ngprop.h>
Inheritance diagram for NamedTickboxProp:
Public Member Functions | |
INT32 | GetState () const |
Protected Member Functions | |
NamedTickboxProp (const StringBase &strName, INT32 nIndex, INT32 nState=0) | |
Constructs a NamedTickboxProp object. | |
NamedTickboxProp (const NamedTickboxProp &other) | |
Copy constructor. | |
virtual BOOL | HandleMouse (SGNameItem *, SGMouseInfo *, SGMiscInfo *) |
Responds to mouse events according to the state of this NamedTickboxProp. | |
virtual void | CalcUiBounds (SGNameItem *, SGFormatInfo *, SGMiscInfo *, DocRect *) |
virtual BOOL | HandleRedraw (SGNameItem *, SGRedrawInfo *, SGMiscInfo *, const DocRect &) |
Draws the UI for the state of this NamedTickboxProp. | |
virtual BOOL | Write (CXaraFileRecord *pRec) |
Writes out a NamedTickboxProp record. Derived classes should call this before writing their specific data. | |
virtual BOOL | Read (CXaraFileRecord *pRec) |
Reads in a NamedTickboxProp record. Derived classes should call this before reading their specific data. | |
Protected Attributes | |
INT32 | m_nState |
Definition at line 197 of file ngprop.h.
|
Constructs a NamedTickboxProp object.
Definition at line 345 of file ngprop.cpp. 00346 : SGNameProp(strName, nIndex), 00347 m_nState(nState) 00348 { 00349 // Empty. 00350 }
|
|
Copy constructor.
Definition at line 362 of file ngprop.cpp. 00363 : SGNameProp(other.GetName(), other.GetIndex()), 00364 m_nState(other.m_nState) 00365 { 00366 // Empty. 00367 }
|
|
Implements SGNameProp. Reimplemented in NamedStretchProp. Definition at line 387 of file ngprop.cpp. 00389 { 00390 // Tickboxes are 16 pixels wide 00391 pMaxBounds->lo.x = pMaxBounds->hi.x - pMiscInfo->PixelSize * 16; 00392 }
|
|
Definition at line 201 of file ngprop.h. 00202 { return m_nState; }
|
|
Responds to mouse events according to the state of this NamedTickboxProp.
Implements SGNameProp. Reimplemented in NamedStretchProp. Definition at line 433 of file ngprop.cpp. 00434 { 00435 /* 00436 * Commented out by Karim MacDonald 14/12/1999. 00437 * This code performs a check for quickshapes in the named sets being 00438 * ticked off, and asks the user whether to convert them to editable shapes. 00439 * A test like this must ideally be made whenever a new quickshape is added to 00440 * a stretching (target) named set, but not once the user has decided not to change that 00441 * quickshape. 00442 * 00443 00444 BOOL bCancelled = FALSE; 00445 BOOL bMakeShapes = FALSE; 00446 std::list<Node*> lpNodes; 00447 if (!m_nState) 00448 { 00449 // if the user is ticking this set, then we must check whether any new nodes 00450 // have been added to the set since we last were called. if they have, then 00451 // we have to test whether each new node's type is NodeRegularShape or NodeBitmap. 00452 // if the test is positive then we ask the user whether they want to convert these 00453 // new nodes into editable shapes. 00454 00455 // NOTE: currently, we test the types of *all* nodes in the set. 00456 FindBadExtendTypesScan findScan(&lpNodes, pItem); 00457 findScan.Scan(); 00458 if (!lpNodes.empty()) 00459 { 00460 INT32 nResult = InformMessage(_R(IDS_QMS_QUERYMAKESHAPES), 00461 NULL, _R(IDS_QMS_MAKESHAPES), _R(IDS_CANCEL)); 00462 00463 // make editable shapes 00464 switch (nResult) 00465 { 00466 case 1: // first button pressed - 'OK'. 00467 // continue to handle the click. 00468 break; 00469 00470 case 2: // 2nd button pressed - 'Convert'. 00471 // make a note to convert the objects to editable shapes. 00472 bMakeShapes = TRUE; 00473 break; 00474 00475 case 3: // 3rd button pressed - 'Cancel'. 00476 // make a note note to proceed any further. 00477 bCancelled = TRUE; 00478 break; 00479 00480 default: 00481 // we shouldn't get here... 00482 ERROR3("NamedTickboxProp::HandleMouse- Inform message box returned bad result"); 00483 break; 00484 } 00485 } 00486 } 00487 00488 // if the user chose to cancel this operation, we get out here. 00489 if (bCancelled) return TRUE; 00490 */ 00491 00492 // Clone this object and set the new state in the clone. 00493 NamedTickboxProp* pClone = (NamedTickboxProp*) Clone(); 00494 ERRORIF(pClone == 0, _R(IDE_NOMORE_MEMORY), FALSE); 00495 pClone->m_nState = !m_nState; 00496 00497 // Try to run an op to change the property in the tree undoably. 00498 if (!Change(pItem, pClone)) return FALSE; 00499 00500 /* 00501 * Commented out by Karim MacDonald 14/12/1999 00502 * See the above commented out block for more info. 00503 * 00504 // If we were successful, then convert (or don't) the objects into editable shapes. 00505 if (bMakeShapes) 00506 { 00507 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_MAKE_NODES_SHAPES); 00508 ERROR3IF(pOpDesc == 0, "NamedTickboxProp::HandleMouse- can't find OpDescriptor"); 00509 pOpDesc->Invoke(&OpParamMakeNodesShapes(&lpNodes)); 00510 } 00511 */ 00512 00513 // Redraw the item. 00514 pItem->ForceRedrawOfMyself(); 00515 return TRUE; 00516 }
|
|
Draws the UI for the state of this NamedTickboxProp.
Implements SGNameProp. Reimplemented in NamedStretchProp. Definition at line 410 of file ngprop.cpp. 00412 { 00413 UINT32 idBmp = (m_nState) ? _R(IDB_LGAL_TICKON) : _R(IDB_LGAL_TICKOFF); 00414 pRedrawInfo->Renderer->DrawBitmap(drBounds.lo, idBmp); 00415 return TRUE; 00416 }
|
|
Reads in a NamedTickboxProp record. Derived classes should call this before reading their specific data.
Reimplemented from SGNameProp. Reimplemented in NamedSliceProp, and NamedStretchProp. Definition at line 551 of file ngprop.cpp. 00552 { 00553 // Try to read in the base class. 00554 if (!SGNameProp::Read(pRec)) return FALSE; 00555 00556 // Read in the tick box state. 00557 short n; 00558 if (!pRec->ReadINT16(&n)) return FALSE; 00559 m_nState = n; 00560 return TRUE; 00561 }
|
|
Writes out a NamedTickboxProp record. Derived classes should call this before writing their specific data.
Reimplemented from SGNameProp. Reimplemented in NamedSliceProp, and NamedStretchProp. Definition at line 532 of file ngprop.cpp. 00533 { 00534 // Write out the tick box state. 00535 return SGNameProp::Write(pRec) && pRec->WriteINT16((short) GetState()); 00536 }
|
|
|