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: depwin.cxx,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 #include <tools/debug.hxx>
33 #include <soldep/depwin.hxx>
34 #include <soldep/depper.hxx>
35 #include <soldep/connctr.hxx>
36 #include <soldep/objwin.hxx>
40 DepWin::DepWin( Window
* pParent
, WinBits nWinStyle
) :
41 Window( pParent
, nWinStyle
),
42 mbStartNewCon( FALSE
),
43 maNewConStart( 0, 0 ),
45 // mpSelectedProject( NULL ) unbekannt
48 if ( !pParent
->IsChildNotify() )
49 pParent
->EnableChildNotify( TRUE
);
50 // if ( !pParent->IsAllResizeEnabled())
51 // pParent->EnableAllResize( TRUE );
52 SetUpdateMode( TRUE
);
53 SetPosSizePixel( Point(0,0), Size( 2000, 2000 )); //Size of the scrollable Window
54 mpPopup
= new PopupMenu();
60 while( ConList
.Count() > 0 )
62 delete ConList
.GetObject( 0 );
68 void DepWin::AddConnector( Connector
* pNewCon
)
70 ConList
.Insert( pNewCon
);
73 void DepWin::RemoveConnector( Connector
* pOldCon
)
75 ConList
.Remove( pOldCon
);
78 void DepWin::NewConnector( ObjectWin
* pWin
)
84 maNewConStart
= pWin
->GetFixPoint(Point(0,0));
88 Invalidate( Rectangle( maNewConStart
, maNewConEnd
));
89 if ( pWin
!= mpNewConWin
)
91 // Connector* pConctr;
92 // pConctr = new Connector( this, WB_NOBORDER );
93 // pConctr->Initialize( mpNewConWin, pWin );
95 // AddConnector has been moved to soldep
96 // mpDepperDontuseme->AddConnector( mpNewConWin, pWin );
99 mbStartNewCon
= FALSE
;
104 void DepWin::Paint( const Rectangle
& rRect
)
107 ULONG nListCount
= ConList
.Count();
109 for ( i
=0 ; i
< nListCount
; i
++ )
111 ConList
.GetObject( i
)->Paint( aEmptyRect
);
115 DrawLine( maNewConStart
, maNewConEnd
);
119 void DepWin::DrawOutput( OutputDevice
* pDevice
, const Point
& rOffset
)
122 ULONG nListCount
= ConList
.Count();
124 for ( i
=0 ; i
< nListCount
; i
++ )
126 ConList
.GetObject( i
)->DrawOutput( pDevice
, rOffset
);
130 pDevice
->DrawLine( maNewConStart
, maNewConEnd
);
134 void DepWin::MouseButtonUp( const MouseEvent
& rMEvt
)
136 if ( rMEvt
.IsRight() )
138 mpPopup
->Execute( this, rMEvt
.GetPosPixel());
142 void DepWin::MouseMove( const MouseEvent
& rMEvt
)
146 Invalidate( Rectangle( maNewConStart
, maNewConEnd
));
147 maNewConEnd
= PixelToLogic(rMEvt
.GetPosPixel());
148 maNewConStart
= mpNewConWin
->GetFixPoint( maNewConEnd
);
153 ConnectorList
* DepWin::GetConnectorList()
158 void DepWin::SetPopupHdl( void* pHdl
)
160 mpPopup
->SetSelectHdl( LINK( pHdl
, Depper
, PopupSelected
));
163 void DepWin::Command( const CommandEvent
& rEvent
)
165 //mpDepperDontuseme->GetGraphWin()->Command( rEvent );
166 GetParent()->Command( rEvent
);