Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 
32 enum EMsgBoxIcon {
33  kMBIconStop,
34  kMBIconQuestion,
35  kMBIconExclamation,
36  kMBIconAsterisk
37 };
38 
39 //--- Button types and return codes
40 
41 enum EMsgBoxButton {
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),
50  kMBDismiss = BIT(8),
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