Logo ROOT   master
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),
45  kMBApply = BIT(3),
46  kMBRetry = BIT(4),
47  kMBIgnore = BIT(5),
48  kMBCancel = BIT(6),
49  kMBClose = BIT(7),
51  kMBYesAll = BIT(9),
52  kMBNoAll = BIT(10),
53  kMBAppend = BIT(11),
54  kMBNewer = BIT(12)
55 };
56 
57 
58 class TGButton;
59 class TGIcon;
60 class TGLabel;
61 
62 
63 class TGMsgBox : public TGTransientFrame {
64 
65 protected:
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 
81 private:
82  TGMsgBox(const TGMsgBox&); // not implemented
83  TGMsgBox& operator=(const TGMsgBox&); // not implemented
84 
85 public:
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
TGMsgBox & operator=(const TGMsgBox &)
TGButton * fCancel
Definition: TGMsgBox.h:67
TGButton * fIgnore
Definition: TGMsgBox.h:67
#define BIT(n)
Definition: Rtypes.h:83
TGButton * fClose
Definition: TGMsgBox.h:68
TGButton * fOK
Definition: TGMsgBox.h:66
virtual Bool_t HandleKey(Event_t *event)
Handle enter and escape keys (used as Ok and Cancel for now).
Definition: TGMsgBox.cxx:382
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process message dialog box event.
Definition: TGMsgBox.cxx:359
#define ClassDef(name, id)
Definition: Rtypes.h:326
TGLayoutHints * fL5
Definition: TGMsgBox.h:74
virtual void CloseWindow()
Close dialog box.
Definition: TGMsgBox.cxx:350
TGMsgBox(const TGMsgBox &)
TGButton * fApply
Definition: TGMsgBox.h:66
Definition: TGIcon.h:30
EMsgBoxIcon
Definition: TGMsgBox.h:32
int main(int argc, char **argv)
TGLayoutHints * fL1
Definition: TGMsgBox.h:74
TList * fMsgList
Definition: TGMsgBox.h:75
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:116
Definition: TGMsgBox.h:43
A doubly linked list.
Definition: TList.h:44
TGLayoutHints * fL4
Definition: TGMsgBox.h:74
Int_t * fRetCode
Definition: TGMsgBox.h:76
TGButton * fAppend
Definition: TGMsgBox.h:69
TGIcon * fIcon
Definition: TGMsgBox.h:70
TGButton * fNoAll
Definition: TGMsgBox.h:68
unsigned int UInt_t
Definition: RtypesCore.h:42
TGButton * fNewer
Definition: TGMsgBox.h:69
long Long_t
Definition: RtypesCore.h:50
TGButton * fYesAll
Definition: TGMsgBox.h:68
TGButton * fNo
Definition: TGMsgBox.h:66
TGVerticalFrame * fLabelFrame
Definition: TGMsgBox.h:73
virtual ~TGMsgBox()
Destroy message dialog box.
Definition: TGMsgBox.cxx:320
TGHorizontalFrame * fIconFrame
Definition: TGMsgBox.h:72
TGHorizontalFrame * fButtonFrame
Definition: TGMsgBox.h:71
TGLayoutHints * fL3
Definition: TGMsgBox.h:74
EMsgBoxButton
Definition: TGMsgBox.h:41
TGButton * fYes
Definition: TGMsgBox.h:66
TGButton * fRetry
Definition: TGMsgBox.h:67
TGLayoutHints * fL2
Definition: TGMsgBox.h:74
TGButton * fDismiss
Definition: TGMsgBox.h:69
Definition: TGMsgBox.h:44