#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
+#include "ui/gfx/font_list.h"
#include "ui/gfx/path.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/label.h"
// The height and width in pixels of the icon.
const int kIconSize = 16;
-// The font to use to draw the title.
-const char* kTitleFontName = "Arial Bold";
-const int kTitleFontSize = 14;
-
// The extra padding between the button and the top edge.
const int kExtraPaddingBetweenButtonAndTop = 1;
return new gfx::ImageSkia(canvas.ExtractImageRep());
}
+#if defined(OS_WIN)
const gfx::ImageSkia& GetTopLeftCornerImage(panel::CornerStyle corner_style) {
static gfx::ImageSkia* rounded_image = NULL;
static gfx::ImageSkia* non_rounded_image = NULL;
if (!rounded_image) {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+ ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
rounded_image = rb.GetImageSkiaNamed(IDR_WINDOW_TOP_LEFT_CORNER);
non_rounded_image = rb.GetImageSkiaNamed(IDR_PANEL_TOP_LEFT_CORNER);
}
static gfx::ImageSkia* rounded_image = NULL;
static gfx::ImageSkia* non_rounded_image = NULL;
if (!rounded_image) {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+ ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
rounded_image = rb.GetImageSkiaNamed(IDR_WINDOW_TOP_RIGHT_CORNER);
non_rounded_image = rb.GetImageSkiaNamed(IDR_PANEL_TOP_RIGHT_CORNER);
}
static gfx::ImageSkia* rounded_image = NULL;
static gfx::ImageSkia* non_rounded_image = NULL;
if (!rounded_image) {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+ ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
rounded_image = rb.GetImageSkiaNamed(IDR_WINDOW_BOTTOM_LEFT_CORNER);
non_rounded_image = rb.GetImageSkiaNamed(IDR_PANEL_BOTTOM_LEFT_CORNER);
}
static gfx::ImageSkia* rounded_image = NULL;
static gfx::ImageSkia* non_rounded_image = NULL;
if (!rounded_image) {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+ ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
rounded_image = rb.GetImageSkiaNamed(IDR_WINDOW_BOTTOM_RIGHT_CORNER);
non_rounded_image = rb.GetImageSkiaNamed(IDR_PANEL_BOTTOM_RIGHT_CORNER);
}
const gfx::ImageSkia& GetTopEdgeImage() {
static gfx::ImageSkia* image = NULL;
if (!image) {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+ ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
image = rb.GetImageSkiaNamed(IDR_WINDOW_TOP_CENTER);
}
return *image;
const gfx::ImageSkia& GetBottomEdgeImage() {
static gfx::ImageSkia* image = NULL;
if (!image) {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+ ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
image = rb.GetImageSkiaNamed(IDR_WINDOW_BOTTOM_CENTER);
}
return *image;
const gfx::ImageSkia& GetLeftEdgeImage() {
static gfx::ImageSkia* image = NULL;
if (!image) {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+ ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
image = rb.GetImageSkiaNamed(IDR_WINDOW_LEFT_SIDE);
}
return *image;
const gfx::ImageSkia& GetRightEdgeImage() {
static gfx::ImageSkia* image = NULL;
if (!image) {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+ ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
image = rb.GetImageSkiaNamed(IDR_WINDOW_RIGHT_SIDE);
}
return *image;
}
-
-const gfx::Font& GetTitleFont() {
- static gfx::Font* font = NULL;
- if (!font)
- font = new gfx::Font(kTitleFontName, kTitleFontSize);
- return *font;
-}
+#endif // defined(OS_WIN)
const gfx::ImageSkia* GetActiveBackgroundDefaultImage() {
static gfx::ImageSkia* image = NULL;
}
void PanelFrameView::Init() {
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+ ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
close_button_ = new views::ImageButton(this);
close_button_->SetImage(views::CustomButton::STATE_NORMAL,
rb.GetImageSkiaNamed(IDR_PANEL_CLOSE_C));
close_button_->SetImageAlignment(views::ImageButton::ALIGN_CENTER,
views::ImageButton::ALIGN_MIDDLE);
- string16 tooltip_text = l10n_util::GetStringUTF16(IDS_PANEL_CLOSE_TOOLTIP);
+ base::string16 tooltip_text =
+ l10n_util::GetStringUTF16(IDS_PANEL_CLOSE_TOOLTIP);
close_button_->SetTooltipText(tooltip_text);
AddChildView(close_button_);
restore_button_->SetVisible(false); // only visible when panel is minimized
AddChildView(restore_button_);
- title_icon_ = new TabIconView(this);
+ title_icon_ = new TabIconView(this, NULL);
title_icon_->set_is_light(true);
AddChildView(title_icon_);
title_icon_->Update();
- title_label_ = new views::Label(panel_view_->panel()->GetWindowTitle());
+ title_label_ = new views::Label(
+ panel_view_->panel()->GetWindowTitle(),
+ rb.GetFontList(ui::ResourceBundle::BoldFont));
title_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
title_label_->SetAutoColorReadabilityEnabled(false);
- title_label_->SetFont(GetTitleFont());
AddChildView(title_label_);
#if defined(USE_AURA)
// Compute the thickness of the client area that needs to be counted towards
// mouse resizing.
+ // TODO(tdanderson): Remove this if possible (crbug.com/344924).
int thickness_for_mouse_resizing =
PanelView::kResizeInsideBoundsSize - BorderThickness();
aura::Window* window = panel_view_->GetNativePanelWindow();
// Layout the title.
int title_x = title_icon_->bounds().right() + panel::kIconAndTitlePadding;
- int title_height = GetTitleFont().GetHeight();
+ int title_height = title_label_->font_list().GetHeight();
title_label_->SetBounds(
title_x,
icon_y + ((kIconSize - title_height - 1) / 2),