2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 #include "CustomImageRadioButton.hxx"
20 #include "DrawHelper.hxx"
22 #include "sfx2/sidebar/Tools.hxx"
24 using namespace ::com::sun::star
;
25 using namespace ::com::sun::star::uno
;
28 namespace sfx2
{ namespace sidebar
{
31 CustomImageRadioButton::CustomImageRadioButton (
32 Window
* pParentWindow
,
34 : ImageRadioButton( pParentWindow
, rResId
)
36 SetStyle( GetStyle() | WB_NOPOINTERFOCUS
);
40 CustomImageRadioButton::~CustomImageRadioButton (void)
45 void CustomImageRadioButton::Paint (const Rectangle
& /*rUpdateArea*/)
47 Rectangle
aPaintRect( Rectangle(Point(0,0), GetSizePixel() ) );
48 SetMouseRect( aPaintRect
);
49 SetStateRect( aPaintRect
);
51 const Theme::ThemeItem eBackground
=
53 ? Theme::Paint_TabItemBackgroundHighlight
54 : Theme::Paint_PanelBackground
;
55 DrawHelper::DrawRoundedRectangle(
58 Theme::GetInteger(Theme::Int_ButtonCornerRadius
),
59 IsChecked() || IsMouseOver() ? Theme::GetColor(Theme::Color_TabItemBorder
) : Color(0xffffffff),
60 Theme::GetPaint( eBackground
) );
62 const Image
& rIcon
= GetModeRadioImage();
63 const Size
aIconSize (rIcon
.GetSizePixel());
64 const Point
aIconLocation(
65 (GetSizePixel().Width() - aIconSize
.Width())/2,
66 (GetSizePixel().Height() - aIconSize
.Height())/2 );
70 IsEnabled() ? 0 : IMAGE_DRAW_DISABLE
);
74 } } // end of namespace sfx2::sidebar