2006-06-16 20:22:53 +04:00
|
|
|
/*
|
2014-06-12 03:00:46 +04:00
|
|
|
* Copyright 2001-2014 Haiku, Inc. All rights reserved.
|
2006-06-16 20:22:53 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2002-07-09 16:24:59 +04:00
|
|
|
#ifndef _ALERT_H
|
|
|
|
#define _ALERT_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <Window.h>
|
|
|
|
|
|
|
|
|
2006-06-16 20:22:53 +04:00
|
|
|
// enum for flavors of alert
|
2002-07-09 16:24:59 +04:00
|
|
|
enum alert_type {
|
|
|
|
B_EMPTY_ALERT = 0,
|
|
|
|
B_INFO_ALERT,
|
|
|
|
B_IDEA_ALERT,
|
|
|
|
B_WARNING_ALERT,
|
|
|
|
B_STOP_ALERT
|
|
|
|
};
|
|
|
|
|
|
|
|
enum button_spacing {
|
|
|
|
B_EVEN_SPACING = 0,
|
|
|
|
B_OFFSET_SPACING
|
|
|
|
};
|
|
|
|
|
2006-06-16 20:22:53 +04:00
|
|
|
|
2014-06-12 03:00:46 +04:00
|
|
|
class BBitmap;
|
|
|
|
class BButton;
|
|
|
|
class BInvoker;
|
|
|
|
class BTextView;
|
|
|
|
|
2006-06-16 20:22:53 +04:00
|
|
|
class BAlert : public BWindow {
|
2014-06-12 03:00:46 +04:00
|
|
|
public:
|
2006-06-16 20:22:53 +04:00
|
|
|
BAlert(const char* title, const char* text,
|
|
|
|
const char* button1, const char* button2 = NULL,
|
|
|
|
const char* button3 = NULL,
|
|
|
|
button_width width = B_WIDTH_AS_USUAL,
|
|
|
|
alert_type type = B_INFO_ALERT);
|
2014-06-12 03:00:46 +04:00
|
|
|
BAlert(const char* title, const char* text,
|
|
|
|
const char* button1, const char* button2,
|
|
|
|
const char* button3, button_width width,
|
2006-06-16 20:22:53 +04:00
|
|
|
button_spacing spacing,
|
|
|
|
alert_type type = B_INFO_ALERT);
|
|
|
|
virtual ~BAlert();
|
|
|
|
|
|
|
|
// Archiving
|
2014-06-12 03:00:46 +04:00
|
|
|
BAlert(BMessage* data);
|
|
|
|
static BArchivable *Instantiate(BMessage* data);
|
|
|
|
virtual status_t Archive(BMessage* data, bool deep = true) const;
|
2006-06-16 20:22:53 +04:00
|
|
|
|
|
|
|
// BAlert guts
|
|
|
|
void SetShortcut(int32 button_index, char key);
|
|
|
|
char Shortcut(int32 button_index) const;
|
|
|
|
|
|
|
|
int32 Go();
|
2014-06-12 03:00:46 +04:00
|
|
|
status_t Go(BInvoker* invoker);
|
2006-06-16 20:22:53 +04:00
|
|
|
|
2014-06-12 03:00:46 +04:00
|
|
|
virtual void MessageReceived(BMessage* message);
|
2006-06-16 20:22:53 +04:00
|
|
|
virtual void FrameResized(float new_width, float new_height);
|
|
|
|
BButton* ButtonAt(int32 index) const;
|
|
|
|
BTextView* TextView() const;
|
|
|
|
|
|
|
|
virtual BHandler* ResolveSpecifier(BMessage* message, int32 index,
|
2014-06-12 03:00:46 +04:00
|
|
|
BMessage* specifier, int32 what,
|
2006-06-16 20:22:53 +04:00
|
|
|
const char* property);
|
2014-06-12 03:00:46 +04:00
|
|
|
virtual status_t GetSupportedSuites(BMessage* data);
|
2006-06-16 20:22:53 +04:00
|
|
|
|
|
|
|
virtual void DispatchMessage(BMessage* message, BHandler* handler);
|
|
|
|
virtual void Quit();
|
|
|
|
virtual bool QuitRequested();
|
|
|
|
|
|
|
|
static BPoint AlertPosition(float width, float height);
|
|
|
|
|
2014-06-12 03:00:46 +04:00
|
|
|
virtual status_t Perform(perform_code d, void* arg);
|
2006-06-16 20:22:53 +04:00
|
|
|
|
2014-06-12 03:00:46 +04:00
|
|
|
private:
|
2006-06-16 20:22:53 +04:00
|
|
|
friend class _BAlertFilter_;
|
|
|
|
|
|
|
|
virtual void _ReservedAlert1();
|
|
|
|
virtual void _ReservedAlert2();
|
|
|
|
virtual void _ReservedAlert3();
|
|
|
|
|
|
|
|
void _InitObject(const char* text, const char* button1,
|
|
|
|
const char* button2 = NULL,
|
|
|
|
const char* button3 = NULL,
|
|
|
|
button_width width = B_WIDTH_AS_USUAL,
|
|
|
|
button_spacing spacing = B_EVEN_SPACING,
|
|
|
|
alert_type type = B_INFO_ALERT);
|
|
|
|
BBitmap* _InitIcon();
|
|
|
|
BButton* _CreateButton(int32 which, const char* label);
|
|
|
|
|
|
|
|
sem_id fAlertSem;
|
|
|
|
int32 fAlertValue;
|
|
|
|
BButton* fButtons[3];
|
|
|
|
BTextView* fTextView;
|
|
|
|
char fKeys[3];
|
|
|
|
alert_type fMsgType;
|
|
|
|
button_width fButtonWidth;
|
|
|
|
BInvoker* fInvoker;
|
|
|
|
uint32 _reserved[4];
|
2002-07-09 16:24:59 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _ALERT_H
|