xref: /aoo42x/main/toolkit/workben/controls.cxx (revision b0724fc6)
1*b0724fc6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*b0724fc6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*b0724fc6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*b0724fc6SAndrew Rist  * distributed with this work for additional information
6*b0724fc6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*b0724fc6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*b0724fc6SAndrew Rist  * "License"); you may not use this file except in compliance
9*b0724fc6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*b0724fc6SAndrew Rist  *
11*b0724fc6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*b0724fc6SAndrew Rist  *
13*b0724fc6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*b0724fc6SAndrew Rist  * software distributed under the License is distributed on an
15*b0724fc6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b0724fc6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*b0724fc6SAndrew Rist  * specific language governing permissions and limitations
18*b0724fc6SAndrew Rist  * under the License.
19*b0724fc6SAndrew Rist  *
20*b0724fc6SAndrew Rist  *************************************************************/
21*b0724fc6SAndrew Rist 
22*b0724fc6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_toolkit.hxx"
26cdf0e10cSrcweir #include <tools/debug.hxx>
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <vcl/window.hxx>
29cdf0e10cSrcweir #include <vcl/svapp.hxx>
30cdf0e10cSrcweir #include <vcl/wrkwin.hxx>
31cdf0e10cSrcweir #include <vcl/msgbox.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir 
34cdf0e10cSrcweir #include <stardiv/uno/awt/window.hxx>
35cdf0e10cSrcweir #include <stardiv/uno/awt/vclwin.hxx>
36cdf0e10cSrcweir #include <stardiv/uno/awt/printer.hxx>
37cdf0e10cSrcweir #include <stardiv/uno/repos/serinfo.hxx>
38cdf0e10cSrcweir #include <stardiv/uno/lang/factory.hxx>
39cdf0e10cSrcweir 
40cdf0e10cSrcweir 
41cdf0e10cSrcweir #include <unoctrl.hxx>
42cdf0e10cSrcweir // #include <unoctrl2.hxx>
43cdf0e10cSrcweir 
44cdf0e10cSrcweir #include <svtools/unoiface.hxx>	// InitExtToolkit
45cdf0e10cSrcweir 
UsrAny_UINT16(UINT16 n)46cdf0e10cSrcweir UsrAny UsrAny_UINT16( UINT16 n )
47cdf0e10cSrcweir {
48cdf0e10cSrcweir 	UsrAny aVal;
49cdf0e10cSrcweir 	aVal.setUINT16( n );
50cdf0e10cSrcweir 	return aVal;
51cdf0e10cSrcweir }
52cdf0e10cSrcweir 
53cdf0e10cSrcweir // -----------------------------------------------------------------------
54cdf0e10cSrcweir 
55cdf0e10cSrcweir class MyApp : public Application
56cdf0e10cSrcweir {
57cdf0e10cSrcweir public:
58cdf0e10cSrcweir     void        Main();
59cdf0e10cSrcweir };
60cdf0e10cSrcweir 
61cdf0e10cSrcweir MyApp aMyApp;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir // -----------------------------------------------------------------------
64cdf0e10cSrcweir 
65cdf0e10cSrcweir class MyWin : public WorkWindow
66cdf0e10cSrcweir {
67cdf0e10cSrcweir 	XControlRef				xCtrl;
68cdf0e10cSrcweir 	XPropertySetRef			xCtrlModel;
69cdf0e10cSrcweir 	XControlContainerRef	xCont;
70cdf0e10cSrcweir 	XPropertySetRef			xContModel;
71cdf0e10cSrcweir 	XControlRef				xDrawCtrl;
72cdf0e10cSrcweir 	XGraphicsRef			xG;
73cdf0e10cSrcweir 
74cdf0e10cSrcweir public:
75cdf0e10cSrcweir                 MyWin( Window* pParent, WinBits nWinStyle );
76cdf0e10cSrcweir                 ~MyWin();
77cdf0e10cSrcweir 
78cdf0e10cSrcweir     void        MouseButtonDown( const MouseEvent& rMEvt );
79cdf0e10cSrcweir     void        Resize();
80cdf0e10cSrcweir     void        Paint( const Rectangle& r );
81cdf0e10cSrcweir };
82cdf0e10cSrcweir 
83cdf0e10cSrcweir // -----------------------------------------------------------------------
84cdf0e10cSrcweir 
Main()85cdf0e10cSrcweir void MyApp::Main()
86cdf0e10cSrcweir {
87cdf0e10cSrcweir 	createAndSetDefaultServiceManager();
88cdf0e10cSrcweir 
89cdf0e10cSrcweir     MyWin aMainWin( NULL, WB_APP | WB_STDWORK );
90cdf0e10cSrcweir     aMainWin.SetText( "Uno-Controls - Workbench" );
91cdf0e10cSrcweir     aMainWin.Show();
92cdf0e10cSrcweir     Execute();
93cdf0e10cSrcweir }
94cdf0e10cSrcweir 
95cdf0e10cSrcweir // -----------------------------------------------------------------------
96cdf0e10cSrcweir 
MyWin(Window * pParent,WinBits nWinStyle)97cdf0e10cSrcweir MyWin::MyWin( Window* pParent, WinBits nWinStyle ) :
98cdf0e10cSrcweir     WorkWindow( pParent, nWinStyle )
99cdf0e10cSrcweir {
100cdf0e10cSrcweir }
101cdf0e10cSrcweir 
102cdf0e10cSrcweir // -----------------------------------------------------------------------
~MyWin()103cdf0e10cSrcweir MyWin::~MyWin()
104cdf0e10cSrcweir {
105cdf0e10cSrcweir 	XComponentRef xC1( xCont, USR_QUERY );
106cdf0e10cSrcweir 	xC1->dispose();
107cdf0e10cSrcweir 	XComponentRef xC2( xContModel, USR_QUERY );
108cdf0e10cSrcweir 	xC2->dispose();
109cdf0e10cSrcweir }
110cdf0e10cSrcweir 
111cdf0e10cSrcweir // -----------------------------------------------------------------------
112cdf0e10cSrcweir 
MouseButtonDown(const MouseEvent & rMEvt)113cdf0e10cSrcweir void MyWin::MouseButtonDown( const MouseEvent& rMEvt )
114cdf0e10cSrcweir {
115cdf0e10cSrcweir 	if( rMEvt.GetClicks() == 2 )
116cdf0e10cSrcweir 	{
117cdf0e10cSrcweir 		XViewRef xV( xDrawCtrl, USR_QUERY );
118cdf0e10cSrcweir 		XWindowRef xC( xDrawCtrl, USR_QUERY );
119cdf0e10cSrcweir 		xV->draw( xC->getPosSize().Left(), xC->getPosSize().Top() );
120cdf0e10cSrcweir 
121cdf0e10cSrcweir 		// Printer Testen...
122cdf0e10cSrcweir /*
123cdf0e10cSrcweir 		XServiceManagerRef xProv = getGlobalServiceManager();
124cdf0e10cSrcweir 		XServiceProviderRef xSSI = xProv->queryServiceProvider( L"stardiv.vcl.PrinterServer" );
125cdf0e10cSrcweir 		XPrinterServerRef xPrinterServer( xSSI->createInstance(), USR_QUERY );
126cdf0e10cSrcweir 
127cdf0e10cSrcweir 		Sequence< UString >	aPrinterNames = xPrinterServer->getPrinterNames();
128cdf0e10cSrcweir 		USHORT nPrinters = aPrinterNames.getLen();
129cdf0e10cSrcweir 		String aInfo( "Printers: " );
130cdf0e10cSrcweir 		aInfo += nPrinters;
131cdf0e10cSrcweir 		if ( nPrinters )
132cdf0e10cSrcweir 		{
133cdf0e10cSrcweir 			for ( USHORT n = 0; n < nPrinters; n++ )
134cdf0e10cSrcweir 			{
135cdf0e10cSrcweir 				aInfo += '\n';
136cdf0e10cSrcweir 				aInfo += OUStringToString( aPrinterNames.getConstArray()[n], CHARSET_SYSTEM );
137cdf0e10cSrcweir 			}
138cdf0e10cSrcweir 
139cdf0e10cSrcweir 			XPrinterRef xPrinter = xPrinterServer->createPrinter( aPrinterNames.getConstArray()[0] );
140cdf0e10cSrcweir 			xPrinter->start( L"UNOPrinterTest", 1, TRUE );
141cdf0e10cSrcweir 			XDeviceRef xDev = xPrinter->startPage();
142cdf0e10cSrcweir 			XGraphicsRef xGraphics = xDev->createGraphics();
143cdf0e10cSrcweir 			xGraphics->drawText( 200, 200, L"Printed with UNO"  );
144cdf0e10cSrcweir 			xPrinter->endPage();
145cdf0e10cSrcweir 			xPrinter->end();
146cdf0e10cSrcweir 		}
147cdf0e10cSrcweir 		InfoBox( this, aInfo ).Execute();
148cdf0e10cSrcweir */
149cdf0e10cSrcweir 	}
150cdf0e10cSrcweir 	else if( rMEvt.GetClicks() == 1 )
151cdf0e10cSrcweir 	{
152cdf0e10cSrcweir 		if( xContModel )
153cdf0e10cSrcweir 		{
154cdf0e10cSrcweir 			static INT32 nColor = 0x001788ab;
155cdf0e10cSrcweir  			xContModel->setPropertyValue( L"BackgroundColor", UsrAny( nColor ) );
156cdf0e10cSrcweir 			nColor += 0x00111111;
157cdf0e10cSrcweir 			nColor &= 0xFFFFFF;
158cdf0e10cSrcweir 		}
159cdf0e10cSrcweir 		else
160cdf0e10cSrcweir 		{
161cdf0e10cSrcweir 			XServiceManagerRef xProv = getGlobalServiceManager();
162cdf0e10cSrcweir 
163cdf0e10cSrcweir 			XMultiServiceFactoryRef xMSF = NAMESPACE_USR( getProcessServiceManager )();
164cdf0e10cSrcweir 
165cdf0e10cSrcweir 			XServiceProviderRef xSSI = xProv->queryServiceProvider( L"stardiv.vcl.VclToolkit" );
166cdf0e10cSrcweir 			XToolkitRef xToolkit( xMSF->createInstance( L"stardiv.vcl.VclToolkit" ), USR_QUERY );
167cdf0e10cSrcweir 			DBG_ASSERT( xToolkit, "No Toolkit!" );
168cdf0e10cSrcweir 
169cdf0e10cSrcweir 			// Uno Container + Model erzeugen
170cdf0e10cSrcweir 			XServiceProviderRef xModelProv; // = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.ControlContainer" );
171cdf0e10cSrcweir 			XInterfaceRef xCMRef( xMSF->createInstance(L"stardiv.vcl.controlmodel.ControlContainer") );
172cdf0e10cSrcweir 			xCMRef->queryInterface( XPropertySet::getSmartUik(), xContModel );
173cdf0e10cSrcweir  			xContModel->setPropertyValue( L"Border", UsrAny_UINT16( 1 ) );
174cdf0e10cSrcweir  			xContModel->setPropertyValue( L"BackgroundColor", UsrAny( (UINT32)0x00CCCCCC) );
175cdf0e10cSrcweir 
176cdf0e10cSrcweir 			xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.control.ControlContainer" );
177cdf0e10cSrcweir 			XInterfaceRef xCCRef( xModelProv->createInstance(), USR_QUERY );
178cdf0e10cSrcweir 			xCCRef->queryInterface( XControlContainer::getSmartUik(), xCont );
179cdf0e10cSrcweir 
180cdf0e10cSrcweir 			XControlModelRef xCM( xContModel, USR_QUERY );
181cdf0e10cSrcweir 			XControlRef xContControl( xCont, USR_QUERY );
182cdf0e10cSrcweir 			xContControl->setModel( xCM );
183cdf0e10cSrcweir 			XWindowRef xContComp( xCont, USR_QUERY );
184cdf0e10cSrcweir 			xContComp->setPosSize( 0, 0, 500, 600, PosSize_POSSIZE );
185cdf0e10cSrcweir 
186cdf0e10cSrcweir 			// Zwei EditControls auf einem Model...
187cdf0e10cSrcweir //			xModelProv = xProv->queryServiceProvider( L"stardiv.uno.awt.UnoControlEditModel" );
188cdf0e10cSrcweir 			XInterfaceRef xModel( xMSF->createInstance(L"stardiv.uno.awt.UnoControlEditModel") );
189cdf0e10cSrcweir 			DBG_ASSERT( xModel, "No Model!" );
190cdf0e10cSrcweir 
191cdf0e10cSrcweir 			XPropertySetRef xPSet( xModel, USR_QUERY );
192cdf0e10cSrcweir 			xPSet->setPropertyValue( L"Text", UsrAny( UString( L"Hallo!" ) ) );
193cdf0e10cSrcweir 			xPSet->setPropertyValue( L"FontName", UsrAny( UString( L"Times New Roman" ) ) );
194cdf0e10cSrcweir //			xPSet->setPropertyValue( L"FontWeight", UsrAny( 200 ) );
195cdf0e10cSrcweir 
196cdf0e10cSrcweir 			XServiceProviderRef xEditCtrlProv = xProv->queryServiceProvider( L"stardiv.uno.awt.UnoControlEdit" );
197cdf0e10cSrcweir 			// Edit1
198cdf0e10cSrcweir 			XControlRef xEdit1( xMSF->createInstance(L"stardiv.uno.awt.UnoControlEdit"), USR_QUERY );
199cdf0e10cSrcweir 			xModel->queryInterface( XControlModel::getSmartUik(), xCM );
200cdf0e10cSrcweir 			xEdit1->setModel( xCM );
201cdf0e10cSrcweir 			XWindowRef xEditCmp1( xEdit1, USR_QUERY );
202cdf0e10cSrcweir 			xEditCmp1->setPosSize( 50, 50, 100, 60, PosSize_POSSIZE );
203cdf0e10cSrcweir 			xCont->addControl( L"", xEdit1 );
204cdf0e10cSrcweir 			// Edit2
205cdf0e10cSrcweir 			XControlRef xEdit2( xMSF->createInstance(L"stardiv.uno.awt.UnoControlEdit"), USR_QUERY );
206cdf0e10cSrcweir 			xModel->queryInterface( XControlModel::getSmartUik(), xCM );
207cdf0e10cSrcweir 			xEdit2->setModel( xCM );
208cdf0e10cSrcweir 			XWindowRef xEditCmp2( xEdit2, USR_QUERY );
209cdf0e10cSrcweir 			XLayoutConstrainsRef xL( xEdit2, USR_QUERY );
210cdf0e10cSrcweir 			if ( xL.is() )
211cdf0e10cSrcweir 			{
212cdf0e10cSrcweir 				Size aSz = xL->getPreferredSize();
213cdf0e10cSrcweir 				xEditCmp2->setPosSize( 100, 180, aSz.Width(), aSz.Height(), PosSize_POSSIZE );
214cdf0e10cSrcweir 			}
215cdf0e10cSrcweir 			else
216cdf0e10cSrcweir 				xEditCmp2->setPosSize( 100, 180, 100, 40, PosSize_POSSIZE );
217cdf0e10cSrcweir 			xCont->addControl( L"", xEdit2 );
218cdf0e10cSrcweir 
219cdf0e10cSrcweir 			xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.NumericField" );
220cdf0e10cSrcweir 			XInterfaceRef xNumModel( xModelProv->createInstance(), USR_QUERY );
221cdf0e10cSrcweir 			DBG_ASSERT( xNumModel, "No Model!" );
222cdf0e10cSrcweir 
223cdf0e10cSrcweir 
224cdf0e10cSrcweir 			XServiceProviderRef xNumFieldProv = xProv->queryServiceProvider( L"stardiv.vcl.control.NumericField" );
225cdf0e10cSrcweir 			XControlRef xNumField( xNumFieldProv->createInstance(), USR_QUERY );
226cdf0e10cSrcweir 			xNumModel->queryInterface( XControlModel::getSmartUik(), xCM );
227cdf0e10cSrcweir 			xNumField->setModel( xCM );
228cdf0e10cSrcweir 			XWindowRef xNumFieldWin( xNumField, USR_QUERY );
229cdf0e10cSrcweir 			xNumFieldWin->setPosSize( 50, 250, 100, 60, PosSize_POSSIZE );
230cdf0e10cSrcweir 			xCont->addControl( L"", xNumField );
231cdf0e10cSrcweir 
232cdf0e10cSrcweir 			XMultiPropertySetRef xPSet2( xNumModel, USR_QUERY );
233cdf0e10cSrcweir 			Sequence<UString> Names( 2 );
234cdf0e10cSrcweir 			Names.getArray()[0] = L"Value";
235cdf0e10cSrcweir 			Names.getArray()[1] = L"ValueMin";
236cdf0e10cSrcweir 			Sequence<UsrAny> Values( 2 );
237cdf0e10cSrcweir 			Values.getArray()[0] = UsrAny( -2000000.0 );
238cdf0e10cSrcweir 			Values.getArray()[1] = UsrAny( -2000000.0 );
239cdf0e10cSrcweir 			xPSet2->setPropertyValues( Names, Values );
240cdf0e10cSrcweir 
241cdf0e10cSrcweir 
242cdf0e10cSrcweir 			// Button...
243cdf0e10cSrcweir 			xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.Button" );
244cdf0e10cSrcweir 			xModelProv->createInstance()->queryInterface( XInterface::getSmartUik(), xModel );
245cdf0e10cSrcweir 			DBG_ASSERT( xModel, "No Model!" );
246cdf0e10cSrcweir 
247cdf0e10cSrcweir 			xModel->queryInterface( XPropertySet::getSmartUik(), xPSet );
248cdf0e10cSrcweir 			xPSet->setPropertyValue( L"Label", UsrAny( L"Press!" ) );
249cdf0e10cSrcweir 
250cdf0e10cSrcweir 			XServiceProviderRef xButtonCtrlProv = xProv->queryServiceProvider( L"stardiv.vcl.control.Button" );
251cdf0e10cSrcweir 			XControlRef xButton1( xButtonCtrlProv->createInstance(), USR_QUERY );
252cdf0e10cSrcweir 			xModel->queryInterface( XControlModel::getSmartUik(), xCM );
253cdf0e10cSrcweir 			xButton1->setModel( xCM );
254cdf0e10cSrcweir 			XWindowRef xButtonCmp1( xButton1, USR_QUERY );
255cdf0e10cSrcweir 			xButtonCmp1->setPosSize( 170, 80, 80, 80, PosSize_POSSIZE );
256cdf0e10cSrcweir 			// Unsichtbar, nur im MBDown mit DrawRoutine bei Doppel-Klick...
257cdf0e10cSrcweir 			xButtonCmp1->setVisible( FALSE );
258cdf0e10cSrcweir 			xDrawCtrl = xButton1;
259cdf0e10cSrcweir 
260cdf0e10cSrcweir 			xCont->addControl( L"", xButton1 );
261cdf0e10cSrcweir 
262cdf0e10cSrcweir /*
263cdf0e10cSrcweir 
264cdf0e10cSrcweir 			// ListBox...
265cdf0e10cSrcweir 			xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.ListBox" );
266cdf0e10cSrcweir 			xModel = (XInterface*)xModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
267cdf0e10cSrcweir 
268cdf0e10cSrcweir 			xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
269cdf0e10cSrcweir 			Sequence<UString> aSeq( 7 );
270cdf0e10cSrcweir 			aSeq.getArray()[0] = L"Item1";
271cdf0e10cSrcweir 			aSeq.getArray()[1] = L"Item2";
272cdf0e10cSrcweir 			aSeq.getArray()[2] = L"Item3";
273cdf0e10cSrcweir 			aSeq.getArray()[3] = L"Item4";
274cdf0e10cSrcweir 			aSeq.getArray()[4] = L"Item5";
275cdf0e10cSrcweir 			aSeq.getArray()[5] = L"Item6";
276cdf0e10cSrcweir 			aSeq.getArray()[6] = L"Item7";
277cdf0e10cSrcweir 			xPSet->setPropertyValue( L"StringItemList", UsrAny( &aSeq, Sequence<UString>::getReflection() ) );
278cdf0e10cSrcweir 			xPSet->setPropertyValue( L"LineCount", UsrAny_UINT16( 4 ) );
279cdf0e10cSrcweir 			xPSet->setPropertyValue( L"Dropdown", UsrAny( (BOOL)TRUE ) );
280cdf0e10cSrcweir 
281cdf0e10cSrcweir 			XServiceProviderRef xListBoxCtrlProv = xProv->queryServiceProvider( L"stardiv.vcl.control.ListBox" );
282cdf0e10cSrcweir 			XControlRef xListBox1 = (XControl*)xListBoxCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
283cdf0e10cSrcweir 			xListBox1->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
284cdf0e10cSrcweir 			XWindowRef xListBoxCmp1 = (XWindow*)xListBox1->queryInterface( XWindow::getSmartUik() );
285cdf0e10cSrcweir 			xListBoxCmp1->setPosSize( 20, 250, 200, 20, PosSize_POSSIZE );
286cdf0e10cSrcweir 			xCont->addControl( L"", xListBox1 );
287cdf0e10cSrcweir 
288cdf0e10cSrcweir 			// FixedText...
289cdf0e10cSrcweir 			xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.FixedText" );
290cdf0e10cSrcweir 			xModel = (XInterface*)xModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
291cdf0e10cSrcweir 			DBG_ASSERT( xModel, "No Model!" );
292cdf0e10cSrcweir 
293cdf0e10cSrcweir 			xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
294cdf0e10cSrcweir 			xPSet->setPropertyValue( L"Label", UsrAny( L"Label:" ) );
295cdf0e10cSrcweir  			xPSet->setPropertyValue( L"BackgroundColor", UsrAny( (UINT32)0x00888888) );
296cdf0e10cSrcweir 
297cdf0e10cSrcweir 			Font_Attribs aFontAttrs;
298cdf0e10cSrcweir 			aFontAttrs.Italic = ITALIC_NORMAL;
299cdf0e10cSrcweir 			xPSet->setPropertyValue( L"Font_Attribs", UsrAny( &aFontAttrs, Font_Attribs_getReflection() ) );
300cdf0e10cSrcweir 
301cdf0e10cSrcweir 			XPropertyStateRef xState = (XPropertyState*)xPSet->queryInterface( XPropertyState::getSmartUik() );
302cdf0e10cSrcweir 			xState->getPropertyState( L"Font_Attribs" );
303cdf0e10cSrcweir 			xState->getPropertyState( L"Font_Size" );
304cdf0e10cSrcweir 
305cdf0e10cSrcweir 			XServiceProviderRef xFixedTextCtrlProv = xProv->queryServiceProvider( L"stardiv.vcl.control.FixedText" );
306cdf0e10cSrcweir 			XControlRef xFixedText1 = (XControl*)xFixedTextCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
307cdf0e10cSrcweir 			DBG_ASSERT( xFixedText1, "No FixedText!" );
308cdf0e10cSrcweir 			xFixedText1->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
309cdf0e10cSrcweir 			XWindowRef xFixedTextCmp1 = (XWindow*)xFixedText1->queryInterface( XWindow::getSmartUik() );
310cdf0e10cSrcweir 			xFixedTextCmp1->setPosSize( 20, 20, 120, 20, PosSize_POSSIZE );
311cdf0e10cSrcweir 			xCont->addControl( L"", xFixedText1 );
312cdf0e10cSrcweir 
313cdf0e10cSrcweir 			// TabTest...
314cdf0e10cSrcweir 			xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.GroupBox" );
315cdf0e10cSrcweir 			xModel = (XInterface*)xModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
316cdf0e10cSrcweir 			xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
317cdf0e10cSrcweir 			xPSet->setPropertyValue( L"Label", UsrAny( L"Radio-Test:" ) );
318cdf0e10cSrcweir 			XServiceProviderRef xGroupBoxCtrlProv = xProv->queryServiceProvider( L"stardiv.vcl.control.GroupBox" );
319cdf0e10cSrcweir 			XControlRef xGroupBox1 = (XControl*)xGroupBoxCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
320cdf0e10cSrcweir 			xGroupBox1->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
321cdf0e10cSrcweir 			XWindowRef xGroupBoxCmp1 = (XWindow*)xGroupBox1->queryInterface( XWindow::getSmartUik() );
322cdf0e10cSrcweir 			xGroupBoxCmp1->setPosSize( 30, 410, 100, 130, PosSize_POSSIZE );
323cdf0e10cSrcweir 			xCont->addControl( L"", xGroupBox1 );
324cdf0e10cSrcweir 
325cdf0e10cSrcweir 			XServiceProviderRef xRadioButtonModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.RadioButton" );
326cdf0e10cSrcweir 			XServiceProviderRef xRadioButtonCtrlProv = xProv->queryServiceProvider( L"stardiv.vcl.control.RadioButton" );
327cdf0e10cSrcweir 
328cdf0e10cSrcweir 			xModel = (XInterface*)xRadioButtonModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
329cdf0e10cSrcweir 			XControlRef xT1 = (XControl*)xRadioButtonCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
330cdf0e10cSrcweir 			xT1->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
331cdf0e10cSrcweir 			XWindowRef xTC1 = (XWindow*)xT1->queryInterface( XWindow::getSmartUik() );
332cdf0e10cSrcweir 			xTC1->setPosSize( 40, 430, 80, 20, PosSize_POSSIZE );
333cdf0e10cSrcweir 			xCont->addControl( L"", xT1 );
334cdf0e10cSrcweir 			xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
335cdf0e10cSrcweir 			xPSet->setPropertyValue( L"Label", UsrAny( L"Radio1" ) );
336cdf0e10cSrcweir 			xPSet->setPropertyValue( L"State", UsrAny_UINT16( 1 ) );
337cdf0e10cSrcweir 
338cdf0e10cSrcweir 			xModel = (XInterface*)xRadioButtonModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
339cdf0e10cSrcweir 			XControlRef xT2 = (XControl*)xRadioButtonCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
340cdf0e10cSrcweir 			xT2->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
341cdf0e10cSrcweir 			XWindowRef xTC2 = (XWindow*)xT2->queryInterface( XWindow::getSmartUik() );
342cdf0e10cSrcweir 			xTC2->setPosSize( 40, 470, 80, 20, PosSize_POSSIZE );
343cdf0e10cSrcweir 			xCont->addControl( L"", xT2 );
344cdf0e10cSrcweir 			xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
345cdf0e10cSrcweir 			xPSet->setPropertyValue( L"Label", UsrAny( L"Radio2" ) );
346cdf0e10cSrcweir 
347cdf0e10cSrcweir 			xModel = (XInterface*)xRadioButtonModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
348cdf0e10cSrcweir 			XControlRef xT3 = (XControl*)xRadioButtonCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
349cdf0e10cSrcweir 			xT3->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
350cdf0e10cSrcweir 			XWindowRef xTC3 = (XWindow*)xT3->queryInterface( XWindow::getSmartUik() );
351cdf0e10cSrcweir 			xTC3->setPosSize( 40, 510, 80, 20, PosSize_POSSIZE );
352cdf0e10cSrcweir 			xCont->addControl( L"", xT3 );
353cdf0e10cSrcweir 			xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
354cdf0e10cSrcweir 			xPSet->setPropertyValue( L"Label", UsrAny( L"Radio3" ) );
355cdf0e10cSrcweir 
356cdf0e10cSrcweir 			xModel = (XInterface*)xRadioButtonModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
357cdf0e10cSrcweir 			XControlRef xT4 = (XControl*)xRadioButtonCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
358cdf0e10cSrcweir 			xT4->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
359cdf0e10cSrcweir 			XWindowRef xTC4 = (XWindow*)xT4->queryInterface( XWindow::getSmartUik() );
360cdf0e10cSrcweir 			xTC4->setPosSize( 40, 550, 80, 20, PosSize_POSSIZE );
361cdf0e10cSrcweir 			xCont->addControl( L"", xT4 );
362cdf0e10cSrcweir 			xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
363cdf0e10cSrcweir 			xPSet->setPropertyValue( L"Label", UsrAny( L"Radio4 - no" ) );
364cdf0e10cSrcweir     		xPSet->setPropertyValue( L"Tabstop", UsrAny( (BOOL)TRUE ) );
365cdf0e10cSrcweir 
366cdf0e10cSrcweir 			// TabController:
367cdf0e10cSrcweir 			xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.TabController" );
368cdf0e10cSrcweir 			xModel = (XInterface*)xModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
369cdf0e10cSrcweir 			XTabControllerModelRef xTCModel = (XTabControllerModel*)xModel->queryInterface( XTabControllerModel::getSmartUik() );
370cdf0e10cSrcweir 
371cdf0e10cSrcweir 			XServiceProviderRef xTCProv = xProv->queryServiceProvider( L"stardiv.vcl.control.TabController" );
372cdf0e10cSrcweir 			XTabControllerRef xTC = (XTabController*)xTCProv->createInstance()->queryInterface( XTabController::getSmartUik() );
373cdf0e10cSrcweir 			xTC->setModel( (XTabControllerModel*)xModel->queryInterface( XTabControllerModel::getSmartUik() ) );
374cdf0e10cSrcweir 			XUnoControlContainerRef xUCC = (XUnoControlContainer*)xCont->queryInterface( XUnoControlContainer::getSmartUik() );
375cdf0e10cSrcweir 			xUCC->addTabController( xTC );
376cdf0e10cSrcweir 
377cdf0e10cSrcweir 			Sequence<XControlModelRef> aControls( 5 );
378cdf0e10cSrcweir 			aControls.getArray()[0] = xGroupBox1->getModel();
379cdf0e10cSrcweir 			aControls.getArray()[1] = xT1->getModel();
380cdf0e10cSrcweir 			aControls.getArray()[2] = xT3->getModel();
381cdf0e10cSrcweir 			aControls.getArray()[3] = xT2->getModel();
382cdf0e10cSrcweir 			aControls.getArray()[4] = xT4->getModel();
383cdf0e10cSrcweir 			xTCModel->setControls( aControls );
384cdf0e10cSrcweir 
385cdf0e10cSrcweir 			Sequence<XControlModelRef> aGroup( 3 );
386cdf0e10cSrcweir 			aGroup.getArray()[0] = xT1->getModel();
387cdf0e10cSrcweir 			aGroup.getArray()[1] = xT3->getModel();
388cdf0e10cSrcweir 			aGroup.getArray()[2] = xT2->getModel();
389cdf0e10cSrcweir 			xTCModel->setGroup( aGroup, L"test" );
390cdf0e10cSrcweir */
391cdf0e10cSrcweir 			// Container anzeigen...
392cdf0e10cSrcweir 			// Als Child zu diesem Fenster
393cdf0e10cSrcweir 			xContControl->createPeer( XToolkitRef(), GetComponentInterface( TRUE ) );
394cdf0e10cSrcweir 
395cdf0e10cSrcweir 			XDeviceRef xD( xContControl->getPeer(), USR_QUERY );
396cdf0e10cSrcweir 			xG = xD->createGraphics();
397cdf0e10cSrcweir 			XViewRef xV ( xDrawCtrl, USR_QUERY );
398cdf0e10cSrcweir 			xV->setGraphics( xG );
399cdf0e10cSrcweir 
400cdf0e10cSrcweir //		((UnoControl*)(XControl*)xNumField))->updateFromModel();
401cdf0e10cSrcweir 
402cdf0e10cSrcweir /*
403cdf0e10cSrcweir 			// TEST:
404cdf0e10cSrcweir 			WindowDecriptor aDescr;
405cdf0e10cSrcweir 			aDescr.ComponentServiceName = "window";
406cdf0e10cSrcweir 			aDescr.Type = VCLCOMPONENTTYPE_CONTAINER;
407cdf0e10cSrcweir 			aDescr.Parent = GetComponentInterface( TRUE );
408cdf0e10cSrcweir 			aDescr.WindowAttributes = WA_SHOW|WA_BORDER;
409cdf0e10cSrcweir 			aDescr.Bounds = Rectangle( Point( 500, 50 ), Size( 300, 200 ) );
410cdf0e10cSrcweir 			XVclWindowPeerRef xSPWin = xToolkit->createComponent( aDescr );
411cdf0e10cSrcweir 
412cdf0e10cSrcweir 			WindowDecriptor aDescr2;
413cdf0e10cSrcweir 			aDescr2.ComponentServiceName = "scrollbar";
414cdf0e10cSrcweir 			aDescr2.Type = VCLCOMPONENTTYPE_SIMPLE;
415cdf0e10cSrcweir 			aDescr2.Parent = xSPWin;
416cdf0e10cSrcweir 			aDescr2.WindowAttributes = WA_SHOW|WA_BORDER|WA_VSCROLL;
417cdf0e10cSrcweir 			aDescr2.Bounds = Rectangle( Point( 250, 0 ), Size( 50, 200 ) );
418cdf0e10cSrcweir 			XVclWindowPeerRef xSB = xToolkit->createComponent( aDescr2 );
419cdf0e10cSrcweir */
420cdf0e10cSrcweir 		}
421cdf0e10cSrcweir 		return;
422cdf0e10cSrcweir 	}
423cdf0e10cSrcweir     WorkWindow::MouseButtonDown( rMEvt );
424cdf0e10cSrcweir }
425cdf0e10cSrcweir 
426cdf0e10cSrcweir 
427cdf0e10cSrcweir // -----------------------------------------------------------------------
428cdf0e10cSrcweir 
Resize()429cdf0e10cSrcweir void MyWin::Resize()
430cdf0e10cSrcweir {
431cdf0e10cSrcweir     WorkWindow::Resize();
432cdf0e10cSrcweir }
433cdf0e10cSrcweir 
Paint(const Rectangle & r)434cdf0e10cSrcweir void MyWin::Paint( const Rectangle& r )
435cdf0e10cSrcweir {
436cdf0e10cSrcweir 	// Muss ueber PaintListener geschehen...
437cdf0e10cSrcweir 	if ( xDrawCtrl.is() )
438cdf0e10cSrcweir 	{
439cdf0e10cSrcweir 		XViewRef xV( xDrawCtrl, USR_QUERY );
440cdf0e10cSrcweir 		XWindowRef xC( xDrawCtrl, USR_QUERY );
441cdf0e10cSrcweir 		xV->draw( xC->getPosSize().Left(), xC->getPosSize().Top() );
442cdf0e10cSrcweir 	}
443cdf0e10cSrcweir 
444cdf0e10cSrcweir }
445cdf0e10cSrcweir 
446