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 SVT_PANELTABBAR_HXX
25 #define SVT_PANELTABBAR_HXX
26 
27 #include "svtools/svtdllapi.h"
28 #include "svtools/toolpanel/tabalignment.hxx"
29 #include "svtools/toolpanel/tabitemcontent.hxx"
30 
31 #include <vcl/ctrl.hxx>
32 
33 #include <memory>
34 #include <boost/optional.hpp>
35 
36 class PushButton;
37 
38 //........................................................................
39 namespace svt
40 {
41 //........................................................................
42 
43     class PanelTabBar_Impl;
44     class IToolPanelDeck;
45 
46 	//====================================================================
47 	//= PanelTabBar
48 	//====================================================================
49     /** a tab bar for selecting panels
50 
51         At the moment, this control aligns the tabs vertically, this might be extended to also support a horizontal
52         layout in the future.
53     */
54     class SVT_DLLPUBLIC PanelTabBar : public Control
55 	{
56     public:
57         PanelTabBar( Window& i_rParentWindow, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent );
58         ~PanelTabBar();
59 
60         // attribute access
61         TabItemContent  GetTabItemContent() const;
62         void            SetTabItemContent( const TabItemContent& i_eItemContent );
63 
64         ::boost::optional< size_t > GetFocusedPanelItem() const;
65         void                        FocusPanelItem( const size_t i_nItemPos );
66         Rectangle                   GetItemScreenRect( const size_t i_nItemPos ) const;
67         bool                        IsVertical() const;
68         IToolPanelDeck&             GetPanelDeck() const;
69         PushButton&                 GetScrollButton( const bool i_bForward );
70 
71         // Window overridables
72         virtual Size    GetOptimalSize( WindowSizeType i_eType ) const;
73 
74     protected:
75         // Window overridables
76         virtual void    Paint( const Rectangle& i_rRect );
77         virtual void    Resize();
78         virtual void    MouseMove( const MouseEvent& i_rMouseEvent );
79         virtual void    MouseButtonDown( const MouseEvent& i_rMouseEvent );
80         virtual void    MouseButtonUp( const MouseEvent& i_rMouseEvent );
81         virtual void    RequestHelp( const HelpEvent& i_rHelpEvent );
82         virtual void    GetFocus();
83         virtual void    LoseFocus();
84         virtual void    KeyInput( const KeyEvent& i_rKeyEvent );
85         virtual void    DataChanged( const DataChangedEvent& i_rDataChanedEvent );
86 
87         virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >
88                         GetComponentInterface( sal_Bool i_bCreate );
89 
90     private:
91         ::std::auto_ptr< PanelTabBar_Impl > m_pImpl;
92 	};
93 
94 //........................................................................
95 } // namespace svt
96 //........................................................................
97 
98 #endif // SVT_PANELTABBAR_HXX
99 
100