PlugInOpDescriptor Class Reference

New PlugInOpDescriptor class whose purpose in life is to allow an OpDescriptor to be created which instead of using a resource id to get the menu item/operation item text, uses a string resource. This then means we can use the name from the plug-in instead of having to resource all names! More...

#include <plugop.h>

Inheritance diagram for PlugInOpDescriptor:

OpDescriptor MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 PlugInOpDescriptor (const TCHAR *pcszToken, const String_64 &NewMenuText, CCRuntimeClass *pClass=CC_RUNTIME_CLASS(PlugInOp), pfnGetState gs=PlugInOp::GetState)
 Constructs the new PlugInOpDescriptor.
virtual BOOL GetText (String_256 *Description, OpTextFlags WhichText)
 This function will use the TextID and ModuleID values to obtain a String resource describing an operation. String resources may have one or more text descriptions in them, therefore, a TextFlag can be used to identify the the appropriate text required.

Static Public Member Functions

static OpState GetState (String_256 *psName, OpDescriptor *pOpDesc)
 Returns the state that this operation should appear in the menus or as a buttom, for example - greyed out, or ticked.

Protected Attributes

String_64 m_MenuText

Private Member Functions

 CC_DECLARE_DYNAMIC (PlugInOpDescriptor)

Detailed Description

New PlugInOpDescriptor class whose purpose in life is to allow an OpDescriptor to be created which instead of using a resource id to get the menu item/operation item text, uses a string resource. This then means we can use the name from the plug-in instead of having to resource all names!

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/12/96

Definition at line 190 of file plugop.h.


Constructor & Destructor Documentation

PlugInOpDescriptor::PlugInOpDescriptor const TCHAR pcszToken,
const String_64 NewMenuText,
CCRuntimeClass pClass = CC_RUNTIME_CLASS(PlugInOp),
pfnGetState  gs = PlugInOp::GetState
 

Constructs the new PlugInOpDescriptor.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/12/96
Parameters:
pcszToken the "OpToken" (OLE verb?) of the associated Operation [INPUTS] NewMenuText string resource of menu text pClass the runtime class to use, defaults to PlugInOp. gs the GetState function to use
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 140 of file plugop.cpp.

00142   : OpDescriptor(   0,                          // tool ID
00143                     _R(IDS_PHOTOSHOP_PLUGIN),       // String resource ID (use same for all)
00144                     pClass, //CC_RUNTIME_CLASS(PlugInOp),   // Runtime class
00145                     (TCHAR*) pcszToken,         // OpToken
00146                     gs,                         // GetState function
00147                     NULL,                       // help ID
00148                     NULL,                       // bubble help
00149                     NULL,                       // resource ID
00150                     NULL,                       // control ID
00151                     TRUE,                       // Recieve system messages
00152                     FALSE,                      // Smart duplicate operation
00153                     TRUE,                       // Clean operation
00154                     NULL,                       // String for one copy only error
00155                     (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC) // Auto state flags
00156                 )
00157 {
00158     m_MenuText = NewMenuText;
00159 }


Member Function Documentation

PlugInOpDescriptor::CC_DECLARE_DYNAMIC PlugInOpDescriptor   )  [private]
 

OpState PlugInOpDescriptor::GetState String_256 psName,
OpDescriptor pOpDesc
[static]
 

Returns the state that this operation should appear in the menus or as a buttom, for example - greyed out, or ticked.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/12/96
Parameters:
pDesc --- A pointer to a String. GetState fills this with the [INPUTS] appropriate details for the conditions arising eg. why "Previous Zoom" is greyed out. pOpDesc --- A pointer to the OpDescriptor whose state is being queried.
Returns:
An OpState containing the flags that show what is valid.

Definition at line 178 of file plugop.cpp.

00179 {
00180     // At present, this item is always available.
00181     OpState OpSt;
00182     return OpSt;
00183 }

BOOL PlugInOpDescriptor::GetText String_256 Description,
OpTextFlags  WhichText
[virtual]
 

This function will use the TextID and ModuleID values to obtain a String resource describing an operation. String resources may have one or more text descriptions in them, therefore, a TextFlag can be used to identify the the appropriate text required.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/12/96
Parameters:
TextFlag - Identifies which text string to retrieve from the string resource [INPUTS]
Description - Operation description string if it is found or [OUTPUTS] NULL otherwise.
Returns:
TRUE if successfully retrieves the string and FALSE othersise.
See also:
OpDescriptor::GetText

GetDescription

Note: Made virtual by Neville 11/12/96 We do this so that we do not have to store a string with every OpDesciptor. This would be ok if we had dynamic strings but of course we don't. The overhead would be unacceptable. So we use this overriding class instead.

Reimplemented from OpDescriptor.

Definition at line 209 of file plugop.cpp.

00210 {
00211     String_256 ResourceText = m_MenuText; // ( TextID, ModuleID );
00212     // This string should contain various elements for each part of the apply, undo, redo text
00213     // each separated by a semi colon. So we will fake this up in the string using the
00214     // text that we will have set, which is the plug-in name on the menu, for the apply name. 
00215     ResourceText += ";";            // DO NOT internationlise this!
00216     ResourceText += m_MenuText;     // add undo text
00217     ResourceText += ";";            // DO NOT internationlise this!
00218     ResourceText += m_MenuText;     // add redo text
00219 
00220     TCHAR* ok = NULL;
00221 
00222     // The rest is the same as the main OpDescriptor...
00223 
00224     // Explicitly cast return value from GetDescription from a TCHAR* to a String_256
00225     ok = GetDescription((TCHAR*) ResourceText, WhichText);
00226     
00227     // if description is found then return true else return false
00228     if (ok)        
00229     {
00230         *Description = String_256(ok);
00231         return TRUE;
00232     }
00233     else
00234         return FALSE;
00235 } 


Member Data Documentation

String_64 PlugInOpDescriptor::m_MenuText [protected]
 

Definition at line 207 of file plugop.h.


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