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 : : #include "radiobtnbox.hxx"
30 : : #include <dialmgr.hxx>
31 : :
32 : : namespace svx {
33 : :
34 : : // class SvxRadioButtonListBox ----------------------------------------------------
35 : :
36 : 0 : SvxRadioButtonListBox::SvxRadioButtonListBox(SvxSimpleTableContainer& rParent, WinBits nBits)
37 : 0 : : SvxSimpleTable(rParent, nBits)
38 : :
39 : : {
40 [ # # ][ # # ]: 0 : EnableCheckButton( new SvLBoxButtonData( this, true ) );
[ # # ]
41 : 0 : }
42 : :
43 : 0 : SvxRadioButtonListBox::~SvxRadioButtonListBox()
44 : : {
45 [ # # ]: 0 : }
46 : :
47 : 0 : void SvxRadioButtonListBox::SetTabs()
48 : : {
49 : 0 : SvxSimpleTable::SetTabs();
50 : 0 : }
51 : :
52 : 0 : void SvxRadioButtonListBox::MouseButtonUp( const MouseEvent& _rMEvt )
53 : : {
54 : 0 : m_aCurMousePoint = _rMEvt.GetPosPixel();
55 : 0 : SvxSimpleTable::MouseButtonUp( _rMEvt );
56 : 0 : }
57 : :
58 : 0 : void SvxRadioButtonListBox::KeyInput( const KeyEvent& rKEvt )
59 : : {
60 [ # # ][ # # ]: 0 : if ( !rKEvt.GetKeyCode().GetModifier() && KEY_SPACE == rKEvt.GetKeyCode().GetCode() )
[ # # ]
61 : : {
62 : 0 : SvLBoxEntry* pEntry = FirstSelected();
63 [ # # ]: 0 : if ( GetCheckButtonState( pEntry ) == SV_BUTTON_UNCHECKED )
64 : : {
65 : 0 : SetCheckButtonState( pEntry, SV_BUTTON_CHECKED );
66 [ # # ]: 0 : GetCheckButtonHdl().Call( NULL );
67 : 0 : return ;
68 : : }
69 : : }
70 : :
71 : 0 : SvxSimpleTable::KeyInput( rKEvt );
72 : : }
73 : :
74 : 0 : void SvxRadioButtonListBox::HandleEntryChecked( SvLBoxEntry* _pEntry )
75 : : {
76 : 0 : Select( _pEntry, sal_True );
77 : 0 : SvButtonState eState = GetCheckButtonState( _pEntry );
78 : :
79 [ # # ]: 0 : if ( SV_BUTTON_CHECKED == eState )
80 : : {
81 : : // we have radio button behavior -> so uncheck the other entries
82 : 0 : SvLBoxEntry* pEntry = First();
83 [ # # ]: 0 : while ( pEntry )
84 : : {
85 [ # # ]: 0 : if ( pEntry != _pEntry )
86 : 0 : SetCheckButtonState( pEntry, SV_BUTTON_UNCHECKED );
87 : 0 : pEntry = Next( pEntry );
88 : : }
89 : : }
90 : : else
91 : 0 : SetCheckButtonState( _pEntry, SV_BUTTON_CHECKED );
92 : 0 : }
93 : :
94 : 0 : const Point& SvxRadioButtonListBox::GetCurMousePoint() const
95 : : {
96 : 0 : return m_aCurMousePoint;
97 : : }
98 : :
99 : : } // end of namespace ::svx
100 : :
101 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|