Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / include / vcl / btndlg.hxx
blob3a955433bc3352e737810c3315ca083670c47a89
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
27 struct ImplBtnDlgItem;
28 class PushButton;
30 #define BUTTONDIALOG_BUTTON_NOTFOUND ((sal_uInt16)0xFFFF)
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)
38 class VCL_DLLPUBLIC ButtonDialog : public Dialog
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;
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();
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();
63 public:
64 ButtonDialog( Window* pParent, WinBits nStyle = WB_STDDIALOG );
65 virtual ~ButtonDialog();
67 virtual void Resize() SAL_OVERRIDE;
68 virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
70 virtual void Click();
72 void SetPageSizePixel( const Size& rSize ) { maPageSize = rSize; }
73 const Size& GetPageSizePixel() const { return maPageSize; }
75 sal_uInt16 GetCurButtonId() const { return mnCurButtonId; }
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 );
86 void SetFocusButton( sal_uInt16 nId = BUTTONDIALOG_BUTTON_NOTFOUND ) { mnFocusButtonId = nId; }
87 sal_uInt16 GetFocusButton() const { return mnFocusButtonId; }
89 void SetClickHdl( const Link& rLink ) { maClickHdl = rLink; }
90 const Link& GetClickHdl() const { return maClickHdl; }
93 #endif // INCLUDED_VCL_BTNDLG_HXX
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */