NamedTickboxProp Class Reference

Abstract base class for the various kinds of properties associated with SGNameItems that have a UI of a (tri-state) tick-box. More...

#include <ngprop.h>

Inheritance diagram for NamedTickboxProp:

SGNameProp NamedSliceProp NamedStretchProp List of all members.

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

Detailed Description

Abstract base class for the various kinds of properties associated with SGNameItems that have a UI of a (tri-state) tick-box.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/8/99
See also:
SGNameProp; SGNameItem; NameGallery

Definition at line 197 of file ngprop.h.


Constructor & Destructor Documentation

NamedTickboxProp::NamedTickboxProp const StringBase strName,
INT32  nIndex,
INT32  nState = 0
[protected]
 

Constructs a NamedTickboxProp object.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/8/99
Parameters:
nState --- the initial state of the property (default is unticked). [INPUTS]

Definition at line 345 of file ngprop.cpp.

00346   : SGNameProp(strName, nIndex),
00347     m_nState(nState)
00348 {
00349     // Empty.
00350 }

NamedTickboxProp::NamedTickboxProp const NamedTickboxProp other  )  [protected]
 

Copy constructor.

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

Definition at line 362 of file ngprop.cpp.

00363   : SGNameProp(other.GetName(), other.GetIndex()),
00364     m_nState(other.m_nState)
00365 {
00366     // Empty.
00367 }


Member Function Documentation

void NamedTickboxProp::CalcUiBounds SGNameItem ,
SGFormatInfo ,
SGMiscInfo pMiscInfo,
DocRect pMaxBounds
[protected, virtual]
 

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/8/99
Parameters:
(see SGNameItem::CalcUiBounds) [INPUTS] pMaxBounds --- the default size of the property - the whole label. The calculation should increase lo.x to move the left edge of the UI rightwards.
pMaxBounds --- the bounds of this property's UI within its SGNameItem. [OUTPUTS]
See also:
SGNameItem::CalcUiBounds; SGNamedProp

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 }

INT32 NamedTickboxProp::GetState  )  const [inline]
 

Definition at line 201 of file ngprop.h.

00202         { return m_nState; }

BOOL NamedTickboxProp::HandleMouse SGNameItem pItem,
SGMouseInfo ,
SGMiscInfo
[protected, virtual]
 

Responds to mouse events according to the state of this NamedTickboxProp.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/8/99
Parameters:
(see SGNameItem::HandleEvent) [INPUTS]
Returns:
TRUE if successful.
See also:
SGNameItem::HandleEvent; NamedTickboxProp::HandleRedraw

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 }

BOOL NamedTickboxProp::HandleRedraw SGNameItem ,
SGRedrawInfo pRedrawInfo,
SGMiscInfo ,
const DocRect drBounds
[protected, virtual]
 

Draws the UI for the state of this NamedTickboxProp.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/8/99
Parameters:
(see SGNameItem::HandleRedraw) [INPUTS] drBounds --- the bounds to render within
Returns:
TRUE if successful.
See also:
SGNameItem::HandleRedraw; NamedTickboxProp::HandleMouse

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 }

BOOL NamedTickboxProp::Read CXaraFileRecord pRec  )  [protected, virtual]
 

Reads in a NamedTickboxProp record. Derived classes should call this before reading their specific data.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/9/99
Parameters:
pRec --- record to read from [INPUTS]
Returns:
TRUE if the object has successfully read in its record.

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 }

BOOL NamedTickboxProp::Write CXaraFileRecord pRec  )  [protected, virtual]
 

Writes out a NamedTickboxProp record. Derived classes should call this before writing their specific data.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/9/99
Parameters:
pRec --- record to write to [INPUTS]
Returns:
TRUE if the object has successfully written out its record.

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 }


Member Data Documentation

INT32 NamedTickboxProp::m_nState [protected]
 

Definition at line 222 of file ngprop.h.


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