xref: /haiku/src/apps/mail/QueryMenu.h (revision d74618871952e28f4550c4381bfdef3d14d6ef3f)
10995b563SAxel Dörfler /*
20995b563SAxel Dörfler Open Tracker License
30995b563SAxel Dörfler 
40995b563SAxel Dörfler Terms and Conditions
50995b563SAxel Dörfler 
60995b563SAxel Dörfler Copyright (c) 1991-2001, Be Incorporated. All rights reserved.
70995b563SAxel Dörfler 
80995b563SAxel Dörfler Permission is hereby granted, free of charge, to any person obtaining a copy of
90995b563SAxel Dörfler this software and associated documentation files (the "Software"), to deal in
100995b563SAxel Dörfler the Software without restriction, including without limitation the rights to
110995b563SAxel Dörfler use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
120995b563SAxel Dörfler of the Software, and to permit persons to whom the Software is furnished to do
130995b563SAxel Dörfler so, subject to the following conditions:
140995b563SAxel Dörfler 
150995b563SAxel Dörfler The above copyright notice and this permission notice applies to all licensees
160995b563SAxel Dörfler and shall be included in all copies or substantial portions of the Software.
170995b563SAxel Dörfler 
180995b563SAxel Dörfler THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
190995b563SAxel Dörfler IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY,
200995b563SAxel Dörfler FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
210995b563SAxel Dörfler BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
220995b563SAxel Dörfler AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION
230995b563SAxel Dörfler WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
240995b563SAxel Dörfler 
250995b563SAxel Dörfler Except as contained in this notice, the name of Be Incorporated shall not be
260995b563SAxel Dörfler used in advertising or otherwise to promote the sale, use or other dealings in
270995b563SAxel Dörfler this Software without prior written authorization from Be Incorporated.
280995b563SAxel Dörfler 
290995b563SAxel Dörfler BeMail(TM), Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks
300995b563SAxel Dörfler of Be Incorporated in the United States and other countries. Other brand product
310995b563SAxel Dörfler names are registered trademarks or trademarks of their respective holders.
320995b563SAxel Dörfler All rights reserved.
330995b563SAxel Dörfler */
340995b563SAxel Dörfler #ifndef _QUERY_MENU
350995b563SAxel Dörfler #define _QUERY_MENU
360995b563SAxel Dörfler 
37f6e4cbb9SAxel Dörfler 
380995b563SAxel Dörfler #include <Locker.h>
390995b563SAxel Dörfler #include <PopUpMenu.h>
400995b563SAxel Dörfler 
410995b563SAxel Dörfler #include <vector>
420995b563SAxel Dörfler 
430995b563SAxel Dörfler class BLooper;
440995b563SAxel Dörfler class BQuery;
450995b563SAxel Dörfler class BVolume;
460995b563SAxel Dörfler class QHandler;
47f6e4cbb9SAxel Dörfler struct entry_ref;
480995b563SAxel Dörfler 
490995b563SAxel Dörfler using std::vector;
500995b563SAxel Dörfler 
510995b563SAxel Dörfler typedef vector<BQuery *> query_t;
520995b563SAxel Dörfler 
530995b563SAxel Dörfler class QueryMenu : public BPopUpMenu {
540995b563SAxel Dörfler 	friend class QHandler;
550995b563SAxel Dörfler 
560995b563SAxel Dörfler 	public:
570995b563SAxel Dörfler 		QueryMenu(const char *title, bool popUp=false,
580995b563SAxel Dörfler 			bool radioMode = false, bool autoRename = false);
590995b563SAxel Dörfler 		virtual ~QueryMenu(void);
600995b563SAxel Dörfler 
610995b563SAxel Dörfler 		virtual BPoint ScreenLocation(void);
620995b563SAxel Dörfler 		virtual status_t SetTargetForItems(BHandler *handler);
630995b563SAxel Dörfler 		virtual status_t SetTargetForItems(BMessenger messenger);
640995b563SAxel Dörfler 		status_t SetPredicate(const char *expr, BVolume *vol = NULL);
650995b563SAxel Dörfler 
660995b563SAxel Dörfler 	protected:
670995b563SAxel Dörfler 		virtual void EntryCreated(const entry_ref &ref, ino_t node);
680995b563SAxel Dörfler 		virtual void EntryRemoved(ino_t node);
690995b563SAxel Dörfler 		virtual void RemoveEntries(void);
700995b563SAxel Dörfler 
710995b563SAxel Dörfler 		BHandler *fTargetHandler;
720995b563SAxel Dörfler 		static BLooper *fQueryLooper;
730995b563SAxel Dörfler 
740995b563SAxel Dörfler 	private:
750995b563SAxel Dörfler 		virtual void DoQueryMessage(BMessage *msg);
760995b563SAxel Dörfler 		static int32 query_thread(void *data);
770995b563SAxel Dörfler 		int32 QueryThread(void);
780995b563SAxel Dörfler 
790995b563SAxel Dörfler 		BLocker fQueryLock;
800995b563SAxel Dörfler //		BQuery *fQuery;
810995b563SAxel Dörfler 		query_t fQueries;
820995b563SAxel Dörfler 		QHandler *fQueryHandler;
830995b563SAxel Dörfler 		bool fCancelQuery;
840995b563SAxel Dörfler 		bool fPopUp;
850995b563SAxel Dörfler 		static int32 fMenuCount;
860995b563SAxel Dörfler };
870995b563SAxel Dörfler 
880995b563SAxel Dörfler #endif // #ifndef _QUERY_MENU
89*d7461887SJonas Sundström 
90