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// //
17// TMsgBox //
18// //
19// A message dialog box. //
20// //
21//////////////////////////////////////////////////////////////////////////
22
23#include "TGFrame.h"
24#include "TGWidget.h"
25
26//--- Icon types
27
33};
34
35//--- Button types and return codes
36
38 kMBYes = BIT(0),
39 kMBNo = BIT(1),
40 kMBOk = BIT(2),
50 kMBNewer = BIT(12)
51};
52
53
54class TGButton;
55class TGIcon;
56class TGLabel;
57
58
59class TGMsgBox : public TGTransientFrame {
60
61protected:
62 TGButton *fYes, *fNo, *fOK, *fApply; // buttons in dialog box
63 TGButton *fRetry, *fIgnore, *fCancel; // buttons in dialog box
64 TGButton *fClose, *fYesAll, *fNoAll; // buttons in dialog box
65 TGButton *fNewer, *fAppend, *fDismiss; // buttons in dialog box
66 TGIcon *fIcon; // icon
67 TGHorizontalFrame *fButtonFrame; // frame containing buttons
68 TGHorizontalFrame *fIconFrame; // frame containing icon and text
69 TGVerticalFrame *fLabelFrame; // frame containing text
70 TGLayoutHints *fL1, *fL2, *fL3, *fL4, *fL5; // layout hints
71 TList *fMsgList; // text (list of TGLabels)
72 Int_t *fRetCode; // address to store return code
73
74 void PMsgBox(const char *title, const char *msg, const TGPicture *icon,
75 Int_t buttons, Int_t *ret_code, Int_t text_align);
76
77private:
78 TGMsgBox(const TGMsgBox&) = delete;
79 TGMsgBox& operator=(const TGMsgBox&) = delete;
80
81public:
82 TGMsgBox(const TGWindow *p = nullptr, const TGWindow *main = nullptr,
83 const char *title = nullptr, const char *msg = nullptr, const TGPicture *icon = nullptr,
84 Int_t buttons = kMBDismiss, Int_t *ret_code = nullptr,
85 UInt_t options = kVerticalFrame,
86 Int_t text_align = kTextCenterX | kTextCenterY);
87 TGMsgBox(const TGWindow *p, const TGWindow *main,
88 const char *title, const char *msg, EMsgBoxIcon icon,
89 Int_t buttons = kMBDismiss, Int_t *ret_code = nullptr,
90 UInt_t options = kVerticalFrame,
91 Int_t text_align = kTextCenterX | kTextCenterY);
92 virtual ~TGMsgBox();
93
94 virtual void CloseWindow();
95 virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
96 virtual Bool_t HandleKey(Event_t* event);
97
98 ClassDef(TGMsgBox,0) // A message dialog box
99};
100
101#endif
@ kVerticalFrame
Definition GuiTypes.h:381
long Long_t
Definition RtypesCore.h:54
#define ClassDef(name, id)
Definition Rtypes.h:325
#define BIT(n)
Definition Rtypes.h:85
EMsgBoxButton
Definition TGMsgBox.h:37
@ kMBNo
Definition TGMsgBox.h:39
@ kMBIgnore
Definition TGMsgBox.h:43
@ kMBApply
Definition TGMsgBox.h:41
@ kMBNoAll
Definition TGMsgBox.h:48
@ kMBClose
Definition TGMsgBox.h:45
@ kMBYes
Definition TGMsgBox.h:38
@ kMBAppend
Definition TGMsgBox.h:49
@ kMBRetry
Definition TGMsgBox.h:42
@ kMBCancel
Definition TGMsgBox.h:44
@ kMBOk
Definition TGMsgBox.h:40
@ kMBYesAll
Definition TGMsgBox.h:47
@ kMBNewer
Definition TGMsgBox.h:50
@ kMBDismiss
Definition TGMsgBox.h:46
EMsgBoxIcon
Definition TGMsgBox.h:28
@ kMBIconExclamation
Definition TGMsgBox.h:31
@ kMBIconAsterisk
Definition TGMsgBox.h:32
@ kMBIconStop
Definition TGMsgBox.h:29
@ kMBIconQuestion
Definition TGMsgBox.h:30
@ kTextCenterX
Definition TGWidget.h:35
@ kTextCenterY
Definition TGWidget.h:38
TGButton * fNoAll
Definition TGMsgBox.h:64
TGButton * fYes
Definition TGMsgBox.h:62
TGButton * fOK
Definition TGMsgBox.h:62
TGLayoutHints * fL5
Definition TGMsgBox.h:70
TGLayoutHints * fL2
Definition TGMsgBox.h:70
TGLayoutHints * fL1
Definition TGMsgBox.h:70
TGMsgBox & operator=(const TGMsgBox &)=delete
virtual Bool_t HandleKey(Event_t *event)
Handle enter and escape keys (used as Ok and Cancel for now).
Definition TGMsgBox.cxx:383
TList * fMsgList
Definition TGMsgBox.h:71
TGButton * fYesAll
Definition TGMsgBox.h:64
TGHorizontalFrame * fIconFrame
Definition TGMsgBox.h:68
virtual ~TGMsgBox()
Destroy message dialog box.
Definition TGMsgBox.cxx:321
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:117
TGVerticalFrame * fLabelFrame
Definition TGMsgBox.h:69
TGMsgBox(const TGMsgBox &)=delete
TGButton * fNo
Definition TGMsgBox.h:62
TGLayoutHints * fL3
Definition TGMsgBox.h:70
virtual void CloseWindow()
Close dialog box.
Definition TGMsgBox.cxx:351
TGButton * fAppend
Definition TGMsgBox.h:65
TGButton * fRetry
Definition TGMsgBox.h:63
TGHorizontalFrame * fButtonFrame
Definition TGMsgBox.h:67
TGButton * fIgnore
Definition TGMsgBox.h:63
TGButton * fDismiss
Definition TGMsgBox.h:65
TGButton * fCancel
Definition TGMsgBox.h:63
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process message dialog box event.
Definition TGMsgBox.cxx:360
TGIcon * fIcon
Definition TGMsgBox.h:66
TGLayoutHints * fL4
Definition TGMsgBox.h:70
TGButton * fClose
Definition TGMsgBox.h:64
TGButton * fNewer
Definition TGMsgBox.h:65
Int_t * fRetCode
Definition TGMsgBox.h:72
TGButton * fApply
Definition TGMsgBox.h:62
A doubly linked list.
Definition TList.h:44
int main()
Event structure.
Definition GuiTypes.h:174