xref: /trunk/main/vcl/inc/vcl/msgbox.hxx (revision ae642d40)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SV_MSGBOX_HXX
25 #define _SV_MSGBOX_HXX
26 
27 #include <vcl/sv.h>
28 #include <vcl/dllapi.h>
29 #include <vcl/btndlg.hxx>
30 #include <vcl/image.hxx>
31 #include <vcl/bitmap.hxx>
32 class FixedText;
33 class FixedImage;
34 class CheckBox;
35 
36 // -----------------
37 // - MessBox-Types -
38 // -----------------
39 
40 // Return-Werte von Execute
41 //!!! bei Aenderungen \basic\source\runtime\methods.cxx msgbox anpassen
42 
43 #define RET_OK				 sal_True
44 #define RET_CANCEL			 sal_False
45 #define RET_YES 			 2
46 #define RET_NO				 3
47 #define RET_RETRY			 4
48 #define RET_IGNORE           5
49 
50 #define BUTTONID_OK 		 RET_OK
51 #define BUTTONID_CANCEL 	 RET_CANCEL
52 #define BUTTONID_YES		 RET_YES
53 #define BUTTONID_NO 		 RET_NO
54 #define BUTTONID_RETRY		 RET_RETRY
55 #define BUTTONID_IGNORE      RET_IGNORE
56 #define BUTTONID_HELP		 10
57 
58 // -----------
59 // - MessBox -
60 // -----------
61 
62 class VCL_DLLPUBLIC MessBox : public ButtonDialog
63 {
64 protected:
65 	FixedText*			mpFixedText;
66 	FixedImage* 		mpFixedImage;
67 	XubString			maMessText;
68 	Image				maImage;
69 	Image				maImageHC;
70 	sal_uInt16				mnSoundType;
71 	sal_Bool				mbHelpBtn;
72 	sal_Bool				mbSound;
73     CheckBox*           mpCheckBox;
74     XubString           maCheckBoxText;
75     sal_Bool                mbCheck;
76 
77 	SAL_DLLPRIVATE void	ImplInitMessBoxData();
78 	SAL_DLLPRIVATE void	ImplInitButtons();
79 	SAL_DLLPRIVATE void	ImplPosControls();
80 
81 protected:
82 	SAL_DLLPRIVATE void	ImplLoadRes( const ResId& rResId );
83 						MessBox( WindowType nType );
84 
85 public:
86 						MessBox( Window* pParent, WinBits nStyle,
87 								 const XubString& rTitle, const XubString& rMessage );
88 						MessBox( Window* pParent, const ResId& rResId );
89 						~MessBox();
90 
91 	virtual void		StateChanged( StateChangedType nStateChange );
92 
SetMessText(const XubString & rText)93 	void				SetMessText( const XubString& rText ) { maMessText = rText; }
GetMessText() const94 	const XubString& 	GetMessText() const { return maMessText; }
95 
SetImage(const Image & rImage)96 	void				SetImage( const Image& rImage ) { maImage = rImage; }
GetImage() const97 	const Image&		GetImage() const { return maImage; }
98 
99     sal_Bool                SetModeImage( const Image& rImage, BmpColorMode eMode = BMP_COLOR_NORMAL );
100     const Image&        GetModeImage( BmpColorMode eMode = BMP_COLOR_NORMAL ) const;
101 
102     void                SetDefaultCheckBoxText();
SetCheckBoxText(const XubString & rText)103     void                SetCheckBoxText( const XubString& rText ) { maCheckBoxText = rText;}
GetCheckBoxText() const104     const XubString&    GetCheckBoxText() const { return maCheckBoxText;}
105     void                SetCheckBoxState( sal_Bool bCheck );
106     sal_Bool                GetCheckBoxState() const;
107 
108     virtual Size        GetOptimalSize(WindowSizeType eType) const;
109 };
110 
111 // -----------
112 // - InfoBox -
113 // -----------
114 
115 class VCL_DLLPUBLIC InfoBox : public MessBox
116 {
117 private:
118 	SAL_DLLPRIVATE void	ImplInitInfoBoxData();
119 
120 public:
121 						InfoBox( Window* pParent, const XubString& rMessage );
122 						InfoBox( Window* pParent, const ResId & rResId );
123 						InfoBox( Window* pParent, WinBits nStyle,
124                                 const XubString& rMessage );
125 
126 	static Image		GetStandardImage();
127 	static Image		GetStandardImageHC();
128 };
129 
130 // --------------
131 // - WarningBox -
132 // --------------
133 
134 class VCL_DLLPUBLIC WarningBox : public MessBox
135 {
136 private:
137 	SAL_DLLPRIVATE void	ImplInitWarningBoxData();
138 
139 public:
140 						WarningBox( Window* pParent, WinBits nStyle,
141 									const XubString& rMessage );
142 						WarningBox( Window* pParent, const ResId& rResId );
143 
144     void                SetDefaultCheckBoxText();
145 
146 	static Image		GetStandardImage();
147 	static Image		GetStandardImageHC();
148 };
149 
150 // ------------
151 // - ErrorBox -
152 // ------------
153 
154 class VCL_DLLPUBLIC ErrorBox : public MessBox
155 {
156 private:
157 	SAL_DLLPRIVATE void	ImplInitErrorBoxData();
158 
159 public:
160 						ErrorBox( Window* pParent, WinBits nStyle,
161 								  const XubString& rMessage );
162 						ErrorBox( Window* pParent, const ResId& rResId );
163 
164 	static Image		GetStandardImage();
165 	static Image		GetStandardImageHC();
166 };
167 
168 // ------------
169 // - QueryBox -
170 // ------------
171 
172 class VCL_DLLPUBLIC QueryBox : public MessBox
173 {
174 private:
175 	SAL_DLLPRIVATE void	ImplInitQueryBoxData();
176 
177 public:
178 						QueryBox( Window* pParent, WinBits nStyle,
179 								  const XubString& rMessage );
180 						QueryBox( Window* pParent, const ResId& rResId );
181 
182     void                SetDefaultCheckBoxText();
183 
184 	static Image		GetStandardImage();
185 	static Image		GetStandardImageHC();
186 };
187 
188 #endif	// _SV_MSGBOX_HXX
189