Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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),
43 kMBNewer = BIT(12)
44};
45
46
47class TGButton;
48class TGIcon;
49class TGLabel;
50
51
52class TGMsgBox : public TGTransientFrame {
53
54protected:
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
70private:
71 TGMsgBox(const TGMsgBox&) = delete;
72 TGMsgBox& operator=(const TGMsgBox&) = delete;
73
74public:
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 void CloseWindow() override;
88 Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override;
89 Bool_t HandleKey(Event_t* event) override;
90
91 ClassDefOverride(TGMsgBox,0) // A message dialog box
92};
93
94#endif
@ kVerticalFrame
Definition GuiTypes.h:381
int main()
Definition Prototype.cxx:12
long Longptr_t
Definition RtypesCore.h:82
#define BIT(n)
Definition Rtypes.h:85
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
EMsgBoxButton
Definition TGMsgBox.h:30
@ kMBNo
Definition TGMsgBox.h:32
@ kMBIgnore
Definition TGMsgBox.h:36
@ kMBApply
Definition TGMsgBox.h:34
@ kMBNoAll
Definition TGMsgBox.h:41
@ kMBClose
Definition TGMsgBox.h:38
@ kMBYes
Definition TGMsgBox.h:31
@ kMBAppend
Definition TGMsgBox.h:42
@ kMBRetry
Definition TGMsgBox.h:35
@ kMBCancel
Definition TGMsgBox.h:37
@ kMBOk
Definition TGMsgBox.h:33
@ kMBYesAll
Definition TGMsgBox.h:40
@ kMBNewer
Definition TGMsgBox.h:43
@ kMBDismiss
Definition TGMsgBox.h:39
EMsgBoxIcon
Definition TGMsgBox.h:21
@ kMBIconExclamation
Definition TGMsgBox.h:24
@ kMBIconAsterisk
Definition TGMsgBox.h:25
@ kMBIconStop
Definition TGMsgBox.h:22
@ kMBIconQuestion
Definition TGMsgBox.h:23
@ kTextCenterX
Definition TGWidget.h:25
@ kTextCenterY
Definition TGWidget.h:28
winID h TVirtualViewer3D TVirtualGLPainter p
A button abstract base class.
Definition TGButton.h:68
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:385
This class handles GUI icons.
Definition TGIcon.h:22
This class handles GUI labels.
Definition TGLabel.h:24
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
TGButton * fNoAll
buttons in dialog box
Definition TGMsgBox.h:57
TGButton * fYes
Definition TGMsgBox.h:55
TGButton * fOK
Definition TGMsgBox.h:55
TGLayoutHints * fL5
layout hints
Definition TGMsgBox.h:63
TGLayoutHints * fL2
Definition TGMsgBox.h:63
TGLayoutHints * fL1
Definition TGMsgBox.h:63
TGMsgBox & operator=(const TGMsgBox &)=delete
TList * fMsgList
text (list of TGLabels)
Definition TGMsgBox.h:64
TGButton * fYesAll
Definition TGMsgBox.h:57
TGHorizontalFrame * fIconFrame
frame containing icon and text
Definition TGMsgBox.h:61
virtual ~TGMsgBox()
Destroy message dialog box.
Definition TGMsgBox.cxx:322
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
TGVerticalFrame * fLabelFrame
frame containing text
Definition TGMsgBox.h:62
Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override
Process message dialog box event.
Definition TGMsgBox.cxx:361
TGMsgBox(const TGMsgBox &)=delete
TGButton * fNo
Definition TGMsgBox.h:55
TGLayoutHints * fL3
Definition TGMsgBox.h:63
Bool_t HandleKey(Event_t *event) override
Handle enter and escape keys (used as Ok and Cancel for now).
Definition TGMsgBox.cxx:384
TGButton * fAppend
Definition TGMsgBox.h:58
TGButton * fRetry
Definition TGMsgBox.h:56
TGHorizontalFrame * fButtonFrame
frame containing buttons
Definition TGMsgBox.h:60
TGButton * fIgnore
Definition TGMsgBox.h:56
TGButton * fDismiss
buttons in dialog box
Definition TGMsgBox.h:58
TGButton * fCancel
buttons in dialog box
Definition TGMsgBox.h:56
TGIcon * fIcon
icon
Definition TGMsgBox.h:59
TGLayoutHints * fL4
Definition TGMsgBox.h:63
TGButton * fClose
Definition TGMsgBox.h:57
TGButton * fNewer
Definition TGMsgBox.h:58
Int_t * fRetCode
address to store return code
Definition TGMsgBox.h:65
void CloseWindow() override
Close dialog box.
Definition TGMsgBox.cxx:352
TGButton * fApply
buttons in dialog box
Definition TGMsgBox.h:55
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition TGPicture.h:25
Defines transient windows that typically are used for dialogs windows.
Definition TGFrame.h:498
A composite frame that layout their children in vertical way.
Definition TGFrame.h:374
ROOT GUI Window base class.
Definition TGWindow.h:23
A doubly linked list.
Definition TList.h:38
Event structure.
Definition GuiTypes.h:174