cmdctrl.h

Go to the documentation of this file.
00001 // $Id: cmdctrl.h 1282 2006-06-09 09:46:49Z 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 
00099 /*
00100  *  */
00101 
00102 /********************************************************************************************
00103 
00104 >   Class CmdControl : public ListItem
00105 
00106     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00107     Created:    12/10/93
00108     Purpose:    
00109         A CmdControl is an abstract class from which all types of interface controls inherit. 
00110         These controls include MenuItems, Keyboard Accelerators, Buttons etc. They all have 
00111         one main thing in common and that is that they are built out of Operations. Unlike 
00112         Tools Controls have only one operation behind them.
00113 
00114     Errors:     None yet.
00115     SeeAlso:    ListItem
00116 
00117 ********************************************************************************************/
00118 
00119 #ifndef INC_CMD_CONTROL
00120 #define INC_CMD_CONTROL
00121 
00122 //#include "list.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00123 //#include "listitem.h"  - in camtypes.h [AUTOMATICALLY REMOVED]
00124 //#include "opdesc.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00125 
00126 /********************************************************************************************
00127 >   class CCAPI CmdControl : public ListItem
00128 
00129     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>   
00130     Created:    sometime in 1993
00131     Purpose:    Base class for Camelot menu items.  Unfortunately neither Mario or Andy
00132                 ever got round to documenting this stuff, ha ha ha
00133     SeeAlso:    -
00134 ********************************************************************************************/
00135 
00136 class CCAPI CmdControl : public ListItem
00137 { 
00138 public:
00139     
00140     CmdControl() { /* Empty */ }
00141     CmdControl(OpDescriptor* Owner);
00142 
00143     virtual BOOL IsEnabled();
00144     virtual void PerformAction();
00145     virtual BOOL UpdateControlState();
00146     virtual String_256* GetWhyDisabled();
00147 
00148     virtual OpDescriptor* GetOpDescriptor() const;
00149 
00150 protected:                        
00151     UINT32 ControlId;
00152     String_256 WhyDisabled;
00153     OpState ControlState;
00154     OpDescriptor* OwnerOperation;
00155 
00156 private:
00157     CC_DECLARE_MEMDUMP(CmdControl);
00158 };
00159 
00160 /********************************************************************************************
00161 
00162 >   Class HotKeyO : public CmdControl
00163 
00164     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00165     Created:    13/10/93
00166     Purpose:    
00167         The HotKey class represents keyboard accelerators for menu items and other short-cut 
00168         keys used for other types of controls. HotKey inherits from the CmdControl class 
00169         provides it with the ability to perform an operation which is the commonality between
00170         all types of CmdControls.
00171 
00172     Errors:     None yet.
00173     SeeAlso:    CmdControl
00174 
00175 ********************************************************************************************/
00176 
00177 #if 0
00178 // Not obvious when & why this was all disabled - AB20060106
00179 class CCAPI HotKeyO : public CmdControl
00180 { 
00181 
00182     CC_DECLARE_MEMDUMP(HotKeyO);
00183 
00184 private:
00185     // List of all Hotkeys
00186     static List HotKeys; 
00187     
00188     String_256 Description;
00189     String_256 MenuTextDesc;
00190 
00191 public:
00192     
00193     HotKeyO() {}
00194 
00195     HotKeyO( OpDescriptor *Owner, String_256 *MenuText );
00196 
00197     BOOL UpdateControlState();
00198 
00199     UINT32 GetHotKeyId();
00200     
00201     String_256* GetDescription();
00202     String_256* GetMenuTextDesc();
00203     
00204     static UINT32 AutomaticHotKeyID;
00205     static UINT32 GetNextAutomaticHotKeyID();
00206 
00207     // a search function that returns a pointer to the HotKey
00208     static HotKeyO* FindHotKey(UINT32 HotKeyId);
00209     
00210     static HotKeyO* FindHotKey(OpDescriptor* OpDesc);
00211 
00212     // Need a method of killing off all the HotKeys at program end
00213     static void DestroyAll();
00214 
00215 /********************************************************************************************
00216 
00217 >   static HotKey* HotKey::GetFirstHotKey()
00218 
00219     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00220     Created:    13/10/93
00221     Purpose:    returns the first HotKey in the list
00222 
00223 ********************************************************************************************/
00224     static HotKeyO* GetFirstHotKey()    
00225     { 
00226         return (HotKeyO*) HotKeys.GetHead(); 
00227     }
00228 
00229 
00230     
00231 /********************************************************************************************
00232 
00233 >   static HotKey* HotKey::GetNextHotKey( HotKey* CurrHotKey )
00234 
00235     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00236     Created:    13/10/93
00237     Inputs:     pointer to last HotKey return by GetFirst to GetNextHotKey
00238     Purpose:    return the next HotKey in the list
00239 
00240 ********************************************************************************************/
00241     static HotKeyO* HotKeyO::GetNextHotKey( HotKeyO* CurrHotKey )
00242     { 
00243         return (HotKeyO*) HotKeys.GetNext( CurrHotKey ); 
00244     }
00245 
00246 
00247 
00248 private:          
00249 
00250 /********************************************************************************************
00251 
00252 >   static void HotKey::LinkHotKey( HotKey* ThisHotKey )
00253 
00254     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00255     Created:    13/10/93
00256     Inputs:     pointer to this HotKey
00257     Purpose:    Add the HotKey to the list of all HotKeys
00258     Scope:      private
00259 
00260 ********************************************************************************************/
00261 
00262     static void HotKeyO::LinkHotKey( HotKeyO* ThisHotKey )
00263     { 
00264         HotKeys.AddTail(ThisHotKey); 
00265     }
00266 
00267 };
00268 
00269 /********************************************************************************************
00270 
00271 >   Class Button : public CmdControl
00272 
00273     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00274     Created:    13/10/93
00275     Purpose:    
00276         The Button class represents keyboard accelerators for menu items and other short-cut 
00277         keys used for other types of controls. Button inherits from the CmdControl class 
00278         provides it with the ability to perform an operation which is the commonality between
00279         all types of CmdControls.
00280 
00281     Errors:     None yet.
00282     SeeAlso:    CmdControl
00283 
00284 ********************************************************************************************/
00285 
00286 class CCAPI Button : public CmdControl
00287 { 
00288 
00289     CC_DECLARE_MEMDUMP(Button);
00290 
00291 private:
00292     // List of all Button Bar
00293     static List ButtonBar;
00294 
00295     static UINT32 NumberOfButtons;
00296     static UINT32 NumberOfSeparators;
00297 
00298     String_256 Description;
00299     
00300     BOOL FollowedBySeparator;
00301     
00302     UINT32 BitMapOffset;    
00303 
00304 public:
00305     
00306     Button() {}
00307 
00308     Button( OpDescriptor *Owner, BOOL Separator, UINT32 BitMapNo = 0 );
00309 
00310     BOOL UpdateControlState();
00311 
00312     UINT32 GetButtonId();
00313     
00314     String_256* GetDescription();
00315     
00316     static UINT32 AutomaticButtonID;
00317     static UINT32 GetNextAutomaticButtonID();
00318 
00319     // a search function that returns a pointer to the Button
00320     static Button* FindButton(UINT32 ButtonId);
00321     
00322     // Need a method of killing off all the Buttons at program end
00323     static void DestroyAll();
00324 
00325 /********************************************************************************************
00326 
00327 >   static Button* Button::GetFirstButton()
00328 
00329     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00330     Created:    13/10/93
00331     Purpose:    returns the first Button in the list
00332 
00333 ********************************************************************************************/
00334     static Button* GetFirstButton() 
00335     { 
00336         return (Button*) ButtonBar.GetHead(); 
00337     }
00338 
00339 
00340     
00341 /********************************************************************************************
00342 
00343 >   static Button* Button::GetNextButton( Button* CurrButton )
00344 
00345     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00346     Created:    13/10/93
00347     Inputs:     pointer to last Button return by GetFirst to GetNextButton
00348     Purpose:    return the next Button in the list
00349 
00350 ********************************************************************************************/
00351     static Button* Button::GetNextButton( Button* CurrButton )
00352     { 
00353         return (Button*) ButtonBar.GetNext( CurrButton ); 
00354     }
00355 
00356 /********************************************************************************************
00357 
00358 >   static UINT32 Button::GetNumberOfButtons()
00359 
00360     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00361     Created:    13/10/93
00362     Outputs:    Number of buttons on button bar
00363     Purpose:    returns the number of buttons on the button bar
00364 
00365 ********************************************************************************************/
00366     static UINT32 Button::GetNumberOfButtons()
00367     { 
00368         return NumberOfButtons; 
00369     }
00370 
00371 /********************************************************************************************
00372 
00373 >   static UINT32 Button::GetNumberOfSeparators()
00374 
00375     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00376     Created:    13/10/93
00377     Outputs:    Number of Separators on button bar
00378     Purpose:    returns the number of separators on the button bar
00379 
00380 ********************************************************************************************/
00381     static UINT32 Button::GetNumberOfSeparators()
00382     { 
00383         return NumberOfSeparators; 
00384     }
00385 
00386 /********************************************************************************************
00387 
00388 >   BOOL Button::IsFollowedBySeparator()
00389 
00390     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00391     Created:    13/10/93
00392     Returns:    TRUE if Button is followed by a separatorand FALSE otherwise
00393     Purpose:    Determines whether a button is followed by a separator on the Button bar
00394 
00395 ********************************************************************************************/
00396     BOOL Button::IsFollowedBySeparator()
00397     { 
00398         return FollowedBySeparator; 
00399     }
00400 
00401 /********************************************************************************************
00402 
00403 >   UINT32 Button::GetBitMapOffset()
00404 
00405     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00406     Created:    29/10/93
00407     Returns:    The Bitmap offset of the Button icon
00408     Purpose:    Determines the bitmap offset of the button's icon
00409 
00410 ********************************************************************************************/
00411     UINT32 Button::GetBitMapOffset()
00412     { 
00413         return BitMapOffset; 
00414     }
00415 
00416 private:          
00417 
00418 /********************************************************************************************
00419 
00420 >   static void Button::LinkButton( Button* ThisButton )
00421 
00422     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00423     Created:    13/10/93
00424     Inputs:     pointer to this Button
00425     Purpose:    Add the Button to the list of all Buttons
00426     Scope:      private
00427 
00428 ********************************************************************************************/
00429 
00430     static void Button::LinkButton( Button* ThisButton )
00431     { 
00432         ButtonBar.AddTail(ThisButton); 
00433     }
00434 
00435 };
00436 
00437 #endif
00438 
00439 #endif

Generated on Sat Nov 10 03:44:43 2007 for Camelot by  doxygen 1.4.4