Alert.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002 /
00003 /   File:           Alert.h
00004 /
00005 /   Description:    BAlert displays a modal alert window.
00006 /
00007 /   Copyright 1993-98, Be Incorporated, All Rights Reserved
00008 /
00009 *******************************************************************************/
00010  
00011 #ifndef _ALERT_H
00012 #define _ALERT_H
00013 
00014 #include <BeBuild.h>
00015 #include <Window.h>
00016 
00017 class BBitmap;
00018 class BButton;
00019 class BInvoker;
00020 class BTextView;
00021 
00022 /*----------------------------------------------------------------*/
00023 /*----- enum for flavors of alert --------------------------------*/
00024 
00025 enum alert_type {
00026     B_EMPTY_ALERT = 0,
00027     B_INFO_ALERT,
00028     B_IDEA_ALERT,
00029     B_WARNING_ALERT,
00030     B_STOP_ALERT
00031 };
00032 
00033 
00034 enum button_spacing {
00035     B_EVEN_SPACING = 0,
00036     B_OFFSET_SPACING
00037 };
00038 
00039 /*----------------------------------------------------------------*/
00040 /*----- BAlert class ---------------------------------------------*/
00041 
00042 class BAlert : public BWindow
00043 {
00044 public:
00045 
00046                     BAlert( const char *title,
00047                             const char *text,
00048                             const char *button1,
00049                             const char *button2 = NULL,
00050                             const char *button3 = NULL,
00051                             button_width width = B_WIDTH_AS_USUAL,
00052                             alert_type type = B_INFO_ALERT);
00053                     BAlert( const char *title,
00054                             const char *text,
00055                             const char *button1,
00056                             const char *button2,
00057                             const char *button3,
00058                             button_width width,
00059                             button_spacing spacing,
00060                             alert_type type = B_INFO_ALERT);
00061 virtual             ~BAlert();
00062     
00063 /* Archiving */
00064                     BAlert(BMessage *data);
00065 static  BArchivable *Instantiate(BMessage *data);
00066 virtual status_t    Archive(BMessage *data, bool deep = true) const;
00067     
00068 /* BAlert guts */
00069         void        SetShortcut(int32 button_index, char key);
00070         char        Shortcut(int32 button_index) const;
00071 
00072         int32       Go();
00073         status_t    Go(BInvoker *invoker);
00074 
00075 virtual void        MessageReceived(BMessage *an_event);
00076 virtual void        FrameResized(float new_width, float new_height);
00077         BButton     *ButtonAt(int32 index) const;
00078         BTextView   *TextView() const;
00079 
00080 virtual BHandler    *ResolveSpecifier(BMessage *msg,
00081                                     int32 index,
00082                                     BMessage *specifier,
00083                                     int32 form,
00084                                     const char *property);
00085 virtual status_t    GetSupportedSuites(BMessage *data);
00086 
00087 virtual void        DispatchMessage(BMessage *msg, BHandler *handler);
00088 virtual void        Quit();
00089 virtual bool        QuitRequested();
00090 
00091 static  BPoint      AlertPosition(float width, float height);
00092 
00093 /*----- Private or reserved -----------------------------------------*/
00094 virtual status_t    Perform(perform_code d, void *arg);
00095 
00096 private:
00097 friend class _BAlertFilter_;
00098 
00099 virtual void        _ReservedAlert1();
00100 virtual void        _ReservedAlert2();
00101 virtual void        _ReservedAlert3();
00102 
00103         void        InitObject(const char *text,
00104                             const char *button1,
00105                             const char *button2 = NULL,
00106                             const char *button3 = NULL,
00107                             button_width width = B_WIDTH_AS_USUAL,
00108                             button_spacing spacing = B_EVEN_SPACING,
00109                             alert_type type = B_INFO_ALERT);
00110         BBitmap     *InitIcon();
00111 
00112         sem_id          fAlertSem;
00113         int32           fAlertVal;
00114         BButton         *fButtons[3];
00115         BTextView       *fTextView;
00116         char            fKeys[3];
00117         alert_type      fMsgType;
00118         button_width    fButtonWidth;
00119         BInvoker        *fInvoker;
00120         uint32          _reserved[4];
00121 };
00122 
00123 /*-------------------------------------------------------------*/
00124 /*-------------------------------------------------------------*/
00125 
00126 // functions to display HTML alerts with Opera
00127 
00128 status_t TellTellBrowser(BMessage*m);
00129 status_t TellTellBrowser(BMessage*m,BMessage*r);
00130 
00131 #endif /* _ALERT_H */

Copyright 2005 by yellowTAB GmbH, Be Inc., Palm Source Inc. and their respective legal successors
All rights reserved.