OpToolSelect Class Reference

This class is used for Tool Selection. More...

#include <menuops.h>

Inheritance diagram for OpToolSelect:

Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 OpToolSelect ()
 Constructs a new OpToolSelect object: setting default operation flags, and adding it to the Live list.
void Do (OpDescriptor *ToolOp)
 Sets the currently active tool based on the tool OpDescriptor passed in.

Static Public Member Functions

static BOOL Init ()
 Create OpDescriptors for each of the Tools available.
static OpState GetState (String_256 *, OpDescriptor *ToolOp)
 Is called to update the state of tool represented by OpDescriptor.

Detailed Description

This class is used for Tool Selection.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/8/93
See also:
OpToolSelect

Definition at line 453 of file menuops.h.


Constructor & Destructor Documentation

OpToolSelect::OpToolSelect  ) 
 

Constructs a new OpToolSelect object: setting default operation flags, and adding it to the Live list.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/8/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 306 of file menuops.cpp.

00306                           : Operation()
00307 {                 
00308 }


Member Function Documentation

void OpToolSelect::Do OpDescriptor ToolOp  )  [virtual]
 

Sets the currently active tool based on the tool OpDescriptor passed in.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/8/93
Parameters:
OpDescriptor representing a Tool [INPUTS]
Returns:
Errors: None

Reimplemented from Operation.

Definition at line 421 of file menuops.cpp.

00422 {
00423     UINT32 ToolId = ToolOp->GetToolID();
00424 
00425     ENSURE(Tool::Find(ToolId) != NULL, "Tool Id does not exist!");
00426     ToolListItem * pItem = NULL;
00427     pItem = Tool::Find(ToolId);
00428     if(pItem)
00429       pItem->m_pTool->SetCurrent();
00430     
00431     //((Tool::Find(ToolId))->pTool)->SetCurrent();
00432     
00433     End();
00434 }

OpState OpToolSelect::GetState String_256 UIDescription,
OpDescriptor ToolOp
[static]
 

Is called to update the state of tool represented by OpDescriptor.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/8/93
Parameters:
String* pointer to a string description of menu item [INPUTS] OpDescriptor* that describes a Tool
None [OUTPUTS]
Returns:
OpState describing the state of the Tool.

Errors: None

Definition at line 385 of file menuops.cpp.

00386 { 
00387     OpState mState;
00388     
00389     UINT32 ToolId = ToolOp->GetToolID();
00390 
00391     ENSURE(Tool::Find(ToolId) != NULL, "Tool Id does not exist!");
00392         
00393     Tool* thisTool = ((Tool::Find(ToolId))->m_pTool);
00394     
00395     if (thisTool ==((Tool::Find(ToolId))->m_pTool)->GetCurrent())
00396     mState.Ticked = TRUE;
00397     else
00398     mState.Ticked = FALSE;
00399 
00400     mState.Greyed = FALSE;
00401     
00402     return mState; 
00403 }

BOOL OpToolSelect::Init void   )  [static]
 

Create OpDescriptors for each of the Tools available.

Author:
Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/8/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from SimpleCCObject.

Definition at line 326 of file menuops.cpp.

00327 {
00328     // Get the first tool in the tool list
00329     ToolListItem* ToolItem = Tool::GetFirstTool();
00330 
00331     ToolInfo *Info = new ToolInfo;
00332     if (Info == NULL)
00333         return FALSE;
00334 
00335     while (ToolItem != NULL)
00336     {
00337         Tool* ATool = ToolItem->m_pTool;
00338         
00339         //Get Tool Info
00340         Info->BubbleID=0;
00341         ATool->Describe(Info);
00342     
00343     // Set up OpToken
00344     String OpToken;
00345     camSnprintf( OpToken, 16, _T("TOOL%u"), (Info->ID) );
00346     
00347     // Create an instance of the ToolOpDescriptor
00348         ToolOpDescriptor* ToolOp = new ToolOpDescriptor(
00349                                                         Info->ID,
00350                                                         Info->TextID,
00351                                                         CC_RUNTIME_CLASS(OpToolSelect), 
00352                                                         OpToken,
00353                                                         OpToolSelect::GetState,
00354                                                         0,                                              /* Help ID */
00355                                                         Info->BubbleID
00356                                                         );
00357 
00358         ERRORIF(!ToolOp, _R(IDE_NOMORE_MEMORY), FALSE);
00359         
00360         //Get the next item in the tool list
00361         ToolItem = Tool::GetNextTool(ToolItem);
00362     }
00363 
00364     delete Info;
00365 
00366     return TRUE;
00367 }


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