OpGalleryCommand Class Reference

A polymorphic Op which is used for all generic gallery "commands". More...

#include <sgmenu.h>

Inheritance diagram for OpGalleryCommand:

Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

virtual void Do (OpDescriptor *pOpDesc)
 The nudge op's Do() function.

Static Public Member Functions

static BOOL InitPolymorphicCommand (StringBase *OpToken, UINT32 MenuTextID)
 Given a Gallery command OpToken of the form "Gallery name:Command name" this creates a new OpDescriptor for the OpGalleryCommand Op. This in turn will provide an Upcall to the named Gallery containing the given command string, whenever the Op is invoked.
static OpState GetCommandState (String_256 *ShadeReason, OpDescriptor *pOpDesc)
 OpGalleryCommand initialiser method.For finding OpGalleryCommand's state.

Static Protected Member Functions

static SuperGalleryGetGalleryAndCommand (OpDescriptor *pOpDesc, String_32 *Command)
 Given a Gallery command OpDescriptor of the form "Gallery name:Command name" this returns a pointer to the gallery to use and the string "Command name" which is the command that gallery should apply.

Private Member Functions

 CC_DECLARE_DYNCREATE (OpGalleryCommand)

Detailed Description

A polymorphic Op which is used for all generic gallery "commands".

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/9/95
A gallery command is an OpToken along the lines "Colour gallery:DoSomething" where "Colour gallery" is the gallery bar name, and "DoSomething" is a command supported by either the "Colour gallery" bar or the SuperGallery base class.

See also:
SuperGallery::DoMenuCommand; SuperGallery::GetMenuCommandState; SuperGallery::GetMenuCommandName

Definition at line 239 of file sgmenu.h.


Member Function Documentation

OpGalleryCommand::CC_DECLARE_DYNCREATE OpGalleryCommand   )  [private]
 

void OpGalleryCommand::Do OpDescriptor pOpDesc  )  [virtual]
 

The nudge op's Do() function.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/9/95
Parameters:
pOpDesc = ptr to the op descriptor [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from Operation.

Definition at line 362 of file sgmenu.cpp.

00363 {  
00364     String_32 Command;
00365     SuperGallery *ParentGallery = GetGalleryAndCommand(pOpDesc, &Command);
00366 
00367     if (ParentGallery != NULL)
00368         ParentGallery->DoCommand(&Command);
00369 
00370     End();
00371 }

OpState OpGalleryCommand::GetCommandState String_256 UIDescription,
OpDescriptor pOpDesc
[static]
 

OpGalleryCommand initialiser method.For finding OpGalleryCommand's state.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/9/95
Parameters:
UIDescriptoin - ptr to a string to place a description of what went wrong (if it did!) [INPUTS] OpDesc - The OpDescriptor for which we need the state
UIDescription is updated appropriately [OUTPUTS]
Returns:
The state of the OpGalleryCommand operation for the given OpDescriptor

Definition at line 328 of file sgmenu.cpp.

00329 {
00330     String_32 Command;
00331     SuperGallery *ParentGallery = GetGalleryAndCommand(pOpDesc, &Command);
00332 
00333     if (ParentGallery != NULL)
00334         return(ParentGallery->GetCommandState(&Command, UIDescription));
00335 
00336     ERROR3("Attempt to get state for non-existent Gallery command");
00337 
00338     // Return a "safe" shaded state
00339     OpState OpSt;
00340     OpSt.Greyed = TRUE;
00341     *UIDescription = "";
00342     return (OpSt);   
00343 }

SuperGallery * OpGalleryCommand::GetGalleryAndCommand OpDescriptor pOpDesc,
String_32 Command
[static, protected]
 

Given a Gallery command OpDescriptor of the form "Gallery name:Command name" this returns a pointer to the gallery to use and the string "Command name" which is the command that gallery should apply.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/9/95
Parameters:
pOpDesc - The Op Descriptor for the Op [INPUTS]
Command - returned as "" or as the command string from the OpToken [OUTPUTS]
Returns:
NULL if the gallery wasn't found, or a pointer to the SuperGallery which should process the command

Definition at line 251 of file sgmenu.cpp.

00252 {
00253     String_256 Temp = pOpDesc->Token;
00254     TCHAR *Str = (TCHAR *)Temp;
00255 
00256     *Command = TEXT("");
00257 
00258     while (*Str != '\0' && *Str != ':')
00259         Str++;
00260 
00261     if (*Str == '\0')
00262         return(NULL);
00263 
00264     // Copy the right end of the string into Command for return
00265     *Command = (TCHAR *) (Str+1);
00266 
00267     // Find the gallery referenced by the left end of the string
00268     *Str = '\0';        // NULL Terminate the left end of the string
00269 
00270     String_32 Bob;
00271     Temp.Left(&Bob, 31);
00272     SuperGallery* pSuperGallery = SuperGallery::FindSuperGallery(Bob , GalleryBarNameLimitSize);
00273 
00274     if (pSuperGallery != NULL && pSuperGallery->IsKindOf(CC_RUNTIME_CLASS(SuperGallery)))
00275         return((SuperGallery *) pSuperGallery);
00276 
00277     // Not found, or isn't a gallery?! (eep!)
00278     return(NULL);
00279 }

BOOL OpGalleryCommand::InitPolymorphicCommand StringBase OpToken,
UINT32  MenuTextID
[static]
 

Given a Gallery command OpToken of the form "Gallery name:Command name" this creates a new OpDescriptor for the OpGalleryCommand Op. This in turn will provide an Upcall to the named Gallery containing the given command string, whenever the Op is invoked.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/9/95
Parameters:
OpToken - The OpToken for the new Op [INPUTS] This must be of the form "Gallery name:Gallery command" Each portion must be no more than 31 characters long
MenuTextID - A String Resource ID for the menu item text

Returns:
TRUE if it succeeded, FALSE if not enough memory to register the OpDescriptor

Definition at line 208 of file sgmenu.cpp.

00209 {
00210     return(RegisterOpDescriptor(0,                                  // Tool ID 
00211                                 MenuTextID,                         // String resource ID
00212                                 CC_RUNTIME_CLASS(OpGalleryCommand), // Runtime class
00213                                 (TCHAR *) (*OpToken),               // Token string
00214                                 OpGalleryCommand::GetCommandState,  // GetState function
00215                                 0,                                  // help ID
00216                                 0,                                  // bubble help
00217                                 0,                                  // resource ID
00218                                 0,                                  // control ID
00219                                 SYSTEMBAR_ILLEGAL,                  // Bar ID
00220                                 FALSE,                              // Recieve system messages
00221                                 FALSE,                              // Smart duplicate operation
00222                                 TRUE,                               // Clean operation
00223                                 0,                                  // No vertical counterpart
00224                                 0,                                  // String for one copy only error
00225                                 DONT_GREY_WHEN_SELECT_INSIDE        // Auto state flags
00226                                 ));
00227 }


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