xref: /AOO41X/main/svtools/inc/svtools/helpagentwindow.hxx (revision 01aa44aa134af97080e2cf8e8bf3a0a4cd1cffe0)
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 
23 
24 #ifndef _SVTOOLS_HELPAGENTWIDNOW_HXX_
25 #define _SVTOOLS_HELPAGENTWIDNOW_HXX_
26 
27 #include "svtools/svtdllapi.h"
28 #include <vcl/floatwin.hxx>
29 #include <vcl/image.hxx>
30 
31 //........................................................................
32 namespace svt
33 {
34 //........................................................................
35 
36     //====================================================================
37     //= IHelpAgentCallback
38     //====================================================================
39     class IHelpAgentCallback
40     {
41     public:
42         virtual void helpRequested() = 0;
43         virtual void closeAgent() = 0;
44     };
45 
46     //====================================================================
47     //= HelpAgentWindow
48     //====================================================================
49     class SVT_DLLPUBLIC HelpAgentWindow : public FloatingWindow
50     {
51     protected:
52         Window*                 m_pCloser;
53         IHelpAgentCallback*     m_pCallback;
54         Size                    m_aPreferredSize;
55         Image                   m_aPicture;
56 
57     public:
58         HelpAgentWindow( Window* _pParent );
59         ~HelpAgentWindow();
60 
61         /// returns the preferred size of the window
getPreferredSizePixel() const62         const Size& getPreferredSizePixel() const { return m_aPreferredSize; }
63 
64         // callback handler maintainance
setCallback(IHelpAgentCallback * _pCB)65         void                setCallback(IHelpAgentCallback* _pCB) { m_pCallback = _pCB; }
getCallback() const66         IHelpAgentCallback* getCallback() const { return m_pCallback; }
67 
68     protected:
69         virtual void Resize();
70         virtual void Paint( const Rectangle& rRect );
71         virtual void MouseButtonUp( const MouseEvent& rMEvt );
72 
73         DECL_LINK( OnButtonClicked, Window* );
74 
75     private:
76         SVT_DLLPRIVATE Size implOptimalButtonSize( const Image& _rButtonImage );
77     };
78 
79 //........................................................................
80 }   // namespace svt
81 //........................................................................
82 
83 #endif  // _SVTOOLS_HELPAGENTWIDNOW_HXX_
84 
85