TitledControl.hxx (30acf5e8) TitledControl.hxx (3e459a30)
1/**************************************************************
1/**************************************************************
2 *
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
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 *
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
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.
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 *
19 *
20 *************************************************************/
21
22
23
24#ifndef SD_TASKPANE_TITLED_CONTROL_HXX
25#define SD_TASKPANE_TITLED_CONTROL_HXX
26
27#include "taskpane/TaskPaneTreeNode.hxx"

--- 9 unchanged lines hidden (view full) ---

37#include <boost/function.hpp>
38
39class Window;
40
41namespace sd { namespace toolpanel {
42
43class ControlContainer;
44
20 *************************************************************/
21
22
23
24#ifndef SD_TASKPANE_TITLED_CONTROL_HXX
25#define SD_TASKPANE_TITLED_CONTROL_HXX
26
27#include "taskpane/TaskPaneTreeNode.hxx"

--- 9 unchanged lines hidden (view full) ---

37#include <boost/function.hpp>
38
39class Window;
40
41namespace sd { namespace toolpanel {
42
43class ControlContainer;
44
45/** This wrapper adds a title bar to a control. Both title bar and
46 control are child windows.
45/** This wrapper adds a title bar to a control. Both title bar and
46 control are child windows.
47*/
48class TitledControl
47*/
48class TitledControl
49 : public ::Window,
50 public TreeNode
49 : public ::Window,
50 public TreeNode
51{
52public:
51{
52public:
53 typedef ::boost::function1<void, TitledControl&> ClickHandler;
54
55 /** Create a new descriptor for the given control.
56 @param pParent
57 The parent window of the new descriptor.
58 @param pControl
59 The control that is shown when being in the expanded
60 state.
61 @param rTitle
62 String that is shown as title in the title area above the
63 control.
64 @param rClickHandler
65 The typical action of the click handler is to expand the control.
66 @param eType
67 Type of the title bar. This specifies how the title bar
68 will be formatted. For more information see TitleBar.
69
70 */
71 TitledControl (
72 TreeNode* pParent,
73 ::std::auto_ptr<TreeNode> pControl,
74 const String& rTitle,
75 const ClickHandler& rClickHandler,
76 TitleBar::TitleBarType eType);
53 typedef ::boost::function1<void, TitledControl&> ClickHandler;
77
54
78 virtual ~TitledControl (void);
55 /** Create a new descriptor for the given control.
56 @param pParent
57 The parent window of the new descriptor.
58 @param pControl
59 The control that is shown when being in the expanded
60 state.
61 @param rTitle
62 String that is shown as title in the title area above the
63 control.
64 @param rClickHandler
65 The typical action of the click handler is to expand the control.
66 @param eType
67 Type of the title bar. This specifies how the title bar
68 will be formatted. For more information see TitleBar.
79
69
70 */
71 TitledControl (
72 TreeNode* pParent,
73 ::std::auto_ptr<TreeNode> pControl,
74 const String& rTitle,
75 const ClickHandler& rClickHandler,
76 TitleBar::TitleBarType eType);
80
77
81 virtual Size GetPreferredSize (void);
82 virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeight);
83 virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
84 virtual bool IsResizable (void);
85 virtual ::Window* GetWindow (void);
78 virtual ~TitledControl (void);
86
79
87 virtual void Resize (void);
88 virtual void GetFocus (void);
89 virtual void KeyInput (const KeyEvent& rEvent);
90
80
91 // void Select (bool bExpansionState);
81 virtual Size GetPreferredSize (void);
82 virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeight);
83 virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
84 virtual bool IsResizable (void);
85 virtual ::Window* GetWindow (void);
92
86
93 TitleBar* GetTitleBar (void);
94 /** Return the control child. When a control factory has been given and
95 the control has not yet been created and the given flag is <TRUE/>
96 then the control is created.
97 */
98 TreeNode* GetControl (void);
99 const TreeNode* GetConstControl () const;
87 virtual void Resize (void);
88 virtual void GetFocus (void);
89 virtual void KeyInput (const KeyEvent& rEvent);
100
90
101 const String& GetTitle (void) const;
91 // void Select (bool bExpansionState);
102
92
103 /** Expand the control without informing its container. This
104 method usually is called by the container as a result of a
105 higher level expand command. You may want to use
106 ExpandViaContainer() instead.
107 @param bExpanded
108 When <TRUE/> then the control is expanded, otherwise it is
109 collapsed.
110 */
111 virtual bool Expand (bool bExpanded = true);
93 TitleBar* GetTitleBar (void);
94 /** Return the control child. When a control factory has been given and
95 the control has not yet been created and the given flag is <TRUE/>
96 then the control is created.
97 */
98 TreeNode* GetControl (void);
99 const TreeNode* GetConstControl () const;
112
100
113 /** Return whether the control is currently expanded (<TRUE/>) or
114 not (<FALSE/>).
115 */
116 virtual bool IsExpanded (void) const;
101 const String& GetTitle (void) const;
117
102
118 /** Returns the value of the control.
119 */
120 virtual bool IsExpandable (void) const;
103 /** Expand the control without informing its container. This
104 method usually is called by the container as a result of a
105 higher level expand command. You may want to use
106 ExpandViaContainer() instead.
107 @param bExpanded
108 When <TRUE/> then the control is expanded, otherwise it is
109 collapsed.
110 */
111 virtual bool Expand (bool bExpanded = true);
121
112
122 virtual void SetEnabledState(bool bFlag);
113 /** Return whether the control is currently expanded (<TRUE/>) or
114 not (<FALSE/>).
115 */
116 virtual bool IsExpanded (void) const;
123
117
124 virtual bool IsShowing (void) const;
125 virtual void Show (bool bVisible);
118 /** Returns the value of the control.
119 */
120 virtual bool IsExpandable (void) const;
126
121
127 virtual ::com::sun::star::uno::Reference<
128 ::com::sun::star::accessibility::XAccessible > CreateAccessibleObject (
129 const ::com::sun::star::uno::Reference<
130 ::com::sun::star::accessibility::XAccessible>& rxParent);
122 virtual void SetEnabledState(bool bFlag);
131
123
124 virtual bool IsShowing (void) const;
125 virtual void Show (bool bVisible);
126
127 virtual ::com::sun::star::uno::Reference<
128 ::com::sun::star::accessibility::XAccessible > CreateAccessibleObject (
129 const ::com::sun::star::uno::Reference<
130 ::com::sun::star::accessibility::XAccessible>& rxParent);
131
132 using Window::GetWindow;
133 using Window::Show;
134
135private:
132 using Window::GetWindow;
133 using Window::Show;
134
135private:
136 String msTitle;
137 bool mbVisible;
138 void* mpUserData;
139 ::std::auto_ptr<ClickHandler> mpClickHandler;
136 String msTitle;
137 bool mbVisible;
138 void* mpUserData;
139 ::std::auto_ptr<ClickHandler> mpClickHandler;
140
140
141 /// Do not use! Assignment operator is not supported.
142 const TitledControl& operator= (
143 const TitledControl& aDescriptor);
141 /// Do not use! Assignment operator is not supported.
142 const TitledControl& operator= (
143 const TitledControl& aDescriptor);
144
144
145 void UpdateStates (void);
146
147 DECL_LINK(WindowEventListener, VclSimpleEvent*);
145 void UpdateStates (void);
146
147 DECL_LINK(WindowEventListener, VclSimpleEvent*);
148};
149
150
151
152
153/** This standard implementation of the ClickHandler expands, or toggles the
148};
149
150
151
152
153/** This standard implementation of the ClickHandler expands, or toggles the
154 expansion state, of the control, whose title was clicked.
154 expansion state, of the control, whose title was clicked.
155*/
156class TitledControlStandardClickHandler
157{
158public:
155*/
156class TitledControlStandardClickHandler
157{
158public:
159 /** Create a new instance of this class.
160 @param rControlContainer
161 The container of which the TitledControl is part of.
162 @param eExpansionState
163 This specifies whether to always expand the titled control or to
164 toggle its expansion state.
165 */
166 TitledControlStandardClickHandler (
167 ControlContainer& rControlContainer,
168 ControlContainer::ExpansionState eExpansionState);
169 void operator () (TitledControl& rTitledControl);
159 /** Create a new instance of this class.
160 @param rControlContainer
161 The container of which the TitledControl is part of.
162 @param eExpansionState
163 This specifies whether to always expand the titled control or to
164 toggle its expansion state.
165 */
166 TitledControlStandardClickHandler (
167 ControlContainer& rControlContainer,
168 ControlContainer::ExpansionState eExpansionState);
169 void operator () (TitledControl& rTitledControl);
170private:
170private:
171 ControlContainer& mrControlContainer;
172 ControlContainer::ExpansionState meExpansionState;
171 ControlContainer& mrControlContainer;
172 ControlContainer::ExpansionState meExpansionState;
173};
174
175} } // end of namespace ::sd::toolpanel
176
177#endif
173};
174
175} } // end of namespace ::sd::toolpanel
176
177#endif