xref: /haiku/src/kits/tracker/OverrideAlert.h (revision 8c968207bb8d62af707f251a936a9e16e55f9c7b)
102be5353SAxel Dörfler /*
202be5353SAxel Dörfler Open Tracker License
302be5353SAxel Dörfler 
402be5353SAxel Dörfler Terms and Conditions
502be5353SAxel Dörfler 
602be5353SAxel Dörfler Copyright (c) 1991-2000, Be Incorporated. All rights reserved.
702be5353SAxel Dörfler 
802be5353SAxel Dörfler Permission is hereby granted, free of charge, to any person obtaining a copy of
902be5353SAxel Dörfler this software and associated documentation files (the "Software"), to deal in
1002be5353SAxel Dörfler the Software without restriction, including without limitation the rights to
1102be5353SAxel Dörfler use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
1202be5353SAxel Dörfler of the Software, and to permit persons to whom the Software is furnished to do
1302be5353SAxel Dörfler so, subject to the following conditions:
1402be5353SAxel Dörfler 
1502be5353SAxel Dörfler The above copyright notice and this permission notice applies to all licensees
1602be5353SAxel Dörfler and shall be included in all copies or substantial portions of the Software.
1702be5353SAxel Dörfler 
1802be5353SAxel Dörfler THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1902be5353SAxel Dörfler IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY,
2002be5353SAxel Dörfler FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
2102be5353SAxel Dörfler BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
2202be5353SAxel Dörfler AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION
2302be5353SAxel Dörfler WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2402be5353SAxel Dörfler 
2502be5353SAxel Dörfler Except as contained in this notice, the name of Be Incorporated shall not be
2602be5353SAxel Dörfler used in advertising or otherwise to promote the sale, use or other dealings in
2702be5353SAxel Dörfler this Software without prior written authorization from Be Incorporated.
2802be5353SAxel Dörfler 
2902be5353SAxel Dörfler Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks
3002be5353SAxel Dörfler of Be Incorporated in the United States and other countries. Other brand product
3102be5353SAxel Dörfler names are registered trademarks or trademarks of their respective holders.
3202be5353SAxel Dörfler All rights reserved.
3302be5353SAxel Dörfler */
3402be5353SAxel Dörfler 
3502be5353SAxel Dörfler // This is a special BAlert for which you can specify modifier
3602be5353SAxel Dörfler // keys that must be down for various buttons to be enabled.  It
3702be5353SAxel Dörfler // is used when confirming changes in the BeOS directory to force
3802be5353SAxel Dörfler // the user to hold shift when confirming.
3902be5353SAxel Dörfler 
4002be5353SAxel Dörfler // The alert also positions itself slightly differently than a
4102be5353SAxel Dörfler // normal BAlert, attempting to be on top of the calling window.
4202be5353SAxel Dörfler // This allows it to work when confirming rename operations with
4302be5353SAxel Dörfler // Focus Follows Mouse turned on.
44*8c968207SJohn Scipione #ifndef _OVERRIDE_ALERT_H
45*8c968207SJohn Scipione #define _OVERRIDE_ALERT_H
4602be5353SAxel Dörfler 
47b05aa8b5SJohn Scipione 
4802be5353SAxel Dörfler #include <Alert.h>
4902be5353SAxel Dörfler 
50b05aa8b5SJohn Scipione 
5102be5353SAxel Dörfler namespace BPrivate {
5202be5353SAxel Dörfler 
5302be5353SAxel Dörfler class OverrideAlert : public BAlert {
5402be5353SAxel Dörfler public:
5502be5353SAxel Dörfler 	OverrideAlert(const char* title, const char* text,
5602be5353SAxel Dörfler 		const char* button1, uint32 modifiers1,
5702be5353SAxel Dörfler 		const char* button2, uint32 modifiers2,
5802be5353SAxel Dörfler 		const char* button3, uint32 modifiers3,
5902be5353SAxel Dörfler 		button_width width = B_WIDTH_AS_USUAL,
6002be5353SAxel Dörfler 		alert_type type = B_INFO_ALERT);
6102be5353SAxel Dörfler 	OverrideAlert(const char* title, const char* text,
6202be5353SAxel Dörfler 		const char* button1, uint32 modifiers1,
6302be5353SAxel Dörfler 		const char* button2, uint32 modifiers2,
6402be5353SAxel Dörfler 		const char* button3, uint32 modifiers3,
6502be5353SAxel Dörfler 		button_width width, button_spacing spacing,
6602be5353SAxel Dörfler 		alert_type type = B_INFO_ALERT);
6702be5353SAxel Dörfler 	virtual ~OverrideAlert();
6802be5353SAxel Dörfler 
6902be5353SAxel Dörfler 	virtual void DispatchMessage(BMessage*, BHandler*);
7002be5353SAxel Dörfler 
7102be5353SAxel Dörfler 	static BPoint OverPosition(float width, float height);
7202be5353SAxel Dörfler 
7302be5353SAxel Dörfler private:
7402be5353SAxel Dörfler 	void UpdateButtons(uint32 modifiers, bool force = false);
7502be5353SAxel Dörfler 
7602be5353SAxel Dörfler 	uint32 fCurModifiers;
7702be5353SAxel Dörfler 	uint32 fButtonModifiers[3];
7802be5353SAxel Dörfler };
7902be5353SAxel Dörfler 
8002be5353SAxel Dörfler } // namespace BPrivate
8102be5353SAxel Dörfler 
8202be5353SAxel Dörfler using namespace BPrivate;
8302be5353SAxel Dörfler 
84*8c968207SJohn Scipione 
85b05aa8b5SJohn Scipione #endif	// _OVERRIDE_ALERT_H
86