122de8995SAndre Fischer /************************************************************** 222de8995SAndre Fischer * 322de8995SAndre Fischer * Licensed to the Apache Software Foundation (ASF) under one 422de8995SAndre Fischer * or more contributor license agreements. See the NOTICE file 522de8995SAndre Fischer * distributed with this work for additional information 622de8995SAndre Fischer * regarding copyright ownership. The ASF licenses this file 722de8995SAndre Fischer * to you under the Apache License, Version 2.0 (the 822de8995SAndre Fischer * "License"); you may not use this file except in compliance 922de8995SAndre Fischer * with the License. You may obtain a copy of the License at 1022de8995SAndre Fischer * 1122de8995SAndre Fischer * http://www.apache.org/licenses/LICENSE-2.0 1222de8995SAndre Fischer * 1322de8995SAndre Fischer * Unless required by applicable law or agreed to in writing, 1422de8995SAndre Fischer * software distributed under the License is distributed on an 1522de8995SAndre Fischer * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1622de8995SAndre Fischer * KIND, either express or implied. See the License for the 1722de8995SAndre Fischer * specific language governing permissions and limitations 1822de8995SAndre Fischer * under the License. 1922de8995SAndre Fischer * 2022de8995SAndre Fischer *************************************************************/ 2122de8995SAndre Fischer 2222de8995SAndre Fischer #include "precompiled_sfx2.hxx" 2322de8995SAndre Fischer 2422de8995SAndre Fischer #include "TitleBar.hxx" 25ff12d537SAndre Fischer #include "Paint.hxx" 2622de8995SAndre Fischer 2722de8995SAndre Fischer #include <tools/svborder.hxx> 2822de8995SAndre Fischer #include <vcl/gradient.hxx> 2922de8995SAndre Fischer 30ff12d537SAndre Fischer ToolbarValue::~ToolbarValue (void) {} 3122de8995SAndre Fischer 32ff12d537SAndre Fischer 33ff12d537SAndre Fischer namespace sfx2 { namespace sidebar { 3422de8995SAndre Fischer 3522de8995SAndre Fischer TitleBar::TitleBar ( 3622de8995SAndre Fischer const ::rtl::OUString& rsTitle, 3722de8995SAndre Fischer Window* pParentWindow) 3822de8995SAndre Fischer : Window(pParentWindow), 39ff12d537SAndre Fischer msTitle(rsTitle) 4022de8995SAndre Fischer { 4122de8995SAndre Fischer SetBackground(Wallpaper()); 4222de8995SAndre Fischer } 4322de8995SAndre Fischer 4422de8995SAndre Fischer 4522de8995SAndre Fischer 4622de8995SAndre Fischer 4722de8995SAndre Fischer TitleBar::~TitleBar (void) 4822de8995SAndre Fischer { 4922de8995SAndre Fischer } 5022de8995SAndre Fischer 5122de8995SAndre Fischer 5222de8995SAndre Fischer 5322de8995SAndre Fischer 5422de8995SAndre Fischer void TitleBar::Paint (const Rectangle& rUpdateArea) 5522de8995SAndre Fischer { 5622de8995SAndre Fischer // Paint title bar background. 5722de8995SAndre Fischer Size aWindowSize( GetOutputSizePixel() ); 58ff12d537SAndre Fischer /* 5922de8995SAndre Fischer int nOuterLeft = 0; 6022de8995SAndre Fischer const SvBorder aBorder( 3, 1, 3, 3 ); 6122de8995SAndre Fischer const sal_Int32 m_nTitleBarHeight = GetSettings().GetStyleSettings().GetTitleHeight(); 6222de8995SAndre Fischer int nInnerLeft = nOuterLeft + aBorder.Left() - 1; 6322de8995SAndre Fischer int nOuterRight = aWindowSize.Width() - 1; 6422de8995SAndre Fischer int nInnerRight = nOuterRight - aBorder.Right() + 1; 6522de8995SAndre Fischer int nInnerTop = m_nTitleBarHeight + aBorder.Top() - 1; 6622de8995SAndre Fischer int nOuterBottom = aWindowSize.Height() - 1; 6722de8995SAndre Fischer int nInnerBottom = nOuterBottom - aBorder.Bottom() + 1; 6822de8995SAndre Fischer Rectangle aTitleBarBox( 6922de8995SAndre Fischer nOuterLeft, 7022de8995SAndre Fischer 0, 7122de8995SAndre Fischer nOuterRight, 7222de8995SAndre Fischer nInnerTop-1 7322de8995SAndre Fischer ); 74ff12d537SAndre Fischer */ 75ff12d537SAndre Fischer Rectangle aTitleBarBox( 76ff12d537SAndre Fischer 0, 77ff12d537SAndre Fischer 0, 78ff12d537SAndre Fischer aWindowSize.Width(), 79ff12d537SAndre Fischer aWindowSize.Height() 80ff12d537SAndre Fischer ); 81ff12d537SAndre Fischer 82ff12d537SAndre Fischer 83ff12d537SAndre Fischer PaintBackground(aTitleBarBox); 84ff12d537SAndre Fischer PaintDecoration(aTitleBarBox); 85ff12d537SAndre Fischer PaintTitle(GetTitleArea(aTitleBarBox)); 86ff12d537SAndre Fischer } 87ff12d537SAndre Fischer 88ff12d537SAndre Fischer 89ff12d537SAndre Fischer 90*b9e67834SAndre Fischer 91ff12d537SAndre Fischer void TitleBar::PaintBackground (const Rectangle& rTitleBarBox) 92ff12d537SAndre Fischer { 93ff12d537SAndre Fischer const sidebar::Paint aBackgroundPaint (GetBackgroundPaint()); 94ff12d537SAndre Fischer 95ff12d537SAndre Fischer switch(aBackgroundPaint.GetType()) 96ff12d537SAndre Fischer { 97ff12d537SAndre Fischer case Paint::NoPaint: 98ff12d537SAndre Fischer default: 99ff12d537SAndre Fischer break; 100ff12d537SAndre Fischer 101ff12d537SAndre Fischer case Paint::ColorPaint: 102ff12d537SAndre Fischer // Set title bar colors. 103ff12d537SAndre Fischer Push(PUSH_LINECOLOR | PUSH_FILLCOLOR); 104ff12d537SAndre Fischer SetFillColor(aBackgroundPaint.GetColor()); 105ff12d537SAndre Fischer SetLineColor(); 106ff12d537SAndre Fischer DrawRect(rTitleBarBox); 107ff12d537SAndre Fischer Pop(); 108ff12d537SAndre Fischer break; 109ff12d537SAndre Fischer 110ff12d537SAndre Fischer case Paint::GradientPaint: 111ff12d537SAndre Fischer DrawGradient(rTitleBarBox, aBackgroundPaint.GetGradient()); 112ff12d537SAndre Fischer break; 113ff12d537SAndre Fischer } 114ff12d537SAndre Fischer } 115ff12d537SAndre Fischer 116ff12d537SAndre Fischer 117ff12d537SAndre Fischer 118ff12d537SAndre Fischer 119ff12d537SAndre Fischer void TitleBar::PaintTitle (const Rectangle& rTitleBox) 120ff12d537SAndre Fischer { 121ff12d537SAndre Fischer Push(PUSH_FONT | PUSH_TEXTCOLOR); 12222de8995SAndre Fischer 12322de8995SAndre Fischer // Use a bold font for the deck title. 12422de8995SAndre Fischer Font aFont(GetFont()); 12522de8995SAndre Fischer aFont.SetWeight(WEIGHT_BOLD); 12622de8995SAndre Fischer SetFont(aFont); 12722de8995SAndre Fischer 12822de8995SAndre Fischer // Paint title bar text. 129ff12d537SAndre Fischer SetTextColor(GetTextColor()); 13022de8995SAndre Fischer DrawText( 131ff12d537SAndre Fischer rTitleBox, 13222de8995SAndre Fischer msTitle, 13322de8995SAndre Fischer TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER); 134ff12d537SAndre Fischer 13522de8995SAndre Fischer Pop(); 13622de8995SAndre Fischer } 13722de8995SAndre Fischer 13822de8995SAndre Fischer 139ff12d537SAndre Fischer } } // end of namespace sfx2::sidebar 140