1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _SV_BTNDLG_HXX
21 #define _SV_BTNDLG_HXX
23 #include <boost/ptr_container/ptr_vector.hpp>
25 #include <tools/solar.h>
26 #include <vcl/dllapi.h>
27 #include <vcl/dialog.hxx>
29 struct ImplBtnDlgItem
;
32 // ----------------------
33 // - ButtonDialog-Types -
34 // ----------------------
36 #define BUTTONDIALOG_BUTTON_NOTFOUND ((sal_uInt16)0xFFFF)
38 #define BUTTONDIALOG_DEFBUTTON ((sal_uInt16)0x0001)
39 #define BUTTONDIALOG_OKBUTTON ((sal_uInt16)0x0002)
40 #define BUTTONDIALOG_CANCELBUTTON ((sal_uInt16)0x0004)
41 #define BUTTONDIALOG_HELPBUTTON ((sal_uInt16)0x0008)
42 #define BUTTONDIALOG_FOCUSBUTTON ((sal_uInt16)0x0010)
48 class VCL_DLLPUBLIC ButtonDialog
: public Dialog
51 boost::ptr_vector
<ImplBtnDlgItem
> maItemList
;
55 sal_uInt16 mnCurButtonId
;
56 sal_uInt16 mnFocusButtonId
;
60 SAL_DLLPRIVATE
void ImplInitButtonDialogData();
61 SAL_DLLPRIVATE PushButton
* ImplCreatePushButton( sal_uInt16 nBtnFlags
);
62 SAL_DLLPRIVATE ImplBtnDlgItem
* ImplGetItem( sal_uInt16 nId
) const;
63 DECL_DLLPRIVATE_LINK( ImplClickHdl
, PushButton
* pBtn
);
64 SAL_DLLPRIVATE
void ImplPosControls();
66 // Copy assignment is forbidden and not implemented.
67 SAL_DLLPRIVATE
ButtonDialog( const ButtonDialog
& );
68 SAL_DLLPRIVATE ButtonDialog
& operator=( const ButtonDialog
& );
70 ButtonDialog( WindowType nType
);
71 SAL_DLLPRIVATE
long ImplGetButtonSize();
74 ButtonDialog( Window
* pParent
, WinBits nStyle
= WB_STDDIALOG
);
77 virtual void Resize();
78 virtual void StateChanged( StateChangedType nStateChange
);
82 void SetPageSizePixel( const Size
& rSize
) { maPageSize
= rSize
; }
83 const Size
& GetPageSizePixel() const { return maPageSize
; }
85 sal_uInt16
GetCurButtonId() const { return mnCurButtonId
; }
87 void AddButton( const XubString
& rText
, sal_uInt16 nId
, sal_uInt16 nBtnFlags
, long nSepPixel
= 0 );
88 void AddButton( StandardButtonType eType
, sal_uInt16 nId
, sal_uInt16 nBtnFlags
, long nSepPixel
= 0 );
89 void RemoveButton( sal_uInt16 nId
);
91 sal_uInt16
GetButtonId( sal_uInt16 nButton
) const;
92 PushButton
* GetPushButton( sal_uInt16 nId
) const;
93 void SetButtonText( sal_uInt16 nId
, const XubString
& rText
);
94 void SetButtonHelpText( sal_uInt16 nId
, const XubString
& rText
);
96 void SetFocusButton( sal_uInt16 nId
= BUTTONDIALOG_BUTTON_NOTFOUND
) { mnFocusButtonId
= nId
; }
97 sal_uInt16
GetFocusButton() const { return mnFocusButtonId
; }
99 void SetClickHdl( const Link
& rLink
) { maClickHdl
= rLink
; }
100 const Link
& GetClickHdl() const { return maClickHdl
; }
103 #endif // _SV_BTNDLG_HXX
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */