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 INCLUDED_VCL_BTNDLG_HXX
21 #define INCLUDED_VCL_BTNDLG_HXX
23 #include <boost/ptr_container/ptr_vector.hpp>
24 #include <vcl/dllapi.h>
25 #include <vcl/dialog.hxx>
26 #include <o3tl/typed_flags_set.hxx>
28 struct ImplBtnDlgItem
;
31 #define BUTTONDIALOG_BUTTON_NOTFOUND ((sal_uInt16)0xFFFF)
33 enum class ButtonDialogFlags
44 template<> struct typed_flags
<ButtonDialogFlags
> : is_typed_flags
<ButtonDialogFlags
, 0x001f> {};
47 class VCL_DLLPUBLIC ButtonDialog
: public Dialog
50 ButtonDialog( vcl::Window
* pParent
, WinBits nStyle
= WB_STDDIALOG
);
51 virtual ~ButtonDialog();
52 virtual void dispose() SAL_OVERRIDE
;
54 virtual void Resize() SAL_OVERRIDE
;
55 virtual void StateChanged( StateChangedType nStateChange
) SAL_OVERRIDE
;
59 void SetPageSizePixel( const Size
& rSize
) { maPageSize
= rSize
; }
60 const Size
& GetPageSizePixel() const { return maPageSize
; }
62 sal_uInt16
GetCurButtonId() const { return mnCurButtonId
; }
64 void AddButton( const OUString
& rText
, sal_uInt16 nId
, ButtonDialogFlags nBtnFlags
= ButtonDialogFlags::NONE
, long nSepPixel
= 0 );
65 void AddButton( StandardButtonType eType
, sal_uInt16 nId
, ButtonDialogFlags nBtnFlags
= ButtonDialogFlags::NONE
, long nSepPixel
= 0 );
66 void RemoveButton( sal_uInt16 nId
);
69 sal_uInt16
GetButtonId( sal_uInt16 nButton
) const;
70 PushButton
* GetPushButton( sal_uInt16 nId
) const;
71 void SetButtonText( sal_uInt16 nId
, const OUString
& rText
);
72 void SetButtonHelpText( sal_uInt16 nId
, const OUString
& rText
);
74 void SetFocusButton( sal_uInt16 nId
= BUTTONDIALOG_BUTTON_NOTFOUND
) { mnFocusButtonId
= nId
; }
75 sal_uInt16
GetFocusButton() const { return mnFocusButtonId
; }
77 void SetClickHdl( const Link
<>& rLink
) { maClickHdl
= rLink
; }
78 const Link
<>& GetClickHdl() const { return maClickHdl
; }
81 ButtonDialog( WindowType nType
);
82 SAL_DLLPRIVATE
long ImplGetButtonSize();
85 ButtonDialog( const ButtonDialog
& ) SAL_DELETED_FUNCTION
;
86 ButtonDialog
& operator=( const ButtonDialog
& ) SAL_DELETED_FUNCTION
;
89 boost::ptr_vector
<ImplBtnDlgItem
> maItemList
;
93 sal_uInt16 mnCurButtonId
;
94 sal_uInt16 mnFocusButtonId
;
98 SAL_DLLPRIVATE
void ImplInitButtonDialogData();
99 SAL_DLLPRIVATE PushButton
* ImplCreatePushButton( ButtonDialogFlags nBtnFlags
);
100 SAL_DLLPRIVATE ImplBtnDlgItem
* ImplGetItem( sal_uInt16 nId
) const;
101 DECL_DLLPRIVATE_LINK( ImplClickHdl
, PushButton
* pBtn
);
102 SAL_DLLPRIVATE
void ImplPosControls();
106 #endif // INCLUDED_VCL_BTNDLG_HXX
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */