1 /* 2 Open Tracker License 3 4 Terms and Conditions 5 6 Copyright (c) 1991-2000, Be Incorporated. All rights reserved. 7 8 Permission is hereby granted, free of charge, to any person obtaining a copy of 9 this software and associated documentation files (the "Software"), to deal in 10 the Software without restriction, including without limitation the rights to 11 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 12 of the Software, and to permit persons to whom the Software is furnished to do 13 so, subject to the following conditions: 14 15 The above copyright notice and this permission notice applies to all licensees 16 and shall be included in all copies or substantial portions of the Software. 17 18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY, 20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 22 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION 23 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 25 Except as contained in this notice, the name of Be Incorporated shall not be 26 used in advertising or otherwise to promote the sale, use or other dealings in 27 this Software without prior written authorization from Be Incorporated. 28 29 Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks 30 of Be Incorporated in the United States and other countries. Other brand product 31 names are registered trademarks or trademarks of their respective holders. 32 All rights reserved. 33 */ 34 #ifndef __RECENT_ITEMS_LIST__ 35 #define __RECENT_ITEMS_LIST__ 36 37 38 // BRecentItemsList classes allow creating an entire menu with 39 // recent files, folders, apps. If the user wishes to add items to 40 // their own menu, they can instead use the GetNextMenuItem call to 41 // get one menu at a time to add it to their app. 42 43 44 #include <Entry.h> 45 #include <Message.h> 46 #include <String.h> 47 48 49 class BMenuItem; 50 class BMenu; 51 52 class BRecentItemsList { 53 public: 54 BRecentItemsList(int32 maxItems, bool navMenuFolders); 55 // if <navMenuFolders> passed, folder items get NavMenu-style 56 // subdirectories attached to them 57 58 virtual ~BRecentItemsList() {} 59 60 virtual void Rewind(); 61 // resets the iteration 62 63 virtual BMenuItem* GetNextMenuItem(const BMessage* fileOpenMessage = NULL, 64 const BMessage* containerOpenMessage = NULL, 65 BHandler* target = NULL, entry_ref* currentItemRef = NULL); 66 // if <fileOpenMessage> specified, the item for a file gets a copy 67 // with the item ref attached as "refs", otherwise a default 68 // B_REFS_RECEIVED message message gets attached 69 // if <containerOpenMessage> specified, the item for a folder, volume 70 // or query gets a copy with the item ref attached as "refs", 71 // otherwise a default B_REFS_RECEIVED message message gets attached 72 // if <currentItemRef> gets passed, the caller gets to look at the 73 // entry_ref corresponding to the item 74 75 virtual status_t GetNextRef(entry_ref*); 76 77 protected: 78 BMessage fItems; 79 int32 fIndex; 80 int32 fMaxItems; 81 bool fNavMenuFolders; 82 83 private: 84 virtual void _r1(); 85 virtual void _r2(); 86 virtual void _r3(); 87 virtual void _r4(); 88 virtual void _r5(); 89 virtual void _r6(); 90 virtual void _r7(); 91 virtual void _r8(); 92 virtual void _r9(); 93 virtual void _r10(); 94 95 uint32 _reserved[20]; 96 }; 97 98 99 class BRecentFilesList : public BRecentItemsList { 100 public: 101 // use one of the two constructors to set up next item iteration 102 BRecentFilesList(int32 maxItems = 10, bool navMenuFolders = false, 103 const char* ofType = NULL, const char* openedByAppSig = NULL); 104 BRecentFilesList(int32 maxItems, bool navMenuFolders, 105 const char* ofTypeList[], int32 ofTypeListCount, 106 const char* openedByAppSig = NULL); 107 virtual ~BRecentFilesList(); 108 109 // use one of the two NewFileListMenu calls to get an entire menu 110 static BMenu* NewFileListMenu(const char* title, 111 BMessage* openFileMessage = NULL, BMessage* openFolderMessage = NULL, 112 BHandler* target = NULL, 113 int32 maxItems = 10, bool navMenuFolders = false, 114 const char* ofType = NULL, const char* openedByAppSig = NULL); 115 116 static BMenu* NewFileListMenu(const char* title, 117 BMessage* openFileMessage, BMessage* openFolderMessage, 118 BHandler* target, 119 int32 maxItems, bool navMenuFolders, 120 const char* ofTypeList[], int32 ofTypeListCount, 121 const char* openedByAppSig); 122 123 virtual status_t GetNextRef(entry_ref*); 124 125 protected: 126 BString fType; 127 char** fTypes; 128 int32 fTypeCount; 129 BString fAppSig; 130 131 private: 132 virtual void _r11(); 133 virtual void _r12(); 134 virtual void _r13(); 135 virtual void _r14(); 136 virtual void _r15(); 137 virtual void _r16(); 138 virtual void _r17(); 139 virtual void _r18(); 140 virtual void _r19(); 141 virtual void _r110(); 142 143 uint32 _reserved[20]; 144 }; 145 146 147 class BRecentFoldersList : public BRecentItemsList { 148 public: 149 // use the constructor to set up next item iteration 150 BRecentFoldersList(int32 maxItems, bool navMenuFolders = false, 151 const char* openedByAppSig = NULL); 152 153 // use NewFolderListMenu to get an entire menu 154 static BMenu* NewFolderListMenu(const char* title, 155 BMessage* openMessage = NULL, BHandler* target = NULL, 156 int32 maxItems = 10, bool navMenuFolders = false, 157 const char* openedByAppSig = NULL); 158 159 virtual status_t GetNextRef(entry_ref*); 160 161 protected: 162 BString fAppSig; 163 164 private: 165 virtual void _r21(); 166 virtual void _r22(); 167 virtual void _r23(); 168 virtual void _r24(); 169 virtual void _r25(); 170 virtual void _r26(); 171 virtual void _r27(); 172 virtual void _r28(); 173 virtual void _r29(); 174 virtual void _r210(); 175 176 uint32 _reserved[20]; 177 }; 178 179 180 class BRecentAppsList : public BRecentItemsList { 181 public: 182 // use the constructor to set up next item iteration 183 BRecentAppsList(int32 maxItems); 184 185 // use NewFolderListMenu to get an entire menu 186 static BMenu* NewAppListMenu(const char* title, 187 BMessage* openMessage = NULL, BHandler* target = NULL, 188 int32 maxItems = 10); 189 190 virtual status_t GetNextRef(entry_ref*); 191 192 private: 193 virtual void _r31(); 194 virtual void _r32(); 195 virtual void _r33(); 196 virtual void _r34(); 197 virtual void _r35(); 198 virtual void _r36(); 199 virtual void _r37(); 200 virtual void _r38(); 201 virtual void _r39(); 202 virtual void _r310(); 203 204 uint32 _reserved[20]; 205 }; 206 207 #endif // __RECENT_ITEMS_LIST__ 208