xref: /trunk/main/svx/source/sidebar/debug/ContextPanel.cxx (revision 5d39f272d9084beebffa455156ddd8913c39a8d6)
1*5d39f272SZheng Fan /**************************************************************
2*5d39f272SZheng Fan  *
3*5d39f272SZheng Fan  * Licensed to the Apache Software Foundation (ASF) under one
4*5d39f272SZheng Fan  * or more contributor license agreements.  See the NOTICE file
5*5d39f272SZheng Fan  * distributed with this work for additional information
6*5d39f272SZheng Fan  * regarding copyright ownership.  The ASF licenses this file
7*5d39f272SZheng Fan  * to you under the Apache License, Version 2.0 (the
8*5d39f272SZheng Fan  * "License"); you may not use this file except in compliance
9*5d39f272SZheng Fan  * with the License.  You may obtain a copy of the License at
10*5d39f272SZheng Fan  *
11*5d39f272SZheng Fan  *   http://www.apache.org/licenses/LICENSE-2.0
12*5d39f272SZheng Fan  *
13*5d39f272SZheng Fan  * Unless required by applicable law or agreed to in writing,
14*5d39f272SZheng Fan  * software distributed under the License is distributed on an
15*5d39f272SZheng Fan  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*5d39f272SZheng Fan  * KIND, either express or implied.  See the License for the
17*5d39f272SZheng Fan  * specific language governing permissions and limitations
18*5d39f272SZheng Fan  * under the License.
19*5d39f272SZheng Fan  *
20*5d39f272SZheng Fan  *************************************************************/
21*5d39f272SZheng Fan 
22*5d39f272SZheng Fan #include "precompiled_svx.hxx"
23*5d39f272SZheng Fan 
24*5d39f272SZheng Fan #include "ContextPanel.hxx"
25*5d39f272SZheng Fan 
26*5d39f272SZheng Fan namespace svx { namespace sidebar {
27*5d39f272SZheng Fan 
28*5d39f272SZheng Fan ContextPanel::ContextPanel (::Window* pParent)
29*5d39f272SZheng Fan     : Window(pParent, 0),
30*5d39f272SZheng Fan       maApplicationName(this, 0),
31*5d39f272SZheng Fan       maContextName(this, 0)
32*5d39f272SZheng Fan {
33*5d39f272SZheng Fan     maApplicationName.SetPosSizePixel(5,5, 250,15);
34*5d39f272SZheng Fan     maContextName.SetPosSizePixel(5,25, 250,15);
35*5d39f272SZheng Fan 
36*5d39f272SZheng Fan     maApplicationName.Show();
37*5d39f272SZheng Fan     maContextName.Show();
38*5d39f272SZheng Fan     Show();
39*5d39f272SZheng Fan }
40*5d39f272SZheng Fan 
41*5d39f272SZheng Fan 
42*5d39f272SZheng Fan 
43*5d39f272SZheng Fan 
44*5d39f272SZheng Fan ContextPanel::~ContextPanel (void)
45*5d39f272SZheng Fan {
46*5d39f272SZheng Fan }
47*5d39f272SZheng Fan 
48*5d39f272SZheng Fan 
49*5d39f272SZheng Fan 
50*5d39f272SZheng Fan 
51*5d39f272SZheng Fan sal_Int32 ContextPanel::GetPreferredHeight (sal_Int32 nWidth)
52*5d39f272SZheng Fan {
53*5d39f272SZheng Fan     const sal_Int32 nHeight (maContextName.GetPosPixel().Y() + maContextName.GetSizePixel().Height() + 5);
54*5d39f272SZheng Fan     return nHeight;
55*5d39f272SZheng Fan }
56*5d39f272SZheng Fan 
57*5d39f272SZheng Fan 
58*5d39f272SZheng Fan 
59*5d39f272SZheng Fan 
60*5d39f272SZheng Fan void ContextPanel::HandleContextChange (const sfx2::sidebar::EnumContext aContext)
61*5d39f272SZheng Fan {
62*5d39f272SZheng Fan     maApplicationName.SetText(aContext.GetApplicationName());
63*5d39f272SZheng Fan     maContextName.SetText(aContext.GetContextName());
64*5d39f272SZheng Fan }
65*5d39f272SZheng Fan 
66*5d39f272SZheng Fan 
67*5d39f272SZheng Fan 
68*5d39f272SZheng Fan 
69*5d39f272SZheng Fan } } // end of namespace ::svx::sidebar
70