1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: navtoolbar.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef FORMS_SOLAR_CONTROL_NAVTOOLBAR_HXX
32 #define FORMS_SOLAR_CONTROL_NAVTOOLBAR_HXX
34 #include <vcl/toolbox.hxx>
35 #include <vcl/field.hxx>
37 //.........................................................................
40 //.........................................................................
42 class IFeatureDispatcher
;
45 //=====================================================================
47 //=====================================================================
48 class NavigationToolBar
: public Window
66 const IFeatureDispatcher
* m_pDispatcher
;
67 ImageSize m_eImageSize
;
68 ImplNavToolBar
* m_pToolbar
;
69 ::std::vector
< Window
* > m_aChildWins
;
72 NavigationToolBar( Window
* _pParent
, WinBits _nStyle
);
73 ~NavigationToolBar( );
75 /** sets the dispatcher which is to be used for the features
77 If the dispatcher is the same as the one which is currently set,
78 then the states of the features are updated
81 the new (or old) dispatcher. The caller is reponsible for
82 ensuring the life time of the object does exceed the life time
83 of the tool bar instance.
85 void setDispatcher( const IFeatureDispatcher
* _pDispatcher
);
87 /** enables or disables a given feature
89 void enableFeature( sal_Int32 _nFeatureId
, bool _bEnabled
);
91 /** checks or unchecks a given feature
93 void checkFeature( sal_Int32 _nFeatureId
, bool _bEnabled
);
95 /** sets the text of a given feature
97 void setFeatureText( sal_Int32 _nFeatureId
, const ::rtl::OUString
& _rText
);
99 /** retrieves the current image size
101 inline ImageSize
GetImageSize( ) const { return m_eImageSize
; }
103 /** sets the size of the images
105 void SetImageSize( ImageSize _eSize
);
107 /** shows or hides a function group
109 void ShowFunctionGroup( FunctionGroup _eGroup
, bool _bShow
);
111 /** determines whether or not a given function group is currently visible
113 bool IsFunctionGroupVisible( FunctionGroup _eGroup
);
115 // Window "overridables" (hiding the respective Window methods)
116 void SetControlBackground();
117 void SetControlBackground( const Color
& rColor
);
118 void SetTextLineColor( );
119 void SetTextLineColor( const Color
& rColor
);
122 // Window overridables
123 virtual void Resize();
124 virtual void StateChanged( StateChangedType nType
);
126 /// ctor implementation
129 /// impl version of SetImageSize
130 void implSetImageSize( ImageSize _eSize
, bool _bForce
= false );
132 /// enables or disables an item, plus possible dependent items
133 void implEnableItem( USHORT _nItemId
, bool _bEnabled
);
135 /** update the states of all features, using the callback
137 void updateFeatureStates( );
139 // iterating through item windows
140 typedef void (NavigationToolBar::*ItemWindowHandler
) (USHORT
, Window
*, const void*) const;
141 void forEachItemWindow( ItemWindowHandler _handler
, const void* _pParam
);
143 void setItemBackground( USHORT
/* _nItemId */, Window
* _pItemWindow
, const void* _pColor
) const;
144 void setTextLineColor( USHORT
/* _nItemId */, Window
* _pItemWindow
, const void* _pColor
) const;
146 void setItemWindowZoom( USHORT
/* _nItemId */, Window
* _pItemWindow
, const void* /* _pParam */ ) const;
148 void setItemControlFont( USHORT
/* _nItemId */, Window
* _pItemWindow
, const void* /* _pParam */ ) const;
149 void setItemControlForeground( USHORT
/* _nItemId */, Window
* _pItemWindow
, const void* /* _pParam */ ) const;
150 void adjustItemWindowWidth( USHORT _nItemId
, Window
* _pItemWindow
, const void* /* _pParam */ ) const;
151 void enableItemRTL( USHORT
/*_nItemId*/, Window
* _pItemWindow
, const void* _pIsRTLEnabled
) const;
154 //=====================================================================
155 //= RecordPositionInput
156 //=====================================================================
157 class RecordPositionInput
: public NumericField
160 const IFeatureDispatcher
* m_pDispatcher
;
163 RecordPositionInput( Window
* _pParent
);
164 ~RecordPositionInput();
166 /** sets the dispatcher which is to be used for the features
168 void setDispatcher( const IFeatureDispatcher
* _pDispatcher
);
171 // Window overridables
172 virtual void LoseFocus();
173 virtual void KeyInput( const KeyEvent
& rKeyEvent
);
176 void FirePosition( sal_Bool _bForce
);
179 //.........................................................................
181 //.........................................................................
183 #endif // FORMS_SOLAR_CONTROL_NAVTOOLBAR_HXX