1721f296aSOliver-Rainer Wittmann /**************************************************************
2721f296aSOliver-Rainer Wittmann *
3721f296aSOliver-Rainer Wittmann * Licensed to the Apache Software Foundation (ASF) under one
4721f296aSOliver-Rainer Wittmann * or more contributor license agreements. See the NOTICE file
5721f296aSOliver-Rainer Wittmann * distributed with this work for additional information
6721f296aSOliver-Rainer Wittmann * regarding copyright ownership. The ASF licenses this file
7721f296aSOliver-Rainer Wittmann * to you under the Apache License, Version 2.0 (the
8721f296aSOliver-Rainer Wittmann * "License"); you may not use this file except in compliance
9721f296aSOliver-Rainer Wittmann * with the License. You may obtain a copy of the License at
10721f296aSOliver-Rainer Wittmann *
11721f296aSOliver-Rainer Wittmann * http://www.apache.org/licenses/LICENSE-2.0
12721f296aSOliver-Rainer Wittmann *
13721f296aSOliver-Rainer Wittmann * Unless required by applicable law or agreed to in writing,
14721f296aSOliver-Rainer Wittmann * software distributed under the License is distributed on an
15721f296aSOliver-Rainer Wittmann * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16721f296aSOliver-Rainer Wittmann * KIND, either express or implied. See the License for the
17721f296aSOliver-Rainer Wittmann * specific language governing permissions and limitations
18721f296aSOliver-Rainer Wittmann * under the License.
19721f296aSOliver-Rainer Wittmann *
20721f296aSOliver-Rainer Wittmann *************************************************************/
21721f296aSOliver-Rainer Wittmann
22721f296aSOliver-Rainer Wittmann #include "precompiled_sfx2.hxx"
23721f296aSOliver-Rainer Wittmann
24721f296aSOliver-Rainer Wittmann #include "CustomImageRadioButton.hxx"
25721f296aSOliver-Rainer Wittmann
26721f296aSOliver-Rainer Wittmann #include "DrawHelper.hxx"
27721f296aSOliver-Rainer Wittmann #include "Paint.hxx"
28*f35c6d02SAndre Fischer #include "sfx2/sidebar/Tools.hxx"
29721f296aSOliver-Rainer Wittmann
30721f296aSOliver-Rainer Wittmann using namespace ::com::sun::star;
31721f296aSOliver-Rainer Wittmann using namespace ::com::sun::star::uno;
32721f296aSOliver-Rainer Wittmann
33721f296aSOliver-Rainer Wittmann
34721f296aSOliver-Rainer Wittmann namespace sfx2 { namespace sidebar {
35721f296aSOliver-Rainer Wittmann
36721f296aSOliver-Rainer Wittmann
CustomImageRadioButton(Window * pParentWindow,const ResId & rResId)37721f296aSOliver-Rainer Wittmann CustomImageRadioButton::CustomImageRadioButton (
38721f296aSOliver-Rainer Wittmann Window* pParentWindow,
39721f296aSOliver-Rainer Wittmann const ResId& rResId )
40721f296aSOliver-Rainer Wittmann : ImageRadioButton( pParentWindow, rResId )
41721f296aSOliver-Rainer Wittmann {
42721f296aSOliver-Rainer Wittmann SetStyle( GetStyle() | WB_NOPOINTERFOCUS );
43721f296aSOliver-Rainer Wittmann }
44721f296aSOliver-Rainer Wittmann
45721f296aSOliver-Rainer Wittmann
~CustomImageRadioButton(void)46721f296aSOliver-Rainer Wittmann CustomImageRadioButton::~CustomImageRadioButton (void)
47721f296aSOliver-Rainer Wittmann {
48721f296aSOliver-Rainer Wittmann }
49721f296aSOliver-Rainer Wittmann
50721f296aSOliver-Rainer Wittmann
Paint(const Rectangle &)512b1fe8a9SPavel Janík void CustomImageRadioButton::Paint (const Rectangle& /* rUpdateArea */)
52721f296aSOliver-Rainer Wittmann {
53721f296aSOliver-Rainer Wittmann Rectangle aPaintRect( Rectangle(Point(0,0), GetSizePixel() ) );
54721f296aSOliver-Rainer Wittmann SetMouseRect( aPaintRect );
55721f296aSOliver-Rainer Wittmann SetStateRect( aPaintRect );
56721f296aSOliver-Rainer Wittmann
57721f296aSOliver-Rainer Wittmann const Theme::ThemeItem eBackground =
5837fee4fdSAndre Fischer IsMouseOver()
59721f296aSOliver-Rainer Wittmann ? Theme::Paint_TabItemBackgroundHighlight
60721f296aSOliver-Rainer Wittmann : Theme::Paint_PanelBackground;
61721f296aSOliver-Rainer Wittmann DrawHelper::DrawRoundedRectangle(
62721f296aSOliver-Rainer Wittmann *this,
63721f296aSOliver-Rainer Wittmann aPaintRect,
6437fee4fdSAndre Fischer Theme::GetInteger(Theme::Int_ButtonCornerRadius),
6537fee4fdSAndre Fischer IsChecked() || IsMouseOver() ? Theme::GetColor(Theme::Color_TabItemBorder) : Color(0xffffffff),
66721f296aSOliver-Rainer Wittmann Theme::GetPaint( eBackground ) );
67721f296aSOliver-Rainer Wittmann
68721f296aSOliver-Rainer Wittmann const Image aIcon (GetModeRadioImage(Theme::IsHighContrastMode()
69721f296aSOliver-Rainer Wittmann ? BMP_COLOR_HIGHCONTRAST
70721f296aSOliver-Rainer Wittmann : BMP_COLOR_NORMAL));
71721f296aSOliver-Rainer Wittmann const Size aIconSize (aIcon.GetSizePixel());
72721f296aSOliver-Rainer Wittmann const Point aIconLocation(
73721f296aSOliver-Rainer Wittmann (GetSizePixel().Width() - aIconSize.Width())/2,
74721f296aSOliver-Rainer Wittmann (GetSizePixel().Height() - aIconSize.Height())/2 );
75721f296aSOliver-Rainer Wittmann DrawImage(
76721f296aSOliver-Rainer Wittmann aIconLocation,
77721f296aSOliver-Rainer Wittmann aIcon,
78721f296aSOliver-Rainer Wittmann IsEnabled() ? 0 : IMAGE_DRAW_DISABLE );
79721f296aSOliver-Rainer Wittmann }
80721f296aSOliver-Rainer Wittmann
81721f296aSOliver-Rainer Wittmann
82721f296aSOliver-Rainer Wittmann } } // end of namespace sfx2::sidebar
83