/src/libreoffice/vcl/inc/helpwin.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
5 | | * This Source Code Form is subject to the terms of the Mozilla Public |
6 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
7 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
11 | | * Licensed to the Apache Software Foundation (ASF) under one or more |
12 | | * contributor license agreements. See the NOTICE file distributed |
13 | | * with this work for additional information regarding copyright |
14 | | * ownership. The ASF licenses this file to you under the Apache |
15 | | * License, Version 2.0 (the "License"); you may not use this file |
16 | | * except in compliance with the License. You may obtain a copy of |
17 | | * the License at http://www.apache.org/licenses/LICENSE-2.0 . |
18 | | */ |
19 | | |
20 | | #pragma once |
21 | | |
22 | | #include <vcl/toolkit/floatwin.hxx> |
23 | | #include <vcl/timer.hxx> |
24 | | |
25 | | enum class QuickHelpFlags; |
26 | | struct ImplSVHelpData; |
27 | | |
28 | | enum class HelpWinStyle |
29 | | { |
30 | | Quick, |
31 | | Balloon, |
32 | | }; |
33 | | |
34 | | /// A tooltip: adds tips to widgets in a floating / popup window. |
35 | | class HelpTextWindow final : public FloatingWindow |
36 | | { |
37 | | private: |
38 | | tools::Rectangle maHelpArea; // If next Help for the same rectangle w/ same text, then keep window |
39 | | |
40 | | tools::Rectangle maTextRect; // For wrapped text in QuickHelp |
41 | | |
42 | | OUString maHelpText; |
43 | | |
44 | | Timer maShowTimer; |
45 | | Timer maHideTimer; |
46 | | |
47 | | HelpWinStyle meHelpWinStyle; |
48 | | QuickHelpFlags mnStyle; |
49 | | |
50 | | private: |
51 | | DECL_LINK( TimerHdl, Timer*, void ); |
52 | | |
53 | | virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override; |
54 | | virtual void RequestHelp( const HelpEvent& rHEvt ) override; |
55 | | virtual void ApplySettings(vcl::RenderContext& rRenderContext) override; |
56 | | |
57 | | virtual OUString GetText() const override; |
58 | | void ImplShow(); |
59 | | |
60 | | virtual void dispose() override; |
61 | | public: |
62 | | HelpTextWindow(vcl::Window* pParent, const OUString& rText, HelpWinStyle eHelpWinStyle, |
63 | | QuickHelpFlags nStyle); |
64 | | virtual ~HelpTextWindow() override; |
65 | | |
66 | 0 | const OUString& GetHelpText() const { return maHelpText; } |
67 | | void SetHelpText( const OUString& rHelpText ); |
68 | 0 | HelpWinStyle GetWinStyle() const { return meHelpWinStyle; } |
69 | 0 | QuickHelpFlags GetStyle() const { return mnStyle; } |
70 | | |
71 | | // only remember: |
72 | 0 | void SetHelpArea( const tools::Rectangle& rRect ) { maHelpArea = rRect; } |
73 | | |
74 | | void ShowHelp(bool bNoDelay); |
75 | | |
76 | | Size CalcOutSize() const; |
77 | 0 | const tools::Rectangle& GetHelpArea() const { return maHelpArea; } |
78 | | |
79 | | void ResetHideTimer(); |
80 | | }; |
81 | | |
82 | | VCL_DLLPUBLIC void ImplDestroyHelpWindow( bool bUpdateHideTime ); |
83 | | void ImplDestroyHelpWindow(ImplSVHelpData& rHelpData, bool bUpdateHideTime); |
84 | | |
85 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |