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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 | 254 |
255 void TabGtk::SetVisible(bool visible) const { | 255 void TabGtk::SetVisible(bool visible) const { |
256 if (visible) { | 256 if (visible) { |
257 gtk_widget_show(event_box_.get()); | 257 gtk_widget_show(event_box_.get()); |
258 } else { | 258 } else { |
259 gtk_widget_hide(event_box_.get()); | 259 gtk_widget_hide(event_box_.get()); |
260 } | 260 } |
261 } | 261 } |
262 | 262 |
263 void TabGtk::CloseButtonResized(const gfx::Rect& bounds) { | 263 void TabGtk::CloseButtonResized(const gfx::Rect& bounds) { |
264 gtk_fixed_move(GTK_FIXED(TabRendererGtk::widget()), | 264 if (!bounds.IsEmpty()) { |
265 close_button_.get()->widget(), bounds.x(), bounds.y()); | 265 gtk_fixed_move(GTK_FIXED(TabRendererGtk::widget()), |
| 266 close_button_.get()->widget(), bounds.x(), bounds.y()); |
| 267 gtk_widget_show(close_button_.get()->widget()); |
| 268 } else { |
| 269 gtk_widget_hide(close_button_.get()->widget()); |
| 270 } |
266 } | 271 } |
267 | 272 |
268 void TabGtk::Paint(GdkEventExpose* event) { | 273 void TabGtk::Paint(GdkEventExpose* event) { |
269 TabRendererGtk::Paint(event); | 274 TabRendererGtk::Paint(event); |
270 | 275 |
271 gtk_container_propagate_expose(GTK_CONTAINER(TabRendererGtk::widget()), | 276 gtk_container_propagate_expose(GTK_CONTAINER(TabRendererGtk::widget()), |
272 close_button_.get()->widget(), event); | 277 close_button_.get()->widget(), event); |
273 } | 278 } |
274 | 279 |
275 /////////////////////////////////////////////////////////////////////////////// | 280 /////////////////////////////////////////////////////////////////////////////// |
(...skipping 17 matching lines...) Expand all Loading... |
293 } | 298 } |
294 | 299 |
295 CustomDrawButton* TabGtk::MakeCloseButton() { | 300 CustomDrawButton* TabGtk::MakeCloseButton() { |
296 CustomDrawButton* button = new CustomDrawButton(IDR_TAB_CLOSE, | 301 CustomDrawButton* button = new CustomDrawButton(IDR_TAB_CLOSE, |
297 IDR_TAB_CLOSE_P, IDR_TAB_CLOSE_H, IDR_TAB_CLOSE); | 302 IDR_TAB_CLOSE_P, IDR_TAB_CLOSE_H, IDR_TAB_CLOSE); |
298 | 303 |
299 g_signal_connect(G_OBJECT(button->widget()), "clicked", | 304 g_signal_connect(G_OBJECT(button->widget()), "clicked", |
300 G_CALLBACK(OnCloseButtonClicked), this); | 305 G_CALLBACK(OnCloseButtonClicked), this); |
301 GTK_WIDGET_UNSET_FLAGS(button->widget(), GTK_CAN_FOCUS); | 306 GTK_WIDGET_UNSET_FLAGS(button->widget(), GTK_CAN_FOCUS); |
302 gtk_fixed_put(GTK_FIXED(TabRendererGtk::widget()), button->widget(), 0, 0); | 307 gtk_fixed_put(GTK_FIXED(TabRendererGtk::widget()), button->widget(), 0, 0); |
303 gtk_widget_show(button->widget()); | |
304 | 308 |
305 return button; | 309 return button; |
306 } | 310 } |
OLD | NEW |