예제 #1
0
    void CustomFrameView::LayoutTitleBar()
    {
        // The window title is based on the calculated icon position, even when there
        // is no icon.
        gfx::Rect icon_bounds(IconBounds());
        if(frame_->widget_delegate()->ShouldShowWindowIcon())
        {
            window_icon_->SetBoundsRect(icon_bounds);
        }

        // Size the title.
        int title_x = frame_->widget_delegate()->ShouldShowWindowIcon() ?
            icon_bounds.right()+kIconTitleSpacing : icon_bounds.x();
        int title_height = title_font_->GetHeight();
        // We bias the title position so that when the difference between the icon and
        // title heights is odd, the extra pixel of the title is above the vertical
        // midline rather than below.  This compensates for how the icon is already
        // biased downwards (see IconBounds()) and helps prevent descenders on the
        // title from overlapping the 3D edge at the bottom of the titlebar.
        title_bounds_.SetRect(title_x,
            icon_bounds.y()+((icon_bounds.height()-title_height-1)/2),
            std::max(0, (should_show_minmax_buttons_ ?
            minimize_button_->x() : close_button_->x()) - kTitleCaptionSpacing -
            title_x), title_height);
    }
예제 #2
0
SidebarNavigator::SidebarNavigator(const BBox& sidebar_bounds,
		const BBox& main_content_bounds) :
		side_bar(sidebar_bounds), main_content(main_content_bounds), view(
				INVENTORY), content_overlay(NULL), inventory(
				get_sprite_by_name("inventory_icon"),
				new InventoryContent(main_content_bounds),
				icon_bounds(main_content_bounds, 0, NUM_ICONS_ROW_1)), equipment(
				get_sprite_by_name("equipment_icon"),
				new EquipmentContent(main_content_bounds),
				icon_bounds(main_content_bounds, 1, NUM_ICONS_ROW_1)), spells(
				get_sprite_by_name("spells_icon"),
				new SpellsContent(main_content_bounds),
				icon_bounds(main_content_bounds, 2, NUM_ICONS_ROW_1)), enemies(
				get_sprite_by_name("enemies_icon"),
				new EnemiesSeenContent(main_content_bounds),
				icon_bounds(main_content_bounds, 0, NUM_ICONS_ROW_2, 1)), config(
				get_sprite_by_name("config_icon"),
				new ConfigContent(main_content_bounds),
				icon_bounds(main_content_bounds, 1, NUM_ICONS_ROW_2, 1)) {
}