Logo ROOT  
Reference Guide
TGMsgBox.h
Go to the documentation of this file.
1 // @(#)root/gui:$Id$
2 // Author: Fons Rademakers 09/01/98
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TGMsgBox
13 #define ROOT_TGMsgBox
14 
15 
16 #include "TGFrame.h"
17 #include "TGWidget.h"
18 
19 //--- Icon types
20 
26 };
27 
28 //--- Button types and return codes
29 
31  kMBYes = BIT(0),
32  kMBNo = BIT(1),
33  kMBOk = BIT(2),
34  kMBApply = BIT(3),
35  kMBRetry = BIT(4),
36  kMBIgnore = BIT(5),
37  kMBCancel = BIT(6),
38  kMBClose = BIT(7),
40  kMBYesAll = BIT(9),
41  kMBNoAll = BIT(10),
42  kMBAppend = BIT(11),
43  kMBNewer = BIT(12)
44 };
45 
46 
47 class TGButton;
48 class TGIcon;
49 class TGLabel;
50 
51 
52 class TGMsgBox : public TGTransientFrame {
53 
54 protected:
55  TGButton *fYes, *fNo, *fOK, *fApply; ///< buttons in dialog box
56  TGButton *fRetry, *fIgnore, *fCancel; ///< buttons in dialog box
57  TGButton *fClose, *fYesAll, *fNoAll; ///< buttons in dialog box
58  TGButton *fNewer, *fAppend, *fDismiss; ///< buttons in dialog box
59  TGIcon *fIcon; ///< icon
60  TGHorizontalFrame *fButtonFrame; ///< frame containing buttons
61  TGHorizontalFrame *fIconFrame; ///< frame containing icon and text
62  TGVerticalFrame *fLabelFrame; ///< frame containing text
63  TGLayoutHints *fL1, *fL2, *fL3, *fL4, *fL5; ///< layout hints
64  TList *fMsgList; ///< text (list of TGLabels)
65  Int_t *fRetCode; ///< address to store return code
66 
67  void PMsgBox(const char *title, const char *msg, const TGPicture *icon,
68  Int_t buttons, Int_t *ret_code, Int_t text_align);
69 
70 private:
71  TGMsgBox(const TGMsgBox&) = delete;
72  TGMsgBox& operator=(const TGMsgBox&) = delete;
73 
74 public:
75  TGMsgBox(const TGWindow *p = nullptr, const TGWindow *main = nullptr,
76  const char *title = nullptr, const char *msg = nullptr, const TGPicture *icon = nullptr,
77  Int_t buttons = kMBDismiss, Int_t *ret_code = nullptr,
78  UInt_t options = kVerticalFrame,
79  Int_t text_align = kTextCenterX | kTextCenterY);
80  TGMsgBox(const TGWindow *p, const TGWindow *main,
81  const char *title, const char *msg, EMsgBoxIcon icon,
82  Int_t buttons = kMBDismiss, Int_t *ret_code = nullptr,
83  UInt_t options = kVerticalFrame,
84  Int_t text_align = kTextCenterX | kTextCenterY);
85  virtual ~TGMsgBox();
86 
87  virtual void CloseWindow();
88  virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
89  virtual Bool_t HandleKey(Event_t* event);
90 
91  ClassDef(TGMsgBox,0) // A message dialog box
92 };
93 
94 #endif
TGMsgBox::fNewer
TGButton * fNewer
Definition: TGMsgBox.h:58
kMBIconQuestion
@ kMBIconQuestion
Definition: TGMsgBox.h:23
TGMsgBox::fRetry
TGButton * fRetry
Definition: TGMsgBox.h:56
TGMsgBox::fDismiss
TGButton * fDismiss
buttons in dialog box
Definition: TGMsgBox.h:58
TGTransientFrame
Defines transient windows that typically are used for dialogs windows.
Definition: TGFrame.h:498
TGMsgBox::fCancel
TGButton * fCancel
buttons in dialog box
Definition: TGMsgBox.h:56
TGWindow
ROOT GUI Window base class.
Definition: TGWindow.h:23
TGMsgBox::fMsgList
TList * fMsgList
text (list of TGLabels)
Definition: TGMsgBox.h:64
TGPicture
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition: TGPicture.h:25
TGMsgBox::operator=
TGMsgBox & operator=(const TGMsgBox &)=delete
TGMsgBox::fL4
TGLayoutHints * fL4
Definition: TGMsgBox.h:63
kMBCancel
@ kMBCancel
Definition: TGMsgBox.h:37
kVerticalFrame
@ kVerticalFrame
Definition: GuiTypes.h:381
TGMsgBox
Definition: TGMsgBox.h:52
TGLabel
This class handles GUI labels.
Definition: TGLabel.h:24
TGMsgBox::fAppend
TGButton * fAppend
Definition: TGMsgBox.h:58
TGMsgBox::fOK
TGButton * fOK
Definition: TGMsgBox.h:55
TGMsgBox::fNoAll
TGButton * fNoAll
buttons in dialog box
Definition: TGMsgBox.h:57
TGMsgBox::fL2
TGLayoutHints * fL2
Definition: TGMsgBox.h:63
kMBYes
@ kMBYes
Definition: TGMsgBox.h:31
TGMsgBox::fIcon
TGIcon * fIcon
icon
Definition: TGMsgBox.h:59
kTextCenterX
@ kTextCenterX
Definition: TGWidget.h:25
event
Definition: triangle.c:552
TGMsgBox::PMsgBox
void PMsgBox(const char *title, const char *msg, const TGPicture *icon, Int_t buttons, Int_t *ret_code, Int_t text_align)
Protected, common message dialog box initialization.
Definition: TGMsgBox.cxx:118
TGMsgBox::ProcessMessage
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process message dialog box event.
Definition: TGMsgBox.cxx:361
TGHorizontalFrame
A composite frame that layout their children in horizontal way.
Definition: TGFrame.h:386
kTextCenterY
@ kTextCenterY
Definition: TGWidget.h:28
kMBIgnore
@ kMBIgnore
Definition: TGMsgBox.h:36
kMBApply
@ kMBApply
Definition: TGMsgBox.h:34
kMBNo
@ kMBNo
Definition: TGMsgBox.h:32
kMBDismiss
@ kMBDismiss
Definition: TGMsgBox.h:39
TGMsgBox::fL1
TGLayoutHints * fL1
Definition: TGMsgBox.h:63
bool
TGMsgBox::HandleKey
virtual Bool_t HandleKey(Event_t *event)
Handle enter and escape keys (used as Ok and Cancel for now).
Definition: TGMsgBox.cxx:384
kMBClose
@ kMBClose
Definition: TGMsgBox.h:38
TGMsgBox::fClose
TGButton * fClose
Definition: TGMsgBox.h:57
TGIcon
This class handles GUI icons.
Definition: TGIcon.h:22
kMBNoAll
@ kMBNoAll
Definition: TGMsgBox.h:41
EMsgBoxButton
EMsgBoxButton
Definition: TGMsgBox.h:30
kMBNewer
@ kMBNewer
Definition: TGMsgBox.h:43
TGMsgBox::fNo
TGButton * fNo
Definition: TGMsgBox.h:55
TGMsgBox::TGMsgBox
TGMsgBox(const TGMsgBox &)=delete
TGVerticalFrame
A composite frame that layout their children in vertical way.
Definition: TGFrame.h:375
TGMsgBox::fL5
TGLayoutHints * fL5
layout hints
Definition: TGMsgBox.h:63
kMBIconExclamation
@ kMBIconExclamation
Definition: TGMsgBox.h:24
TGMsgBox::~TGMsgBox
virtual ~TGMsgBox()
Destroy message dialog box.
Definition: TGMsgBox.cxx:322
TGFrame.h
Long_t
long Long_t
Definition: RtypesCore.h:54
TGLayoutHints
This class describes layout hints used by the layout classes.
Definition: TGLayout.h:50
BIT
#define BIT(n)
Definition: Rtypes.h:85
TGWidget.h
kMBAppend
@ kMBAppend
Definition: TGMsgBox.h:42
unsigned int
kMBOk
@ kMBOk
Definition: TGMsgBox.h:33
TGMsgBox::CloseWindow
virtual void CloseWindow()
Close dialog box.
Definition: TGMsgBox.cxx:352
TGMsgBox::fYesAll
TGButton * fYesAll
Definition: TGMsgBox.h:57
TGMsgBox::fIgnore
TGButton * fIgnore
Definition: TGMsgBox.h:56
TGMsgBox::fL3
TGLayoutHints * fL3
Definition: TGMsgBox.h:63
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
Event_t
Event structure.
Definition: GuiTypes.h:174
kMBIconAsterisk
@ kMBIconAsterisk
Definition: TGMsgBox.h:25
TGMsgBox::fButtonFrame
TGHorizontalFrame * fButtonFrame
frame containing buttons
Definition: TGMsgBox.h:60
TGMsgBox::fLabelFrame
TGVerticalFrame * fLabelFrame
frame containing text
Definition: TGMsgBox.h:62
EMsgBoxIcon
EMsgBoxIcon
Definition: TGMsgBox.h:21
TGButton
A button abstract base class.
Definition: TGButton.h:68
TGMsgBox::fRetCode
Int_t * fRetCode
address to store return code
Definition: TGMsgBox.h:65
kMBRetry
@ kMBRetry
Definition: TGMsgBox.h:35
kMBIconStop
@ kMBIconStop
Definition: TGMsgBox.h:22
TGMsgBox::fApply
TGButton * fApply
buttons in dialog box
Definition: TGMsgBox.h:55
TGMsgBox::fIconFrame
TGHorizontalFrame * fIconFrame
frame containing icon and text
Definition: TGMsgBox.h:61
kMBYesAll
@ kMBYesAll
Definition: TGMsgBox.h:40
TList
A doubly linked list.
Definition: TList.h:44
TGMsgBox::fYes
TGButton * fYes
Definition: TGMsgBox.h:55
main
int main(int argc, char *argv[])
Definition: cef_main.cxx:54
int