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: ControlContainerDescriptor.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 SD_TASKPANE_CONTROL_CONTAINER_DESCRIPTOR_HXX
32 #define SD_TASKPANE_CONTROL_CONTAINER_DESCRIPTOR_HXX
34 #include "taskpane/ILayoutableWindow.hxx"
35 #include "taskpane/TitleBar.hxx"
36 #include <tools/string.hxx>
37 #include <tools/gen.hxx>
39 #include <vcl/window.hxx>
45 namespace sd
{ namespace toolpanel
{
47 class ControlContainer
;
49 /** Collection of information the describes entries of the tool
50 panel. A descriptor owns the control it is associated with.
52 class ControlContainerDescriptor
54 public virtual ILayoutableWindow
57 /** Create a new descriptor for the given control.
59 The container to inform about selection (caused by mouse
62 The parent window of the new descriptor.
64 The control that is shown when being in the expanded
67 String that is shown as title in the title area above the
70 Type of the title bar. This specifies how the title bar
71 will be formated. For more information see TitleBar.
74 ControlContainerDescriptor (
75 ControlContainer
& rContainer
,
77 ::std::auto_ptr
<ILayoutableWindow
> pControl
,
79 TitleBar::TitleBarType eType
);
81 virtual ~ControlContainerDescriptor (void);
84 virtual Size
GetPreferredSize (void);
85 virtual int GetPreferredWidth (int nHeight
);
86 virtual int GetPreferredHeight (int nWidth
);
87 virtual bool IsResizable (void);
88 virtual ::Window
* GetWindow (void);
90 virtual void Resize (void);
91 virtual void GetFocus (void);
92 virtual void LoseFocus (void);
93 virtual void MouseButtonUp (const MouseEvent
& rMouseEvent
);
94 virtual void KeyInput (const KeyEvent
& rEvent
);
96 void Select (bool bExpansionState
);
98 // const Rectangle& GetTitleBarBox (void) const;
100 Window
* GetControl (void) const;
101 const String
& GetTitle (void) const;
103 void Expand (bool bExpanded
= true);
104 void Collapse (void);
105 bool IsExpanded (void) const;
107 /** Ownership of the given data remains with the caller. The data
108 is thus not destroyed when the destructor of this class is
111 void SetUserData (void* pUserData
);
112 void* GetUserData (void) const;
114 bool IsVisible (void) const;
115 void SetVisible (bool bVisible
);
117 using Window::GetWindow
;
118 using sd::toolpanel::ILayoutableWindow::GetPreferredWidth
;
119 using sd::toolpanel::ILayoutableWindow::GetPreferredHeight
;
122 ControlContainer
& mrContainer
;
123 ::std::auto_ptr
<TitleBar
> mpTitleBar
;
124 ::std::auto_ptr
<ILayoutableWindow
> mpControl
;
131 /// Do not use! Assignment operator is not supported.
132 const ControlContainerDescriptor
& operator= (
133 const ControlContainerDescriptor
& aDescriptor
);
135 void UpdateStates (void);
137 DECL_LINK(WindowEventListener
, VclSimpleEvent
*);
140 } } // end of namespace ::sd::toolpanel