xref: /trunk/main/svtools/inc/svtools/hyperlabel.hxx (revision 01aa44aa)
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 #ifndef SVTOOLS_HYPERLABEL_HXX
24 #define SVTOOLS_HYPERLABEL_HXX
25 
26 #include <vcl/event.hxx>
27 
28 
29 #include <vcl/fixed.hxx>
30 
31 #define LABELBASEMAPHEIGHT      8
32 
33 
34 //.........................................................................
35 namespace svt
36 {
37 //.........................................................................
38 
39    	class HyperLabelImpl;
40 
41 	class HyperLabel : public FixedText
42 	{
43 	protected:
44 		HyperLabelImpl*		m_pImpl;
45         Link                maClickHdl;
46 
47         virtual void        MouseMove( const MouseEvent& rMEvt );
48         virtual void        MouseButtonDown( const MouseEvent& rMEvt );
49         virtual void        GetFocus();
50         virtual void        LoseFocus();
51 
52         void                DeactivateHyperMode(Font aFont, const Color aColor);
53         void                ActivateHyperMode(Font aFont, const Color aColor);
54 
55     protected:
56         void                implInit();
57 
58 	public:
59 		HyperLabel( Window* _pParent, const ResId& _rId );
60 		HyperLabel( Window* _pParent, WinBits _nWinStyle = 0 );
61 		~HyperLabel( );
62 
63 		virtual void	DataChanged( const DataChangedEvent& rDCEvt );
64 
65         void                SetID( sal_Int16 _ID );
66         sal_Int16           GetID() const;
67 
68         void                SetIndex( sal_Int32 _Index );
69         sal_Int32           GetIndex() const;
70 
71         void                SetLabel( const ::rtl::OUString& _rText );
72 		sal_Int32			GetLogicWidth();
73 
74         ::rtl::OUString     GetLabel( );
75 
76 		void				ToggleBackgroundColor( const Color& _rGBColor );
77         void                SetInteractive( sal_Bool _bInteractive );
78 
SetClickHdl(const Link & rLink)79         void                SetClickHdl( const Link& rLink ) { maClickHdl = rLink; }
GetClickHdl() const80         const Link&         GetClickHdl() const { return maClickHdl; }
81 
82         Size                CalcMinimumSize( long nMaxWidth = 0 ) const;
83 
84     private:
85 
86         DECL_LINK(ImplClickHdl, HyperLabel*);
87 
88     private:
89         using FixedText::CalcMinimumSize;
90     };
91 }
92 
93 #endif
94 
95