opdesc.h

Go to the documentation of this file.
00001 // $Id: opdesc.h 1261 2006-06-06 11:58:26Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 // OpDescriptor allows camelot to maintain a list of all the operations 
00099 // which can be performed
00100 
00101 
00102 #ifndef INC_OPDESC
00103 #define INC_OPDESC
00104 
00105 #include "listitem.h"
00106 #include "list.h"
00107 #include "pump.h"
00108 #include "msg.h"
00109 
00110 // AutoStateFlags (parameter to OpDescriptor's constructor)
00111 // These flags are used to specify when the Operation should automatically be greyed, ticked etc.
00112 // they cut down the number of tests that need to be made in the GetState fn
00113 // Format <What happens>_WHEN_<Condition>
00114 // <What happens> -> GREY | TICKED
00115 
00116 #define GREY_WHEN_NO_CURRENT_DOC 1    // Document::GetCurrent == NULL
00117 #define GREY_WHEN_NO_SELECTION   2    // There are no selected objects
00118 #define DONT_GREY_WHEN_SELECT_INSIDE 4
00119 // Add others here
00120 
00121 class OpParam;
00122 
00123 /******************************************************************************************
00124 
00125 >   void BTNOP(NAME, OPCLASS, SYSTEM)
00126 
00127     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00128     Created:    20/04/94
00129     Inputs:     NAME:       Operation name
00130                 OPCLASS:    Name of Operation class in which GetState will be called and
00131                             which will be instatiated by the OpDescriptor's Invoke()
00132                             function.
00133                 SYSTEM:     Name of system bar which op should be attached to.
00134                             Currently this can be one of:
00135                                 FILE
00136                                 EDIT
00137                                 ATTR
00138                                 ARRANGE
00139                                 UTIL
00140                                 WINDOW
00141                                 HELP
00142     Purpose:    MACRO
00143                 Construct a complete OpDescriptor given three simple parameters. The
00144                 parameters are used to build all the various resource IDs required by the
00145                 call to RegisterOpDescriptor. Each use of this macro replaces the following
00146                 code;
00147                 BOOL Blobby = RegisterOpDescriptor(
00148                                                     0, 
00149                                                     _R(IDS_FILEOPEN),
00150                                                     CC_RUNTIME_CLASS(DocOps), 
00151                                                     OPTOKEN_FILEOPEN,
00152                                                     DocOps::GetState,
00153                                                     HID_FILEOPEN,
00154                                                     _R(IDBBL_FILEOPEN),
00155                                                     _R(IDD_BARCONTROLSTORE),
00156                                                     _R(IDC_BTN_FILEOPEN),
00157                                                     SYSTEMBAR_FILE,
00158                                                     TRUE // ReceiveMessages
00159                                                     );
00160                 ERRORIF(!Blobby, _R(IDS_OUT_OF_MEMORY), FALSE);
00161 
00162                 As you can see this macro causes the function that called it to exit and
00163                 return FALSE if the registration fails. This is normally correct for calls
00164                 made from Operation::Init functions, like this:
00165                 BOOL BlobbyOp::Init()
00166                 {
00167                     BTNOP(...);
00168                     BTNOP(...);
00169                     return(TRUE);
00170                 }
00171                 Note:   This macro uses new format IDs. Don't use the REGOP macro in
00172                         menuops.cpp because it uses old format IDs.
00173                 
00174     SeeAlso:    CTRLOP
00175 
00176 ******************************************************************************************/
00177 
00178 #define BTNOP(NAME, OPCLASS, SYSTEM)\
00179     {\
00180         BOOL Blobby = RegisterOpDescriptor(\
00181                         0,\
00182                         _R(IDS_ ## NAME),/*NORESOURCEFIX*/\
00183                         CC_RUNTIME_CLASS(OPCLASS),\
00184                         OPTOKEN_ ## NAME,\
00185                         OPCLASS::GetState,\
00186                         HID_ ## NAME,\
00187                         _R(IDBBL_ ## NAME),/*NORESOURCEFIX*/\
00188                         _R(IDD_BARCONTROLSTORE),\
00189                         _R(IDC_BTN_ ## NAME),/*NORESOURCEFIX*/\
00190                         SYSTEMBAR_ ## SYSTEM,\
00191                         TRUE\
00192                       );\
00193         ERRORIF(!Blobby, _R(IDS_OUT_OF_MEMORY), FALSE);\
00194     }
00195 
00196 
00197 
00198 
00199 /******************************************************************************************
00200 
00201 >   void CTRLOP(NAME, OPCLASS, SYSTEM)
00202 
00203     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00204     Created:    20/04/94
00205     Inputs:     NAME:       Operation name
00206                 OPCLASS:    Name of Operation class in which GetState will be called and
00207                             which will be instatiated by the OpDescriptor's Invoke()
00208                             function.
00209                 SYSTEM:     Name of system bar which op should be attached to.
00210                             Currently this can be one of:
00211                                 FILE
00212                                 EDIT
00213                                 ATTR
00214                                 ARRANGE
00215                                 UTIL
00216                                 WINDOW
00217                                 HELP
00218     Purpose:    MACRO
00219                 Construct a complete OpDescriptor given three simple parameters. The
00220                 parameters are used to build all the various resource IDs required by the
00221                 call to RegisterOpDescriptor. Each use of this macro replaces the following
00222                 code;
00223                 BOOL Blobby = RegisterOpDescriptor(
00224                                                     0, 
00225                                                     _R(IDS_FILEOPEN),
00226                                                     CC_RUNTIME_CLASS(DocOps), 
00227                                                     OPTOKEN_FILEOPEN,
00228                                                     DocOps::GetState,
00229                                                     HID_FILEOPEN,
00230                                                     _R(IDBBL_FILEOPEN),
00231                                                     _R(IDD_BARCONTROLSTORE),
00232                                                     _R(IDC_BTN_FILEOPEN),
00233                                                     SYSTEMBAR_FILE,
00234                                                     TRUE // ReceiveMessages
00235                                                     );
00236                 ERRORIF(!Blobby, _R(IDS_OUT_OF_MEMORY), FALSE);
00237 
00238                 As you can see this macro causes the function that called it to exit and
00239                 return FALSE if the registration fails. This is normally correct for calls
00240                 made from Operation::Init functions.
00241                 Note:   This macro uses new format IDs. Don't use the REGOP macro in
00242                         menuops.cpp because it uses old format IDs.
00243                 
00244     SeeAlso:    BTNOP
00245 
00246 ******************************************************************************************/
00247 
00248 #define CTRLOP(NAME, OPCLASS, SYSTEM)\
00249     {\
00250         BOOL Blobby = RegisterOpDescriptor(\
00251                         0,\
00252                         _R(IDS_ ## NAME),/*NORESOURCEFIX*/\
00253                         CC_RUNTIME_CLASS(OPCLASS),\
00254                         OPTOKEN_ ## NAME,\
00255                         OPCLASS::GetState,\
00256                         HID_ ## NAME,\
00257                         _R(IDBBL_ ## NAME),/*NORESOURCEFIX*/\
00258                         _R(IDD_BARCONTROLSTORE),\
00259                         _R(IDC_CTRL_ ## NAME)/*NORESOURCEFIX*/,\
00260                         SYSTEMBAR_ ## SYSTEM,\
00261                         TRUE\
00262                       );\
00263         ERRORIF(!Blobby, _R(IDS_OUT_OF_MEMORY), FALSE);\
00264     }
00265 
00266 
00267 
00268 
00269 // Forward declarations...
00270 class DialogOp; 
00271 
00272 
00273 
00274 
00275 /********************************************************************************************
00276 
00277 >   class OpState
00278 
00279 Purpose:    The Opstate class contains flags describing the state of an operation at any 
00280             particular time. This state will be used by the Menu system to tick and grey
00281             menus (and do corresponding things to buttons where necessary).
00282 SeeAlso:    OpDescriptor; Operation
00283 
00284 ********************************************************************************************/
00285 
00286 class CCAPI OpState
00287 {
00288 public:
00289     // Member vars
00290     BOOL Ticked : 1;
00291     BOOL Greyed : 1;
00292     BOOL RemoveFromMenu : 1;
00293     
00294     // Constructor to allow default values to be supplied
00295     OpState( BOOL tick = FALSE, BOOL grey = FALSE, BOOL Remove = FALSE );
00296     
00297 };
00298  
00299 
00300 // Operation Ability Flags
00301 /*
00302 Goodbye
00303 #define OP_MACRO            0x0001
00304 #define OP_SIMPLE           0x0002
00305 #define OP_NOTFORMACRO      0x0004
00306 #define OP_NEEDSDOC         0x0008
00307 #define OP_SPECIALITEM      0x0010  
00308 */
00309 
00310 
00311 // Operation Text Flags
00312 
00313 enum OpTextFlags { OP_MENU_TEXT, OP_DESC_TEXT, OP_UNDO_TEXT, OP_MENU_NAME };
00314 
00315 // String Resource Text Delimeter
00316 
00317 #define STRING_DELIMETER    ';'
00318 
00319 // End Of String Delimeter
00320 
00321 #define END_OF_STRING       '\0'
00322 
00323 // Maximum Text String Size
00324 
00325 #define MAX_TEXT_SIZE       256
00326 
00327 
00328 // This creates a new name, pfnGetState, for a pointer to a function that returns
00329 // your OpState information.
00330 
00331 class OpDescriptor;
00332 typedef OpState (*pfnGetState)(String_256*, OpDescriptor*);
00333 typedef OpState (*pfnGetParamState)(String_256*, OpDescriptor*, OpParam*);
00334 
00335 
00336 
00337 
00338 /********************************************************************************************
00339 
00340 >   class BarControlInfo
00341 
00342     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com> (modified by Phil, 13/04/94)
00343     Created:    5/4/94
00344     Purpose:    A class that encapsulates the minimum data required to specify a control on
00345                 a bar.  The info is platform independant.
00346 
00347 ********************************************************************************************/
00348 
00349 class BarControlInfo
00350 {
00351 public:
00352     UINT32  ResourceID;     // Resource in which control is found
00353     UINT32  ControlID;      // ID of control within that resource
00354     UINT32  ToolID;         // Tool (and thus module) in which resource is found
00355 
00356     BarControlInfo& operator=(BarControlInfo& other) 
00357     { 
00358         ResourceID = other.ResourceID;
00359         ControlID  = other.ControlID;
00360         ToolID     = other.ToolID;
00361 
00362         return *this;
00363     }
00364 
00365 /********************************************************************************************
00366 
00367 >   BarControlInfo::BarControlInfo(UINT32 resID, UINT32 ctrlID=0, UINT32 toolID=0)
00368 
00369     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00370     Created:    13/04/94
00371     Purpose:    BarControlInfo constructor which fills in the member data fields.
00372                 The caller MUST specify the resource ID but the control ID and tool ID may 
00373                 be ommitted. Their default values are 0 which for the tool ID means that 
00374                 the resource will be found in the kernel resources.
00375 
00376 ********************************************************************************************/
00377     BarControlInfo(UINT32 resID, UINT32 ctrlID=0, UINT32 toolID=0) :
00378                     ResourceID(resID), ControlID(ctrlID), ToolID(toolID)
00379                     {}
00380 };
00381 
00382 
00383 
00384 
00385 /********************************************************************************************
00386 
00387 >   class OpListItem: public ListItem
00388 
00389     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00390     Created:    22/3/94
00391     Purpose:    The reason we need to store OpDescriptors in OpListItems is that 
00392                 OpDescriptors are MessageHandler objects and so are already potentially
00393                 stored on a list. 
00394     SeeAlso:    -
00395 
00396 ********************************************************************************************/
00397 
00398 class OpListItem: public ListItem
00399 {
00400     CC_DECLARE_MEMDUMP(OpListItem)
00401 
00402 public: 
00403     OpDescriptor* pOpDesc; 
00404 };
00405 
00406 // The OpFlgs structure holds info about the type of an operation
00407 struct CCAPI OpFlgs
00408 {                       
00409     BOOL Clean : 1;          // Op does not "modify" document
00410     BOOL Smart : 1;          // Op can be smart duplicated
00411 
00412     BOOL fCheckable : 1;     // Op should have checkbox when in menu
00413 };
00414 
00415 
00416 
00417 /********************************************************************************************
00418 
00419 >   class ListItemOpPtr: public ListItem
00420 
00421     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00422     Created:    05/10/94
00423     Purpose:    To enable storage of pointers to operations on lists. 
00424     SeeAlso:    -
00425 
00426 ********************************************************************************************/
00427 
00428 class ListItemOpPtr: public ListItem
00429 {
00430     CC_DECLARE_MEMDUMP(ListItemOpPtr)
00431 
00432 public: 
00433     Operation* pOp; 
00434 };
00435 
00436 
00437 
00438 /********************************************************************************************
00439 
00440 >   class OpDescriptor : public MessageHandler
00441 
00442     Author:     Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
00443     Created:    30/6/93
00444     Purpose:    The OpDescriptor class describes a particular operation. It contains
00445                 pointers to the literal token describing the operation (used by the 
00446                 macro language, among other things) and pointers to some static member
00447                 functions of the operation which allow dynamic creation of the operation.
00448     SeeAlso:    operation
00449 
00450 ********************************************************************************************/
00451 
00452 class OpDescControlCreateMsg;
00453 class OpDescControlMsg;
00454 
00455 class CCAPI OpDescriptor : public MessageHandler
00456 {
00457     CC_DECLARE_DYNAMIC( OpDescriptor )
00458     
00459 protected:
00460     
00461     DWORD           ModuleID;   
00462     UINT32          TextID;
00463     UINT32          HelpID;
00464     UINT32          BubbleID;
00465     BarControlInfo  BarCtrlInfo;
00466 //  UINT32          BitmapID;
00467     CCRuntimeClass* OpClass;
00468     OpFlgs          Flags;  
00469 
00470     BOOL            m_bHotKeyEnabled;
00471     // This set of member vars looks after the aliased state of the op descriptor
00472     BOOL            Aliased;            // TRUE if the op desc has been aliased
00473     CCRuntimeClass* AliasOpClass;       // The op class to use to invoke the alias op
00474     pfnGetState     OldGetState;        // The GetState func before aliasing
00475     UINT32          OldAutoStateFlags;  // The AutoStateFlags before aliasing
00476     UINT32          OldTextID;          // The ID of the text string
00477     UINT32          OldBubbleID;        // The ID of the bubble help string
00478     
00479     // When not 0 only one live instance
00480     // of the operation is permitted, and
00481     // OneInstID is the string resource
00482     // ID describing why.This will be useful
00483     // for 1 open instance dialogs. 
00484     UINT32 OneInstID;
00485     UINT32 AutoStateFlgs;   // Flags which indicate conditions when
00486                            // the operation should automatically be
00487                            // greyed/ticked etc..(This cuts down the 
00488                            // number of tests that need to be made in the 
00489                            // GetState function).
00490 
00491 private: 
00492     pfnGetState GetState;               // pointer to the GetState function in the operation
00493 
00494 protected:
00495     pfnGetParamState GetParamState;     // pointer to the GetParamState function in the operation
00496     
00497 public:
00498     // Public Member variable so people can actually get at the name of the Op.
00499     String Token;           // literal token - does not need to be internationalised
00500 
00501     // Calls GetState fn 
00502     virtual OpState GetOpsState(String_256*, OpParam* pOpParam = NULL);
00503 
00504 public:
00505     
00506     // Invokes the operation associated with the OpDescriptor calling either the Operations
00507     // Do or DoWithParam virtual fns.
00508     void Invoke(OpParam* pOpParam = NULL, BOOL fWithUndo = TRUE);
00509     
00510     // Constructor for creating an instance, which also links
00511     // the object into the linked list.
00512     // This constructor takes in a resource ID and control ID.
00513     // If they are both zero (the default case) then this OpDescriptor cannot be accessed
00514     // by the user through any control in the toolbars.
00515     // If the resource ID is supplied alone is is treated as a bitmap ID which connects
00516     // the OpDescriptor to a bitmap button.
00517     // If both the resource ID and the Control ID are supplied then the OpDescriptor is
00518     // connected to an aribtrary control which may be on a toolbar somewhere.
00519     OpDescriptor(
00520                  UINT32 toolID,                         // Module Identifier
00521                  UINT32 txID,                         // String Resource ID
00522                  CCRuntimeClass* Op,                // pointer to the Op's runtime class object
00523                  TCHAR* tok,                        // pointer to the token string
00524                  pfnGetState gs,                    // pointer to the GetState function
00525                  UINT32 helpId = 0,                 // help identifier 
00526                  UINT32 bubbleID = 0,                   // string resource for bubble help
00527                  UINT32 resourceID = 0,             // bitmap ("icon") or resource ID
00528                  UINT32 controlID =0,                   // control ID
00529                  BOOL ReceiveMessages = FALSE,
00530                  BOOL Smart = FALSE,
00531                  BOOL Clean = TRUE,
00532                  UINT32 OneOpenInstID = 0,          // When not 0 only one live instance
00533                                                     // of the operation is permitted, and
00534                                                     // OneOpenInstID is the string resource
00535                                                     // ID describing why.This will be useful
00536                                                     // for 1 open instance dialogs.
00537                  UINT32 AutoStateFlags = 0,         // Flags which indicate conditions when
00538                                                     // the operation should automatically be
00539                                                     // greyed/ticked etc..(This cuts down the 
00540                                                     // number of tests that need to be made in the 
00541                                                     // GetState function).
00542                  BOOL fCheckable = FALSE
00543                 );
00544 
00545     // standard destructor
00546     ~OpDescriptor();
00547 
00548     OpFlgs GetOpFlags();
00549 
00550 
00551     void SetBarControlInfo(BarControlInfo ThisInfo){ BarCtrlInfo = ThisInfo;};
00552                         
00553     // a search function that returns a pointer to the OpDescriptor that contains token
00554     static OpDescriptor* FindOpDescriptor(TCHAR* Token);
00555     
00556     // a search function that returns a pointer to the OpDescriptor that describes operation
00557     static OpDescriptor* FindOpDescriptor(CCRuntimeClass* Op);
00558 
00559     // a search function that returns a pointer to the OpDescriptor searching by ResourceID
00560     static OpDescriptor* FindOpDescriptor(ResourceID res);
00561     
00562     // Need a method of killing off all the Descriptors at program end
00563     static void DestroyAll();
00564 
00565     // Allows you to alias the operation invoked by this OpDesc.
00566     // When the Invoke() method is called an instance of AliasOp is made instead of the registered Op.
00567     // Also, you have to provide an alias GetState() function so that menu items, buttons, etc can
00568     // be greyed, etc, correctly.
00569     // This function also allows you to change the auto state calculation flags
00570     void AliasOperation(CCRuntimeClass* AliasOp,pfnGetState AliasGetState,UINT32 AliasAutoStateFlags=0,UINT32 AliasTextID=0,UINT32 AliasBubbleID=0);
00571 
00572     // Reverts the op desc to its default operation, i.e. unaliases it
00573     void RemoveAlias();
00574 
00575     // Static fn that clears all aliases of all OpDescs in the system
00576     static void RemoveAllAliases();
00577 
00578     // Returns TRUE if this OpDesc is aliased.
00579     BOOL IsAliased();
00580 
00581     // For those ops associated with a hot key, the following functions determine the key's viability
00582     BOOL    IsHotKeyEnabled() const;
00583     void    DisableHotKey();
00584     void    EnableHotKey();
00585 
00586     // This will use the TextID to obtain a string resource text description of the 
00587     // operation. 
00588     virtual BOOL GetText(String_256* Description, OpTextFlags WhichText);
00589 
00590     // The Default Message function 
00591     virtual MsgResult Message(Msg* Msg);
00592 
00593     // This iterates through all the controls in the application, adding to the given
00594     // list those which are associated with this OpDescriptor.  Returns FALSE if there
00595     // are no such controls.
00596     BOOL BuildGadgetList(List* pOutputList);
00597 
00598     // --------------------------------------------------------------------------------------
00599     // OpDescriptor On message handlers
00600     // These get called by the default OpDescriptor Message handler
00601 
00602     // This function gets called by the OpDescriptors default Message handler whenever the 
00603     // control associated with an OpDescriptor is created. This base class function does 
00604     // nothing. 
00605     virtual void OnControlCreate(OpDescControlCreateMsg* CreateMsg);
00606 
00607     // This function gets called whenever the user selects an item from a list or combo 
00608     // control associated with an OpDescriptor
00609     virtual void OnSelectionChange(OpDescControlMsg* SelChangedMsg, List* GadgetList);
00610 
00611     // This function is called whenever a slider control associated with the opdescriptor
00612     // changes to a new position.
00613     virtual void OnSliderChanging(OpDescControlMsg* SliderChangingMsg);
00614     
00615     // This function is called whenever a slider control associated with the opdescriptor
00616     // changes to a new position.
00617     virtual void OnSliderSet(OpDescControlMsg* SelChangedMsg);
00618 
00619     // This function is called whenever a slide associated with the opdescriptor
00620     // is cancelled.
00621     virtual void OnSliderCancelled(OpDescControlMsg* SelChangedMsg);
00622 
00623     TCHAR* ReadString(TCHAR* pDesc);
00624     TCHAR* GetMenuNameString(TCHAR* pDesc);
00625     void SetStringPos(TCHAR** pDesc, OpTextFlags WhichText);
00626 
00627     UINT32 GetHelpId();
00628     UINT32 GetToolID();
00629     UINT32 GetBubbleId();
00630     const BarControlInfo* GetBarControlInfo();
00631 
00632 private:
00633 
00634     static List OpList; 
00635 
00636 protected:
00637     TCHAR* GetDescription(TCHAR* pDesc, OpTextFlags WhichText);
00638 
00639 public:
00640 
00641 /********************************************************************************************
00642 
00643 >   static OpListItem* OpDescriptor::GetFirstDescriptor()
00644 
00645     Author:     Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
00646     Created:    30/6/93
00647     Purpose:    returns the first OpListItem in the list
00648 
00649 ********************************************************************************************/
00650     static OpListItem* GetFirstDescriptor() 
00651     { 
00652         return ((OpListItem*)(OpList.GetHead()));  
00653     }
00654 
00655 
00656     
00657 /********************************************************************************************
00658 
00659 >   static OpListItem* OpDescriptor::GetNextDescriptor( OpListItem* CurrOp )
00660 
00661     Author:     Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
00662     Created:    30/6/93
00663     Inputs:     pointer to last OpListItem returned by GetFirst ot GetNextDescriptor
00664     Purpose:    returns the next OpListItem in the list
00665 
00666 ********************************************************************************************/
00667 
00668     static OpListItem* GetNextDescriptor( OpListItem* CurrOp )
00669     {  
00670         return ((OpListItem*)OpList.GetNext(CurrOp));  
00671     }
00672 
00673     static void LinkDescriptor( OpDescriptor* ThisOp );
00674     static BOOL DelinkDescriptor( OpDescriptor* pThisOp );
00675 };
00676 
00677 
00678 
00679 /********************************************************************************************
00680 
00681 >   class UndoableOpDescriptor : public OpDescriptor
00682 
00683     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00684     Created:    16/8/93
00685     Purpose:    All undoable operations should be registered using an UndoableOpDescriptor. 
00686                 The only difference between an UndoableOpDescriptor and an OpDescriptor
00687                 is that the Operation Flags are set to different default values. 
00688                 
00689     SeeAlso:    operation
00690 
00691 ********************************************************************************************/
00692 
00693 class CCAPI UndoableOpDescriptor : public OpDescriptor
00694 {
00695     CC_DECLARE_DYNAMIC( UndoableOpDescriptor )
00696     
00697 public:
00698 
00699     // Constructor for creating an instance. The params are all the same as for OpDescriptor
00700 
00701     UndoableOpDescriptor(
00702                          UINT32 toolID,                         // Tool (Module) Identifier
00703                          UINT32 txID,                         // String Resource ID
00704                          CCRuntimeClass* Op,                // pointer to the Op's runtime class object
00705                          TCHAR* tok,                        // pointer to the token string
00706                          pfnGetState gs,                    // pointer to the GetState function
00707                          UINT32 helpId = 0,                 // help identifier 
00708                          UINT32 bubbleID = 0,                   // string resource for bubble help
00709                          UINT32 resourceID = 0,             // resource ID
00710                          UINT32 controlID = 0,              // control ID within resource
00711                          BOOL ReceiveMessages = FALSE,      
00712                          BOOL Smart = FALSE, 
00713                          BOOL Clean = FALSE,
00714                          UINT32 OneOpenInstID = 0,  // When not 0 only one live instance
00715                                                     // of the operation is permitted, and
00716                                                     // OneOpenInstID is the string resource
00717                                                     // ID describing why.This will be useful
00718                                                     // for 1 open instance dialogs.
00719                          UINT32 AutoStateFlags = 0, // Flags which indicate conditions when
00720                                                     // the operation should automatically be
00721                                                     // greyed/ticked etc..(This cuts down the 
00722                                                     // number of tests that need to be made in the 
00723                                                     // GetState function).
00724                          BOOL fCheckable = FALSE
00725                 );
00726 
00727 
00728     UINT32 ToolId;
00729 
00730 };
00731 
00732 
00733 
00734 /********************************************************************************************
00735 
00736 >   class ToolOpDescriptor : public OpDescriptor
00737 
00738     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00739     Created:    16/8/93
00740     Purpose:    The ToolOpDescriptor class describes a Tool Selection operation. It contains
00741                 pointers to the literal token describing the operation (used by the 
00742                 macro language, among other things) and pointers to some static member
00743                 functions of the operation which allow dynamic creation of the operation.
00744     SeeAlso:    operation
00745 
00746 ********************************************************************************************/
00747 
00748 class CCAPI ToolOpDescriptor : public OpDescriptor
00749 {
00750     CC_DECLARE_DYNAMIC( ToolOpDescriptor )
00751     
00752 public:
00753 
00754     ToolOpDescriptor(   
00755                         UINT32 toolID,                    // Tool (Module) Identifier
00756                         UINT32 txID,                      // String Resource ID
00757 //                      UINT32 toolId,                  // Tool Identifier
00758                         CCRuntimeClass* Op,             // pointer to the runtime class of
00759                                                         // appropriate Operation object
00760                         TCHAR* tok = NULL,              // pointer to the token string 
00761                         pfnGetState gs = NULL,          // pointer to the GetState function
00762                         UINT32 hlpID = 0,                   // help file "jump" ID
00763                         UINT32 bubID = 0,                   // bubble-help string resource ID
00764                         UINT32 resID = 0,               // resource ID of this OpDesc.
00765                         UINT32 ctlID = 0,                   // control of this OpDesc
00766                         BOOL ReceiveMessages = TRUE,        
00767                         BOOL Smart = FALSE, 
00768                         BOOL Clean = FALSE,
00769                         BOOL fCheckable = FALSE ); 
00770 
00771 private:
00772     // Set to TRUE if this is the selected tool
00773     BOOL CurrentTool; 
00774 
00775 public:
00776     void SetCurrentTool(BOOL State) { CurrentTool = State; }
00777     BOOL IsCurrentTool() { return CurrentTool;}
00778 
00779 
00780 
00781 //  UINT32 ToolId;
00782 
00783 };
00784 
00785 
00786 
00787 
00788 /********************************************************************************************
00789 
00790 >   class ParamOpDescriptor : public OpDescriptor
00791 
00792     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com> (from code by Neville Humphrys)
00793     Created:    11/10/2004
00794     Purpose:    New ParamOpDescriptor class whose purpose in life is to allow an OpDescriptor
00795                 to be created which instead of using a resource id to get the menu item/operation
00796                 item text, uses a string resource. This then means we can use the name from the
00797                 plug-in instead of having to resource all names!
00798 
00799 ********************************************************************************************/
00800 
00801 class ParamOpDescriptor : public OpDescriptor
00802 {
00803     CC_DECLARE_DYNAMIC( ParamOpDescriptor );
00804 
00805 // Statics
00806 public:
00807     static OpState  GetState(String_256* psName, OpDescriptor* pOpDesc);
00808 
00809 // Methods
00810 public:
00811     ParamOpDescriptor(const TCHAR* pcszToken,
00812                                 CCRuntimeClass* pClass,
00813                                 pfnGetParamState gps);
00814 
00815     virtual BOOL    GetText(String_256* Description, OpTextFlags WhichText);
00816 
00817 // Properties
00818 public:
00819 //  String_64       MenuText;
00820 };
00821 
00822 
00823 
00824 
00825 // ------------------------------------------------------------------------------------------
00826 // OpDescriptor messages    
00827 
00828 
00829 /********************************************************************************************
00830 
00831 >   class OpDescMsg: public Msg
00832 
00833     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00834     Created:    16/4/94
00835     Inputs:     -
00836     Outputs:    -
00837     Returns:    -
00838     Purpose:    Base class for all OpDescriptor messages  
00839     Errors:     -
00840     SeeAlso:    OpDescControlDestroy
00841     SeeAlso:    OpDescControlCreate
00842 
00843 ********************************************************************************************/
00844 
00845 class OpDescMsg: public Msg
00846 {
00847     CC_DECLARE_DYNAMIC(OpDescMsg);
00848     
00849 public:
00850     OpDescriptor* OpDesc; // The OpDescriptor the message is meant for
00851     
00852     CGadgetID GadgetID;    // This is the resource gadget ID
00853 
00854     CGadgetID SetGadgetID; // You should use this GadgetID whenever you are sending a message 
00855                            // to the gadget, eg. if you are using any of the DialogOp set
00856                            // functions. It is a unique gadget ID for the bar.  
00857 
00858     DialogOp* pDlgOp;     // A pointer to the DialogOp 
00859 
00860     
00861     OpDescMsg(OpDescriptor* OpD, CGadgetID GadID, CGadgetID SetGadget, DialogOp* pDialogOp)
00862     {
00863         OpDesc = OpD; 
00864         GadgetID = GadID; 
00865         pDlgOp = pDialogOp;
00866         SetGadgetID = SetGadget;
00867     };
00868 
00869 };
00870 
00871 /********************************************************************************************
00872 
00873 >   class OpDescControlCreate: public OpDescMsg
00874 
00875     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00876     Created:    16/4/94
00877     Inputs:     -
00878     Outputs:    -
00879     Returns:    -
00880     Purpose:    This message is sent to an OpDescriptor after its controls have 
00881                 been created. It gives you a chance to perform control initialisation. 
00882                 eg. Set scrollbar ranges, fill listboxes ...
00883     Errors:     -
00884     SeeAlso:    OpDescControlDestroy
00885 
00886 ********************************************************************************************/
00887 
00888 class OpDescControlCreateMsg: public OpDescMsg
00889 {   
00890     CC_DECLARE_DYNAMIC(OpDescControlCreateMsg);
00891     OpDescControlCreateMsg(OpDescriptor* OpD, 
00892                            CGadgetID GadID, CGadgetID SetGadget, DialogOp* pDialogOp):
00893         OpDescMsg(OpD,  GadID, SetGadget, pDialogOp)
00894     {
00895     }; 
00896 }; 
00897 
00898 /********************************************************************************************
00899 
00900 >   class OpDescControlDestroy: public OpDescMsg
00901 
00902     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00903     Created:    16/4/94
00904     Inputs:     -
00905     Outputs:    -
00906     Returns:    -
00907     Purpose:    This message is sent to an OpDescriptor after its controls have 
00908                 been destroyed, It gives the OpDescriptor a chance to cleanup 
00909 
00910     Errors:     -
00911     SeeAlso:    OpDescControlCreateMsg
00912 
00913 
00914 ********************************************************************************************/
00915 
00916 class OpDescControlDestroyMsg: public OpDescMsg
00917 {
00918     CC_DECLARE_DYNAMIC(OpDescControlDestroyMsg); 
00919     OpDescControlDestroyMsg(OpDescriptor* OpD,
00920                            CGadgetID GadID, CGadgetID SetGadget, DialogOp* pDialogOp):
00921         OpDescMsg(OpD, GadID, SetGadget, pDialogOp)
00922     {
00923     }; 
00924 };
00925 
00926 /********************************************************************************************
00927 
00928 >   class OpDescControlMsg: public OpDescMsg
00929 
00930     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00931     Created:    16/4/94
00932     Inputs:     -
00933     Outputs:    -
00934     Returns:    -
00935     Purpose:    This message is the OpDescriptor equivelant of a DialogMsg. It is sent 
00936                 when an OpDescriptor's control sends a message.
00937     Errors:     -
00938     SeeAlso:    -
00939 
00940 ********************************************************************************************/
00941 
00942 class OpDescControlMsg: public OpDescMsg
00943 {
00944     CC_DECLARE_DYNAMIC(OpDescControlMsg); 
00945     
00946     public:
00947     
00948     CDlgMessage DlgMsg;
00949 
00950     OpDescControlMsg(OpDescriptor* OpD, CDlgMessage DlgM, CGadgetID GadID, 
00951                      CGadgetID SetGadget, DialogOp* pDialogOp):
00952         OpDescMsg(OpD, GadID, SetGadget, pDialogOp)
00953     {
00954         DlgMsg = DlgM; 
00955     };
00956  
00957 };
00958 
00959 
00960 class DialogBarOp;
00961 
00962 
00963 
00964 /********************************************************************************************
00965 >   class GadgetListItem
00966 
00967 Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00968 Created:    17/5/94
00969 Purpose:    Put on a list by OpDescriptor::BuildGadgetList.  Contains a pointer to a
00970             DialogBarOp and a CGadgetID for a control associated with an OpDescriptor.
00971             Data fields are PUBLIC for easy access.
00972 SeeAlso:    OpDescriptor::BuildGadgetList
00973 ********************************************************************************************/
00974 
00975 class GadgetListItem : public ListItem
00976 {
00977     CC_DECLARE_MEMDUMP(GadgetListItem)
00978 
00979 public:
00980     DialogOp*    pDialogOp;
00981     CGadgetID    gidGadgetID;
00982 
00983     GadgetListItem(DialogOp* pop, CGadgetID gid)
00984       : pDialogOp(pop), gidGadgetID(gid) { /* empty */ }
00985 };
00986 
00987 #endif      // INC_OPDESC

Generated on Sat Nov 10 03:46:13 2007 for Camelot by  doxygen 1.4.4