1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 #include "precompiled_sfx2.hxx" 23 24 #include "TitleBar.hxx" 25 26 #include <tools/svborder.hxx> 27 #include <vcl/gradient.hxx> 28 29 30 namespace sfx2 { 31 32 TitleBar::TitleBar ( 33 const ::rtl::OUString& rsTitle, 34 const bool bIsDeckTitle, 35 Window* pParentWindow) 36 : Window(pParentWindow), 37 msTitle(rsTitle), 38 mbIsDeckTitle(bIsDeckTitle) 39 { 40 SetBackground(Wallpaper()); 41 } 42 43 44 45 46 TitleBar::~TitleBar (void) 47 { 48 } 49 50 51 52 53 void TitleBar::Paint (const Rectangle& rUpdateArea) 54 { 55 Push(PUSH_FONT | PUSH_FILLCOLOR | PUSH_LINECOLOR); 56 57 // Set title bar colors. 58 SetFillColor(GetSettings().GetStyleSettings().GetDialogColor()); 59 SetLineColor(); 60 61 // Paint title bar background. 62 Size aWindowSize( GetOutputSizePixel() ); 63 int nOuterLeft = 0; 64 const SvBorder aBorder( 3, 1, 3, 3 ); 65 const sal_Int32 m_nTitleBarHeight = GetSettings().GetStyleSettings().GetTitleHeight(); 66 int nInnerLeft = nOuterLeft + aBorder.Left() - 1; 67 int nOuterRight = aWindowSize.Width() - 1; 68 int nInnerRight = nOuterRight - aBorder.Right() + 1; 69 int nInnerTop = m_nTitleBarHeight + aBorder.Top() - 1; 70 int nOuterBottom = aWindowSize.Height() - 1; 71 int nInnerBottom = nOuterBottom - aBorder.Bottom() + 1; 72 Rectangle aTitleBarBox( 73 nOuterLeft, 74 0, 75 nOuterRight, 76 nInnerTop-1 77 ); 78 const static Gradient aTitleBarGradient( 79 GRADIENT_LINEAR, 80 Color(0xe8e8f0), 81 Color(0xf0f0ff)); 82 DrawGradient(aTitleBarBox, aTitleBarGradient); 83 84 // Use a bold font for the deck title. 85 Font aFont(GetFont()); 86 aFont.SetWeight(WEIGHT_BOLD); 87 SetFont(aFont); 88 89 // Paint title bar text. 90 SetLineColor( GetSettings().GetStyleSettings().GetActiveTextColor() ); 91 aTitleBarBox.Left() += 3; 92 DrawText( 93 aTitleBarBox, 94 msTitle, 95 TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER); 96 97 Pop(); 98 } 99 100 101 } // end of namespace sfx2 102