sgname.h

Go to the documentation of this file.
00001 // $Id: sgname.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 // sgname.h - the NameGallery classes.
00099 
00100 /*
00101     $Log: /Camelot/kernel/sgname.h $
00102  * 
00103  * 2     16/07/99 18:06 Justinf
00104  * Now shows little circular blobs for adding sets to / subtracting sets
00105  * from the selection.
00106  * 
00107  * 1     24/06/99 16:23 Justinf
00108  * Name Gallery
00109 */
00110 
00111 #ifndef SGNAME_H
00112 #define SGNAME_H
00113 
00114 //#include "sgallery.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00115 //#include "sgtree.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00116 #include "sgdrag.h"
00117 #include "dragbmp.h"
00118 //#include "dragtrgt.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00119 
00120 #include "attrsets.h"
00121 
00122 
00123 /***********************************************************************************************
00124 >   class CCAPI NameGallery : public SuperGallery
00125 
00126     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> (Based on template code by Jason)
00127     Created:    27/1/95 (Based on the Colour SGallery code)
00128     Purpose:    The Name SuperGallery class
00129     Notes:      SuperGalleries are specced in a number of docs including
00130                     specs\sgallery.doc ("super" gallery extensions)
00131                     specs\propui.doc  (gallery basic ui)
00132                 There is also howtouse\sgallery.doc which describes creating a supergallery
00133     SeeAlso:    SuperGallery; SGDisplayName
00134 ***********************************************************************************************/
00135 
00136 class SGNameGroup;
00137 
00138 class CCAPI NameGallery : public SuperGallery
00139 {
00140 public:
00141     NameGallery();
00142     virtual ~NameGallery();
00143     virtual MsgResult Message(Msg* pMessage);
00144 
00145 protected:
00146     virtual BOOL PreCreate();
00147 
00148     virtual BOOL InitMenuCommands();
00149     virtual BOOL BuildCommandMenu(GalleryContextMenu* pMenu, SGMenuID id);
00150     virtual OpState GetCommandState(StringBase* pstrCommandID, String_256* pstrShadeReason);
00151     virtual void DoCommand(StringBase* pstrCommandID);
00152 
00153     virtual void SelectionHasChanged();
00154     virtual BOOL ApplyAction(SGActionType Action);
00155     
00156     virtual BOOL OnApply(SGNameGroup* pGroup, BOOL fIsAdjust);
00157     virtual BOOL OnCreate(SGNameGroup* pGroup);
00158     virtual BOOL OnRename(SGNameGroup* pGroup);
00159     virtual BOOL OnDelete(SGNameGroup* pGroup);
00160     virtual BOOL OnRedefine(SGNameGroup* pGroup);
00161     virtual BOOL OnUnname(SGNameGroup* pGroup);
00162 
00163     virtual SGNameGroup* CreateItems(Document* pParentDoc, SGNameGroup* pGroup);
00164     virtual BOOL GetNewName(SGNameGroup* pGroup, UINT32 nDialogTemplateID, String_256* pstrName);
00165     virtual void RefreshDocument(Document* pDoc);
00166     virtual BOOL OnIdleEvent();
00167 
00168 private:
00169     // Extension to the action codes already defined by the SuperGallery class.
00170     enum { SGACTION_UNNAME = SGACTION_UNDO + 1 };
00171 
00172     BOOL m_fMenusCreated;
00173     BOOL m_fIdleProc;
00174 
00175     CC_DECLARE_DYNCREATE(NameGallery)
00176 };
00177 
00178 
00179 
00180 /***********************************************************************************************
00181 >   class CCAPI SGNameGroup : public SGDisplayGroup
00182 
00183     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> (Based on template code by Jason)
00184     Created:    27/01/95
00185     Purpose:    A SuperGallery group of SGNameItems.  Records whether this group's display
00186                 needs to be updated on the next idle event because of a change to its
00187                 Document's named objects.
00188     SeeAlso:    NameGallery; SuperGallery; SGDisplayItem
00189 ***********************************************************************************************/
00190 
00191 class CCAPI SGNameGroup : public SGDisplayGroup
00192 {
00193 public:
00194     SGNameGroup(NameGallery* pParentGal, Document* pParentDoc = 0)
00195       : SGDisplayGroup(pParentGal, pParentDoc),
00196         m_fRefresh(FALSE)
00197             { Flags.CanSelect = TRUE; }
00198 
00199     // Call this to mark (or unmark) this group for refresh on the next idle event.
00200     void SetRefresh(BOOL fR = TRUE)
00201             { m_fRefresh = fR; }
00202     
00203     // Query whether this group needs to be refreshed and also reset its status.
00204     BOOL NeedsRefresh()
00205             { BOOL fR = m_fRefresh; m_fRefresh = FALSE; return fR; }
00206 
00207 private:
00208     BOOL m_fRefresh;
00209 };
00210 
00211 
00212 
00213 /***********************************************************************************************
00214 >   class CCAPI SGNameItem : public SGDisplayItem
00215 
00216     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com> (Based on template code by Jason)
00217     Created:    27/01/95
00218     Purpose:    This DisplayTree node is used by the Name SuperGallery
00219                 It is responsible for providing the ability to handle/redraw one NameItem
00220                 displayed in said gallery.
00221     SeeAlso:    NameGallery; SuperGallery; SGDisplayItem
00222 ***********************************************************************************************/
00223 
00224 class CCAPI SGNameItem : public SGDisplayItem
00225 {
00226 public:
00227     SGNameItem(const String_256& strName);
00228     
00229     virtual void GetNameText(String_256* pResult);
00230     virtual BOOL GetBubbleHelp(DocCoord* pMousePos, String_256* pResult);
00231     virtual BOOL GetStatusLineHelp(DocCoord* pMousePos, String_256* pResult);
00232     virtual BOOL HandleEvent(SGEventType EventType, void* pEventInfo,
00233                              SGMiscInfo* pMiscInfo);
00234     Document* GetDocument()
00235         { return ((SGDisplayGroup*) GetParent())->GetParentDocument(); }
00236 
00237 protected:
00238     virtual void CalculateMyRect(SGFormatInfo* pFormatInfo, SGMiscInfo* pMiscInfo);
00239     virtual void HandleRedraw(SGRedrawInfo* pRedrawInfo, SGMiscInfo* pMiscInfo);
00240     
00241 private:
00242     String_256 m_strSetName;
00243     AttributeSets::Intersect m_eIntersect;
00244     
00245     CC_DECLARE_DYNAMIC(SGNameItem);
00246 };
00247 
00248 
00249 
00250 /********************************************************************************************
00251 >   class CCAPI GalleryNameDragInfo : public BitmapDragInformation
00252 
00253     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00254     Created:    10/4/95
00255     Purpose:    A Wix ObjectName attribute drag, which was started from the Name gallery
00256     SeeAlso:    BitmapDragInformation           
00257 ********************************************************************************************/
00258 
00259 class TemplateAttribute;
00260 class DragTarget;
00261 class ViewDragTarget;
00262 
00263 class CCAPI GalleryNameDragInfo : public BitmapDragInformation
00264 { 
00265 public:
00266     // Creation & destruction.
00267     GalleryNameDragInfo();
00268     GalleryNameDragInfo(SGNameItem* pSourceItem, SGMouseInfo* pMouseInfo,
00269                         SGMiscInfo* pMiscInfo, TemplateAttribute* pAttrib,
00270                         BOOL fIsAdjust = FALSE);
00271     virtual ~GalleryNameDragInfo();
00272 
00273     // Click handling and user feedback.
00274     virtual void OnClick(INT32 nFlags, POINT ptClick);
00275     virtual UINT32 GetCursorID(DragTarget* pDragTarget);
00276     virtual BOOL GetStatusLineText(String_256* pText, DragTarget* pDragTarget);
00277 
00278     // Called when the drag ends over a view onto a document.
00279     virtual BOOL CanDropOnPage();
00280     virtual BOOL OnPageDrop(ViewDragTarget*);
00281 
00282     // Handlers for bitmap rendering during a drag.
00283     virtual INT32 GetDragTransparency();
00284     virtual KernelBitmap* GetSolidDragMask();
00285     
00286     SGNameItem* GetDraggedNameAttr()    { return m_pSourceItem; }
00287 
00288 private:
00289     SGNameItem*    m_pSourceItem;
00290     SGMouseInfo    m_MouseInfo;
00291     SGMiscInfo     m_MiscInfo;
00292     NodeAttribute* m_pAttrib;
00293 
00294     CC_DECLARE_DYNCREATE(GalleryNameDragInfo)
00295 };
00296 
00297 
00298 
00299 /*********************************************************************************************
00300 >   class CCAPI SGNameDragTarget : public SGListDragTarget
00301 
00302     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00303     Created:    10/4/95
00304     Purpose:    An instantiation of this class is created by each entity which wishes to 
00305                 provide a 'destination' to which the mouse can go to complete a drag.
00306                 This particular target is used for handling drags of NameGalllery items
00307                 within their displayed list. It automatically handles drags with draginfo
00308                 derived from BitmapDragInformation.
00309     Notes:      Drag targets are destroyed automatically when a drag finishes by the drag
00310                 manager with which they were registered.
00311                 To remove a drag target at any time, destroy it - it automatically deregisters
00312                 and cleans up.          
00313     SeeAlso:    SGListDragTarget; DragManagerOp::StartDrag; DragInformation; DragTarget;
00314                 SGBitmapDragTarget::ProcessEvent
00315 *********************************************************************************************/
00316 
00317 class CCAPI SGNameDragTarget : public SGListDragTarget
00318 {
00319 public:
00320     SGNameDragTarget();
00321     SGNameDragTarget(NameGallery* pGallery, CGadgetID idGadget = 0);
00322 
00323 protected:
00324     virtual BOOL ProcessEvent(DragEventType nEvent, DragInformation* pDragInfo,
00325                               OilCoord* pMousePos, KeyPress* pKeyPress);
00326 private:
00327     CC_DECLARE_DYNAMIC(SGNameDragTarget)
00328 };
00329 
00330 
00331 
00332 /********************************************************************************************
00333 >   class CCAPI OpDisplayNameGallery: public Operation
00334 
00335     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00336     Created:    9/2/95 (Based on the Colour SGallery code)
00337     Purpose:    Displays the Name gallery.  This op can be attached to a menu, button
00338                 or keypress.
00339     SeeAlso:    NameGallery
00340 ********************************************************************************************/
00341 
00342 #define OPTOKEN_DISPLAY_NAME_GALLERY    TEXT("DisplayNameGallery")
00343 
00344 class CCAPI OpDisplayNameGallery: public Operation
00345 {         
00346 public:
00347     static BOOL Init();             
00348     static OpState GetState(String_256*, OpDescriptor*);        
00349     void Do(OpDescriptor*);
00350 
00351 private:
00352     static DialogBarOp* FindGallery();
00353 
00354 private:
00355     CC_DECLARE_DYNCREATE(OpDisplayNameGallery);
00356 };  
00357 
00358 
00359 
00360 /********************************************************************************************
00361 >   class CCAPI NameObjectsDlg: public DialogOp
00362 
00363     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00364     Created:    20/6/94
00365     Purpose:    Runs a dialog which asks the user to enter a name for the selected objects.
00366 ********************************************************************************************/
00367 
00368 #define OPTOKEN_NAME_OBJECTS_DLG    TEXT("NameObjectsDlg")
00369 
00370 class CCAPI NameObjectsDlg : public DialogOp
00371 {         
00372 public:
00373     NameObjectsDlg();
00374     static BOOL Init();
00375     
00376     static OpState GetState(String_256*, OpDescriptor*);
00377     void DoWithParam(OpDescriptor*, OpParam*);
00378     MsgResult Message(Msg* Message);
00379 
00380 private:
00381     // Where to output the results of the dialog.
00382     String_256* m_pstrOutputName;
00383     BOOL* m_pfOkCancel; 
00384 
00385     CC_DECLARE_DYNCREATE(NameObjectsDlg)  
00386 }; 
00387 
00388 #endif  /* SGNAME_H */

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