sglfills.h

Go to the documentation of this file.
00001 // $Id: sglfills.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 // SGLFills.h - the Fills library gallery class
00099 
00100 
00101 #ifndef INC_SGLFILLS
00102 #define INC_SGLFILLS
00103 
00104 //#include "sgallery.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00105 //#include "sgtree.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00106 //#include "sgscan.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00107 #include "sglib.h"
00108 #include "dragbmp.h"
00109 #include "sgdrag.h"
00110 #include "scrcamvw.h"
00111 
00112 // LibraryGallery
00113 #include "sglbase.h"
00114 
00115 enum CALLRESULT {FAILURE = 0, SUCCESS, PENDING}; 
00116 
00117 /***********************************************************************************************
00118 
00119 >   class LibFillsSGallery : public LibraryGallery
00120 
00121     Author:     Richard_Millican (Xara Group Ltd) <camelotdev@xara.com> (Based on Clipart gallery code by Richard / Jason)
00122     Created:    23/3/95
00123     Purpose:    The LibFills SuperGallery class
00124 
00125     Notes:      SuperGalleries are specced in a number of docs including
00126                     specs\sgallery.doc ("super" gallery extensions)
00127                     specs\propui.doc  (gallery basic ui)
00128                 There is also howtouse\sgallery.doc which describes creating a supergallery
00129 
00130     SeeAlso:    SuperGallery; SGDisplayLibFills
00131 
00132 ***********************************************************************************************/
00133 
00134 class LibFillsSGallery : public LibraryGallery
00135 {
00136     CC_DECLARE_DYNCREATE(LibFillsSGallery)
00137 
00138 public:
00139     LibFillsSGallery();
00140     ~LibFillsSGallery();
00141 
00142     // TRUE if the SuperGallery is also a LibraryGallery & has no non-library groups
00143     virtual BOOL IsLibraryGalleryWithNonLibraryGroups(void) {return TRUE;};
00144 
00145 public:
00146 
00147     // Initialise the fills gallery
00148     static BOOL Init(void);
00149 
00150     // Fills gallery message handler
00151     virtual MsgResult Message(Msg* Message);
00152 
00153     // Can we search keywords ? Yes, I think we can
00154     virtual BOOL CanSearchKeywords(void);
00155 
00156 public:
00157     // These _MUST_ be overridden by LibraryGalleries
00158 
00159     // Can we create indexes ?
00160     virtual BOOL CanCreateIndexes(void);
00161 
00162     // Get various default bits 'n' pieces
00163     virtual BOOL GetDefaults(String_256 *DefaultIndex, String_256 *IndexDesc, SGLibType *Type);
00164 
00165     // Get the default CD directory name for the gallery
00166     virtual BOOL GetLibraryDirectoryName(String_256 *LibDirName);
00167 
00168     // Check the entry in the index.txt file with our gallery, and return TRUE if it's a match
00169     virtual BOOL CheckForIndexMatch(StringBase *Txt);
00170 
00171     // Returns the section name to use in the grm file
00172     virtual void WorkOutSectionName(String_256 *Section);
00173 
00174     // Get the quiet status of the gallery
00175     virtual BOOL GetQuietStatus(void);
00176 
00177     // Set the quiet status of the gallery
00178     virtual void SetQuietStatus(BOOL Status);
00179 
00180     // Scan for location of default CD library
00181     virtual BOOL ScanForLocation(SGLibType Type, StringBase *Result);
00182 
00183     // Return gallery type
00184     virtual SGLibType GetGalleryType() { return SGLib_Fractal;}
00185 
00186     virtual String_256* GetDefaultLibraryPath() {return &DefaultLibraryPath;}
00187 
00188     void SelectionHasChanged(void);
00189 
00190 protected:      // Overridden upcall methods
00191 
00192     void DoShadeGallery(BOOL ShadeIt);
00193 
00194     virtual BOOL PreCreate(void);
00195 
00196     virtual BOOL ApplyAction(SGActionType Action);
00197 
00198     // Override for creating fill library groups rather than display groups
00199     virtual SGDisplayGroup *AddLibraryGroup(Library *LibraryToDisplay, INT32 NumItems);
00200 
00201     // Adds an item to the given library display group
00202     // Must be overridden by derived galleries if they wish to handle Libraries
00203     virtual SGDisplayItem *AddLibraryItem(SGDisplayGroup *LibraryGroup, Library *ParentLib,
00204                                             LibraryIndex ItemIndex, BOOL bNew = FALSE);
00205 
00206     void HandleDragStart(DragMessage *DragMsg);
00207 
00208     // Use the currently selected item in the fills gallery to do a fill
00209     // of type FillType
00210     bool FillUsingFillGallerySelection(FillTypeEnum FillType);
00211 
00212 public:         // Overridden Command interface (for Ops and menu support)
00213     virtual BOOL InitMenuCommands(void);
00214         // Called on startup to initialise any desired menu commands. Will make repeated calls
00215         // to InitMenuCommand(), below.
00216 
00217     virtual BOOL BuildCommandMenu(GalleryContextMenu *TheMenu, SGMenuID MenuID);
00218         // Builds the command menu for the given menu pop-up (over an item, or options button)
00219 
00220     virtual OpState GetCommandState(StringBase *CommandID, String_256 *ShadeReason);
00221         // Returns an OpState indicating the state of this command, much like an Op GetState
00222 
00223     virtual void DoCommand(StringBase *CommandID);
00224         // Attempts to "do" the given command. Should call down to the base class to handle
00225         // any commands it can't deal with.
00226 
00227 
00228 protected:
00229     // Handle clicks on the browse button
00230     BOOL BrowseClicked(void);
00231 
00232     // Sort the entire gallery alphabetically
00233     void SortGallery(void);
00234 
00235     SGDisplayItem *CopyDisplayItem(SGDisplayItem *SourceItem, 
00236                                 SGDisplayGroup *DestGroup, SGDisplayItem *TargetPosition);
00237 
00238     KernelBitmap* GetSelectedBitmap(void);
00239 
00240 public:         // ini file options
00241     // Where to find the default library
00242     static String_256 DefaultLibraryPath;
00243 
00244     // For keeping the display modes constant when next loaded
00245     static INT32 DefaultDisplayMode;
00246 
00247     // For storing sort modes across quits
00248     static UINT32 DefaultSortKeys;
00249 
00250 public:
00251     // This gallery
00252     static LibFillsSGallery *ThisGallery;
00253 
00254     // Quiet status of the gallery
00255     static BOOL QuietStatus;
00256 };
00257                                   
00258 
00259 /********************************************************************************************
00260 
00261 >   class OpDisplayLibFillsGallery: public Operation
00262 
00263     Author:     Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
00264     Created:    23/3/95 (Based on the Clipart SGallery code)
00265 
00266     Purpose:    Displays the LibFills gallery.
00267                 This op can be attached to a menu, button or keypress
00268     SeeAlso:    LibFillsSGallery
00269 
00270 ********************************************************************************************/
00271 
00272 #define OPTOKEN_DISPLAYFILLSGALLERY _T("DisplayFillsGallery")
00273 
00274 class CCAPI OpDisplayLibFillsGallery: public Operation
00275 {         
00276     CC_DECLARE_DYNCREATE( OpDisplayLibFillsGallery );
00277 
00278 public:
00279     static BOOL     Init();             
00280     static OpState  GetState(String_256*, OpDescriptor*);       
00281     void            Do(OpDescriptor*);
00282 
00283 private:
00284     static DialogBarOp *FindGallery(void);
00285             // Finds the LibFills gallery class instance
00286 };  
00287 
00288 /********************************************************************************************
00289 
00290 >   class SGFillsItem: public SGLibDisplayItem
00291 
00292     Author:     Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
00293     Created:    23/3/95
00294 
00295     Purpose:    A fills gallery item
00296     SeeAlso:
00297     
00298 ********************************************************************************************/
00299 
00300 class SGFillsItem: public SGLibDisplayItem
00301 {         
00302     CC_DECLARE_DYNCREATE( SGFillsItem );
00303 public:
00304     SGFillsItem();
00305     ~SGFillsItem();
00306     SGFillsItem(LibraryIndex LibraryIndexToDisplay, BOOL bNew = FALSE);
00307     LibDisplayType GetDisplayType(SGMiscInfo *MiscInfo);
00308 
00309 protected:
00310     virtual BOOL HandleEvent(SGEventType EventType, void *EventInfo,
00311                              SGMiscInfo *MiscInfo);
00312 };
00313 
00314 /********************************************************************************************
00315 
00316 >   class GalleryFillsDragInfo : public BitmapDragInformation
00317 
00318     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
00319     Created:    8/4/95
00320     Purpose:    A fill drag, which was started from the fill gallery
00321     SeeAlso:    BitmapDragInformation
00322                 
00323 ********************************************************************************************/
00324 
00325 class GalleryFillsDragInfo : public BitmapDragInformation
00326 { 
00327     CC_DECLARE_DYNCREATE(GalleryFillsDragInfo)
00328  
00329 public:
00330     GalleryFillsDragInfo();
00331     ~GalleryFillsDragInfo();
00332     GalleryFillsDragInfo(   SGFillsItem *pSourceItem,
00333                             SGMouseInfo *pMouseInfo, SGMiscInfo *pMiscInfo,
00334                             BOOL IsAdjust = FALSE, INT32 XSize = 0, INT32 YSize = 0);
00335 
00336     virtual void OnClick(INT32 Flags, POINT Point);
00337 
00338     virtual UINT32 GetCursorID(DragTarget* pDragTarget);
00339     virtual BOOL GetStatusLineText(String_256 * TheText, DragTarget* pDragTarget);
00340 
00341     virtual BOOL CanDropOnPage() { return TRUE; };
00342     virtual BOOL OnPageDrop(ViewDragTarget*);
00343 
00344     SGFillsItem*    GetDraggedFill()    { return(SourceItem); }
00345 
00346 protected:
00347     SGFillsItem*            SourceItem;
00348     SGMouseInfo             MouseInfo;
00349     SGMiscInfo              MiscInfo;
00350 };
00351 
00352 
00353 
00354 /*********************************************************************************************
00355 
00356 >   class   SGFillsDragTarget : public SGListDragTarget
00357 
00358     Author:     Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
00359     Created:    8/4/95
00360 
00361     Purpose:    An instantiation of this class is created by each entity which wishes to 
00362                 provide a 'destination' to which the mouse can go to complete a drag.
00363 
00364                 This particular target is used for handling drags of BitmapSGalllery items
00365                 within their displayed list. It automatically handles drags with draginfo
00366                 derived from BitmapDragInformation.
00367 
00368     Notes:      Drag targets are destructed automatically when a drag finishes by the drag
00369                 manager with which they were registered.
00370 
00371                 To remove a drag target at any time, destruct it - it automatically deregisters
00372                 and cleans up.
00373                 
00374     SeeAlso:    DragManagerOp::StartDrag; DragInformation; DragTarget;
00375                 SGBitmapDragTarget::ProcessEvent
00376 
00377     Documentation:  Docs\Specs\DragMan.doc; Docs\HowToUse\SGallery.doc
00378 
00379 *********************************************************************************************/
00380 
00381 class SGFillsDragTarget : public SGListDragTarget
00382 {
00383 friend class DragManagerOp;
00384     
00385 CC_DECLARE_DYNAMIC(SGFillsDragTarget)
00386 
00387 public: // Public interface
00388     SGFillsDragTarget(DialogOp *TheDialog, CGadgetID TheGadget = NULL);
00389 
00390 protected:
00391         // Process a drag-related event
00392     virtual BOOL ProcessEvent(DragEventType Event,
00393                                 DragInformation *pDragInfo,
00394                                 OilCoord *pMousePos, KeyPress* pKeyPress);
00395 };
00396 
00397 
00398 #endif
00399 

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