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 <vcl/dllapi.h>
24 #include <vcl/dialog.hxx>
25 #include <o3tl/typed_flags_set.hxx>
30 struct ImplBtnDlgItem
;
34 #define BUTTONDIALOG_BUTTON_NOTFOUND ((sal_uInt16)0xFFFF)
36 enum class ButtonDialogFlags
47 template<> struct typed_flags
<ButtonDialogFlags
> : is_typed_flags
<ButtonDialogFlags
, 0x001f> {};
50 class VCL_DLLPUBLIC ButtonDialog
: public Dialog
53 ButtonDialog( vcl::Window
* pParent
, WinBits nStyle
);
54 virtual ~ButtonDialog() override
;
55 virtual void dispose() override
;
57 virtual void Resize() override
;
58 virtual void StateChanged( StateChangedType nStateChange
) override
;
60 void SetPageSizePixel( const Size
& rSize
) { maPageSize
= rSize
; }
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
) { mnFocusButtonId
= nId
; }
77 ButtonDialog( WindowType nType
);
78 SAL_DLLPRIVATE
long ImplGetButtonSize();
81 ButtonDialog( const ButtonDialog
& ) = delete;
82 ButtonDialog
& operator=( const ButtonDialog
& ) = delete;
85 std::vector
<std::unique_ptr
<ImplBtnDlgItem
>> m_ItemList
;
89 sal_uInt16 mnCurButtonId
;
90 sal_uInt16 mnFocusButtonId
;
93 SAL_DLLPRIVATE
void ImplInitButtonDialogData();
94 SAL_DLLPRIVATE VclPtr
<PushButton
> ImplCreatePushButton( ButtonDialogFlags nBtnFlags
);
95 SAL_DLLPRIVATE ImplBtnDlgItem
* ImplGetItem( sal_uInt16 nId
) const;
96 DECL_DLLPRIVATE_LINK( ImplClickHdl
, Button
* pBtn
, void );
97 SAL_DLLPRIVATE
void ImplPosControls();
101 #endif // INCLUDED_VCL_BTNDLG_HXX
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */