Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SV_BTNDLG_HXX
30 : : #define _SV_BTNDLG_HXX
31 : :
32 : : #include <boost/ptr_container/ptr_vector.hpp>
33 : :
34 : : #include <tools/solar.h>
35 : : #include <vcl/dllapi.h>
36 : : #include <vcl/dialog.hxx>
37 : :
38 : : struct ImplBtnDlgItem;
39 : : class PushButton;
40 : :
41 : : // ----------------------
42 : : // - ButtonDialog-Types -
43 : : // ----------------------
44 : :
45 : : #define BUTTONDIALOG_BUTTON_NOTFOUND ((sal_uInt16)0xFFFF)
46 : :
47 : : #define BUTTONDIALOG_DEFBUTTON ((sal_uInt16)0x0001)
48 : : #define BUTTONDIALOG_OKBUTTON ((sal_uInt16)0x0002)
49 : : #define BUTTONDIALOG_CANCELBUTTON ((sal_uInt16)0x0004)
50 : : #define BUTTONDIALOG_HELPBUTTON ((sal_uInt16)0x0008)
51 : : #define BUTTONDIALOG_FOCUSBUTTON ((sal_uInt16)0x0010)
52 : :
53 : : // ----------------
54 : : // - ButtonDialog -
55 : : // ----------------
56 : :
57 : : class VCL_DLLPUBLIC ButtonDialog : public Dialog
58 : : {
59 : : private:
60 : : boost::ptr_vector<ImplBtnDlgItem> maItemList;
61 : : Size maPageSize;
62 : : Size maCtrlSize;
63 : : long mnButtonSize;
64 : : sal_uInt16 mnCurButtonId;
65 : : sal_uInt16 mnFocusButtonId;
66 : : sal_Bool mbFormat;
67 : : Link maClickHdl;
68 : :
69 : : SAL_DLLPRIVATE void ImplInitButtonDialogData();
70 : : SAL_DLLPRIVATE PushButton* ImplCreatePushButton( sal_uInt16 nBtnFlags );
71 : : SAL_DLLPRIVATE ImplBtnDlgItem* ImplGetItem( sal_uInt16 nId ) const;
72 : : DECL_DLLPRIVATE_LINK( ImplClickHdl, PushButton* pBtn );
73 : : SAL_DLLPRIVATE void ImplPosControls();
74 : :
75 : : // Copy assignment is forbidden and not implemented.
76 : : SAL_DLLPRIVATE ButtonDialog( const ButtonDialog & );
77 : : SAL_DLLPRIVATE ButtonDialog& operator=( const ButtonDialog& );
78 : : protected:
79 : : ButtonDialog( WindowType nType );
80 : : SAL_DLLPRIVATE long ImplGetButtonSize();
81 : :
82 : : public:
83 : : ButtonDialog( Window* pParent, WinBits nStyle = WB_STDDIALOG );
84 : : ~ButtonDialog();
85 : :
86 : : virtual void Resize();
87 : : virtual void StateChanged( StateChangedType nStateChange );
88 : :
89 : : virtual void Click();
90 : :
91 : 0 : void SetPageSizePixel( const Size& rSize ) { maPageSize = rSize; }
92 : : const Size& GetPageSizePixel() const { return maPageSize; }
93 : :
94 : 0 : sal_uInt16 GetCurButtonId() const { return mnCurButtonId; }
95 : :
96 : : void AddButton( const XubString& rText, sal_uInt16 nId, sal_uInt16 nBtnFlags, long nSepPixel = 0 );
97 : : void AddButton( StandardButtonType eType, sal_uInt16 nId, sal_uInt16 nBtnFlags, long nSepPixel = 0 );
98 : : void RemoveButton( sal_uInt16 nId );
99 : : void Clear();
100 : : sal_uInt16 GetButtonId( sal_uInt16 nButton ) const;
101 : : PushButton* GetPushButton( sal_uInt16 nId ) const;
102 : : void SetButtonText( sal_uInt16 nId, const XubString& rText );
103 : : void SetButtonHelpText( sal_uInt16 nId, const XubString& rText );
104 : :
105 : 0 : void SetFocusButton( sal_uInt16 nId = BUTTONDIALOG_BUTTON_NOTFOUND ) { mnFocusButtonId = nId; }
106 : : sal_uInt16 GetFocusButton() const { return mnFocusButtonId; }
107 : :
108 : : void SetClickHdl( const Link& rLink ) { maClickHdl = rLink; }
109 : : const Link& GetClickHdl() const { return maClickHdl; }
110 : : };
111 : :
112 : : #endif // _SV_BTNDLG_HXX
113 : :
114 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|