gallery.h

Go to the documentation of this file.
00001 // $Id: gallery.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 // This file is the header file for the gallery classes
00099 
00100 #ifndef INC_GALLERY
00101 #define INC_GALLERY
00102 
00103 #if FALSE
00104 // GALLERIES ARE DEFUNCT - SEE SuperGallery INSTEAD
00105 
00106 //#include "bars.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00107 //#include "document.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00108 #include "ordlist.h"
00109 
00110 
00111 /********************************************************************************************
00112 
00113 >   class GalleryBodge : public CC_CLASS_MEMDUMP
00114 
00115     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
00116     Created:    22/6/94
00117     Purpose:    A bodge prototype pure virtual class. This should not be derived in this way.    
00118 
00119 ********************************************************************************************/
00120 
00121 // Your class definition in here, eg
00122 // This is a dummy definition - please ignore. Soon to be deleted
00123 class GalleryBodge : public CC_CLASS_MEMDUMP
00124 {
00125     // Give my name in memory dumps
00126     // If you need a different sort of decare, replace this one. 
00127     // See CCObject in the help file for info about DECLARE types
00128     CC_DECLARE_MEMDUMP(GalleryBodge);
00129     
00130 public:
00131     // Add some functions here
00132 
00133     // Add some vars here
00134 };
00135 
00136 
00137 
00138 /***********************************************************************************************
00139 
00140 >   class GalleryDisplayListPtr : public ListItem
00141 
00142     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00143     Created:    1/8/94
00144     Purpose:    The Gallery class provides a mechanism for all derived classes to use to
00145                 store a cached DisplayList in each document.
00146                 This is achieved using a list of GalleryDisplayListPtr's held in
00147                 the Document object, for which the Gallery provides management
00148                 access functions.
00149     Scope:      private to Gallery
00150     SeeAlso:    Gallery
00151 
00152 ***********************************************************************************************/
00153 
00154 class GalleryDisplayListPtr : public ListItem
00155 {
00156     friend class Gallery;
00157 
00158     CC_DECLARE_MEMDUMP(GalleryDisplayListPtr);
00159 
00160 public:
00161     GalleryDisplayListPtr(OrderedList *ListPtr);
00162     ~GalleryDisplayListPtr();
00163 
00164 protected:      // Only available from within Gallery and derivatives
00165     OrderedList *DisplayList;   
00166 };
00167 
00168 
00169 
00170 /***********************************************************************************************
00171 
00172 >   class GalleryDisplayItem : public ListItem
00173 
00174     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00175     Created:    12/7/94
00176     Purpose:    This list item is used by the gallery to keep tabs on the real
00177                 item displayed in a gallery. An OrderedList Sequence will contain
00178                 SequenceItems that point at GalleryDisplayItems. Thus, by a double
00179                 dereference from the original SequenceItem, one can find the actual
00180                 item data related to the displayed Gallery ListBox item.
00181     Scope:      private middle-man data structure used by the Gallery class
00182     SeeAlso:    Gallery
00183 
00184 ***********************************************************************************************/
00185 
00186 class GalleryDisplayItem : public ListItem
00187 {
00188     friend class Gallery;
00189 
00190     CC_DECLARE_MEMDUMP(GalleryDisplayItem);
00191 
00192 public:
00193     GalleryDisplayItem();
00194     GalleryDisplayItem(ListItem *TheRealItem);
00195 
00196     inline ListItem *GetRealItem(void);
00197     inline BOOL     IsSelected(void);
00198     inline void     SetSelected(BOOL IsSelected);
00199 
00200 private:
00201     ListItem *RealItem;         // Pointer to the actual item we are displaying
00202     BOOL     Selected;          // TRUE if this item is selected in the gallery listbox
00203 };
00204 
00205 
00206 
00207 /***********************************************************************************************
00208 
00209 >   inline ListItem *GalleryDisplayItem::GetRealItem(void)
00210 
00211     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00212     Created:    12/7/94
00213     Returns:    A pointer to the real item
00214     Purpose:    Dereferences a GalleryDisplayItem in order to find the real item 
00215                 to which it refers.
00216     Scope:      private middle-man used by the Gallery class
00217     SeeAlso:    Gallery::FindRealItem
00218 
00219 ***********************************************************************************************/
00220 
00221 ListItem *GalleryDisplayItem::GetRealItem(void)
00222 {
00223     return(RealItem);
00224 }                        
00225 
00226 
00227 
00228 /***********************************************************************************************
00229 
00230 >   inline BOOL GalleryDisplayItem::IsSelected(void)
00231 
00232     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00233     Created:    12/7/94
00234     Returns:    TRUE if this item is selected
00235     Purpose:    Determines the selection state of a display list item
00236     Scope:      private middle-man used by the Gallery class
00237     SeeAlso:    GalleryDisplayItem::SetSelected
00238 
00239 ***********************************************************************************************/
00240 
00241 BOOL GalleryDisplayItem::IsSelected(void)
00242 {
00243     return(Selected);
00244 }                        
00245 
00246 
00247 
00248 /***********************************************************************************************
00249 
00250 >   inline void GalleryDisplayItem::SetSelected(BOOL IsSelected)
00251 
00252     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00253     Created:    12/7/94
00254     Purpose:    Sets the selection state of a GalleryDisplayItem
00255     Scope:      private middle-man used by the Gallery class
00256     SeeAlso:    GalleryDisplayItem::IsSelected
00257 
00258 ***********************************************************************************************/
00259 
00260 void GalleryDisplayItem::SetSelected(BOOL IsSelected)
00261 {
00262     Selected = IsSelected;
00263 }                        
00264 
00265 
00266 
00267 
00268 
00269 /********************************************************************************************
00270 
00271 >   class Gallery : public DialogBarOp
00272 
00273     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>, Jason
00274     Created:    22/6/94
00275     Purpose:    The kernel version of the gallery.   
00276 
00277 ********************************************************************************************/
00278 
00279 
00280 class GalleryDisplayDlg;        // Pre declare. See below.
00281 
00282 class Gallery : public DialogBarOp
00283 {
00284 friend class GalleryDisplayDlg;
00285 
00286     CC_DECLARE_DYNCREATE( Gallery )
00287 
00288 public:             // Constructors/Destructors
00289     Gallery(CCRuntimeClass* Class = NULL);
00290     Gallery(String_32& NewName,CCRuntimeClass* Class = NULL);
00291     ~Gallery();
00292 
00293 
00294 public:             // Dialogue operations on Galleries
00295     BOOL Create(void);
00296     void SetGallerySize(CSize Size)
00297                     { GallerySize = Size; };
00298 
00299     CSize GetGallerySize(void)
00300                     { return GallerySize; };
00301 
00302     void ShadeGallery(void);
00303     void UnshadeGallery(BOOL UnshadeIt = TRUE);
00304 
00305     BOOL            Write(CCLexFile& file); // Override DialogBarOp read function
00306 
00307 protected:
00308     BOOL IsShaded;  // Current shaded/unshaded status
00309 
00310 
00311 protected:          // Private dialogue/Bar handlers for galleries
00312     CSize GallerySize;
00313     
00314 
00315 public:             // Message handlers
00316     MsgResult Message(Msg *Message);
00317         // If you override Message, you must pass msgs on to Gallery::Message
00318 
00319     inline Document *GetGalleryDocument(void);
00320 
00321 
00322 public:             // Display list handlers - available to external users & galleries
00323     DWORD GetDisplayedItemCount(void);
00324     inline SequenceItem *FindFirstDisplayed(void);
00325     inline SequenceItem *FindLastDisplayed(void);
00326     inline SequenceItem *FindNextDisplayed(SequenceItem *CurItem);
00327     inline SequenceItem *FindPreviousDisplayed(SequenceItem *CurItem);
00328 
00329     ListItem *FindRealItem(SequenceItem *DisplayItem);
00330 
00331 
00332 protected:          // Display List handlers - used by derived classes only
00333     ListItem *FindRealItem(GalleryDisplayItem *DisplayItem);
00334 
00335     SequenceItem *FindSequenceItem(ListItem *TheItem);
00336 
00337     DWORD GetSelectedItemCount(void);
00338     SequenceItem *FindFirstSelected(void);
00339     SequenceItem *FindLastSelected(void);
00340     SequenceItem *FindNextSelected(SequenceItem *CurItem);
00341     SequenceItem *FindPreviousSelected(SequenceItem *CurItem);
00342 
00343     void DeselectAllItems(void);
00344     void SetDisplayItemSelState(SequenceItem *TheItem, BOOL IsSelected);
00345     void SetDisplayItemSelState(INT32 ItemIndex, BOOL IsSelected);
00346 
00347 
00348     BOOL AddItemToDisplay(ListItem *TheItem);
00349         // Adds the given item to the display list, returning TRUE for success
00350         // If you wish to find the newly added item in the display list, you must
00351         // then call FindSequenceItem()
00352 
00353     BOOL AddListToDisplay(List *TheList);
00354         // Adds all items in the given list to the display list, returning TRUE if it
00355         // succeeds. As the items may be spread apart due to the display sorting
00356         // it cannot return where in the list the items have been placed.
00357     
00358     BOOL RemoveItemFromDisplay(SequenceItem *TheSeqItem);
00359     BOOL RemoveItemFromDisplay(ListItem *TheItem);
00360         // Deletes the DisplayItem referring to this item, removing it from the display
00361         // DOES NOT delete the master item
00362 
00363     void RemoveAllItemsFromDisplay(void);
00364         // As RemoveItemFromDisplay, but removes ALL items (clears the display)
00365 
00366     void ForceRedrawOfList(void);
00367         // re-paints the gallery list box to show the new gallery information
00368 
00369     void ForceRedrawOfItem(SequenceItem* pSeqItem);
00370         // re-paints the gallery list item 
00371 
00372     void ForceRedrawOfItem(INT32 Index);
00373         // re-paints the gallery list item 
00374 
00375     
00376 protected:          // Display List caching support
00377     BOOL AddDisplayListToDoc(Document *ScopeDoc, OrderedList *NewList);
00378         // Adds the given list (or creates one if it's NULL) to the list of cached
00379         // Gallery displaylists held in the Document. Used to cache derived gallery
00380         // DisplayLists in each document.
00381 
00382     void DeleteDisplayListFromDoc(Document *ScopeDoc);
00383         // Removes a DisplayList from the document DisplayList cache
00384 
00385     OrderedList *FindDisplayListInDoc(Document *ScopeDoc);
00386         // Finds a derived gallery's DisplayList from a document's DisplayList cache.
00387 
00388 
00389     inline OrderedList *GetCurrentDisplayList(void);
00390 
00391     void SelectDisplayList(OrderedList *NewDisplayList);
00392         // Selects the given list as the new displaylist for the gallery
00393 
00394     void SelectMyDocDisplayList(Document *ScopeDoc);
00395         // Selects the appropriate cached DisplayList fromt the GalleryDocument
00396         // as the new current DisplayList
00397 
00398 
00399 private:            // Internal (private) DisplayList caching support
00400     void RescanSelection(void);
00401         // Scans the list box, setting the DisplayList selection-state cache to echo the
00402         // current selection state. Intended only for internal use
00403 
00404     void SetSelectionFromDisplayList(void);
00405         // Tells the gallery to update the selection state of the list box from the current
00406         // DisplayList selection-state cache. Intended only for internal use
00407 
00408 
00409 protected:          // Gallery Display Dialogue information - current display mode
00410     UINT32 CurrentDisplayMode;
00411 
00412             
00413 private:            // Gallery sort mode information
00414     static INT32 SortFunction(OrderedList *Parent, ListItem *Item1, ListItem *Item2);
00415         // This generic method takes the specific instance's GallerySortKey and
00416         // provides a sort comparator operation with it. The Sort Mode is stored
00417         // as an array of SortKeys in the OrderedList passed to the sort function.
00418 
00419 
00420 protected:          // Derived class interface - called by Gallery base class
00421     virtual BOOL PreCreate(void);
00422     virtual BOOL PostCreate(void);
00423         // Initialise display-related stuff before/after the window is created
00424 
00425     virtual BOOL DoRedrawAnItem(ListItem *Item, BOOL Large, UINT32 DisplayMode);
00426         // Redraws the given item appropriately for large/small mode, and
00427         // using the given derived class DisplayMode (see DoDisplayMode... below)
00428         // returns TRUE if it redrew successfully
00429 
00430     virtual BOOL PrepareToDelete(void);
00431         // returns TRUE if the selection can be deleted, or FALSE if not
00432         // May alter the selection as appropriate (after getting user confirmation)
00433 
00434     virtual BOOL DoDeleteSelection(void);
00435         // Force-deletes anything still remaining in the selection
00436         // returns TRUE if successful
00437 
00438     virtual ListItem *DoCreateNewItem(ListItem *BasedOn);
00439         // Applies the appropriate action to create a new item, based upon the
00440         // given item (or if that is NULL, the attribute applied to the document
00441         // selection, or a default). Returns the new item.
00442 
00443     virtual void DoApplyItem(ListItem *ItemToApply);
00444         // Applies the appropriate action to apply the selected item to the document
00445 
00446     virtual BOOL DoRedefineItem(ListItem *ItemToRedefine);
00447         // Redefines the given item (allow the user to edit it for example)
00448         // Returns FALSE if the value of the item definitely has not changed
00449         // Returns TRUE if the item has changed, or if it is unknown whether it was changed
00450 
00451     virtual void DoSpecialClick(ListItem *ClickedItem);
00452         // Handles a special (alt-)click on a list item. This is generally used as a short-
00453         // cut to bring up an editor on the clicked item, but the exact interpretation is
00454         // left to the derived gallery to decide.
00455 
00456     virtual StringBase *GetItemText(ListItem *TheItem);
00457         // Returns NULL, or a pointer to the text to use in the listbox.
00458         // This is an early development aid while we're waiting for the advent
00459         // of proper user-redraw.
00460 
00461     virtual void SortModeHasBeenChanged(BOOL SetDerivedSortsToo);
00462         // Called when the display dialogue has set a new sort mode, to make the
00463         // Gallery (and related entities) redisplay its list in the new order.
00464         // Note that the base class method for this MUST be calleded in derivations
00465 
00466     virtual BOOL DoSetDisplayModes(GalleryDisplayDlg *TheDialogue);
00467         // Called to set up the display mode combo box (large icons, full info etc)
00468         // This will call TheDialogue->SetDisplayModeName repeatedly to set all
00469         // available modes. Returns FALSE if there are no display modes.
00470 
00471     virtual void DoDisplayModeChange(UINT32 NewDisplayMode);
00472         // Called when the user has chosen a display mode, with the index of the
00473         // mode in the given list. You should not need to take action here, as
00474         // the display mode is passed through to RedrawAnItem, but this is called
00475         // in case you wish to cache values before redraw...
00476 
00477     virtual void DoShowMenu(void);
00478         // Pops up the Gallery menu
00479         // Menu choices will be handled by the derived class through the Ops system
00480         // or message handlers - the base class knows nothing of this process.
00481 
00482     virtual BOOL SetAlsoButton(String_64 *TextToPutIn);
00483         // Called to set up the generic Gallery Display dialogue
00484         // Returns FALSE if no 'also set the sort mode for the xxxx' button is wanted
00485         // Returns TRUE, and fills in the text with an appropriate string if 
00486         // a button is wanted. See the ColourGallery for an example.
00487 
00488     virtual void DoSelectionChanged();
00489         // A selection changed message has occurred on the gallery list
00490         // This is called after the gallery has rescanned the list, so it is up to date
00491         // when you receive this call
00492 
00493     virtual void DoShadeGallery(BOOL ShadeIt);
00494         // Called by Gallery::ShadeGallery or UnshadeGallery to allow the derived
00495         // gallery to add code to shade/unshade any extra controls it may have in
00496         // its window
00497 
00498 
00499 protected:          // Supplied methods to support DerivedGallery redraw of items
00500     void PaintText(INT32 XOffset, INT32 YOffset, StringBase *TheText);
00501 
00502 
00503 private:            // General data members - only accessible through veneer functions
00504     OrderedList *DisplayList;           // The OrderedList of display items
00505     List        *DisplaySequence;       // The sorted display sequence of the OrdList
00506                                         // (this is permanently selected)
00507 
00508 private:            // Private winoil interface and related subroutines
00509     void ApplyApplyItem(void);
00510     void ApplyNewItem(void);
00511     void ApplyRedefineItem(void);
00512     void ApplyDeleteSelection(void);
00513     void ApplyUndo(void);
00514     void ApplyGalleryMenu(void);
00515     void ApplySpecialClick(void);
00516 
00517     INT32 CalculateListIndex(SequenceItem *TheItem);
00518         // Given an item, determine its index in the DisplayList
00519 
00520     SequenceItem *FindItemByIndex(INT32 ItemIndex);
00521         // Given an index into the DisplayList, find the item to which that refers
00522 
00523     inline void EnsureDisplaySequence(void);
00524 };
00525 
00526 
00527 
00528 /***********************************************************************************************
00529 
00530 inline OrderedList *Gallery::GetCurrentDisplayList(void)
00531 
00532     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00533     Created:    3/8/94
00534     Returns:    NULL, or a pointer to the current gallery DisplayList
00535     Purpose:    To find the current display list. This should only be necessary
00536                 for code that checks/sets the DisplayList on document changes.
00537 
00538 ***********************************************************************************************/
00539 
00540 OrderedList *Gallery::GetCurrentDisplayList(void)
00541 {
00542     return(DisplayList);
00543 }
00544 
00545 
00546 
00547 /***********************************************************************************************
00548 
00549 >   Document *Gallery::GetGalleryDocument(void)
00550 
00551     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00552     Created:    18/7/94
00553     Returns:    NULL, or a pointer to the Gallery doc 
00554     Purpose:    Finds the document from which all Galleries display information.
00555                 This currently corresponds to the Selected document, but you should
00556                 use this call to determine the doc so that any scheme can be
00557                 implemented if/whenever we feel like it.
00558 
00559 ***********************************************************************************************/
00560 
00561 Document *Gallery::GetGalleryDocument(void)
00562 {
00563     return(Document::GetSelected());
00564 }
00565 
00566 
00567 
00568 /***********************************************************************************************
00569 
00570 >   inline SequenceItem *Gallery::FindFirstDisplayed(void)
00571 
00572     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00573     Created:    12/7/94
00574     Returns:    NULL, or a pointer to the first item
00575     Purpose:    Finds the first item displayed in the Gallery.
00576                 This uses the current gallery display order, so this is the item
00577                 displayed at the top of the list box.
00578     SeeAlso:    Gallery::FindLastDisplayed; Gallery::FindNextDisplayed; 
00579                 Gallery::FindPreviousDisplayed; Gallery::GetDisplayedItemCount
00580 
00581 ***********************************************************************************************/
00582  
00583 SequenceItem *Gallery::FindFirstDisplayed(void)
00584 {
00585     EnsureDisplaySequence();
00586     return( (SequenceItem *) DisplaySequence->GetHead() );
00587 }
00588 
00589 
00590 
00591 /***********************************************************************************************
00592 
00593 >   inline SequenceItem *Gallery::FindLastDisplayed(void)
00594 
00595     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00596     Created:    12/7/94
00597     Returns:    NULL, or a pointer to the last displayed item
00598     Purpose:    Finds the last item displayed in the gallery
00599                 This uses the current gallery display order, so this is the item
00600                 displayed at the bottom of the list box.
00601     SeeAlso:    Gallery::FindFirstDisplayed; Gallery::FindNextDisplayed; 
00602                 Gallery::FindPreviousDisplayed; Gallery::GetDisplayedItemCount
00603 
00604 ***********************************************************************************************/
00605  
00606 SequenceItem *Gallery::FindLastDisplayed(void)
00607 {
00608     EnsureDisplaySequence();
00609     return( (SequenceItem *) DisplaySequence->GetTail() );
00610 }
00611 
00612 
00613 
00614 /***********************************************************************************************
00615 
00616 >   inline SequenceItem *Gallery::FindNextDisplayed(SequenceItem *CurItem)
00617 
00618     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00619     Created:    12/7/94
00620     Inputs:     CurItem - The current position in the list
00621     Returns:    NULL (if have passed the last item), or a pointer to the next
00622                 item in the current display ordering.
00623     Purpose:    Given a displayed gallery item, finds the next item in the display
00624     SeeAlso:    Gallery::FindFirstDisplayed; Gallery::FindLastDisplayed;
00625                 Gallery::FindPreviousDisplayed
00626 
00627 ***********************************************************************************************/
00628  
00629 SequenceItem *Gallery::FindNextDisplayed(SequenceItem *CurItem)
00630 {
00631     ENSURE(DisplaySequence != NULL, "Gallery DisplaySequence is NULL!");
00632     return( (SequenceItem *) DisplaySequence->GetNext(CurItem) );
00633 }
00634 
00635 
00636 
00637 /***********************************************************************************************
00638 
00639 >   inline SequenceItem *Gallery::FindPreviousDisplayed(SequenceItem *CurItem)
00640 
00641     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00642     Created:    12/7/94
00643     Inputs:     CurItem - The current position in the list
00644     Returns:    NULL (if have passed the first item), or a pointer to the previous
00645                 item in the current display ordering.
00646     Purpose:    Given a displayed gallery item, finds the previous item in the display
00647     SeeAlso:    Gallery::FindFirstDisplayed; Gallery::FindLastDisplayed;
00648                 Gallery::FindNextDisplayed
00649 
00650 ***********************************************************************************************/
00651  
00652 SequenceItem *Gallery::FindPreviousDisplayed(SequenceItem *CurItem)
00653 {
00654     ENSURE(DisplaySequence != NULL, "Gallery DisplaySequence is NULL!");
00655     return( (SequenceItem *) DisplaySequence->GetPrev(CurItem) );
00656 }
00657 
00658 
00659 
00660 /***********************************************************************************************
00661 
00662 >   void Gallery::EnsureDisplaySequence(void)
00663 
00664     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00665     Created:    18/10/94
00666     Purpose:    Ensures that the DisplaySequence member variable is up to date, and points
00667                 at the current display sequence for the gallery.
00668     Scope:      private
00669 
00670 ***********************************************************************************************/
00671 
00672 void Gallery::EnsureDisplaySequence(void)
00673 {
00674     if (DisplayList != NULL && DisplaySequence == NULL)
00675         DisplaySequence = DisplayList->SelectOrder(SortFunction, FALSE);
00676 
00677     ERROR3IF(DisplaySequence == NULL, "Unable to select a valid DisplaySequence!\n");
00678 }
00679 
00680 
00681 
00682 
00683 
00684 
00685 // Sort information for the gallery display dialogue. Holds the currently selected
00686 // sort keys, plus the control IDs of the lists/check boxes which display these
00687 // modes in the dialogue. An array of these is used to store MaxSortKeys of these
00688 // structures, one per sort key.
00689 
00690 typedef struct
00691 {
00692     SortKey Key;
00693     UINT32  ListControlID;
00694     UINT32  CheckControlID;
00695 } GalSortInfo;
00696 
00697 
00698 
00699 /***********************************************************************************************
00700 
00701 >   class GalleryDisplayDlg : public DialogOp
00702 
00703     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00704     Created:    18/5/94 (Colour Sort Dialogue -> Gallery Display Dialogue 21/7/94)
00705     Purpose:    A dialogue box allowing the user to set the display options (size
00706                 and sort mode) for its parent Gallery display list.
00707     SeeAlso:    Gallery
00708 
00709 ***********************************************************************************************/
00710 
00711 #define OPTOKEN_GALDISPLAYDLG _T("GalDisplayDialog")
00712 
00713 
00714 class GalleryDisplayDlg : public DialogOp
00715 {
00716     CC_DECLARE_DYNCREATE(GalleryDisplayDlg)
00717 
00718 public:
00719     GalleryDisplayDlg();
00720 
00721     MsgResult Message(Msg *Message);
00722 
00723     void Do(OpDescriptor*);
00724     static BOOL Init();
00725     BOOL Create();
00726     static OpState GetState(String_256*, OpDescriptor*);
00727 
00728     static const UINT32 IDD;
00729 
00730     static const CDlgMode Mode;
00731 
00732     void SetParentGallery(Gallery *Parent);
00733 
00734     void SetDisplayModeName(StringBase *EntryName);
00735         // Called by derived gallery from DoSetDisplayMode() function to set each
00736         // entry in turn of their display mode combobox list.
00737 
00738 protected:
00739     Gallery *ParentGallery;
00740 
00741     static GalSortInfo GallerySorts[MaxSortKeys];
00742 
00743     void InitValues(void);
00744     void SetControls(void);
00745     void SetSortMode(void);
00746 
00747     static ComparatorInfo *FindCIFromName(List *Sorts, StringBase &Name);
00748     static INT32 FindIndexFromCI(List *Sorts, INT32 SortInfoIndex);
00749 };
00750 
00751 #endif  // if FALSE
00752 
00753 #endif  // INC_GALLERY

Generated on Sat Nov 10 03:45:25 2007 for Camelot by  doxygen 1.4.4