OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/gtk/tabs/tab_gtk.h" | 5 #include "chrome/browser/gtk/tabs/tab_gtk.h" |
6 | 6 |
7 #include "app/gfx/path.h" | 7 #include "app/gfx/path.h" |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
10 #include "chrome/browser/gtk/custom_button.h" | 10 #include "chrome/browser/gtk/custom_button.h" |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 } | 224 } |
225 | 225 |
226 /////////////////////////////////////////////////////////////////////////////// | 226 /////////////////////////////////////////////////////////////////////////////// |
227 // TabGtk, TabRendererGtk overrides: | 227 // TabGtk, TabRendererGtk overrides: |
228 | 228 |
229 bool TabGtk::IsSelected() const { | 229 bool TabGtk::IsSelected() const { |
230 return delegate_->IsTabSelected(this); | 230 return delegate_->IsTabSelected(this); |
231 } | 231 } |
232 | 232 |
233 void TabGtk::CloseButtonResized(const gfx::Rect& bounds) { | 233 void TabGtk::CloseButtonResized(const gfx::Rect& bounds) { |
234 gtk_fixed_move(GTK_FIXED(TabRendererGtk::widget()), | 234 if (!bounds.IsEmpty()) { |
235 close_button_.get()->widget(), bounds.x(), bounds.y()); | 235 gtk_fixed_move(GTK_FIXED(TabRendererGtk::widget()), |
| 236 close_button_.get()->widget(), bounds.x(), bounds.y()); |
| 237 gtk_widget_show(close_button_.get()->widget()); |
| 238 } else { |
| 239 gtk_widget_hide(close_button_.get()->widget()); |
| 240 } |
236 } | 241 } |
237 | 242 |
238 void TabGtk::Paint(GdkEventExpose* event) { | 243 void TabGtk::Paint(GdkEventExpose* event) { |
239 TabRendererGtk::Paint(event); | 244 TabRendererGtk::Paint(event); |
240 | 245 |
241 gtk_container_propagate_expose(GTK_CONTAINER(TabRendererGtk::widget()), | 246 gtk_container_propagate_expose(GTK_CONTAINER(TabRendererGtk::widget()), |
242 close_button_.get()->widget(), event); | 247 close_button_.get()->widget(), event); |
243 } | 248 } |
244 | 249 |
245 /////////////////////////////////////////////////////////////////////////////// | 250 /////////////////////////////////////////////////////////////////////////////// |
(...skipping 17 matching lines...) Expand all Loading... |
263 } | 268 } |
264 | 269 |
265 CustomDrawButton* TabGtk::MakeCloseButton() { | 270 CustomDrawButton* TabGtk::MakeCloseButton() { |
266 CustomDrawButton* button = new CustomDrawButton(IDR_TAB_CLOSE, | 271 CustomDrawButton* button = new CustomDrawButton(IDR_TAB_CLOSE, |
267 IDR_TAB_CLOSE_P, IDR_TAB_CLOSE_H, IDR_TAB_CLOSE); | 272 IDR_TAB_CLOSE_P, IDR_TAB_CLOSE_H, IDR_TAB_CLOSE); |
268 | 273 |
269 g_signal_connect(G_OBJECT(button->widget()), "clicked", | 274 g_signal_connect(G_OBJECT(button->widget()), "clicked", |
270 G_CALLBACK(OnCloseButtonClicked), this); | 275 G_CALLBACK(OnCloseButtonClicked), this); |
271 GTK_WIDGET_UNSET_FLAGS(button->widget(), GTK_CAN_FOCUS); | 276 GTK_WIDGET_UNSET_FLAGS(button->widget(), GTK_CAN_FOCUS); |
272 gtk_fixed_put(GTK_FIXED(TabRendererGtk::widget()), button->widget(), 0, 0); | 277 gtk_fixed_put(GTK_FIXED(TabRendererGtk::widget()), button->widget(), 0, 0); |
273 gtk_widget_show(button->widget()); | |
274 | 278 |
275 return button; | 279 return button; |
276 } | 280 } |
OLD | NEW |