Update ooo320-m1
[ooovba.git] / vcl / source / window / msgbox.cxx
blob3fc21ffc6b8c6b59592c36e934105e5939911f9b
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: msgbox.cxx,v $
10 * $Revision: 1.25 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_vcl.hxx"
34 #ifndef _SV_SVIDS_HRC
35 #include <vcl/svids.hrc>
36 #endif
37 #include <vcl/svdata.hxx>
38 #include <vcl/metric.hxx>
39 #include <vcl/svapp.hxx>
40 #include <vcl/wrkwin.hxx>
41 #include <vcl/fixed.hxx>
42 #include <vcl/sound.hxx>
43 #include <vcl/brdwin.hxx>
44 #include <vcl/msgbox.hxx>
45 #include <vcl/button.hxx>
46 #ifndef _SV_RC_H
47 #include <tools/rc.h>
48 #endif
49 #include <vcl/mnemonic.hxx>
50 #include <vcl/window.h>
54 // =======================================================================
56 static void ImplInitMsgBoxImageList()
58 ImplSVData* pSVData = ImplGetSVData();
59 if ( !pSVData->maWinData.mpMsgBoxImgList )
61 ResMgr* pResMgr = ImplGetResMgr();
62 pSVData->maWinData.mpMsgBoxImgList = new ImageList(4);
63 pSVData->maWinData.mpMsgBoxHCImgList = new ImageList(4);
64 if( pResMgr )
66 Color aNonAlphaMask( 0xC0, 0xC0, 0xC0 );
67 pSVData->maWinData.mpMsgBoxImgList->InsertFromHorizontalBitmap
68 ( ResId( SV_RESID_BITMAP_MSGBOX, *pResMgr ), 4, &aNonAlphaMask );
69 pSVData->maWinData.mpMsgBoxHCImgList->InsertFromHorizontalBitmap
70 ( ResId( SV_RESID_BITMAP_MSGBOX_HC, *pResMgr ), 4, &aNonAlphaMask );
75 // =======================================================================
77 void MessBox::ImplInitMessBoxData()
79 mpFixedText = NULL;
80 mpFixedImage = NULL;
81 mnSoundType = 0;
82 mbHelpBtn = FALSE;
83 mbSound = TRUE;
84 mpCheckBox = NULL;
85 mbCheck = FALSE;
88 // -----------------------------------------------------------------------
90 void MessBox::ImplInitButtons()
92 WinBits nStyle = GetStyle();
93 USHORT nOKFlags = BUTTONDIALOG_OKBUTTON;
94 USHORT nCancelFlags = BUTTONDIALOG_CANCELBUTTON;
95 USHORT nRetryFlags = 0;
96 USHORT nYesFlags = 0;
97 USHORT nNoFlags = 0;
99 if ( nStyle & WB_OK_CANCEL )
101 if ( nStyle & WB_DEF_CANCEL )
102 nCancelFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
103 else // WB_DEF_OK
104 nOKFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
106 AddButton( BUTTON_OK, BUTTONID_OK, nOKFlags );
107 AddButton( BUTTON_CANCEL, BUTTONID_CANCEL, nCancelFlags );
109 else if ( nStyle & WB_YES_NO )
111 if ( nStyle & WB_DEF_YES )
112 nYesFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
113 else // WB_DEF_NO
114 nNoFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
115 nNoFlags |= BUTTONDIALOG_CANCELBUTTON;
117 AddButton( BUTTON_YES, BUTTONID_YES, nYesFlags );
118 AddButton( BUTTON_NO, BUTTONID_NO, nNoFlags );
120 else if ( nStyle & WB_YES_NO_CANCEL )
122 if ( nStyle & WB_DEF_YES )
123 nYesFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
124 else if ( nStyle & WB_DEF_NO )
125 nNoFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
126 else
127 nCancelFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
129 AddButton( BUTTON_YES, BUTTONID_YES, nYesFlags );
130 AddButton( BUTTON_NO, BUTTONID_NO, nNoFlags );
131 AddButton( BUTTON_CANCEL, BUTTONID_CANCEL, nCancelFlags );
133 else if ( nStyle & WB_RETRY_CANCEL )
135 if ( nStyle & WB_DEF_CANCEL )
136 nCancelFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
137 else // WB_DEF_RETRY
138 nRetryFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
140 AddButton( BUTTON_RETRY, BUTTONID_RETRY, nRetryFlags );
141 AddButton( BUTTON_CANCEL, BUTTONID_CANCEL, nCancelFlags );
143 else if ( nStyle & WB_ABORT_RETRY_IGNORE )
145 USHORT nAbortFlags = 0;
146 USHORT nIgnoreFlags = 0;
148 if ( nStyle & WB_DEF_CANCEL )
149 nAbortFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
150 else if ( nStyle & WB_DEF_RETRY )
151 nRetryFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
152 else if ( nStyle & WB_DEF_IGNORE )
153 nIgnoreFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
155 AddButton( BUTTON_ABORT, BUTTONID_CANCEL, nAbortFlags );
156 AddButton( BUTTON_RETRY, BUTTONID_RETRY, nRetryFlags );
157 AddButton( BUTTON_IGNORE, BUTTONID_IGNORE, nIgnoreFlags );
159 else if ( nStyle & WB_OK )
161 nOKFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
163 AddButton( BUTTON_OK, BUTTONID_OK, nOKFlags );
167 // -----------------------------------------------------------------------
169 MessBox::MessBox( WindowType ) :
170 ButtonDialog( WINDOW_MESSBOX )
172 ImplInitMessBoxData();
175 // -----------------------------------------------------------------------
177 MessBox::MessBox( Window* pParent, WinBits nStyle,
178 const XubString& rTitle, const XubString& rMessage ) :
179 ButtonDialog( WINDOW_MESSBOX ),
180 maMessText( rMessage )
182 ImplInitMessBoxData();
183 ImplInit( pParent, nStyle | WB_MOVEABLE | WB_HORZ | WB_CENTER );
184 ImplInitButtons();
186 if ( rTitle.Len() )
187 SetText( rTitle );
190 // -----------------------------------------------------------------------
192 MessBox::MessBox( Window* pParent, const ResId& rResId ) :
193 ButtonDialog( WINDOW_MESSBOX )
195 ImplInitMessBoxData();
197 GetRes( rResId.SetRT( RSC_MESSBOX ) );
198 USHORT nHiButtons = ReadShortRes();
199 USHORT nLoButtons = ReadShortRes();
200 USHORT nHiDefButton = ReadShortRes();
201 USHORT nLoDefButton = ReadShortRes();
202 USHORT nHiHelpId = ReadShortRes();
203 USHORT nLoHelpId = ReadShortRes();
204 /* USHORT bSysModal = */ ReadShortRes();
205 SetHelpId( ((ULONG)nHiHelpId << 16) + nLoHelpId );
206 WinBits nBits = (((ULONG)nHiButtons << 16) + nLoButtons) |
207 (((ULONG)nHiDefButton << 16) + nLoDefButton);
208 ImplInit( pParent, nBits | WB_MOVEABLE | WB_HORZ | WB_CENTER );
210 ImplLoadRes( rResId );
211 ImplInitButtons();
214 // -----------------------------------------------------------------------
216 void MessBox::ImplLoadRes( const ResId& )
218 SetText( ReadStringRes() );
219 SetMessText( ReadStringRes() );
220 SetHelpText( ReadStringRes() );
223 // -----------------------------------------------------------------------
225 MessBox::~MessBox()
227 if ( mpFixedText )
228 delete mpFixedText;
229 if ( mpFixedImage )
230 delete mpFixedImage;
231 if ( mpCheckBox )
232 delete mpCheckBox;
235 // -----------------------------------------------------------------------
237 void MessBox::ImplPosControls()
239 if ( GetHelpId() )
241 if ( !mbHelpBtn )
243 AddButton( BUTTON_HELP, BUTTONID_HELP, BUTTONDIALOG_HELPBUTTON, 3 );
244 mbHelpBtn = TRUE;
247 else
249 if ( mbHelpBtn )
251 RemoveButton( BUTTONID_HELP );
252 mbHelpBtn = FALSE;
256 XubString aMessText( maMessText );
257 TextRectInfo aTextInfo;
258 Rectangle aRect( 0, 0, 30000, 30000 );
259 Rectangle aFormatRect;
260 Point aTextPos( IMPL_DIALOG_OFFSET, IMPL_DIALOG_OFFSET+IMPL_MSGBOX_OFFSET_EXTRA_Y );
261 Size aImageSize;
262 Size aPageSize;
263 Size aFixedSize;
264 long nTitleWidth;
265 long nButtonSize = ImplGetButtonSize();
266 long nMaxWidth = GetDesktopRectPixel().GetWidth()-8;
267 long nMaxLineWidth;
268 long nWidth;
269 WinBits nWinStyle = WB_LEFT | WB_WORDBREAK | WB_NOLABEL | WB_INFO;
270 USHORT nTextStyle = TEXT_DRAW_MULTILINE | TEXT_DRAW_TOP | TEXT_DRAW_LEFT;
272 if ( mpFixedText )
273 delete mpFixedText;
274 if ( mpFixedImage )
276 delete mpFixedImage;
277 mpFixedImage = NULL;
279 if ( mpCheckBox )
281 mbCheck = mpCheckBox->IsChecked();
282 delete mpCheckBox;
283 mpCheckBox = NULL;
287 // Message-Text um Tabs bereinigen
288 XubString aTabStr( RTL_CONSTASCII_USTRINGPARAM( " " ) );
289 USHORT nIndex = 0;
290 while ( nIndex != STRING_NOTFOUND )
291 nIndex = aMessText.SearchAndReplace( '\t', aTabStr, nIndex );
293 // Wenn Fenster zu schmall, machen wir Dialog auch breiter
294 if ( mpWindowImpl->mbFrame )
295 nMaxWidth = 630;
296 else if ( nMaxWidth < 120 )
297 nMaxWidth = 120;
299 nMaxWidth -= mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder+4;
301 // MessageBox sollte min. so breit sein, das auch Title sichtbar ist
302 // Extra-Width for Closer, because Closer is set after this call
303 nTitleWidth = CalcTitleWidth();
304 nTitleWidth += mpWindowImpl->mnTopBorder;
306 nMaxWidth -= (IMPL_DIALOG_OFFSET*2)+(IMPL_MSGBOX_OFFSET_EXTRA_X*2);
308 // Wenn wir ein Image haben, dann deren Groesse ermitteln und das
309 // entsprechende Control anlegen und positionieren
310 aImageSize = maImage.GetSizePixel();
311 if ( aImageSize.Width() )
313 aImageSize.Width() += 4;
314 aImageSize.Height() += 4;
315 aTextPos.X() += aImageSize.Width()+IMPL_SEP_MSGBOX_IMAGE;
316 mpFixedImage = new FixedImage( this );
317 mpFixedImage->SetPosSizePixel( Point( IMPL_DIALOG_OFFSET-2+IMPL_MSGBOX_OFFSET_EXTRA_X,
318 IMPL_DIALOG_OFFSET-2+IMPL_MSGBOX_OFFSET_EXTRA_Y ),
319 aImageSize );
320 mpFixedImage->SetImage( maImage );
321 // forward the HC image
322 if( !!maImageHC )
323 mpFixedImage->SetModeImage( maImageHC, BMP_COLOR_HIGHCONTRAST );
324 mpFixedImage->Show();
325 nMaxWidth -= aImageSize.Width()+IMPL_SEP_MSGBOX_IMAGE;
327 else
328 aTextPos.X() += IMPL_MSGBOX_OFFSET_EXTRA_X;
330 // Maximale Zeilenlaenge ohne Wordbreak ermitteln
331 aFormatRect = GetTextRect( aRect, aMessText, nTextStyle, &aTextInfo );
332 nMaxLineWidth = aFormatRect.GetWidth();
333 nTextStyle |= TEXT_DRAW_WORDBREAK;
335 // Breite fuer Textformatierung ermitteln
336 if ( nMaxLineWidth > 450 )
337 nWidth = 450;
338 else if ( nMaxLineWidth > 300 )
339 nWidth = nMaxLineWidth+5;
340 else
341 nWidth = 300;
342 if ( nButtonSize > nWidth )
343 nWidth = nButtonSize-(aTextPos.X()-IMPL_DIALOG_OFFSET);
344 if ( nWidth > nMaxWidth )
345 nWidth = nMaxWidth;
347 aRect.Right() = nWidth;
348 aFormatRect = GetTextRect( aRect, aMessText, nTextStyle, &aTextInfo );
349 if ( aTextInfo.GetMaxLineWidth() > nWidth )
351 nWidth = aTextInfo.GetMaxLineWidth()+8;
352 aRect.Right() = nWidth;
353 aFormatRect = GetTextRect( aRect, aMessText, nTextStyle, &aTextInfo );
356 // Style fuer FixedText ermitteln
357 aPageSize.Width() = aImageSize.Width();
358 aFixedSize.Width() = aTextInfo.GetMaxLineWidth()+1;
359 aFixedSize.Height() = aFormatRect.GetHeight();
360 if ( aFixedSize.Height() < aImageSize.Height() )
362 nWinStyle |= WB_VCENTER;
363 aPageSize.Height() = aImageSize.Height();
364 aFixedSize.Height() = aImageSize.Height();
366 else
368 nWinStyle |= WB_TOP;
369 aPageSize.Height() = aFixedSize.Height();
371 if ( aImageSize.Width() )
372 aPageSize.Width() += IMPL_SEP_MSGBOX_IMAGE;
373 aPageSize.Width() += (IMPL_DIALOG_OFFSET*2)+(IMPL_MSGBOX_OFFSET_EXTRA_X*2);
374 aPageSize.Width() += aFixedSize.Width()+1;
375 aPageSize.Height() += (IMPL_DIALOG_OFFSET*2)+(IMPL_MSGBOX_OFFSET_EXTRA_Y*2);
377 if ( aPageSize.Width() < IMPL_MINSIZE_MSGBOX_WIDTH )
378 aPageSize.Width() = IMPL_MINSIZE_MSGBOX_WIDTH;
379 if ( aPageSize.Width() < nTitleWidth )
380 aPageSize.Width() = nTitleWidth;
382 if ( maCheckBoxText.Len() )
384 Size aMinCheckboxSize ( aFixedSize );
385 if ( aPageSize.Width() < IMPL_MINSIZE_MSGBOX_WIDTH+80 )
387 aPageSize.Width() = IMPL_MINSIZE_MSGBOX_WIDTH+80;
388 aMinCheckboxSize.Width() += 80;
391 // #104492# auto mnemonics for CJK strings may increase the length, so measure the
392 // checkbox length including a temporary mnemonic, the correct auto mnemonic will be
393 // generated later in the dialog (see init_show)
395 String aMnemonicString( maCheckBoxText );
396 if( GetSettings().GetStyleSettings().GetAutoMnemonic() )
398 if( aMnemonicString == GetNonMnemonicString( maCheckBoxText ) )
400 // no mnemonic found -> create one
401 MnemonicGenerator aMnemonicGenerator;
402 aMnemonicGenerator.CreateMnemonic( aMnemonicString );
406 mpCheckBox = new CheckBox( this );
407 mpCheckBox->Check( mbCheck );
408 mpCheckBox->SetText( aMnemonicString );
409 mpCheckBox->SetStyle( mpCheckBox->GetStyle() | WB_WORDBREAK );
410 mpCheckBox->SetHelpId( GetHelpId() ); // DR: Check box and dialog have same HID
412 // align checkbox with message text
413 Size aSize = mpCheckBox->CalcMinimumSize( aMinCheckboxSize.Width() );
415 // now set the original non-mnemonic string
416 mpCheckBox->SetText( maCheckBoxText );
418 Point aPos( aTextPos );
419 aPos.Y() += aFixedSize.Height() + (IMPL_DIALOG_OFFSET)+(IMPL_MSGBOX_OFFSET_EXTRA_Y*2);
421 // increase messagebox
422 aPageSize.Height() += aSize.Height() + (IMPL_DIALOG_OFFSET*2)+(IMPL_MSGBOX_OFFSET_EXTRA_Y*2);
424 mpCheckBox->SetPosSizePixel( aPos, aSize );
425 mpCheckBox->Show();
428 mpFixedText = new FixedText( this, nWinStyle );
429 mpFixedText->SetPosSizePixel( aTextPos, aFixedSize );
430 mpFixedText->SetText( aMessText );
431 mpFixedText->Show();
432 SetPageSizePixel( aPageSize );
435 // -----------------------------------------------------------------------
437 void MessBox::StateChanged( StateChangedType nType )
439 if ( nType == STATE_CHANGE_INITSHOW )
441 ImplPosControls();
442 if ( mbSound && mnSoundType )
443 Sound::Beep( (SoundType)(mnSoundType-1), this );
445 ButtonDialog::StateChanged( nType );
448 // -----------------------------------------------------------------------
450 BOOL MessBox::GetCheckBoxState() const
452 return mpCheckBox ? mpCheckBox->IsChecked() : mbCheck;
455 // -----------------------------------------------------------------------
457 void MessBox::SetCheckBoxState( BOOL bCheck )
459 if( mpCheckBox ) mpCheckBox->Check( bCheck );
460 mbCheck = bCheck;
463 // -----------------------------------------------------------------------
465 void MessBox::SetDefaultCheckBoxText()
467 ResMgr* pResMgr = ImplGetResMgr();
468 if( pResMgr )
469 maCheckBoxText = XubString( ResId( SV_STDTEXT_DONTHINTAGAIN, *pResMgr ) );
472 // -----------------------------------------------------------------------
474 BOOL MessBox::SetModeImage( const Image& rImage, BmpColorMode eMode )
476 if( eMode == BMP_COLOR_NORMAL )
477 SetImage( rImage );
478 else if( eMode == BMP_COLOR_HIGHCONTRAST )
479 maImageHC = rImage;
480 else
481 return FALSE;
482 return TRUE;
485 // -----------------------------------------------------------------------
487 const Image& MessBox::GetModeImage( BmpColorMode eMode ) const
489 if( eMode == BMP_COLOR_HIGHCONTRAST )
490 return maImageHC;
491 else
492 return maImage;
495 // -----------------------------------------------------------------------
497 void InfoBox::ImplInitInfoBoxData()
499 // Default Text is the display title from the application
500 if ( !GetText().Len() )
501 SetText( Application::GetDisplayName() );
503 SetImage( GetSettings().GetStyleSettings().GetHighContrastMode() ?
504 InfoBox::GetStandardImageHC() : InfoBox::GetStandardImage() );
505 mnSoundType = ((USHORT)SOUND_INFO)+1;
508 // -----------------------------------------------------------------------
510 InfoBox::InfoBox( Window* pParent, const XubString& rMessage ) :
511 MessBox( pParent, WB_OK | WB_DEF_OK, ImplGetSVEmptyStr(), rMessage )
513 ImplInitInfoBoxData();
516 // -----------------------------------------------------------------------
518 InfoBox::InfoBox( Window* pParent, const ResId & rResId ) :
519 MessBox( pParent, rResId.SetRT( RSC_INFOBOX ) )
521 ImplInitInfoBoxData();
524 // -----------------------------------------------------------------------
526 Image InfoBox::GetStandardImage()
528 ImplInitMsgBoxImageList();
529 return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 4 );
532 // -----------------------------------------------------------------------
534 Image InfoBox::GetStandardImageHC()
536 ImplInitMsgBoxImageList();
537 return ImplGetSVData()->maWinData.mpMsgBoxHCImgList->GetImage( 4 );
540 // -----------------------------------------------------------------------
542 void WarningBox::ImplInitWarningBoxData()
544 // Default Text is the display title from the application
545 if ( !GetText().Len() )
546 SetText( Application::GetDisplayName() );
548 SetImage( WarningBox::GetStandardImage() );
549 mnSoundType = ((USHORT)SOUND_WARNING)+1;
552 // -----------------------------------------------------------------------
554 WarningBox::WarningBox( Window* pParent, WinBits nStyle,
555 const XubString& rMessage ) :
556 MessBox( pParent, nStyle, ImplGetSVEmptyStr(), rMessage )
558 ImplInitWarningBoxData();
561 // -----------------------------------------------------------------------
563 WarningBox::WarningBox( Window* pParent, const ResId& rResId ) :
564 MessBox( pParent, rResId.SetRT( RSC_WARNINGBOX ) )
566 ImplInitWarningBoxData();
569 // -----------------------------------------------------------------------
571 void WarningBox::SetDefaultCheckBoxText()
573 ResMgr* pResMgr = ImplGetResMgr();
574 if( pResMgr )
575 maCheckBoxText = XubString( ResId( SV_STDTEXT_DONTWARNAGAIN, *pResMgr ) );
578 // -----------------------------------------------------------------------
580 Image WarningBox::GetStandardImage()
582 ImplInitMsgBoxImageList();
583 return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 3 );
586 // -----------------------------------------------------------------------
588 void ErrorBox::ImplInitErrorBoxData()
590 // Default Text is the display title from the application
591 if ( !GetText().Len() )
592 SetText( Application::GetDisplayName() );
594 SetImage( GetSettings().GetStyleSettings().GetHighContrastMode() ?
595 ErrorBox::GetStandardImageHC() : ErrorBox::GetStandardImage() );
596 mnSoundType = ((USHORT)SOUND_ERROR)+1;
599 // -----------------------------------------------------------------------
601 ErrorBox::ErrorBox( Window* pParent, WinBits nStyle,
602 const XubString& rMessage ) :
603 MessBox( pParent, nStyle, ImplGetSVEmptyStr(), rMessage )
605 ImplInitErrorBoxData();
608 // -----------------------------------------------------------------------
610 ErrorBox::ErrorBox( Window* pParent, const ResId& rResId ) :
611 MessBox( pParent, rResId.SetRT( RSC_ERRORBOX ) )
613 ImplInitErrorBoxData();
616 // -----------------------------------------------------------------------
618 Image ErrorBox::GetStandardImage()
620 ImplInitMsgBoxImageList();
621 return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 1 );
624 // -----------------------------------------------------------------------
626 Image ErrorBox::GetStandardImageHC()
628 ImplInitMsgBoxImageList();
629 return ImplGetSVData()->maWinData.mpMsgBoxHCImgList->GetImage( 1 );
632 // -----------------------------------------------------------------------
634 void QueryBox::ImplInitQueryBoxData()
636 // Default Text is the display title from the application
637 if ( !GetText().Len() )
638 SetText( Application::GetDisplayName() );
640 SetImage( GetSettings().GetStyleSettings().GetHighContrastMode() ?
641 QueryBox::GetStandardImageHC() : QueryBox::GetStandardImage() );
642 mnSoundType = ((USHORT)SOUND_QUERY)+1;
645 // -----------------------------------------------------------------------
647 QueryBox::QueryBox( Window* pParent, WinBits nStyle, const XubString& rMessage ) :
648 MessBox( pParent, nStyle, ImplGetSVEmptyStr(), rMessage )
650 ImplInitQueryBoxData();
653 // -----------------------------------------------------------------------
655 QueryBox::QueryBox( Window* pParent, const ResId& rResId ) :
656 MessBox( pParent, rResId.SetRT( RSC_QUERYBOX ) )
658 ImplInitQueryBoxData();
661 // -----------------------------------------------------------------------
663 void QueryBox::SetDefaultCheckBoxText()
665 ResMgr* pResMgr = ImplGetResMgr();
666 if( pResMgr )
667 maCheckBoxText = XubString( ResId( SV_STDTEXT_DONTASKAGAIN, *pResMgr ) );
670 // -----------------------------------------------------------------------
672 Image QueryBox::GetStandardImage()
674 ImplInitMsgBoxImageList();
675 return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 2 );
678 // -----------------------------------------------------------------------
680 Image QueryBox::GetStandardImageHC()
682 ImplInitMsgBoxImageList();
683 return ImplGetSVData()->maWinData.mpMsgBoxHCImgList->GetImage( 2 );
686 // -----------------------------------------------------------------------
688 Size MessBox::GetOptimalSize(WindowSizeType eType) const
690 switch( eType ) {
691 case WINDOWSIZE_MINIMUM:
692 // FIXME: base me on the font size ?
693 return Size( 250, 100 );
694 default:
695 return Window::GetOptimalSize( eType );