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