2 * Copyright 2001-2015 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
14 // enum for flavors of alert
37 class BAlert
: public BWindow
{
40 BAlert(const char* title
, const char* text
,
42 const char* button2
= NULL
,
43 const char* button3
= NULL
,
44 button_width width
= B_WIDTH_AS_USUAL
,
45 alert_type type
= B_INFO_ALERT
);
46 BAlert(const char* title
, const char* text
,
47 const char* button1
, const char* button2
,
48 const char* button3
, button_width width
,
49 button_spacing spacing
,
50 alert_type type
= B_INFO_ALERT
);
51 BAlert(BMessage
* data
);
55 static BArchivable
* Instantiate(BMessage
* data
);
56 virtual status_t
Archive(BMessage
* data
, bool deep
= true) const;
59 alert_type
Type() const;
60 void SetType(alert_type type
);
61 void SetIcon(BBitmap
* bitmap
);
62 void SetText(const char* text
);
63 void SetButtonSpacing(button_spacing spacing
);
64 void SetButtonWidth(button_width width
);
66 void SetShortcut(int32 buttonIndex
, char key
);
67 char Shortcut(int32 buttonIndex
) const;
70 status_t
Go(BInvoker
* invoker
);
72 virtual void MessageReceived(BMessage
* message
);
73 virtual void FrameResized(float newWidth
, float newHeight
);
75 void AddButton(const char* label
, char key
= 0);
76 int32
CountButtons() const;
77 BButton
* ButtonAt(int32 index
) const;
79 BTextView
* TextView() const;
81 virtual BHandler
* ResolveSpecifier(BMessage
* message
, int32 index
,
82 BMessage
* specifier
, int32 form
,
83 const char* property
);
84 virtual status_t
GetSupportedSuites(BMessage
* data
);
86 virtual void DispatchMessage(BMessage
* message
,
89 virtual bool QuitRequested();
91 virtual status_t
Perform(perform_code d
, void* arg
);
93 static BPoint
AlertPosition(float width
, float height
);
96 virtual void _ReservedAlert1();
97 virtual void _ReservedAlert2();
98 virtual void _ReservedAlert3();
100 void _Init(const char* text
, const char* button1
,
101 const char* button2
, const char* button3
,
102 button_width width
, button_spacing spacing
,
104 BBitmap
* _CreateTypeIcon();
105 BButton
* _CreateButton(int32 which
, const char* label
);
111 TAlertView
* fIconView
;
112 BTextView
* fTextView
;
113 BGroupLayout
* fButtonLayout
;
114 std::vector
<BButton
*> fButtons
;
115 std::vector
<char> fKeys
;
117 uint8 fButtonSpacing
;