libyui-mga  1.1.0
YMGAMsgBox.h
1 /*
2  Copyright 2014 by Angelo Naselli <anaselli@linux.it>
3 
4  This library is free software; you can redistribute it and/or modify
5  it under the terms of the GNU Lesser General Public License as
6  published by the Free Software Foundation; either version 2.1 of the
7  License, or (at your option) version 3.0 of the License. This library
8  is distributed in the hope that it will be useful, but WITHOUT ANY
9  WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
11  License for more details. You should have received a copy of the GNU
12  Lesser General Public License along with this library; if not, write
13  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
14  Floor, Boston, MA 02110-1301 USA
15 */
16 /*-/
17 
18  File: YMGAMessageBox.h
19 
20  Author: Angelo Naselli <anaselli@linux.it>
21 
22 /-*/
23 
24 #ifndef YMGAMessageBox_h
25 #define YMGAMessageBox_h
26 
27 #include <string>
28 #include <yui/YTypes.h>
29 
31 class YDialog;
32 class YReplacePoint;
33 
35 {
36 public:
37  enum DLG_BUTTON {
38  /// One button dialog, or button one pressed
39  B_ONE = 0,
40  /// two buttons dialog, or button two pressed
41  B_TWO = 1
42  };
43 
44  enum DLG_MODE {
45  /// Normal dialog
47  /// Info dialog
49  /// Warning dialog
50  D_WARNING
51  };
52 
53  /**
54  * The constructor. Note that this object is not a widget, so you must deleted it, if allocated on the heap.
55  * @param b_num B_ONE: one button only, B_TWO Two buttons dialog.
56  * @param dlg_mode NORMAL, INFO, WARNING dialog
57  * @see YMGAMessageBox::DLG_BUTTON
58  * @see YMGAMessageBox::DLG_MODE
59  */
61  DLG_MODE dlg_mode = D_NORMAL
62  );
63  /**
64  * Destructor.
65  **/
66  virtual ~YMGAMessageBox();
67 
68  /**
69  * sets the message box icon (full path)
70  * @param icon icon pathname
71  */
72  void setIcon(const std::string& icon);
73 
74  /**
75  * sets the message box title
76  * @param title title text
77  */
78  void setTitle(const std::string& title);
79 
80  /**
81  * sets the message box text information
82  * @param text dialog content text
83  * @param useRichText set text using rich text if true
84  */
85  void setText(const std::string& text, bool useRichText=false);
86 
87  /**
88  * sets the dilaog box minimum size according to YWidgetFactory::createMinSize()
89  * @param minWidth dialog min width
90  * @param minHeight dialog min height
91  */
92  void setMinSize(YLayoutSize_t minWidth, YLayoutSize_t minHeight );
93 
94  /**
95  * sets the message box button name (empty string is assigned by default)
96  * @param label button name
97  * @param button button to set (B_ONE, or B_TWO if configured for two buttons)
98  */
99  void setButtonLabel(const std::string& label, DLG_BUTTON button=B_ONE);
100 
101  /**
102  * sets the message box default button
103  * @param button button to set (B_ONE, or B_TWO if configured for two buttons)
104  */
105  void setDefaultButton(DLG_BUTTON button=B_ONE);
106 
107  /**
108  * it shows the message box dialog using data set by user.
109  * @return which button has been pressed to leave the dialog (B_ONE or B_TWO)
110  */
111  DLG_BUTTON show();
112 
113 
114 private:
115  YMGAMessageBoxPrivate *priv;
116 
117 
118 };
119 
120 
121 #endif //YMGAMessageBox_h
YMGAMessageBox::setDefaultButton
void setDefaultButton(DLG_BUTTON button=B_ONE)
sets the message box default button
Definition: YMGAMsgBox.cc:126
YMGAMessageBox::setMinSize
void setMinSize(YLayoutSize_t minWidth, YLayoutSize_t minHeight)
sets the dilaog box minimum size according to YWidgetFactory::createMinSize()
Definition: YMGAMsgBox.cc:106
YMGAMessageBox::D_INFO
@ D_INFO
Info dialog.
Definition: YMGAMsgBox.h:48
YMGAMessageBox::setText
void setText(const std::string &text, bool useRichText=false)
sets the message box text information
Definition: YMGAMsgBox.cc:100
YMGAMessageBoxPrivate
Definition: YMGAMsgBox.cc:47
YMGAMessageBox::B_ONE
@ B_ONE
One button dialog, or button one pressed.
Definition: YMGAMsgBox.h:39
YMGAMessageBox::DLG_MODE
DLG_MODE
Definition: YMGAMsgBox.h:44
YMGAMessageBox::B_TWO
@ B_TWO
two buttons dialog, or button two pressed
Definition: YMGAMsgBox.h:41
YMGAMessageBox::show
DLG_BUTTON show()
it shows the message box dialog using data set by user.
Definition: YMGAMsgBox.cc:135
YMGAMessageBox::~YMGAMessageBox
virtual ~YMGAMessageBox()
Destructor.
Definition: YMGAMsgBox.cc:83
YMGAMessageBox::setButtonLabel
void setButtonLabel(const std::string &label, DLG_BUTTON button=B_ONE)
sets the message box button name (empty string is assigned by default)
Definition: YMGAMsgBox.cc:118
YMGAMessageBox::setTitle
void setTitle(const std::string &title)
sets the message box title
Definition: YMGAMsgBox.cc:95
YMGAMessageBox
Definition: YMGAMsgBox.h:35
YMGAMessageBox::D_NORMAL
@ D_NORMAL
Normal dialog.
Definition: YMGAMsgBox.h:46
YMGAMessageBox::D_WARNING
@ D_WARNING
Warning dialog.
Definition: YMGAMsgBox.h:50
YMGAMessageBox::setIcon
void setIcon(const std::string &icon)
sets the message box icon (full path)
Definition: YMGAMsgBox.cc:89
YMGAMessageBox::DLG_BUTTON
DLG_BUTTON
Definition: YMGAMsgBox.h:37
YMGAMessageBox::YMGAMessageBox
YMGAMessageBox(DLG_BUTTON b_num=B_ONE, DLG_MODE dlg_mode=D_NORMAL)
The constructor.
Definition: YMGAMsgBox.cc:70