Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_VCL_BTNDLG_HXX
21 : #define INCLUDED_VCL_BTNDLG_HXX
22 :
23 : #include <boost/ptr_container/ptr_vector.hpp>
24 : #include <vcl/dllapi.h>
25 : #include <vcl/dialog.hxx>
26 :
27 : struct ImplBtnDlgItem;
28 : class PushButton;
29 :
30 : #define BUTTONDIALOG_BUTTON_NOTFOUND ((sal_uInt16)0xFFFF)
31 :
32 : #define BUTTONDIALOG_DEFBUTTON ((sal_uInt16)0x0001)
33 : #define BUTTONDIALOG_OKBUTTON ((sal_uInt16)0x0002)
34 : #define BUTTONDIALOG_CANCELBUTTON ((sal_uInt16)0x0004)
35 : #define BUTTONDIALOG_HELPBUTTON ((sal_uInt16)0x0008)
36 : #define BUTTONDIALOG_FOCUSBUTTON ((sal_uInt16)0x0010)
37 :
38 : class VCL_DLLPUBLIC ButtonDialog : public Dialog
39 : {
40 : public:
41 : ButtonDialog( vcl::Window* pParent, WinBits nStyle = WB_STDDIALOG );
42 : virtual ~ButtonDialog();
43 :
44 : virtual void Resize() SAL_OVERRIDE;
45 : virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
46 :
47 : virtual void Click();
48 :
49 0 : void SetPageSizePixel( const Size& rSize ) { maPageSize = rSize; }
50 : const Size& GetPageSizePixel() const { return maPageSize; }
51 :
52 0 : sal_uInt16 GetCurButtonId() const { return mnCurButtonId; }
53 :
54 : void AddButton( const OUString& rText, sal_uInt16 nId, sal_uInt16 nBtnFlags, long nSepPixel = 0 );
55 : void AddButton( StandardButtonType eType, sal_uInt16 nId, sal_uInt16 nBtnFlags, long nSepPixel = 0 );
56 : void RemoveButton( sal_uInt16 nId );
57 :
58 : void Clear();
59 : sal_uInt16 GetButtonId( sal_uInt16 nButton ) const;
60 : PushButton* GetPushButton( sal_uInt16 nId ) const;
61 : void SetButtonText( sal_uInt16 nId, const OUString& rText );
62 : void SetButtonHelpText( sal_uInt16 nId, const OUString& rText );
63 :
64 0 : void SetFocusButton( sal_uInt16 nId = BUTTONDIALOG_BUTTON_NOTFOUND ) { mnFocusButtonId = nId; }
65 : sal_uInt16 GetFocusButton() const { return mnFocusButtonId; }
66 :
67 : void SetClickHdl( const Link& rLink ) { maClickHdl = rLink; }
68 : const Link& GetClickHdl() const { return maClickHdl; }
69 :
70 : protected:
71 : ButtonDialog( WindowType nType );
72 : SAL_DLLPRIVATE long ImplGetButtonSize();
73 :
74 : private:
75 : // Copy assignment is forbidden and not implemented.
76 : SAL_DLLPRIVATE ButtonDialog( const ButtonDialog & );
77 : SAL_DLLPRIVATE ButtonDialog& operator=( const ButtonDialog& );
78 :
79 : private:
80 : boost::ptr_vector<ImplBtnDlgItem> maItemList;
81 : Size maPageSize;
82 : Size maCtrlSize;
83 : long mnButtonSize;
84 : sal_uInt16 mnCurButtonId;
85 : sal_uInt16 mnFocusButtonId;
86 : bool mbFormat;
87 : Link maClickHdl;
88 :
89 : SAL_DLLPRIVATE void ImplInitButtonDialogData();
90 : SAL_DLLPRIVATE PushButton* ImplCreatePushButton( sal_uInt16 nBtnFlags );
91 : SAL_DLLPRIVATE ImplBtnDlgItem* ImplGetItem( sal_uInt16 nId ) const;
92 : DECL_DLLPRIVATE_LINK( ImplClickHdl, PushButton* pBtn );
93 : SAL_DLLPRIVATE void ImplPosControls();
94 :
95 : };
96 :
97 : #endif // INCLUDED_VCL_BTNDLG_HXX
98 :
99 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|