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 : private:
41 : boost::ptr_vector<ImplBtnDlgItem> maItemList;
42 : Size maPageSize;
43 : Size maCtrlSize;
44 : long mnButtonSize;
45 : sal_uInt16 mnCurButtonId;
46 : sal_uInt16 mnFocusButtonId;
47 : bool mbFormat;
48 : Link maClickHdl;
49 :
50 : SAL_DLLPRIVATE void ImplInitButtonDialogData();
51 : SAL_DLLPRIVATE PushButton* ImplCreatePushButton( sal_uInt16 nBtnFlags );
52 : SAL_DLLPRIVATE ImplBtnDlgItem* ImplGetItem( sal_uInt16 nId ) const;
53 : DECL_DLLPRIVATE_LINK( ImplClickHdl, PushButton* pBtn );
54 : SAL_DLLPRIVATE void ImplPosControls();
55 :
56 : // Copy assignment is forbidden and not implemented.
57 : SAL_DLLPRIVATE ButtonDialog( const ButtonDialog & );
58 : SAL_DLLPRIVATE ButtonDialog& operator=( const ButtonDialog& );
59 : protected:
60 : ButtonDialog( WindowType nType );
61 : SAL_DLLPRIVATE long ImplGetButtonSize();
62 :
63 : public:
64 : ButtonDialog( Window* pParent, WinBits nStyle = WB_STDDIALOG );
65 : virtual ~ButtonDialog();
66 :
67 : virtual void Resize() SAL_OVERRIDE;
68 : virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
69 :
70 : virtual void Click();
71 :
72 0 : void SetPageSizePixel( const Size& rSize ) { maPageSize = rSize; }
73 : const Size& GetPageSizePixel() const { return maPageSize; }
74 :
75 0 : sal_uInt16 GetCurButtonId() const { return mnCurButtonId; }
76 :
77 : void AddButton( const OUString& rText, sal_uInt16 nId, sal_uInt16 nBtnFlags, long nSepPixel = 0 );
78 : void AddButton( StandardButtonType eType, sal_uInt16 nId, sal_uInt16 nBtnFlags, long nSepPixel = 0 );
79 : void RemoveButton( sal_uInt16 nId );
80 : void Clear();
81 : sal_uInt16 GetButtonId( sal_uInt16 nButton ) const;
82 : PushButton* GetPushButton( sal_uInt16 nId ) const;
83 : void SetButtonText( sal_uInt16 nId, const OUString& rText );
84 : void SetButtonHelpText( sal_uInt16 nId, const OUString& rText );
85 :
86 0 : void SetFocusButton( sal_uInt16 nId = BUTTONDIALOG_BUTTON_NOTFOUND ) { mnFocusButtonId = nId; }
87 : sal_uInt16 GetFocusButton() const { return mnFocusButtonId; }
88 :
89 : void SetClickHdl( const Link& rLink ) { maClickHdl = rLink; }
90 : const Link& GetClickHdl() const { return maClickHdl; }
91 : };
92 :
93 : #endif // INCLUDED_VCL_BTNDLG_HXX
94 :
95 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|