btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / kits / tracker / FavoritesMenu.h
blobec365c7c039539c6492b1973242b82c2343f553c
1 /*
2 Open Tracker License
4 Terms and Conditions
6 Copyright (c) 1991-2000, Be Incorporated. All rights reserved.
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:
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.
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.
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.
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.
34 #ifndef _FAVORITES_MENU_H
35 #define _FAVORITES_MENU_H
38 #include <vector>
40 #include <ObjectList.h>
42 #include "NavMenu.h"
45 class BRefFilter;
47 namespace BPrivate {
49 class EntryListBase;
51 #define kGoDirectory "Tracker/Go"
54 class FavoritesMenu : public BSlowMenu {
55 // FavoritesMenu is used in the FilePanel -
56 // displays recent files, recent folders and favorites items
57 public:
58 FavoritesMenu(const char* title, BMessage* openFolderMessage,
59 BMessage* openFileMessage, const BMessenger &,
60 bool isSavePanel, BRefFilter* filter = NULL);
61 virtual ~FavoritesMenu();
63 void SetRefFilter(BRefFilter* filter);
65 private:
66 // override the necessary SlowMenu hooks
67 virtual bool StartBuildingItemList();
68 virtual bool AddNextItem();
69 virtual void DoneBuildingItemList();
70 virtual void ClearMenuBuildingState();
72 bool ShouldShowModel(const Model* model);
74 BMessage* fOpenFolderMessage;
75 BMessage* fOpenFileMessage;
76 BMessenger fTarget;
78 enum State {
79 kStart,
80 kAddingFavorites,
81 kAddingFiles,
82 kAddingFolders,
83 kDone
86 State fState;
88 int32 fIndex;
89 int32 fSectionItemCount;
90 bool fAddedSeparatorForSection;
91 // keeps track whether a separator will be needed before the
92 // next inserted item
93 BMessage fItems;
95 EntryListBase* fContainer;
96 BObjectList<BMenuItem>* fItemList;
97 int32 fInitialItemCount;
98 std::vector<entry_ref> fUniqueRefCheck;
99 bool fIsSavePanel;
100 BRefFilter* fRefFilter;
102 typedef BSlowMenu _inherited;
106 enum recent_type {
107 kRecentDocuments = 0,
108 kRecentApplications = 1,
109 kRecentFolders = 2
113 class RecentsMenu : public BNavMenu {
114 public:
115 RecentsMenu(const char* name, int32 which, uint32 what,
116 BHandler* target);
118 void DetachedFromWindow();
120 int32 RecentsCount();
122 private:
123 virtual bool StartBuildingItemList();
124 virtual bool AddNextItem();
125 bool AddRecents(int32 count);
126 virtual void DoneBuildingItemList();
127 virtual void ClearMenuBuildingState();
129 private:
130 int32 fWhich;
131 int32 fRecentsCount;
133 int32 fItemIndex;
134 BMessage fRecentList;
137 } // namespace BPrivate
139 using namespace BPrivate;
142 #endif // _FAVORITES_MENU_H