1 /* 2 * Copyright (c) 1999-2000, Eric Moon. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions, and the following disclaimer. 11 * 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions, and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * 3. The name of the author may not be used to endorse or promote products 17 * derived from this software without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR 20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 26 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 27 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31 32 // DormantNodeListItem.h 33 // e.moon 2jun99 34 // 35 // * PURPOSE 36 // - represent a single dormant (add-on) media node in a 37 // list view. 38 // 39 // * HISTORY 40 // 22oct99 c.lenz complete rewrite 41 // 27oct99 c.lenz added tooltip support 42 43 #ifndef __DormantNodeListItem_H__ 44 #define __DormantNodeListItem_H__ 45 46 // Interface Kit 47 #include <Bitmap.h> 48 #include <Font.h> 49 #include <ListItem.h> 50 // Media Kit 51 #include <MediaAddOn.h> 52 53 #include "cortex_defs.h" 54 __BEGIN_CORTEX_NAMESPACE 55 56 class DormantNodeView; 57 class MediaIcon; 58 59 int compareName(const void *lValue, const void *rValue); 60 int compareAddOnID(const void *lValue, const void *rValue); 61 62 63 class DormantNodeListItem : 64 public BListItem { 65 typedef BListItem _inherited; 66 67 public: // *** constants 68 69 // [e.moon 26oct99] moved definition to DormantNodeListItem.cpp 70 // to appease the Metrowerks compiler. 71 static const float M_ICON_H_MARGIN; 72 static const float M_ICON_V_MARGIN; 73 74 public: // *** ctor/dtor 75 76 DormantNodeListItem( 77 const dormant_node_info &nodeInfo); 78 79 virtual ~DormantNodeListItem(); 80 81 public: // *** accessors 82 info()83 const dormant_node_info &info() const 84 { return m_info; } 85 86 public: // *** operations 87 88 void MouseOver( 89 BView *owner, 90 BPoint point, 91 uint32 transit); 92 93 BRect getRealFrame( 94 const BFont *font) const; 95 96 BBitmap *getDragBitmap(); 97 98 void showContextMenu( 99 BPoint point, 100 BView *owner); 101 102 public: // *** BListItem impl. 103 104 virtual void DrawItem( 105 BView *owner, 106 BRect frame, 107 bool drawEverything = false); 108 109 virtual void Update( 110 BView *owner, 111 const BFont *fFont); 112 113 protected: // *** compare functions 114 115 friend int compareName( 116 const void *lValue, 117 const void *rValue); 118 119 friend int compareAddOnID( 120 const void *lValue, 121 const void *rValue); 122 123 private: // *** data 124 125 dormant_node_info m_info; 126 127 BRect m_frame; 128 129 font_height m_fontHeight; 130 131 MediaIcon *m_icon; 132 }; 133 134 __END_CORTEX_NAMESPACE 135 #endif /*__DormantNodeListItem_H__*/ 136