xref: /aoo4110/main/soldep/source/graphwin.cxx (revision b1cdbd2c)
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 #include <soldep/graphwin.hxx>
25 //#include "depapp.hxx"
26 #include <soldep/soldep.hxx>
27 
28 
GraphWin(Window * pParent,void * pClass)29 GraphWin::GraphWin( Window * pParent, void * pClass )
30 : ScrollableWindow( pParent, 0L, SCRWIN_DEFAULT | SCRWIN_VCENTER | SCRWIN_HCENTER )
31 , aBufferWindow( this )
32 {
33     mpClass = pClass;
34 	SetSizePixel( pParent->GetSizePixel());
35 	SetPosPixel( pParent->GetPosPixel());
36 	SetTotalSize( Size( 2000,2000 ));
37 
38     aBufferWindow.SetBackground( Wallpaper( Color( COL_WHITE )));
39 	aBufferWindow.SetPosSizePixel( PIXELS( 0, 0, 2000, 2000 ) );
40 	aBufferWindow.Show(); // Content
41 	Show();               // Window with Scrollbars
42 }
43 
EndScroll(long nDeltaX,long nDeltaY)44 void GraphWin::EndScroll( long nDeltaX, long nDeltaY )
45 {
46 	// get the visible area
47 	Rectangle aArea( GetVisibleArea());
48 	long nX = aArea.Right();
49 	long nY = aArea.Bottom();
50 
51 	// set the new pos and size by using LogicToPixel (this is mandatory)
52     aBufferWindow.SetPosSizePixel( LogicToPixel( Point( 0, 0 )),
53 		LogicToPixel( Size( nX, nY )));
54 	aBufferWindow.Invalidate();
55 }
56 
Resize()57 void GraphWin::Resize()
58 {
59 	// get the visible area
60 	ScrollableWindow::Resize();
61 	Rectangle aArea( GetVisibleArea());
62 	long nX = aArea.Right();
63 	long nY = aArea.Bottom();
64 
65 	// set the new pos and size by using LogicToPixel (this is mandatory)
66     aBufferWindow.SetPosSizePixel( LogicToPixel( Point( 0, 0 )),
67 		LogicToPixel( Size( nX, nY )));
68 }
69 
Command(const CommandEvent & rEvent)70 void GraphWin::Command( const CommandEvent& rEvent)
71 {
72 	ScrollableWindow::Command( rEvent );
73 }
74