Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:12:03

0001 // @(#)root/gui:$Id$
0002 // Author: Fons Rademakers   09/01/98
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TGMsgBox
0013 #define ROOT_TGMsgBox
0014 
0015 
0016 #include "TGFrame.h"
0017 #include "TGWidget.h"
0018 
0019 //--- Icon types
0020 
0021 enum EMsgBoxIcon {
0022    kMBIconStop,
0023    kMBIconQuestion,
0024    kMBIconExclamation,
0025    kMBIconAsterisk
0026 };
0027 
0028 //--- Button types and return codes
0029 
0030 enum EMsgBoxButton {
0031    kMBYes     = BIT(0),
0032    kMBNo      = BIT(1),
0033    kMBOk      = BIT(2),
0034    kMBApply   = BIT(3),
0035    kMBRetry   = BIT(4),
0036    kMBIgnore  = BIT(5),
0037    kMBCancel  = BIT(6),
0038    kMBClose   = BIT(7),
0039    kMBDismiss = BIT(8),
0040    kMBYesAll  = BIT(9),
0041    kMBNoAll   = BIT(10),
0042    kMBAppend  = BIT(11),
0043    kMBNewer   = BIT(12)
0044 };
0045 
0046 
0047 class TGButton;
0048 class TGIcon;
0049 class TGLabel;
0050 
0051 
0052 class TGMsgBox : public TGTransientFrame {
0053 
0054 protected:
0055    TGButton            *fYes, *fNo, *fOK, *fApply;   ///< buttons in dialog box
0056    TGButton            *fRetry, *fIgnore, *fCancel;  ///< buttons in dialog box
0057    TGButton            *fClose, *fYesAll, *fNoAll;   ///< buttons in dialog box
0058    TGButton            *fNewer, *fAppend, *fDismiss; ///< buttons in dialog box
0059    TGIcon              *fIcon;                       ///< icon
0060    TGHorizontalFrame   *fButtonFrame;                ///< frame containing buttons
0061    TGHorizontalFrame   *fIconFrame;                  ///< frame containing icon and text
0062    TGVerticalFrame     *fLabelFrame;                 ///< frame containing text
0063    TGLayoutHints       *fL1, *fL2, *fL3, *fL4, *fL5; ///< layout hints
0064    TList               *fMsgList;                    ///< text (list of TGLabels)
0065    Int_t               *fRetCode;                    ///< address to store return code
0066 
0067    void PMsgBox(const char *title, const char *msg, const TGPicture *icon,
0068                 Int_t buttons, Int_t *ret_code, Int_t text_align);
0069 
0070 private:
0071    TGMsgBox(const TGMsgBox&) = delete;
0072    TGMsgBox& operator=(const TGMsgBox&) = delete;
0073 
0074 public:
0075    TGMsgBox(const TGWindow *p = nullptr, const TGWindow *main = nullptr,
0076             const char *title = nullptr, const char *msg = nullptr, const TGPicture *icon = nullptr,
0077             Int_t buttons = kMBDismiss, Int_t *ret_code = nullptr,
0078             UInt_t options = kVerticalFrame,
0079             Int_t text_align = kTextCenterX | kTextCenterY);
0080    TGMsgBox(const TGWindow *p, const TGWindow *main,
0081             const char *title, const char *msg, EMsgBoxIcon icon,
0082             Int_t buttons = kMBDismiss, Int_t *ret_code = nullptr,
0083             UInt_t options = kVerticalFrame,
0084             Int_t text_align = kTextCenterX | kTextCenterY);
0085    ~TGMsgBox() override;
0086 
0087    void CloseWindow() override;
0088    Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override;
0089    Bool_t HandleKey(Event_t* event) override;
0090 
0091    ClassDefOverride(TGMsgBox,0)  // A message dialog box
0092 };
0093 
0094 #endif