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