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_ACCEL_HXX
21 #define INCLUDED_VCL_ACCEL_HXX
23 #include <tools/link.hxx>
24 #include <tools/resid.hxx>
25 #include <tools/rc.hxx>
26 #include <vcl/keycod.hxx>
27 #include <vcl/dllapi.h>
32 class VCL_DLLPUBLIC Accelerator
: public Resource
34 friend class ImplAccelManager
;
37 ImplAccelData
* mpData
;
40 Link
<> maDeactivateHdl
;
43 // Will be set by AcceleratorManager
44 vcl::KeyCode maCurKeyCode
;
46 sal_uInt16 mnCurRepeat
;
50 SAL_DLLPRIVATE
void ImplInit();
51 SAL_DLLPRIVATE
void ImplCopyData( ImplAccelData
& rAccelData
);
52 SAL_DLLPRIVATE
void ImplDeleteData();
53 SAL_DLLPRIVATE
void ImplInsertAccel(
55 const vcl::KeyCode
& rKeyCode
,
57 Accelerator
* pAutoAccel
);
59 SAL_DLLPRIVATE ImplAccelEntry
*
60 ImplGetAccelData( const vcl::KeyCode
& rKeyCode
) const;
63 SAL_DLLPRIVATE
void ImplLoadRes( const ResId
& rResId
);
67 Accelerator( const Accelerator
& rAccel
);
68 Accelerator( const ResId
& rResId
);
69 virtual ~Accelerator();
75 void InsertItem( sal_uInt16 nItemId
, const vcl::KeyCode
& rKeyCode
);
76 void InsertItem( const ResId
& rResId
);
78 sal_uInt16
GetCurItemId() const { return mnCurId
; }
79 const vcl::KeyCode
& GetCurKeyCode() const { return maCurKeyCode
; }
80 sal_uInt16
GetCurRepeat() const { return mnCurRepeat
; }
81 bool IsCancel() const { return mbIsCancel
; }
83 sal_uInt16
GetItemCount() const;
84 sal_uInt16
GetItemId( sal_uInt16 nPos
) const;
85 vcl::KeyCode
GetKeyCode( sal_uInt16 nItemId
) const;
87 Accelerator
* GetAccel( sal_uInt16 nItemId
) const;
89 void SetHelpText( const OUString
& rHelpText
) { maHelpStr
= rHelpText
; }
90 const OUString
& GetHelpText() const { return maHelpStr
; }
92 void SetActivateHdl( const Link
<>& rLink
) { maActivateHdl
= rLink
; }
93 const Link
<>& GetActivateHdl() const { return maActivateHdl
; }
94 void SetDeactivateHdl( const Link
<>& rLink
) { maDeactivateHdl
= rLink
; }
95 const Link
<>& GetDeactivateHdl() const { return maDeactivateHdl
; }
96 void SetSelectHdl( const Link
<>& rLink
) { maSelectHdl
= rLink
; }
97 const Link
<>& GetSelectHdl() const { return maSelectHdl
; }
99 Accelerator
& operator=( const Accelerator
& rAccel
);
102 #endif // INCLUDED_VCL_ACCEL_HXX
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */