SGClipartItem Class Reference

A clipart gallery item. More...

#include <sglcart.h>

Inheritance diagram for SGClipartItem:

SGLibDisplayItem SGDisplayItem SGDisplayNode CCObject SimpleCCObject List of all members.

Public Member Functions

 SGClipartItem ()
 ~SGClipartItem ()
 SGClipartItem (LibraryIndex LibraryIndexToDisplay, BOOL bNew=FALSE)
 Creates and initialises a new item for the clipart gallery Notes:.
LibDisplayType GetDisplayType (SGMiscInfo *MiscInfo)
 Return the display type to use - clipart gallery override Notes:.

Protected Member Functions

virtual BOOL HandleEvent (SGEventType EventType, void *EventInfo, SGMiscInfo *MiscInfo)
 Handles a SuperGallery DisplayTree event.

Private Member Functions

 CC_DECLARE_DYNCREATE (SGClipartItem)

Detailed Description

A clipart gallery item.

Author:
Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/3/95
See also:
SGClipartItem

Definition at line 378 of file sglcart.h.


Constructor & Destructor Documentation

SGClipartItem::SGClipartItem  ) 
 

Definition at line 2648 of file sglcart.cpp.

02649 {
02650 }

SGClipartItem::~SGClipartItem  ) 
 

Definition at line 2652 of file sglcart.cpp.

02653 {
02654     TRACEUSER( "Matt", _T("~SGClipartItem called\n"));
02655 }

SGClipartItem::SGClipartItem LibraryIndex  LibraryIndexToDisplay,
BOOL  bNew = FALSE
 

Creates and initialises a new item for the clipart gallery Notes:.

Author:
Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/3/95
Parameters:
LibraryIndex - Offset into index file which describes this item [INPUTS]
[OUTPUTS] 
Returns:
See also:

Definition at line 2641 of file sglcart.cpp.

02641                                                                           :
02642     SGLibDisplayItem(LibraryIndexToDisplay, bNew)
02643 {
02644 }


Member Function Documentation

SGClipartItem::CC_DECLARE_DYNCREATE SGClipartItem   )  [private]
 

LibDisplayType SGClipartItem::GetDisplayType SGMiscInfo MiscInfo  )  [virtual]
 

Return the display type to use - clipart gallery override Notes:.

Author:
Richard_Millican (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/3/95
Parameters:
MiscInfo - Contains a few useful bits of info that may be [INPUTS] needed for all event types.
[OUTPUTS] 
Returns:
The display mode type to use (position of text, and size of thumb)
See also:

Reimplemented from SGLibDisplayItem.

Definition at line 2607 of file sglcart.cpp.

02608 {
02609     switch(MiscInfo->DisplayMode)
02610     {
02611         case 2:
02612             return LibDisplay_SmallThumbText;
02613             break;
02614         case 1:
02615             return LibDisplay_FullInfo;
02616             break;
02617         case 0:
02618         default:
02619             return LibDisplay_LargeThumbTextUnder;
02620             break;
02621     }
02622 
02623     return LibDisplay_LargeThumbTextUnder;
02624 }

BOOL SGClipartItem::HandleEvent SGEventType  EventType,
void *  EventInfo,
SGMiscInfo MiscInfo
[protected, virtual]
 

Handles a SuperGallery DisplayTree event.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/1/95 (base generated in sgbase.cpp)
Parameters:
EventType - An enumerated value describing what type of event is to be processed [INPUTS]
EventInfo - A structure describing the event (may be NULL). The exact thing pointed at by this pointer depends upon the event type:

MonoOn Event Thing EventInfo points at SGEVENT_FORMAT (SGFormatInfo *) SGEVENT_REDRAW (SGRedrawInfo *) SGEVENT_MOUSECLICK (SGMouseInfo *) MonoOff Use the provided SGDisplayNode::Get[Format]Info() inlines to retrieve this information - they provide useful error/type checking, and hide the cast

MiscInfo - always provided. Contains a few useful bits of info that may be needed for all event types.

Parameters:
FormatInfo is updated as appropriate [OUTPUTS]
Returns:
TRUE if the event was handled successfully FALSE if it was not
Notes: This overrides the pure virtual SGDisplayNode::HandleEvent method

A node need not handle a specific event - if it does not handle it, it should return FALSE.

Redraw and Formatting handlers should never return TRUE, as this will prevent the event from continuing through the tree.

Non-leaf-nodes must call SGDisplayNode::GiveEventToMyChildren in order to pass the event dow the tree. THIS node is a leaf-node, so it doesn't.

See also:
SGDisplayNode::HandleEvent

Reimplemented from SGLibDisplayItem.

Definition at line 2710 of file sglcart.cpp.

02711 {
02712     switch (EventType)
02713     {
02714         case SGEVENT_MOUSECLICK:
02715         {
02716             SGMouseInfo *Mouse = GetMouseInfo(EventType, EventInfo);
02717 
02718             if (Mouse != NULL && FormatRect.ContainsCoord(Mouse->Position))
02719             {   
02720                 if(LibClipartSGallery::DoSounds)
02721                 {
02722                     Library *Lib = GetParentLibrary();
02723                     if (Lib != NULL)
02724                     {
02725                         String_64 Key("Sample");
02726                         String_256 SampleString;
02727                         Lib->GetSingleField(TheLibraryIndex, &Key, &SampleString);
02728                         if(SampleString.Length() > 2)
02729                         {
02730                             String_256 SubPath = Lib->SubLibPath->GetPath();
02731                             BOOL Done = SGLibOil::PlayRandomSample(&SampleString, &SubPath);
02732                             ERROR3IF(!Done, "Problems playing sample");
02733                         }
02734                     }
02735                 }
02736 
02737                 INT32 XSize=0, YSize=0;
02738                 if(SGLibDisplayItem::StartDrag(EventType, EventInfo, MiscInfo, &XSize, &YSize))
02739                 {
02740                     GalleryClipartDragInfo *DragClipart;
02741                     DragClipart = new GalleryClipartDragInfo(this, Mouse, MiscInfo,
02742                                                         Mouse->MenuClick, XSize, YSize);
02743                     if (DragClipart != NULL)
02744                         DragManagerOp::StartDrag(DragClipart, GetListWindow());
02745                     else
02746                     {
02747                         if(LibClipartSGallery::TmpDraggingBitmap != NULL)
02748                         {
02749                             delete LibClipartSGallery::TmpDraggingBitmap;
02750                             LibClipartSGallery::TmpDraggingBitmap = NULL;
02751                         }
02752                     }
02753                 }
02754                 return TRUE;        // Claim this event - nobody else can own this click
02755             }
02756         }
02757     }
02758     
02759     return(SGLibDisplayItem::HandleEvent(EventType, EventInfo, MiscInfo));
02760 }


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:00:56 2007 for Camelot by  doxygen 1.4.4