TabItem.cxx (7a32b0c8) TabItem.cxx (65908a7e)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 27 unchanged lines hidden (view full) ---

36namespace sfx2 { namespace sidebar {
37
38
39TabItem::TabItem (Window* pParentWindow)
40 : ImageRadioButton(pParentWindow),
41 mbIsLeftButtonDown(false),
42 mePaintType(PT_Theme)
43{
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 27 unchanged lines hidden (view full) ---

36namespace sfx2 { namespace sidebar {
37
38
39TabItem::TabItem (Window* pParentWindow)
40 : ImageRadioButton(pParentWindow),
41 mbIsLeftButtonDown(false),
42 mePaintType(PT_Theme)
43{
44 SetStyle(GetStyle() | WB_TABSTOP | WB_DIALOGCONTROL | WB_NOPOINTERFOCUS);
44 SetBackground(Theme::GetPaint(Theme::Paint_TabBarBackground).GetWallpaper());
45#ifdef DEBUG
46 SetText(A2S("TabItem"));
47#endif
48}
49
50
51
52
53TabItem::~TabItem (void)
54{
55}
56
57
58
59
60void TabItem::Paint (const Rectangle& rUpdateArea)
61{
45 SetBackground(Theme::GetPaint(Theme::Paint_TabBarBackground).GetWallpaper());
46#ifdef DEBUG
47 SetText(A2S("TabItem"));
48#endif
49}
50
51
52
53
54TabItem::~TabItem (void)
55{
56}
57
58
59
60
61void TabItem::Paint (const Rectangle& rUpdateArea)
62{
63 OSL_TRACE("TabItem::Paint");
62 switch(mePaintType)
63 {
64 case PT_Theme:
65 default:
66 {
67 const bool bIsSelected (IsChecked());
64 switch(mePaintType)
65 {
66 case PT_Theme:
67 default:
68 {
69 const bool bIsSelected (IsChecked());
68 const bool bIsMouseOver (IsMouseOver());
70 const bool bIsHighlighted (IsMouseOver() || HasFocus());
69 DrawHelper::DrawRoundedRectangle(
70 *this,
71 Rectangle(Point(0,0), GetSizePixel()),
71 DrawHelper::DrawRoundedRectangle(
72 *this,
73 Rectangle(Point(0,0), GetSizePixel()),
72 2,
73 bIsMouseOver||bIsSelected ? Theme::GetColor(Theme::Color_TabItemBorder) : Color(0xffffffff),
74 bIsMouseOver
74 3,
75 bIsHighlighted||bIsSelected
76 ? Theme::GetColor(Theme::Color_TabItemBorder)
77 : Color(0xffffffff),
78 bIsHighlighted
75 ? Theme::GetPaint(Theme::Paint_TabItemBackgroundHighlight)
76 : Theme::GetPaint(Theme::Paint_TabItemBackgroundNormal));
77
78 const Image aIcon (Button::GetModeImage(Theme::IsHighContrastMode()
79 ? BMP_COLOR_HIGHCONTRAST
80 : BMP_COLOR_NORMAL));
81 const Size aIconSize (aIcon.GetSizePixel());
82 const Point aIconLocation(

--- 21 unchanged lines hidden (view full) ---

104 ImageRadioButton::MouseMove(rEvent);
105}
106
107
108
109
110void TabItem::MouseButtonDown (const MouseEvent& rMouseEvent)
111{
79 ? Theme::GetPaint(Theme::Paint_TabItemBackgroundHighlight)
80 : Theme::GetPaint(Theme::Paint_TabItemBackgroundNormal));
81
82 const Image aIcon (Button::GetModeImage(Theme::IsHighContrastMode()
83 ? BMP_COLOR_HIGHCONTRAST
84 : BMP_COLOR_NORMAL));
85 const Size aIconSize (aIcon.GetSizePixel());
86 const Point aIconLocation(

--- 21 unchanged lines hidden (view full) ---

108 ImageRadioButton::MouseMove(rEvent);
109}
110
111
112
113
114void TabItem::MouseButtonDown (const MouseEvent& rMouseEvent)
115{
112#if 0
113 Hide();
114 ImageRadioButton::MouseButtonDown(rMouseEvent);
115 Show();
116#else
117 if (rMouseEvent.IsLeft())
118 {
119 mbIsLeftButtonDown = true;
120 CaptureMouse();
121 Invalidate();
122 }
116 if (rMouseEvent.IsLeft())
117 {
118 mbIsLeftButtonDown = true;
119 CaptureMouse();
120 Invalidate();
121 }
123#endif
124}
125
126
127
128
129void TabItem::MouseButtonUp (const MouseEvent& rMouseEvent)
130{
122}
123
124
125
126
127void TabItem::MouseButtonUp (const MouseEvent& rMouseEvent)
128{
131#if 0
132 Hide();
133 ImageRadioButton::MouseButtonUp(rMouseEvent);
134 Show();
135#else
136 if (IsMouseCaptured())
137 ReleaseMouse();
138
139 if (rMouseEvent.IsLeft())
140 {
141 if (mbIsLeftButtonDown)
142 {
143 Check();
144 Click();
145 GetParent()->Invalidate();
146 }
147 }
148 if (mbIsLeftButtonDown)
149 {
150 mbIsLeftButtonDown = false;
151 Invalidate();
152 }
129 if (IsMouseCaptured())
130 ReleaseMouse();
131
132 if (rMouseEvent.IsLeft())
133 {
134 if (mbIsLeftButtonDown)
135 {
136 Check();
137 Click();
138 GetParent()->Invalidate();
139 }
140 }
141 if (mbIsLeftButtonDown)
142 {
143 mbIsLeftButtonDown = false;
144 Invalidate();
145 }
153#endif
154}
155
156
157
158} } // end of namespace sfx2::sidebar
146}
147
148
149
150} } // end of namespace sfx2::sidebar