OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/gtk/custom_button.h" | 5 #include "chrome/browser/ui/gtk/custom_button.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" | 10 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 if (UseGtkTheme()) { | 348 if (UseGtkTheme()) { |
349 // Continue processing this expose event. | 349 // Continue processing this expose event. |
350 return FALSE; | 350 return FALSE; |
351 } else { | 351 } else { |
352 double hover_state = hover_controller_.GetCurrentValue(); | 352 double hover_state = hover_controller_.GetCurrentValue(); |
353 return button_base_.OnExpose(sender, e, hover_state); | 353 return button_base_.OnExpose(sender, e, hover_state); |
354 } | 354 } |
355 } | 355 } |
356 | 356 |
357 // static | 357 // static |
358 CustomDrawButton* CustomDrawButton::CloseButton( | 358 CustomDrawButton* CustomDrawButton::CloseButtonBar( |
359 GtkThemeService* theme_provider) { | 359 GtkThemeService* theme_provider) { |
360 CustomDrawButton* button = new CustomDrawButton(theme_provider, IDR_CLOSE_BAR, | 360 CustomDrawButton* button = new CustomDrawButton(theme_provider, |
361 IDR_CLOSE_BAR_P, IDR_CLOSE_BAR_H, 0, GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU); | 361 IDR_CLOSE_1, IDR_CLOSE_1_P, IDR_CLOSE_1_H, 0, |
| 362 GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU); |
362 return button; | 363 return button; |
363 } | 364 } |
364 | 365 |
| 366 // static |
| 367 CustomDrawButton* CustomDrawButton::CloseButtonBubble( |
| 368 GtkThemeService* theme_provider) { |
| 369 CustomDrawButton* button = new CustomDrawButton(theme_provider, |
| 370 IDR_CLOSE_2, IDR_CLOSE_2_P, IDR_CLOSE_2_H, 0, |
| 371 GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU); |
| 372 return button; |
| 373 } |
| 374 |
365 void CustomDrawButton::SetBrowserTheme() { | 375 void CustomDrawButton::SetBrowserTheme() { |
366 if (UseGtkTheme()) { | 376 if (UseGtkTheme()) { |
367 if (native_widget_.get()) | 377 if (native_widget_.get()) |
368 gtk_button_set_image(GTK_BUTTON(widget()), native_widget_.get()); | 378 gtk_button_set_image(GTK_BUTTON(widget()), native_widget_.get()); |
369 gtk_widget_set_size_request(widget(), -1, -1); | 379 gtk_widget_set_size_request(widget(), -1, -1); |
370 gtk_widget_set_app_paintable(widget(), FALSE); | 380 gtk_widget_set_app_paintable(widget(), FALSE); |
371 } else { | 381 } else { |
372 if (native_widget_.get()) | 382 if (native_widget_.get()) |
373 gtk_button_set_image(GTK_BUTTON(widget()), NULL); | 383 gtk_button_set_image(GTK_BUTTON(widget()), NULL); |
374 gtk_widget_set_size_request(widget(), button_base_.Width(), | 384 gtk_widget_set_size_request(widget(), button_base_.Width(), |
375 button_base_.Height()); | 385 button_base_.Height()); |
376 | 386 |
377 gtk_widget_set_app_paintable(widget(), TRUE); | 387 gtk_widget_set_app_paintable(widget(), TRUE); |
378 } | 388 } |
379 | 389 |
380 gtk_chrome_button_set_use_gtk_rendering( | 390 gtk_chrome_button_set_use_gtk_rendering( |
381 GTK_CHROME_BUTTON(widget()), UseGtkTheme()); | 391 GTK_CHROME_BUTTON(widget()), UseGtkTheme()); |
382 } | 392 } |
383 | 393 |
384 bool CustomDrawButton::UseGtkTheme() { | 394 bool CustomDrawButton::UseGtkTheme() { |
385 return !forcing_chrome_theme_ && theme_service_ && | 395 return !forcing_chrome_theme_ && theme_service_ && |
386 theme_service_->UsingNativeTheme(); | 396 theme_service_->UsingNativeTheme(); |
387 } | 397 } |
OLD | NEW |