home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / macfe / gui / CPersonalToolbarTable.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  4.1 KB  |  106 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. //
  20. // Interface for the table that is the main component of the personal toolbar.
  21. //
  22.  
  23. #pragma once
  24.  
  25. #include <LSmallIconTable.h>
  26. #include "ntypes.h"
  27. #include "CDynamicTooltips.h"
  28.  
  29. class CPersonalToolbarManager;
  30. class CUserButtonInfo;
  31.  
  32.  
  33. class CPersonalToolbarTable : public LSmallIconTable, public LListener, public LDragAndDrop,
  34.                                 public CDynamicTooltipMixin
  35. {
  36.     public:
  37.     
  38.         enum { class_ID = 'PerT', kTextTraitsID = 130 };
  39.         enum { kBOOKMARK_ICON = 15313, kFOLDER_ICON = -3999 };
  40.  
  41.         CPersonalToolbarTable ( LStream* inStream ) ;
  42.         virtual ~CPersonalToolbarTable ( ) ;
  43.  
  44.         // for handling mouse tracking
  45.         virtual void MouseLeave ( ) ;
  46.         virtual void MouseWithin ( Point inPortPt, const EventRecord& ) ;
  47.         virtual void Click ( SMouseDownEvent &inMouseDown ) ;
  48.  
  49.         virtual void FillInToolbar ( ) ;
  50.         
  51.         virtual void ListenToMessage ( MessageT inMessage, void* ioPtr ) ;
  52.         
  53.         // send data when a drop occurs
  54.         void DoDragSendData( FlavorType inFlavor, ItemReference inItemRef, DragReference inDragRef) ;
  55.         void ReceiveDragItem ( DragReference inDragRef, DragAttributes inDragAttrs,
  56.                                 ItemReference inItemRef, Rect &inItemBounds ) ;
  57.  
  58.         // calculate tooltip to display url text for the item mouse is over
  59.         virtual void FindTooltipForMouseLocation ( const EventRecord& inMacEvent,
  60.                                                     StringPtr outTip );
  61.                                                     
  62.         virtual void ResizeFrameBy ( Int16 inWidth, Int16 inHeight, Boolean inRefresh );
  63.  
  64.     protected:
  65.     
  66.         virtual void ClickCell(const STableCell    &inCell, const SMouseDownEvent &inMouseDown);
  67.         virtual Boolean ClickSelect( const STableCell &inCell, const SMouseDownEvent &inMouseDown);
  68.         virtual void FinishCreateSelf ( ) ;
  69.         virtual void DrawCell ( const STableCell &inCell, const Rect &inLocalRect ) ;
  70.         virtual void RedrawCellWithHilite ( const STableCell inCell, bool inHiliteOn ) ;
  71.  
  72.         // override to do nothing
  73.         virtual void HiliteSelection ( Boolean /*inActively*/, Boolean /*inHilite*/) { } ;
  74.         
  75.         // fetch cell data given a column #
  76.         CUserButtonInfo* GetButtonInfo ( Uint32 inColumn ) ;
  77.         
  78.         // drag and drop overrides for drop feedback, etc
  79.         void HiliteDropArea ( DragReference inDragRef );
  80.         Boolean ItemIsAcceptable ( DragReference inDragRef, ItemReference inItemRef ) ;
  81.         void InsideDropArea ( DragReference inDragRef ) ;
  82.         void DrawDividingLine ( TableIndexT inCol ) ;
  83.         void LeaveDropArea( DragReference inDragRef ) ;
  84.         bool FindBestFlavor ( DragReference inDragRef, ItemReference inItemRef, 
  85.                                 FlavorType & oFlavor ) ;
  86.  
  87.         virtual void ComputeItemDropAreas ( const Rect & inLocalCellRect, Rect & oLeftSide, 
  88.                                                 Rect & oRightSide ) ;
  89.         virtual void ComputeFolderDropAreas ( const Rect & inLocalCellRect, Rect & oLeftSide, 
  90.                                                 Rect & oRightSide ) ;
  91.  
  92.         virtual Rect ComputeTextRect ( const SIconTableRec & inText, const Rect & inLocalRect ) ;
  93.         virtual void RedrawCellWithTextClipping ( const STableCell & inCell ) ;
  94.  
  95.             // these are valid only during a D&D and are used for hiliting and determining
  96.             // the drop location
  97.         STableCell    mDraggedCell;
  98.         TableIndexT mDropCol;            // position where a drop will go
  99.         bool        mDropOn;            // are they on a folder?
  100.         Rect        mTextHiliteRect;    // cached rect drawn behind selected folder title
  101.         TableIndexT mHiliteCol;            // which column is mouse hovering over?
  102.  
  103.         static DragSendDataUPP sSendDataUPP;
  104.  
  105. }; // CPersonalToolbarTable
  106.